From 3b19c8d2d78e644a79d105589834a219d677e8bf Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Tue, 20 Mar 2012 12:46:04 -0700 Subject: [PATCH] CSPACE-4943 - fixed problem with refObjs call and extended schemas. Added tests to cover this, which includes adding an extension to the Person schema in the lifesci tenant. --- .../test-data/xmlreplay/AuthsREADME.txt | 13 ++ .../xmlreplay/person/acquisition.xml | 14 ++ .../xmlreplay/person/lifesciperson.xml | 164 ++++++++++++++++++ .../person/persons_common_and_lifesci.xml | 18 ++ ...persons_common_and_lifesci_set_broader.xml | 36 ++++ .../person/res/lifesciPersonWithRelns.res.xml | 26 +++ .../xmlreplay/person/res/refObjs.res.xml | 6 + .../tenants/lifesci/tenant-bindings.delta.xml | 52 ++++++ .../services/nuxeo/util/NuxeoUtils.java | 12 +- services/person/3rdparty/build.xml | 4 + .../nuxeo-platform-person-lifesci/build.xml | 147 ++++++++++++++++ .../nuxeo-platform-person-lifesci/pom.xml | 56 ++++++ .../src/main/resources/META-INF/MANIFEST.MF | 23 +++ .../resources/OSGI-INF/core-types-contrib.xml | 19 ++ .../OSGI-INF/deployment-fragment.xml | 10 ++ .../resources/OSGI-INF/ecm-types-contrib.xml | 30 ++++ .../resources/OSGI-INF/layouts-contrib.xml | 32 ++++ .../resources/OSGI-INF/life-cycle-contrib.xml | 11 ++ .../schemas/persons_naturalhistory.xsd | 73 ++++++++ services/person/3rdparty/pom.xml | 1 + 20 files changed, 744 insertions(+), 3 deletions(-) create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/AuthsREADME.txt create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/acquisition.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/lifesciperson.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_and_lifesci.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_and_lifesci_set_broader.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/lifesciPersonWithRelns.res.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/refObjs.res.xml create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/build.xml create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/pom.xml create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/META-INF/MANIFEST.MF create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/core-types-contrib.xml create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/deployment-fragment.xml create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/ecm-types-contrib.xml create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/layouts-contrib.xml create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/life-cycle-contrib.xml create mode 100644 services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/schemas/persons_naturalhistory.xsd diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/AuthsREADME.txt b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/AuthsREADME.txt new file mode 100644 index 000000000..5df826385 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/AuthsREADME.txt @@ -0,0 +1,13 @@ +To produce the auths content values, you needs to base64 encode the credentials. + +This means, for example that if you want to use: + + Login: admin@core.collectionspace.org + Password: Administrator + +Then you have to encode the string "admin@core.collectionspace.org:Administrator" which +should yield the encoded string: "YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I=" + +A convenient way to encode and decode (to verify results, or check values that +are already coded in the various xmlReplay files) is to use the online service +at: http://www.motobit.com/util/base64-decoder-encoder.asp \ No newline at end of file diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/acquisition.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/acquisition.xml new file mode 100644 index 000000000..73447b4dc --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/acquisition.xml @@ -0,0 +1,14 @@ + + + + + 2010-11-15T07:30:24Z + + ${acqNum} + + ${owner} + + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/lifesciperson.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/lifesciperson.xml new file mode 100644 index 000000000..d12309887 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/lifesciperson.xml @@ -0,0 +1,164 @@ + + + + + YWRtaW5AbGlmZXNjaS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + + + + + + POST + /cspace-services/personauthorities/ + person/personauthorities_common.xml + + TestPersonAuthority + + + + POST + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/ + person/persons_common_and_lifesci.xml + + johnWayneActor1 + John + Wayne + Actor + Way Long Time + + + + POST + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/ + person/persons_common_and_lifesci.xml + + billyBob1 + Billy-Bob + Homeboy + Goof + Too Long + + + + GET + /cspace-services/personauthorities/ + + + GET + /cspace-services/personauthorities/urn:cspace:name(TestPersonAuthority) + + + GET + /cspace-services/personauthorities/${PersonAuth1.CSID} + + + GET + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/ + + + GET + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID} + + + + PUT + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person2.CSID} + person/persons_common_and_lifesci_set_broader.xml + + billyBob1 + Billy-Bob + Homeboy + Goof + Too Long + ${Person2.CSID} + ${Person1.CSID} + John Wayne + + + + + GET + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}?showAllRelations=true + + + person/res/lifesciPersonWithRelns.res.xml + + /document/*[local-name()='relations-common-list'] + + + + + GET + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person2.CSID}?showAllRelations=true + + + person/res/lifesciPersonWithRelns.res.xml + + /document/*[local-name()='relations-common-list'] + + + + + POST + /cspace-services/loansin/ + authrefs/loanin.xml + + 42 + ${getPerson1.got("//refName")} + + + + + GET + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}/refObjs + + + person/res/refObjs.res.xml + + 1 + + + + + + POST + /cspace-services/acquisitions/ + person/acquisition.xml + + 42 + ${getPerson1.got("//refName")} + + + + + GET + /cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}/refObjs + + + person/res/refObjs.res.xml + + 2 + + + + + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_and_lifesci.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_and_lifesci.xml new file mode 100644 index 000000000..d6532c217 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_and_lifesci.xml @@ -0,0 +1,18 @@ + + + + ${shortIdentifier} + ${foreName} ${surName} + false + >${foreName} ${surName} + false + ${foreName} + ${surName} + + + ${entityType} + ${lifeSpan} + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_and_lifesci_set_broader.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_and_lifesci_set_broader.xml new file mode 100644 index 000000000..9955abb6b --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_and_lifesci_set_broader.xml @@ -0,0 +1,36 @@ + + + + ${shortIdentifier} + ${foreName} ${surName} + false + >${foreName} ${surName} + false + ${foreName} + ${surName} + + + ${entityType} + ${lifeSpan} + + + + ${childCSID} + hasBroader + hasBroader + ${parentCSID} + + ${childCSID} + ${foreName} ${surName} + PersonTenant2 + + + ${parentCSID} + ${parentName} + PersonTenant2 + + + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/lifesciPersonWithRelns.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/lifesciPersonWithRelns.res.xml new file mode 100644 index 000000000..d9661ff15 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/lifesciPersonWithRelns.res.xml @@ -0,0 +1,26 @@ + + + + 1 + + + + + ${Person2.CSID} + ${Person1.CSID} + hasBroader + + ${Person2.CSID} + + + ${Person1.CSID} + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/refObjs.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/refObjs.res.xml new file mode 100644 index 000000000..7b7ccfb8d --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/refObjs.res.xml @@ -0,0 +1,6 @@ + + + ${numFound} + ${numFound} + diff --git a/services/common/src/main/cspace/config/services/tenants/lifesci/tenant-bindings.delta.xml b/services/common/src/main/cspace/config/services/tenants/lifesci/tenant-bindings.delta.xml index bf072662d..2cd346a9d 100644 --- a/services/common/src/main/cspace/config/services/tenants/lifesci/tenant-bindings.delta.xml +++ b/services/common/src/main/cspace/config/services/tenants/lifesci/tenant-bindings.delta.xml @@ -52,6 +52,58 @@ + + + + + + + entityType + persons_naturalhistory + entityType + + + + + + + + + + + + + + authRef + affiliatedPersonOrgGroupList/*/affiliatedPersonOrg + + + authRef + orgContactNames|orgContactName + + + termRef + affiliatedPersonOrgGroupList/*/affiliatedPersonOrgType + + + termRef + nameTypes|nameType + + + termRef + nameSource + + + termRef + entityType + + + + + diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java index 614d32e62..6daadf926 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java @@ -363,7 +363,10 @@ public class NuxeoUtils { */ static public final String buildNXQLQuery(ServiceContext ctx, QueryContext queryContext) throws Exception { StringBuilder query = new StringBuilder("SELECT * FROM "); - query.append(NuxeoUtils.getTenantQualifiedDocType(queryContext)); // Nuxeo doctype must be tenant qualified. + // Since we have a tenant qualification in the WHERE clause, we do not need + // tenant-specific doc types + // query.append(NuxeoUtils.getTenantQualifiedDocType(queryContext)); // Nuxeo doctype must be tenant qualified. + query.append(queryContext.getDocType()); appendNXQLWhere(query, queryContext); appendNXQLOrderBy(query, queryContext); return query.toString(); @@ -385,8 +388,11 @@ public class NuxeoUtils { } else { query.append(","); } - String tqDocType = getTenantQualifiedDocType(queryContext, docType); - query.append(tqDocType); // Nuxeo doctype must be tenant qualified. + // Since we have a tenant qualification in the WHERE clause, we do not need + // tenant-specific doc types + // String tqDocType = getTenantQualifiedDocType(queryContext, docType); + // query.append(tqDocType); // Nuxeo doctype must be tenant qualified. + query.append(docType); } appendNXQLWhere(query, queryContext); // FIXME add 'order by' clause here, if appropriate diff --git a/services/person/3rdparty/build.xml b/services/person/3rdparty/build.xml index fbc5416b0..516b147bf 100644 --- a/services/person/3rdparty/build.xml +++ b/services/person/3rdparty/build.xml @@ -111,21 +111,25 @@ + + + + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/build.xml b/services/person/3rdparty/nuxeo-platform-person-lifesci/build.xml new file mode 100644 index 000000000..155c3ae4e --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/build.xml @@ -0,0 +1,147 @@ + + + + Person nuxeo document type for the lifesci tenant + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/pom.xml b/services/person/3rdparty/nuxeo-platform-person-lifesci/pom.xml new file mode 100644 index 000000000..484c0cd39 --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/pom.xml @@ -0,0 +1,56 @@ + + + org.collectionspace.services + org.collectionspace.services.person.3rdparty + 2.2-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.person.3rdparty.lifesci.nuxeo + jar + + Person Nuxeo document type for Tenant ID = "2" + + + + persons_naturalhistory + 2 + lifesci + + + + + + ../../../../3rdparty/nuxeo/nuxeo-doctype/src/main/resources + true + + + ../../../../3rdparty/nuxeo/nuxeo-doctype-custom/src/main/resources + true + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-jar-plugin + + + target/classes/META-INF/MANIFEST.MF + + ${eclipseVersion} + 2 + + + + + + + + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/META-INF/MANIFEST.MF b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 000000000..8dfecb254 --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 1 +Bundle-Name: org.collectionspace.person.lifesci +Bundle-SymbolicName: org.collectionspace.person.lifesci;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Bundle-Vendor: Nuxeo +Require-Bundle: org.nuxeo.runtime, + org.nuxeo.ecm.core.api, + org.nuxeo.ecm.core, + org.nuxeo.ecm.core.api, + org.nuxeo.ecm.platform.types.api, + org.nuxeo.ecm.platform.versioning.api, + org.nuxeo.ecm.platform.ui, + org.nuxeo.ecm.platform.forms.layout.client, + org.nuxeo.ecm.platform.ws, + org.collectionspace.collectionspace_core +Provide-Package: org.collectionspace.person.lifesci +Nuxeo-Component: OSGI-INF/core-types-contrib.xml, + OSGI-INF/life-cycle-contrib.xml, + OSGI-INF/ecm-types-contrib.xml, + OSGI-INF/layouts-contrib.xml + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/core-types-contrib.xml new file mode 100644 index 000000000..2ffba8c1b --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/core-types-contrib.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + persons_common:displayName persons_common:refName persons_common:shortIdentifier + + + + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/deployment-fragment.xml new file mode 100644 index 000000000..270abbd5f --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/deployment-fragment.xml @@ -0,0 +1,10 @@ + + + + + + ${bundle.fileName} + + + + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/ecm-types-contrib.xml new file mode 100644 index 000000000..aa11b07f6 --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/ecm-types-contrib.xml @@ -0,0 +1,30 @@ + + + + + + + view_documents + + + heading + collectionspace_core + person + person_naturalhistory + + + + + + PersonTenant2 + + + + + + PersonTenant2 + + + + + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/layouts-contrib.xml new file mode 100644 index 000000000..580506c4a --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/layouts-contrib.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/life-cycle-contrib.xml b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/life-cycle-contrib.xml new file mode 100644 index 000000000..3a36934b3 --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/OSGI-INF/life-cycle-contrib.xml @@ -0,0 +1,11 @@ + + + + + + default + + + + diff --git a/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/schemas/persons_naturalhistory.xsd b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/schemas/persons_naturalhistory.xsd new file mode 100644 index 000000000..936a3d5dd --- /dev/null +++ b/services/person/3rdparty/nuxeo-platform-person-lifesci/src/main/resources/schemas/persons_naturalhistory.xsd @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/person/3rdparty/pom.xml b/services/person/3rdparty/pom.xml index e25a2d0ec..4458c6825 100644 --- a/services/person/3rdparty/pom.xml +++ b/services/person/3rdparty/pom.xml @@ -19,5 +19,6 @@ nuxeo-platform-cs-person + nuxeo-platform-person-lifesci -- 2.47.3