]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-4256: Merged services trunk changes from r5918 through r6056 into the Apache...
authorAron Roberts <aron@socrates.berkeley.edu>
Tue, 22 Nov 2011 05:26:57 +0000 (05:26 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Tue, 22 Nov 2011 05:26:57 +0000 (05:26 +0000)
97 files changed:
services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java
services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java
services/IntegrationTests/src/test/resources/test-data/xmlreplay/acquisitions/ac1.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/acquisitions/ac2.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/acquisitions/res/ac1.res.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/acquisitions/res/ac2.res.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/acquisitions/res/ac3.res.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/authrefs.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/loanout.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/newPerson1.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/newPerson2.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/newPersonAuthority.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/res/loanout.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/updatePerson1.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/updatePerson2.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/person.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/personTermStatusSearch.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/person_pmadry.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/person_pschmitz.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_w_relations.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_w_relations_2.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_w_relations_3.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistActive.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistAll.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistNone.res.xml [new file with mode: 0644]
services/IntegrationTests/src/test/resources/test-data/xmlreplay/relation/r-1.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/relation/r-2.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/relation/relation.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/res/GetVocabularyItems.res.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml
services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/CollectionSpacePerformanceTest.java
services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/schemas/acquisitions_common.xsd
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateAndLinkLoanOutBatchJob.java
services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/schemas/blobs_common.xsd
services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java
services/collectionobject/3rdparty/nuxeo-platform-collectionobject-lifesci/src/main/resources/schemas/collectionobjects_naturalhistory.xsd
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_common.xsd
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java
services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd
services/common-api/src/main/java/org/collectionspace/services/common/api/Tools.java
services/common/build.xml
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/common/src/main/java/org/collectionspace/services/common/config/TenantBindingConfigReaderImpl.java
services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java
services/common/src/main/java/org/collectionspace/services/common/datetime/DateTimeFormatUtils.java
services/common/src/main/java/org/collectionspace/services/common/datetime/GregorianCalendarDateTimeUtils.java
services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java
services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoImageUtils.java
services/common/src/main/java/org/collectionspace/services/common/query/QueryManager.java
services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java
services/common/src/main/java/org/collectionspace/services/common/relation/RelationJAXBSchema.java
services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationsUtils.java
services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClient.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java
services/contact/service/src/main/java/org/collectionspace/services/contact/AuthorityResourceWithContacts.java
services/imports/service/src/test/resources/requests/collectionobject-request.xml
services/intake/3rdparty/nuxeo-platform-cs-intake/src/main/resources/schemas/intakes_common.xsd
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java
services/jaxb/src/main/resources/authorityrefdocs.xsd
services/jaxb/src/main/resources/blobs_common.xsd
services/jaxb/src/main/resources/relations_common.xsd
services/loanin/3rdparty/nuxeo-platform-cs-loanin/src/main/resources/schemas/loansin_common.xsd
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java
services/loanin/jaxb/src/main/resources/loansin-common.xsd
services/loanout/3rdparty/nuxeo-platform-cs-loanout/src/main/resources/schemas/loansout_common.xsd
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java
services/loanout/jaxb/src/main/resources/loansout-common.xsd
services/location/3rdparty/nuxeo-platform-cs-location/src/main/resources/schemas/locations_common.xsd
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/schemas/media_common.xsd
services/media/jaxb/src/main/resources/media_common.xsd
services/movement/3rdparty/nuxeo-platform-cs-movement/src/main/resources/schemas/movements_common.xsd
services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementServiceTest.java
services/objectexit/3rdparty/nuxeo-platform-cs-objectexit/src/main/resources/schemas/objectexit_common.xsd
services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitAuthRefsTest.java
services/objectexit/jaxb/src/main/resources/objectexit_common.xsd
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonAuthorityValidatorHandler.java
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonValidatorHandler.java
services/relation/3rdparty/nuxeo-platform-cs-relation/src/main/resources/OSGI-INF/layouts-contrib.xml
services/relation/3rdparty/nuxeo-platform-cs-relation/src/main/resources/schemas/relations_common.xsd
services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationValidatorHandler.java
services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonDocumentModelHandler.java

index 7b3cf371560b075d08a9ac52d07b7d42cb3ec70e..ecd4b2fa90cbe1ed69518d2b71dd72cdc66da96b 100755 (executable)
@@ -39,6 +39,7 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;\r
 import org.collectionspace.services.collectionobject.TitleGroup;\r
 import org.collectionspace.services.collectionobject.TitleGroupList;\r
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;\r
 import org.collectionspace.services.intake.IntakesCommon;\r
 import org.collectionspace.services.relation.RelationsCommon;\r
 import org.collectionspace.services.relation.RelationshipType;\r
@@ -91,8 +92,8 @@ public abstract class CollectionSpaceIntegrationTest {
         * @param identifier the identifier\r
         */\r
        void fillIntake(IntakesCommon theIntake, String identifier) {\r
-               fillIntake(theIntake, "entryNumber-" + identifier, "entryDate-"\r
-                               + identifier);\r
+               String CURRENT_DATE_UTC = GregorianCalendarDateTimeUtils.currentDateUTC();\r
+               fillIntake(theIntake, "entryNumber-" + identifier, CURRENT_DATE_UTC);\r
        }\r
 \r
        /**\r
@@ -111,19 +112,21 @@ public abstract class CollectionSpaceIntegrationTest {
      * Fill relation.\r
      * \r
      * @param relation the relation\r
-     * @param documentId1 the document id1\r
-     * @param documentType1 the document type1\r
-     * @param documentId2 the document id2\r
-     * @param documentType2 the document type2\r
+     * @param subjectCsid the document id1\r
+     * @param subjectDocumentType the document type1\r
+     * @param objectCsid the document id2\r
+     * @param objectDocumentType the document type2\r
      * @param rt the rt\r
      */\r
-    void fillRelation(RelationsCommon relation, String documentId1, String documentType1,\r
-               String documentId2, String documentType2, String rt)\r
+    void fillRelation(RelationsCommon relation, \r
+            String subjectCsid, String subjectDocumentType,\r
+            String objectCsid, String objectDocumentType,\r
+            String rt)\r
     {\r
-        relation.setDocumentId1(documentId1);\r
-        relation.setDocumentType1(documentType1);\r
-        relation.setDocumentId2(documentId2);\r
-        relation.setDocumentType2(documentType2);\r
+       relation.setSubjectCsid(subjectCsid);\r
+       relation.setSubjectDocumentType(subjectDocumentType);\r
+       relation.setObjectCsid(objectCsid);\r
+       relation.setObjectDocumentType(objectDocumentType);\r
         \r
         relation.setRelationshipType(rt);\r
     }\r
index c4eb6f3830e2b97eda24bbb96f8fff1954788795..8736756a8dbb8d26dce93414af1bc442468605aa 100755 (executable)
@@ -179,9 +179,9 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
                        multiPartResponse.releaseConnection();
                }
                
-               Assert.assertEquals(resultRelation.getDocumentId1(), collectionObjectCsid);
+               Assert.assertEquals(resultRelation.getSubjectCsid(), collectionObjectCsid);
                Assert.assertEquals(resultRelation.getRelationshipType(), RelationshipType.COLLECTIONOBJECT_INTAKE.toString());
-               Assert.assertEquals(resultRelation.getDocumentId2(), intakeCsid);
+               Assert.assertEquals(resultRelation.getObjectCsid(), intakeCsid);
             System.out.println();
                i++;            
         }
@@ -308,9 +308,9 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
                                multiPartResponse.releaseConnection();
                        }
        
-                       Assert.assertEquals(resultRelation.getDocumentId1(), intakeCsid);
+                       Assert.assertEquals(resultRelation.getSubjectCsid(), intakeCsid);
                        Assert.assertEquals(resultRelation.getRelationshipType(), RelationshipType.COLLECTIONOBJECT_INTAKE.toString());
-                       Assert.assertEquals(resultRelation.getDocumentId2(), collectionObjectCsid);
+                       Assert.assertEquals(resultRelation.getObjectCsid(), collectionObjectCsid);
                        System.out.println();
                        i++;            
                }
index 31de83477df4649ca22b4288b1b54619a7cb9645..ae8665103b89354e4ef90d1d459daa93101f6acd 100755 (executable)
@@ -4,8 +4,8 @@
   xmlns:ns2="http://collectionspace.org/services/jaxb"\r
   xmlns:ns3="http://collectionspace.org/services/acquisition">\r
   <acquisitionDates>\r
-    <acquisitionDate>NEW First Acquisition Date-334</acquisitionDate>\r
-    <acquisitionDate>Second Acquisition Date-1292275630222</acquisitionDate>\r
+    <acquisitionDate>2010-11-15T07:30:24Z</acquisitionDate>\r
+    <acquisitionDate>2009-10-15T07:30:24Z</acquisitionDate>\r
   </acquisitionDates>\r
   <acquisitionReferenceNumber>acquisitionReferenceNumber-1</acquisitionReferenceNumber>\r
   <owners>\r
index 81287aba8d83f4a766d8c9655ae49719df568548..dfa99178c19ae44925c01651a4b863439869611d 100755 (executable)
@@ -4,8 +4,8 @@
 xmlns:ns2="http://collectionspace.org/services/jaxb"\r
 xmlns:ns3="http://collectionspace.org/services/acquisition">\r
   <acquisitionDates>\r
-    <acquisitionDate>Second Acquisition Date-1292275631503</acquisitionDate>\r
-    <acquisitionDate>First Acquisition Date -1292275631503</acquisitionDate>\r
+    <acquisitionDate>2010-11-15T07:30:24Z</acquisitionDate>\r
+    <acquisitionDate>2009-10-15T07:30:24Z</acquisitionDate>\r
   </acquisitionDates>\r
   <acquisitionReferenceNumber>acquisitionReferenceNumber-1292275631503</acquisitionReferenceNumber>\r
   <owners>\r
index 7187217b2024b3c23cef6a5a6d4ba2f046491fc1..da16a0e1457949ebe432c998a168a26d9fa9f5f2 100755 (executable)
@@ -4,8 +4,8 @@
 <acquisitionReferenceNumber>acquisitionReferenceNumber-1</acquisitionReferenceNumber>\r
 <acquisitionFundingList/>\r
 <acquisitionDates>\r
-<acquisitionDate>NEW First Acquisition Date-334</acquisitionDate>\r
-<acquisitionDate>Second Acquisition Date-1292275630222</acquisitionDate>\r
+<acquisitionDate>2010-11-15T07:30:24Z</acquisitionDate>\r
+<acquisitionDate>2009-10-15T07:30:24Z</acquisitionDate>\r
 </acquisitionDates>\r
 <acquisitionSources>\r
 <acquisitionSource>Donor Acquisition Source-1292275630222</acquisitionSource>\r
index 21d1a9364842d0338cb6d5599ecba5cd69fb31f9..9fa704a36f620064e59750f608f37cc91c6e298e 100755 (executable)
@@ -4,8 +4,8 @@
 <acquisitionReferenceNumber>acquisitionReferenceNumber-1292275631503</acquisitionReferenceNumber>\r
 <acquisitionFundingList/>\r
 <acquisitionDates>\r
-<acquisitionDate>Second Acquisition Date-1292275631503</acquisitionDate>\r
-<acquisitionDate>First Acquisition Date -1292275631503</acquisitionDate>\r
+<acquisitionDate>2010-11-15T07:30:24Z</acquisitionDate>\r
+<acquisitionDate>2009-10-15T07:30:24Z</acquisitionDate>\r
 </acquisitionDates>\r
 <acquisitionSources>\r
 <acquisitionSource>Museum Acquisition Source-1292275631503</acquisitionSource>\r
index dd7b7a580ee6c8daca7cb60b36cb9b2238a596ca..ebe0bbfe88d06a46916deeb8609c37a52d2fd9b7 100755 (executable)
@@ -4,8 +4,8 @@
 <acquisitionReferenceNumber>acquisitionReferenceNumber-1292275630222</acquisitionReferenceNumber>\r
 <acquisitionFundingList/>\r
 <acquisitionDates>\r
-<acquisitionDate>First Acquisition Date -1292275630222</acquisitionDate>\r
-<acquisitionDate>Second Acquisition Date-1292275630222</acquisitionDate>\r
+<acquisitionDate>2010-11-15T07:30:24Z</acquisitionDate>\r
+<acquisitionDate>2009-10-15T07:30:24Z</acquisitionDate>\r
 </acquisitionDates>\r
 <acquisitionSources>\r
 <acquisitionSource>Donor Acquisition Source-1292275630222</acquisitionSource>\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/authrefs.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/authrefs.xml
new file mode 100644 (file)
index 0000000..56ee91e
--- /dev/null
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<xmlReplay>\r
+       <!-- \r
+                        testGroup ID="person" is not live.  It works, but may not clean up correctly. \r
+                        For now, use ID="updatePerson"\r
+       -->\r
+       <testGroup ID="AuthRefs" autoDeletePOSTS="true">\r
+               <test ID="PersonAuth1" auth="admin@core.collectionspace.org">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/personauthorities/</uri>\r
+                       <filename>authrefs/newPersonAuthority.xml</filename>\r
+               </test>\r
+               <test ID="Person1">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/</uri>\r
+                       <filename>authrefs/newPerson1.xml</filename>\r
+               </test>\r
+               <test ID="Person2">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/</uri>\r
+                       <filename>authrefs/newPerson2.xml</filename>\r
+               </test>\r
+\r
+        <test ID="GetPerson1">\r
+                       <method>GET</method>\r
+                       <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}</uri>\r
+               </test>\r
+\r
+        <test ID="GetPerson2">\r
+                       <method>GET</method>\r
+                       <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person2.CSID}</uri>\r
+               </test>\r
+\r
+               <test ID="loanout1" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">42</var>\r
+                               <var ID="person">${GetPerson1.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout2" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">102</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout3" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">103</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout4" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">104</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout5" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">105</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout6" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">106</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout7" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">107</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout8" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">108</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout9" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">109</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="loanout10" auth="test">\r
+                       <method>POST</method>\r
+                       <uri>/cspace-services/loansout/</uri>\r
+                       <filename>authrefs/loanout.xml</filename>\r
+                       <vars>\r
+                               <var ID="loannum">110</var>\r
+                               <var ID="person">${GetPerson2.got("//refName")}</var>\r
+                       </vars>\r
+               </test>\r
+\r
+               <test ID="UpdatePerson1">\r
+                       <method>PUT</method>\r
+                       <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}</uri>\r
+                       <filename>authrefs/updatePerson1.xml</filename>\r
+               </test>\r
+\r
+               <test ID="UpdatePerson2">\r
+                       <method>PUT</method>\r
+                       <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person2.CSID}</uri>\r
+                       <filename>authrefs/updatePerson2.xml</filename>\r
+               </test>\r
+\r
+        <test ID="GetFirstUpdatedPerson">\r
+                       <method>GET</method>\r
+                       <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}</uri>\r
+                       <response>\r
+                               <expected level="ADDOK" />\r
+                               <filename>authrefs/updatePerson1.xml</filename>\r
+                       </response>\r
+               </test>\r
+\r
+        <test ID="GetSecondUpdatedPerson">\r
+                       <method>GET</method>\r
+                       <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person2.CSID}</uri>\r
+                       <response>\r
+                               <expected level="ADDOK" />\r
+                               <filename>authrefs/updatePerson2.xml</filename>\r
+                       </response>\r
+               </test>\r
+\r
+               <test ID="afterUpdateGetLoan1">\r
+                       <method>GET</method>\r
+                       <uri>/cspace-services/loansout/${loanout1.CSID}</uri>\r
+                       <response>\r
+                               <expected level="ADDOK" />\r
+                               <label>loansout_common</label>\r
+                               <filename>authrefs/res/loanout.res.xml</filename>\r
+                               <vars>\r
+                                       <var ID="person">${GetFirstUpdatedPerson.got("//refName")}</var>\r
+                               </vars>\r
+                        </response>\r
+               </test>\r
+               \r
+               <test ID="afterUpdateGetLoan2">\r
+                       <method>GET</method>\r
+                       <uri>/cspace-services/loansout/${loanout2.CSID}</uri>\r
+                       <response>\r
+                               <expected level="ADDOK" />\r
+                               <label>loansout_common</label>\r
+                               <filename>authrefs/res/loanout.res.xml</filename>\r
+                               <vars>\r
+                                       <var ID="person">${GetSecondUpdatedPerson.got("//refName")}</var>\r
+                               </vars>\r
+                        </response>\r
+               </test>\r
+<!-- FIXME: Tests failed in Tomcat 6/Nuxeo 5.4.2 branch after merging from trunk through r6056: Aron -->\r
+<!-- These appear to be testing propagation of updates to display names in authRefs, following an update within a person record -->\r
+<!--\r
+{TEXT_DIFFERENT, L.path:/borrowersContact, R.path:/borrowersContact, status:TEXT_DIFFERENT,\r
+    L.trimmed:urn:cspace:core.collectionspace.org:personauthorities:name(TestPersonAuth):item:name(debbieDoNothingPerson)'Debbie Do Nothing Personality',\r
+    R.trimmed:urn:cspace:core.collectionspace.org:personauthorities:name(TestPersonAuth):item:name(debbieDoNothingPerson)'Debbie DoNothingPerson'}\r
+-->\r
+<!--\r
+               <test ID="afterUpdateGetLoan5">\r
+                       <method>GET</method>\r
+                       <uri>/cspace-services/loansout/${loanout5.CSID}</uri>\r
+                       <response>\r
+                               <expected level="ADDOK" />\r
+                               <label>loansout_common</label>\r
+                               <filename>authrefs/res/loanout.res.xml</filename>\r
+                               <vars>\r
+                                       <var ID="person">${GetSecondUpdatedPerson.got("//refName")}</var>\r
+                               </vars>\r
+                        </response>\r
+               </test>\r
+               <test ID="afterUpdateGetLoan9">\r
+                       <method>GET</method>\r
+                       <uri>/cspace-services/loansout/${loanout9.CSID}</uri>\r
+                       <response>\r
+                               <expected level="ADDOK" />\r
+                               <label>loansout_common</label>\r
+                               <filename>authrefs/res/loanout.res.xml</filename>\r
+                               <vars>\r
+                                       <var ID="person">${GetSecondUpdatedPerson.got("//refName")}</var>\r
+                               </vars>\r
+                        </response>\r
+               </test>\r
+-->\r
+\r
+       </testGroup>\r
+</xmlReplay>\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/loanout.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/loanout.xml
new file mode 100644 (file)
index 0000000..2ab7824
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document name="loansout">
+  <ns2:loansout_common xmlns:ns2="http://collectionspace.org/services/loanout" xmlns:ns3="http://collectionspace.org/services/jaxb">
+    <loanOutNumber>loanoutNumber-${loannum}</loanOutNumber>
+    <borrowersContact>${person}</borrowersContact>
+    <loanedObjectStatusGroupList>
+      <loanedObjectStatusGroup>
+        <loanedObjectStatus>returned</loanedObjectStatus>
+        <loanedObjectStatusNote>Left under the front mat.</loanedObjectStatusNote>
+      </loanedObjectStatusGroup>
+    </loanedObjectStatusGroupList>
+    <loanPurpose>Allow people in cold climes to share the magic of Surfboards of the 1960s.</loanPurpose>
+  </ns2:loansout_common>
+</document>
+
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/newPerson1.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/newPerson1.xml
new file mode 100644 (file)
index 0000000..ee80f56
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<document name="persons">\r
+       <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
+               <shortIdentifier>connieContactPerson</shortIdentifier>\r
+               <displayNameComputed>true</displayNameComputed>\r
+               <foreName>Connie</foreName>\r
+               <surName>ContactPerson</surName>\r
+       </ns2:persons_common>\r
+</document>\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/newPerson2.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/newPerson2.xml
new file mode 100644 (file)
index 0000000..7fc57fa
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<document name="persons">\r
+       <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
+               <shortIdentifier>debbieDoNothingPerson</shortIdentifier>\r
+               <displayNameComputed>true</displayNameComputed>\r
+               <foreName>Debbie</foreName>\r
+               <surName>DoNothingPerson</surName>\r
+       </ns2:persons_common>\r
+</document>\r
index 7809ec4785774f79508cc8d37fecc7b55c467304..86f4d56be0a3855bf3a9a3e45cde48860138d961 100755 (executable)
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-<ns2:personauthorities_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
-<displayName>TestPersonAuth</displayName>\r
-<shortIdentifier>TestPersonAuth</shortIdentifier>\r
-<refName>urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth)'TestPersonAuth'</refName>\r
-<vocabType>PersonAuthority</vocabType>\r
-</ns2:personauthorities_common>
\ No newline at end of file
+<document name="personauthorities">\r
+       <ns2:personauthorities_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
+               <displayName>TestPersonAuth</displayName>\r
+               <shortIdentifier>TestPersonAuth</shortIdentifier>\r
+               <vocabType>PersonAuthority</vocabType>\r
+       </ns2:personauthorities_common>\r
+</document>\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/res/loanout.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/res/loanout.res.xml
new file mode 100644 (file)
index 0000000..ee63091
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document name="loansout">
+  <ns2:loansout_common xmlns:ns2="http://collectionspace.org/services/loanout" xmlns:ns3="http://collectionspace.org/services/jaxb">
+    <borrowersContact>${person}</borrowersContact>
+  </ns2:loansout_common>
+</document>
+
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/updatePerson1.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/updatePerson1.xml
new file mode 100644 (file)
index 0000000..7d3103a
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<document name="persons">\r
+       <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
+               <shortIdentifier>connieContactPerson</shortIdentifier>\r
+               <displayNameComputed>true</displayNameComputed>\r
+               <foreName>Connie</foreName>\r
+               <surName>ContactPersonlity</surName>\r
+       </ns2:persons_common>\r
+</document>\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/updatePerson2.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authrefs/updatePerson2.xml
new file mode 100644 (file)
index 0000000..73cc943
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<document name="persons">\r
+       <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
+               <shortIdentifier>debbieDoNothingPerson</shortIdentifier>\r
+               <displayNameComputed>true</displayNameComputed>\r
+               <foreName>Debbie</foreName>\r
+               <surName>Do Nothing Personality</surName>\r
+       </ns2:persons_common>\r
+</document>\r
index fd72e30e78425f7ea89710e019d1ebb7164f7622..3be5d13b0f02222bf764bfe55f21c6ffe43927e6 100755 (executable)
              <uri>/cspace-services/relations/</uri>\r
              <filename>relation/r-1.xml</filename>\r
              <vars>\r
-                <var ID="documentId1">${Person1.CSID}</var>\r
-                <var ID="documentId2">${Person2.CSID}</var>\r
-                <var ID="documentType1">Persons</var>\r
-                <var ID="documentType2">Persons</var>\r
+                <var ID="subjectCsid">${Person1.CSID}</var>\r
+                <var ID="objectCsid">${Person2.CSID}</var>\r
+                <var ID="subjectDocumentType">Persons</var>\r
+                <var ID="objectDocumentType">Persons</var>\r
                 <var ID="relationshipType">hasBroader</var>\r
              </vars>\r
         </test>\r
              <!-- Person2 and Person1 are switched in this record. \r
                   Ultimately we don't want any hasNarrower actually stored.\r
              -->\r
-                <var ID="documentId1">${Person2.CSID}</var>\r
-                <var ID="documentId2">${Person1.CSID}</var>\r
-                <var ID="documentType1">Persons</var>\r
-                <var ID="documentType2">Persons</var>\r
+                <var ID="subjectCsid">${Person2.CSID}</var>\r
+                <var ID="objectCsid">${Person1.CSID}</var>\r
+                <var ID="subjectDocumentType">Persons</var>\r
+                <var ID="objectDocumentType">Persons</var>\r
                 <var ID="relationshipType">hasNarrower</var>\r
              </vars>\r
          </test>\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/personTermStatusSearch.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/personTermStatusSearch.xml
new file mode 100644 (file)
index 0000000..4999518
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<xmlReplay>\r
+    <!-- \r
+         testGroup ID="person" is not live.  It works, but may not clean up correctly. \r
+         For now, use ID="updatePerson"\r
+    -->\r
+    <testGroup ID="personTermStatus" autoDeletePOSTS="true">\r
+        <test ID="PersonAuth1" auth="admin@core.collectionspace.org">\r
+            <method>POST</method>\r
+            <uri>/cspace-services/personauthorities/</uri>\r
+            <filename>person/personauthorities_common.xml</filename>\r
+            <vars>\r
+                <var ID="authShortIdentifier">TermStatusTestAuth</var>\r
+            </vars>\r
+        </test>\r
+        <test ID="Patrick">\r
+            <method>POST</method>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/</uri>\r
+            <filename>person/person_pschmitz.xml</filename>\r
+            <vars>\r
+                <var ID="termStatus">Approved</var>\r
+            </vars>\r
+        </test>\r
+        <test ID="Penelope">\r
+            <method>POST</method>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/</uri>\r
+            <filename>person/person_pmadry.xml</filename>\r
+            <vars>\r
+                <var ID="termStatus">Inactive</var>\r
+            </vars>\r
+        </test>\r
+\r
+        <test ID="GetAll">\r
+            <method>GET</method>\r
+                                               <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items</uri>\r
+                                               <response>\r
+                                                       <expected level="ADDOK"/>\r
+                                                       <filename>person/res/personlistAll.res.xml</filename>\r
+                                               </response>\r
+        </test>\r
+        <test ID="GetActive">\r
+            <method>GET</method>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items?ts=Inactive</uri>\r
+                                               <response>\r
+                                                       <expected level="ADDOK"/>\r
+                                                       <filename>person/res/personlistActive.res.xml</filename>\r
+                                               </response>\r
+        </test>\r
+        <test ID="GetBogus">\r
+            <method>GET</method>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items?ts=Garbage</uri>\r
+                                               <response>\r
+                                                       <expected level="ADDOK"/>\r
+                                                       <filename>person/res/personlistAll.res.xml</filename>\r
+                                               </response>\r
+        </test>\r
+        <test ID="GetNone">\r
+            <method>GET</method>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items?ts=Inactive%7CApproved</uri>\r
+                                               <response>\r
+                                                       <expected level="ADDOK"/>\r
+                                                       <filename>person/res/personlistNone.res.xml</filename>\r
+                                               </response>\r
+        </test>\r
+                               <test ID="GetPartial">\r
+            <method>GET</method>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items?pt=Patrick</uri>\r
+                                               <response>\r
+                                                       <expected level="ADDOK"/>\r
+                                                       <filename>person/res/personlistActive.res.xml</filename>\r
+                                               </response>\r
+        </test>\r
+                               <test ID="GetPartialNone">\r
+            <method>GET</method>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items?pt=Patrick&amp;ts=Approved</uri>\r
+                                               <response>\r
+                                                       <expected level="ADDOK"/>\r
+                                                       <filename>person/res/personlistNone.res.xml</filename>\r
+                                               </response>\r
+        </test>\r
+   </testGroup>\r
+\r
+</xmlReplay>\r
index 6e4b9731ef64ccf05d23b477c3dc5aa559bf18ca..b6b8a196fab4f3e404008ceebb36f4ed01d6e632 100644 (file)
@@ -2,11 +2,11 @@
 <document name="persons">\r
   <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
        <shortIdentifier>pmadry</shortIdentifier>\r
-       <refName>urn:cspace:org.collectionspace.demo:personauthority:name(testpersonauth):person:name(pmadry)'Penelope Madry'</refName>\r
        <displayNameComputed>false</displayNameComputed>\r
        <shortDisplayNameComputed>false</shortDisplayNameComputed>\r
        <shortDisplayName>Penelope Madry</shortDisplayName>\r
        <displayName>Penelope Madry, New York</displayName>\r
+       <termStatus>${termStatus}</termStatus>\r
        <bioNote>Project Manager for CollectionSpace</bioNote>\r
   </ns2:persons_common>\r
 </document>\r
index 585a15d30a27c809da28c795db06864257d810cf..ee908b05572b8832fc2fc1b9dbf128c793feecfa 100644 (file)
@@ -2,11 +2,11 @@
 <document name="persons">\r
   <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
        <shortIdentifier>pschmitz</shortIdentifier>\r
-       <refName>urn:cspace:org.collectionspace.demo:personauthority:name(testpersonauth):person:name(pschmitz)'Patrick Schmitz'</refName>\r
        <displayNameComputed>false</displayNameComputed>\r
        <shortDisplayNameComputed>false</shortDisplayNameComputed>\r
        <shortDisplayName>Patrick Schmitz</shortDisplayName>\r
        <displayName>Patrick Schmitz, Berkeley</displayName>\r
+       <termStatus>${termStatus}</termStatus>\r
        <bioNote>Technical Lead for CollectionSpace</bioNote>\r
     <description>This is a test PersonAuthority item</description>\r
     <source>Some mythical book</source>\r
index f4be7468dc7070925847a10b5d0810465912f94c..2934776f4d0721858e52be7e9d94c8486f36ee96 100755 (executable)
@@ -30,8 +30,8 @@
     <fieldsReturned>subjectCsid|relationshipType|predicateDisplayName|objectCsid|uri|csid|subject|object</fieldsReturned>\r
     <relation-list-item>\r
                <subjectCsid>${myCSID}</subjectCsid>\r
-               <documentType1>Person</documentType1>\r
-               <documentType2>Person</documentType2>\r
+               <subjectDocumentType>Person</subjectDocumentType>\r
+               <objectDocumentType>Person</objectDocumentType>\r
                <relationshipType>hasBroader</relationshipType>\r
                <predicate>hasBroader</predicate>\r
                <predicateDisplayName>hasBroader</predicateDisplayName>\r
@@ -49,8 +49,8 @@
        </relation-list-item>\r
        <relation-list-item>\r
                <subjectCsid>${childCSID}</subjectCsid>\r
-               <documentType1>Person</documentType1>\r
-               <documentType2>Person</documentType2>\r
+               <subjectDocumentType>Person</subjectDocumentType>\r
+               <objectDocumentType>Person</objectDocumentType>\r
                <relationshipType>hasBroader</relationshipType>\r
                <predicate>hasBroader</predicate>\r
                <predicateDisplayName>hasBroader</predicateDisplayName>\r
index 85f01c6def16b903203675e29b2e7add5bdad541..c332ccac2ff938d4a142d208cabf11f252442f35 100755 (executable)
@@ -30,8 +30,8 @@
     <fieldsReturned>subjectCsid|relationshipType|predicateDisplayName|objectCsid|uri|csid|subject|object</fieldsReturned>\r
     <relation-list-item>\r
                <subjectCsid>${myCSID}</subjectCsid>\r
-               <documentType1>Person</documentType1>\r
-               <documentType2>Person</documentType2>\r
+               <subjectDocumentType>Person</subjectDocumentType>\r
+               <objectDocumentType>Person</objectDocumentType>\r
                <relationshipType>hasBroader</relationshipType>\r
                <predicate>hasBroader</predicate>\r
                <predicateDisplayName>hasBroader</predicateDisplayName>\r
index 37916fa9384becf9875620862b140a7b64e63730..a573e0f7dafa0d43d6302d6d8fb868d223451d65 100755 (executable)
@@ -30,8 +30,8 @@
     <fieldsReturned>subjectCsid|relationshipType|predicateDisplayName|objectCsid|uri|csid|subject|object</fieldsReturned>\r
    <relation-list-item>\r
                <subjectCsid>${childCSID}</subjectCsid>\r
-               <documentType1>Person</documentType1>\r
-               <documentType2>Person</documentType2>\r
+               <subjectDocumentType>Person</subjectDocumentType>\r
+               <objectDocumentType>Person</objectDocumentType>\r
                <relationshipType>hasBroader</relationshipType>\r
                <predicate>hasBroader</predicate>\r
                <predicateDisplayName>hasBroader</predicateDisplayName>\r
@@ -49,8 +49,8 @@
        </relation-list-item>\r
        <relation-list-item>\r
                <subjectCsid>${child2CSID}</subjectCsid>\r
-               <documentType1>Person</documentType1>\r
-               <documentType2>Person</documentType2>\r
+               <subjectDocumentType>Person</subjectDocumentType>\r
+               <objectDocumentType>Person</objectDocumentType>\r
                <relationshipType>hasBroader</relationshipType>\r
                <predicate>hasBroader</predicate>\r
                <predicateDisplayName>hasBroader</predicateDisplayName>\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistActive.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistActive.res.xml
new file mode 100644 (file)
index 0000000..9fe8400
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
+    <pageNum>0</pageNum>\r
+    <pageSize>40</pageSize>\r
+               <itemsInPage>1</itemsInPage>\r
+    <fieldsReturned>csid|uri|updatedAt|displayName|shortIdentifier|refName|termStatus</fieldsReturned>\r
+    <list-item>\r
+        <shortIdentifier>pschmitz</shortIdentifier>\r
+    </list-item>\r
+</ns2:abstract-common-list>\r
+\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistAll.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistAll.res.xml
new file mode 100644 (file)
index 0000000..322dbe5
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
+    <pageNum>0</pageNum>\r
+    <pageSize>40</pageSize>\r
+               <itemsInPage>2</itemsInPage>\r
+    <fieldsReturned>csid|uri|updatedAt|displayName|shortIdentifier|refName|termStatus</fieldsReturned>\r
+    <list-item>\r
+        <shortIdentifier>pschmitz</shortIdentifier>\r
+    </list-item>\r
+    <list-item>\r
+        <shortIdentifier>pmadry</shortIdentifier>\r
+    </list-item>\r
+</ns2:abstract-common-list>\r
+\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistNone.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/res/personlistNone.res.xml
new file mode 100644 (file)
index 0000000..8f085a3
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">\r
+    <pageNum>0</pageNum>\r
+    <pageSize>40</pageSize>\r
+               <itemsInPage>0</itemsInPage>\r
+    <fieldsReturned>csid|uri|updatedAt|displayName|shortIdentifier|refName|termStatus</fieldsReturned>\r
+</ns2:abstract-common-list>\r
+\r
index bf61191126aa53ed88ff05ea8daf8db73c89202c..f96366b8a4cda69c9e588c3863763c4d52770648 100644 (file)
@@ -3,10 +3,10 @@
   <ns2:relations_common 
           xmlns:ns2="http://collectionspace.org/services/relation" 
           xmlns:ns3="http://collectionspace.org/services/jaxb">
-    <documentId1>${documentId1}</documentId1>
-    <documentType1>${documentType1}</documentType1>
-    <documentId2>${documentId2}</documentId2>
-    <documentType2>${documentType1}</documentType2>
+    <subjectCsid>${subjectCsid}</subjectCsid>
+    <subjectDocumentType>${subjectDocumentType}</subjectDocumentType>
+    <objectCsid>${objectCsid}</objectCsid>
+    <objectDocumentType>${objectDocumentType}</objectDocumentType>
     <relationshipType>${relationshipType}</relationshipType>
     <predicateDisplayName>${relationshipType}</predicateDisplayName>
   </ns2:relations_common>
index 6ddcf829a2338904364bda7261f5f091edb1bce8..540692a928eb0fd1042575e6315fe6be15a33649 100644 (file)
@@ -1,16 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <document name="relations">
   <ns2:relations_common xmlns:ns2="http://collectionspace.org/services/relation" xmlns:ns3="http://collectionspace.org/services/jaxb">
-    <documentId1>${documentId1}</documentId1>
-    <documentType1>${documentType1}</documentType1>
-    <documentId2>${documentId2}</documentId2>
-    <documentType2>${documentType2}</documentType2>
+    <subjectCsid>${subjectCsid}</subjectCsid>
+    <subjectDocumentType>${subjectDocumentType}</subjectDocumentType>
+    <subjectUri>/my/long/uri/${subjectCsid}</subjectUri>
+    <objectCsid>${objectCsid}</objectCsid>
+    <objectDocumentType>${objectDocumentType}</objectDocumentType>
+    <objectUri>/my/long/uri/${objectCsid}</objectUri>
     <relationshipType>${relationshipType}</relationshipType>
     <predicateDisplayName>${relationshipType}</predicateDisplayName>
-    <subjectCsid>${documentId1}</subjectCsid>
-    <objectCsid>${documentId2}</objectCsid>
-    <subjectUri>/my/long/uri/${documentId1}</subjectUri>
-    <objectUri>/my/long/uri/${documentId2}</objectUri>
   </ns2:relations_common>
 </document>
 
index 52f010414308b5b602b7b4847d1239ae0cdac405..b085b325126b6a2a469531d2d2707b9046b335db 100644 (file)
              <uri>/cspace-services/relations/</uri>\r
              <filename>relation/r-1.xml</filename>\r
              <vars>\r
-                <var ID="documentId1">${oe1.CSID}</var>\r
-                <var ID="documentId2">${oe2.CSID}</var>\r
-                <var ID="documentType1">objectexit</var>\r
-                <var ID="documentType2">objectexit</var>\r
+                <var ID="subjectCsid">${oe1.CSID}</var>\r
+                <var ID="objectCsid">${oe2.CSID}</var>\r
+                <var ID="subjectDocumentType">objectexit</var>\r
+                <var ID="objectDocumentType">objectexit</var>\r
                 <var ID="relationshipType">hasBroader</var>\r
              </vars>\r
          </test>\r
              <filename>relation/r-1.xml</filename>\r
              <vars>\r
                 <!-- switched oe2 and oe1 on this -->\r
-                <var ID="documentId1">${oe2.CSID}</var>\r
-                <var ID="documentId2">${oe1.CSID}</var>\r
-                <var ID="documentType1">objectexit</var>\r
-                <var ID="documentType2">objectexit</var>\r
+                <var ID="subjectCsid">${oe2.CSID}</var>\r
+                <var ID="objectCsid">${oe1.CSID}</var>\r
+                <var ID="subjectDocumentType">objectexit</var>\r
+                <var ID="objectDocumentType">objectexit</var>\r
                 <var ID="relationshipType">hasBroader</var>\r
              </vars>\r
          </test>\r
              <uri>/cspace-services/relations/</uri>\r
              <filename>relation/r-2.xml</filename>\r
              <vars>\r
-                <var ID="documentId1">${oe1.CSID}</var>\r
-                <var ID="documentId2">${itemCSID}</var>\r
-                <var ID="documentType1">ObjectExit</var>\r
-                <var ID="documentType2">ObjectExit</var>\r
+                <var ID="subjectCsid">${oe1.CSID}</var>\r
+                <var ID="objectCsid">${itemCSID}</var>\r
+                <var ID="subjectDocumentType">ObjectExit</var>\r
+                <var ID="objectDocumentType">ObjectExit</var>\r
                 <var ID="relationshipType">hasBroader</var>\r
              </vars>\r
          </test>\r
              <uri>/cspace-services/relations/</uri>\r
              <filename>relation/r-2.xml</filename>\r
              <vars>\r
-                <var ID="documentId1">1234-5678</var>\r
-                <var ID="documentId2">${itemCSID}</var>\r
-                <var ID="documentType1">ObjectExit</var>\r
-                <var ID="documentType2">ObjectExit</var>\r
+                <var ID="subjectCsid">1234-5678</var>\r
+                <var ID="objectCsid">${itemCSID}</var>\r
+                <var ID="subjectDocumentType">ObjectExit</var>\r
+                <var ID="objectDocumentType">ObjectExit</var>\r
                 <var ID="relationshipType">hasBroader</var>\r
              </vars>\r
          </test>\r
index fe7ab95e3546040bfea8694f393ea904963fbaae..4a130df47fb3d69bd1556baee4a3cd54647bfb12 100644 (file)
@@ -6,26 +6,29 @@
        <pageNum>0</pageNum>
     <itemsInPage>3</itemsInPage>
     <totalItems>3</totalItems>
-    <fieldsReturned>csid|uri|updatedAt|displayName|shortIdentifier|refName|order</fieldsReturned>
+    <fieldsReturned>csid|uri|updatedAt|order|displayName|shortIdentifier|refName|termStatus</fieldsReturned>
     <list-item>
         <displayName>${Item3DupeOrder.displayName}</displayName>
         <shortIdentifier>${Item3DupeOrder.itemID}</shortIdentifier>
         <order>${Item3DupeOrder.order}</order>
         <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item3DupeOrder.CSID}</uri>
-        <csid>${Item3DupeOrder.CSID}</csid>
+                               <csid>${Item3DupeOrder.CSID}</csid>
+                               <termStatus/>
     </list-item>
     <list-item>
         <displayName>${Item2.displayName}</displayName>
         <shortIdentifier>${Item2.itemID}</shortIdentifier>
         <order>${Item2.order}</order>
         <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item2.CSID}</uri>
-        <csid>${Item2.CSID}</csid>
+                               <csid>${Item2.CSID}</csid>
+                               <termStatus/>
     </list-item>
     <list-item>
         <displayName>${Item1.displayName}</displayName>
         <shortIdentifier>${Item1.itemID}</shortIdentifier>
         <order>${Item1.order}</order>
         <uri>/vocabularies/${Vocabulary1.CSID}/items/${Item1.CSID}</uri>
-        <csid>${Item1.CSID}</csid>
+                               <csid>${Item1.CSID}</csid>
+                               <termStatus/>
     </list-item>
 </ns3:abstract-common-list>
index e78cd5c63bda4f0c68d0a37f1296b6b484af6d5b..686cb68e3f7be8fc2ca30c996122533c1b92ba1f 100755 (executable)
@@ -53,6 +53,8 @@
     <run controlFile="batch/batch.xml" />\r
     <run controlFile="report/report.xml" />\r
     <run controlFile="vocabulary/vocabulary.xml" testGroup="TestOrder" />\r
+               <run controlFile="authrefs/authrefs.xml" testGroup="AuthRefs" />\r
+\r
     \r
 </xmlReplayMaster>\r
 \r
index 74d161446a80ac0eb87b5639d9661dff723d2f33..ae9cf211501ef6b80e9086cdb79416f473b385b6 100644 (file)
@@ -112,19 +112,19 @@ public abstract class CollectionSpacePerformanceTest {
      * Fill relation.\r
      * \r
      * @param relation the relation\r
-     * @param documentId1 the document id1\r
-     * @param documentType1 the document type1\r
-     * @param documentId2 the document id2\r
-     * @param documentType2 the document type2\r
+     * @param subjectCsid the document id1\r
+     * @param subjectDocumentType the document type1\r
+     * @param objectCsid the document id2\r
+     * @param objectDocumentType the document type2\r
      * @param rt the rt\r
      */\r
-    void fillRelation(RelationsCommon relation, String documentId1, String documentType1,\r
-               String documentId2, String documentType2, RelationshipType rt)\r
+    void fillRelation(RelationsCommon relation, String subjectCsid, String subjectDocumentType,\r
+               String objectCsid, String objectDocumentType, RelationshipType rt)\r
     {\r
-        relation.setDocumentId1(documentId1);\r
-        relation.setDocumentType1(documentType1);\r
-        relation.setDocumentId2(documentId2);\r
-        relation.setDocumentType2(documentType2);\r
+        relation.setSubjectCsid(subjectCsid);\r
+        relation.setSubjectDocumentType(subjectDocumentType);\r
+        relation.setSubjectCsid(objectCsid);\r
+        relation.setObjectDocumentType(objectDocumentType);\r
         \r
         relation.setRelationshipType(rt.toString());\r
     }\r
index 5046ade10dd831af2d9ce7e6b57980d8340c7ccd..ebba7a018b5c8e464cf701b5e16a54d6f0800acf 100644 (file)
     <!-- See http://wiki.collectionspace.org/display/collectionspace/Acquisition+Schema -->\r
 \r
     <!--  Object Entry Information Group -->\r
-    <xs:element name="accessionDate" type="xs:string"/>\r
+    <xs:element name="accessionDate" type="xs:date"/>\r
     <xs:element name="acquisitionAuthorizer" type="xs:string"/>\r
-    <xs:element name="acquisitionAuthorizerDate" type="xs:string"/>\r
+    <xs:element name="acquisitionAuthorizerDate" type="xs:date"/>\r
     <xs:element name="acquisitionDates">\r
         <xs:complexType>\r
             <xs:sequence>\r
-                <xs:element name="acquisitionDate" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>\r
+                <xs:element name="acquisitionDate" type="xs:date" minOccurs="0" maxOccurs="unbounded"/>\r
             </xs:sequence>\r
         </xs:complexType>\r
     </xs:element>\r
index c43ef9ec794155d235464dc556e946f53959c868..3147e8a153846c83614b02e7bba56cf789fbf6ee 100644 (file)
@@ -32,6 +32,7 @@ import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.AbstractCommonListUtils;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
 import org.collectionspace.services.acquisition.AcquisitionsCommon;
@@ -62,17 +63,20 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
     // Instance variables specific to this test.
     /** The known resource id. */
     private String knownResourceId = null;
+    private final static String CURRENT_DATE_UTC =
+            GregorianCalendarDateTimeUtils.timestampUTC();
 
-       @Override
-       public String getServicePathComponent() {
-               return AcquisitionClient.SERVICE_PATH_COMPONENT;
-       }
+
+    @Override
+    public String getServicePathComponent() {
+        return AcquisitionClient.SERVICE_PATH_COMPONENT;
+    }
 
 
-       @Override
-       protected String getServiceName() {
-               return AcquisitionClient.SERVICE_NAME;
-       }
+    @Override
+    protected String getServiceName() {
+        return AcquisitionClient.SERVICE_NAME;
+    }
     
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
@@ -797,10 +801,8 @@ public class AcquisitionServiceTest extends AbstractServiceTestImpl {
 
         AcquisitionDateList acqDatesList = new AcquisitionDateList();
         List<String> acqDates = acqDatesList.getAcquisitionDate();
-        // FIXME Use properly timestamps for representative acquisition
-        // dates in this example test record. The following are mere placeholders.
-        acqDates.add("First Acquisition Date -" + identifier);
-        acqDates.add("Second Acquisition Date-" + identifier);
+        acqDates.add(CURRENT_DATE_UTC);
+        acqDates.add(CURRENT_DATE_UTC);
         acquisition.setAcquisitionDates(acqDatesList);
 
         OwnerList ownersList = new OwnerList();
index 2764731c50e9fc522305f16ef0ee171079bc0dbd..f72d750c52106fbae2508bc99c0fe2a18f6b9db5 100644 (file)
@@ -103,6 +103,8 @@ import java.util.List;
 @Produces("application/xml")
 public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         extends ResourceBase {
+       
+       final static String SEARCH_TYPE_TERMSTATUS = "ts";
 
     protected Class<AuthCommon> authCommonClass;
     protected Class<?> resourceClass;
@@ -638,6 +640,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         try {
             MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
             String partialTerm = queryParams.getFirst(IQueryManager.SEARCH_TYPE_PARTIALTERM);
+            String termStatus = queryParams.getFirst(SEARCH_TYPE_TERMSTATUS);
             String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);
             String advancedSearch = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_AS);
 
@@ -660,12 +663,21 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
             if (sortBy == null || sortBy.isEmpty()) {
                 myFilter.setOrderByClause(qualifiedDisplayNameField);
             }
-
+            
             myFilter.appendWhereClause(authorityItemCommonSchemaName + ":"
                     + AuthorityItemJAXBSchema.IN_AUTHORITY + "="
                     + "'" + parentcsid + "'",
                     IQueryManager.SEARCH_QUALIFIER_AND);
 
+            if (Tools.notBlank(termStatus)) {
+               // Start with the qualified termStatus field
+               String qualifiedTermStatusField = authorityItemCommonSchemaName + ":"
+                        + AuthorityItemJAXBSchema.TERM_STATUS;
+               String[] filterTerms = termStatus.trim().split("\\|");
+               String tsClause = QueryManager.createWhereClauseToFilterFromStringList(qualifiedTermStatusField, filterTerms, IQueryManager.FILTER_EXCLUDE);
+                myFilter.appendWhereClause(tsClause, IQueryManager.SEARCH_QUALIFIER_AND);
+            }
+                
             // AND vocabularyitems_common:displayName LIKE '%partialTerm%'
             // NOTE: Partial terms searches are mutually exclusive to keyword and advanced-search, but
             // the PT query param trumps the KW and AS query params.
@@ -740,9 +752,13 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
             DocumentModel docModel = docWrapper.getWrappedObject();
             String refName = (String) docModel.getPropertyValue(AuthorityItemJAXBSchema.REF_NAME);
 
+            // Could be smarter about using the list from above, and/or allowing multiple
+            ArrayList<String> serviceTypes = new ArrayList<String>(1);
+            serviceTypes.add(serviceType);
+            
             authRefDocList = RefNameServiceUtils.getAuthorityRefDocs(ctx,
                     repoClient,
-                    serviceType,
+                    serviceTypes,
                     refName,
                     getRefPropName(),
                     myFilter.getPageSize(), myFilter.getStartPage(), true /*computeTotal*/);
index 56fb517791ec1f7a6162b293f369514b3f801393..5e22beb2aec4b6c8c7b41ea84452044ea317a9f8 100644 (file)
@@ -33,11 +33,15 @@ import java.util.Map;
 import org.nuxeo.ecm.core.api.ClientException;\r
 import org.nuxeo.ecm.core.api.DocumentModel;\r
 import org.nuxeo.ecm.core.api.DocumentModelList;\r
+import org.nuxeo.ecm.core.api.model.Property;\r
+import org.nuxeo.ecm.core.api.model.PropertyException;\r
+import org.nuxeo.ecm.core.api.model.impl.primitives.StringProperty;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 \r
 import org.collectionspace.services.common.ServiceMain;\r
 import org.collectionspace.services.common.context.ServiceContext;\r
+import org.collectionspace.services.common.api.Tools;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefList;\r
 import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;\r
@@ -47,6 +51,8 @@ import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentUtils;\r
 import org.collectionspace.services.common.document.DocumentWrapper;\r
 import org.collectionspace.services.common.repository.RepositoryClient;\r
+import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;\r
+import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;\r
 import org.collectionspace.services.common.service.ServiceBindingType;\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;\r
@@ -60,10 +66,12 @@ import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 public class RefNameServiceUtils {\r
 \r
     private static final Logger logger = LoggerFactory.getLogger(RefNameServiceUtils.class);\r
+    \r
+    private static ArrayList<String> refNameServiceTypes = null;\r
 \r
     public static AuthorityRefDocList getAuthorityRefDocs(ServiceContext ctx,\r
             RepositoryClient repoClient,\r
-            String serviceType,\r
+            List<String> serviceTypes,\r
             String refName,\r
             String refPropName,\r
             int pageSize, int pageNum, boolean computeTotal) throws DocumentException, DocumentNotFoundException {\r
@@ -73,11 +81,96 @@ public class RefNameServiceUtils {
         commonList.setPageSize(pageSize);\r
         List<AuthorityRefDocList.AuthorityRefDocItem> list =\r
                 wrapperList.getAuthorityRefDocItem();\r
+        \r
+        Map<String, ServiceBindingType> queriedServiceBindings = new HashMap<String, ServiceBindingType>();\r
+        Map<String, Map<String, String>> authRefFieldsByService = new HashMap<String, Map<String, String>>();\r
+\r
+        DocumentModelList docList = findAuthorityRefDocs(ctx, repoClient, serviceTypes, refName, refPropName,\r
+                       queriedServiceBindings, authRefFieldsByService, pageSize, pageNum, computeTotal);\r
+\r
+        if (docList == null) { // found no authRef fields - nothing to process\r
+            return wrapperList;\r
+        }\r
+        // Set num of items in list. this is useful to our testing framework.\r
+        commonList.setItemsInPage(docList.size());\r
+        // set the total result size\r
+        commonList.setTotalItems(docList.totalSize());\r
+        \r
+        int nRefsFound = processRefObjsDocList(docList, refName, queriedServiceBindings, authRefFieldsByService,\r
+                                                       list, null);\r
+        if(logger.isDebugEnabled()  && (nRefsFound < docList.size())) {\r
+               logger.debug("Internal curiosity: got fewer matches of refs than # docs matched...");\r
+        }\r
+        return wrapperList;\r
+    }\r
+    \r
+    private static ArrayList<String> getRefNameServiceTypes() {\r
+       if(refNameServiceTypes == null) {\r
+               refNameServiceTypes = new ArrayList<String>();\r
+               refNameServiceTypes.add(ServiceBindingUtils.SERVICE_TYPE_AUTHORITY);\r
+               refNameServiceTypes.add(ServiceBindingUtils.SERVICE_TYPE_OBJECT);\r
+               refNameServiceTypes.add(ServiceBindingUtils.SERVICE_TYPE_PROCEDURE);\r
+       }\r
+       return refNameServiceTypes;\r
+    }\r
+    \r
+    public static int updateAuthorityRefDocs(ServiceContext ctx,\r
+            RepositoryClient repoClient,\r
+            String oldRefName,\r
+            String newRefName,\r
+            String refPropName ) {\r
+        Map<String, ServiceBindingType> queriedServiceBindings = new HashMap<String, ServiceBindingType>();\r
+        Map<String, Map<String, String>> authRefFieldsByService = new HashMap<String, Map<String, String>>();\r
+        int nRefsFound = 0;\r
+        if(!(repoClient instanceof RepositoryJavaClientImpl)) {\r
+               throw new InternalError("updateAuthorityRefDocs() called with unknown repoClient type!");\r
+        }\r
+        try {\r
+               final int pageSize = 100;       // Seems like a good value - no real data to set this well.\r
+               int pageNumProcessed = 1;\r
+               while(true) {   // Keep looping until we find all the refs.\r
+                       logger.debug("updateAuthorityRefDocs working on page: "+pageNumProcessed);\r
+                       // Note that we always ask the Repo for the first page, since each page we process\r
+                       // should not be found in successive searches.\r
+                       DocumentModelList docList = findAuthorityRefDocs(ctx, repoClient, getRefNameServiceTypes(), oldRefName, refPropName,\r
+                                       queriedServiceBindings, authRefFieldsByService, pageSize, 0, false);\r
+               \r
+                       if((docList == null)                    // found no authRef fields - nothing to do\r
+                               || (docList.size() == 0)) {     // No more to handle\r
+                               logger.debug("updateAuthorityRefDocs no more results");\r
+                           break;\r
+                       }\r
+                       logger.debug("updateAuthorityRefDocs curr page result list size: "+docList.size());\r
+                       int nRefsFoundThisPage = processRefObjsDocList(docList, oldRefName, queriedServiceBindings, authRefFieldsByService,\r
+                                                                       null, newRefName);\r
+                       if(nRefsFoundThisPage>0) {\r
+                               ((RepositoryJavaClientImpl)repoClient).saveDocListWithoutHandlerProcessing(ctx, docList, true);\r
+                               nRefsFound += nRefsFoundThisPage;\r
+                       }\r
+                       pageNumProcessed++;\r
+               }\r
+        } catch(Exception e) {\r
+               logger.error("Internal error updating the AuthorityRefDocs: " + e.getLocalizedMessage());\r
+               logger.debug(Tools.errorToString(e, true));\r
+        }\r
+               logger.debug("updateAuthorityRefDocs replaced a total of: "+nRefsFound);\r
+        return nRefsFound;\r
+    }\r
+    \r
+    private static DocumentModelList findAuthorityRefDocs(ServiceContext ctx,\r
+            RepositoryClient repoClient,\r
+            List<String> serviceTypes,\r
+            String refName,\r
+            String refPropName,\r
+            Map<String, ServiceBindingType> queriedServiceBindings,\r
+            Map<String, Map<String, String>> authRefFieldsByService,\r
+            int pageSize, int pageNum, boolean computeTotal) throws DocumentException, DocumentNotFoundException {\r
 \r
         // Get the service bindings for this tenant\r
         TenantBindingConfigReaderImpl tReader =\r
                 ServiceMain.getInstance().getTenantBindingConfigReader();\r
-        List<ServiceBindingType> servicebindings = tReader.getServiceBindingsByType(ctx.getTenantId(), serviceType);\r
+        // We need to get all the procedures, authorities, and objects.\r
+        List<ServiceBindingType> servicebindings = tReader.getServiceBindingsByType(ctx.getTenantId(), serviceTypes);\r
         if (servicebindings == null || servicebindings.isEmpty()) {\r
                logger.error("RefNameServiceUtils.getAuthorityRefDocs: No services bindings found, cannot proceed!");\r
             return null;\r
@@ -87,28 +180,18 @@ public class RefNameServiceUtils {
         // TODO What if they are already escaped?\r
         String escapedRefName = refName.replaceAll("'", "\\\\'");\r
         ArrayList<String> docTypes = new ArrayList<String>();\r
-        Map<String, ServiceBindingType> queriedServiceBindings = new HashMap<String, ServiceBindingType>();\r
-        Map<String, Map<String, String>> authRefFieldsByService = new HashMap<String, Map<String, String>>();\r
         \r
         String query = computeWhereClauseForAuthorityRefDocs(escapedRefName, refPropName, docTypes, servicebindings, \r
                                                                                                queriedServiceBindings, authRefFieldsByService );\r
         if (query == null) { // found no authRef fields - nothing to query\r
-            return wrapperList;\r
+            return null;\r
         }\r
         // Now we have to issue the search\r
         DocumentWrapper<DocumentModelList> docListWrapper = repoClient.findDocs(ctx,\r
                 docTypes, query, pageSize, pageNum, computeTotal);\r
         // Now we gather the info for each document into the list and return\r
         DocumentModelList docList = docListWrapper.getWrappedObject();\r
-        // Set num of items in list. this is useful to our testing framework.\r
-        commonList.setItemsInPage(docList.size());\r
-        // set the total result size\r
-        commonList.setTotalItems(docList.totalSize());\r
-        \r
-        processRefObjsDocList(docList, refName, servicebindings,\r
-                                                       queriedServiceBindings, authRefFieldsByService,\r
-                                                       list, null);\r
-        return wrapperList;\r
+        return docList;\r
     }\r
     \r
     private static String computeWhereClauseForAuthorityRefDocs(\r
@@ -173,16 +256,28 @@ public class RefNameServiceUtils {
     /*\r
      * Runs through the list of found docs, processing them. \r
      * If list is non-null, then processing means gather the info for items.\r
-     * If list is null, and newRefName is non-null, then processing means replacing and updating.\r
+     * If list is null, and newRefName is non-null, then processing means replacing and updating. \r
+     *   If processing/updating, this must be called in teh context of an open session, and caller\r
+     *   must release Session after calling this.\r
+     * \r
      */\r
-    private static void processRefObjsDocList(DocumentModelList docList,\r
+    private static int processRefObjsDocList(\r
+               DocumentModelList docList,\r
                String refName,\r
-               List<ServiceBindingType> servicebindings,\r
                Map<String, ServiceBindingType> queriedServiceBindings,\r
                Map<String, Map<String, String>> authRefFieldsByService,\r
                        List<AuthorityRefDocList.AuthorityRefDocItem> list, \r
                        String newAuthorityRefName) {\r
+       if(newAuthorityRefName==null) {\r
+               if(list==null) {\r
+                       throw new InternalError("processRefObjsDocList() called with neither an itemList nor a new RefName!");\r
+               }\r
+       } else if(list!=null) {\r
+               throw new InternalError("processRefObjsDocList() called with both an itemList and a new RefName!");\r
+       }\r
+\r
         Iterator<DocumentModel> iter = docList.iterator();\r
+        int nRefsFoundTotal = 0;\r
         while (iter.hasNext()) {\r
             DocumentModel docModel = iter.next();\r
             AuthorityRefDocList.AuthorityRefDocItem ilistItem;\r
@@ -202,6 +297,11 @@ public class RefNameServiceUtils {
                 String csid = NuxeoUtils.getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());\r
                 ilistItem.setDocId(csid);\r
                 ilistItem.setUri(serviceContextPath + csid);\r
+                try {\r
+                       ilistItem.setUpdatedAt(DocHandlerBase.getUpdatedAtAsString(docModel));\r
+                } catch(Exception e) {\r
+                       logger.error("Error getting udpatedAt value for doc ["+csid+"]: "+e.getLocalizedMessage());\r
+                }\r
                 // The id and URI are the same on all doctypes\r
                 ilistItem.setDocType(docType);\r
                 ilistItem.setDocNumber(\r
@@ -210,7 +310,7 @@ public class RefNameServiceUtils {
                         ServiceBindingUtils.getMappedFieldInDoc(sb, ServiceBindingUtils.OBJ_NAME_PROP, docModel));\r
             }\r
             // Now, we have to loop over the authRefFieldsByService to figure\r
-            // out which field matched this. Ignore multiple matches.\r
+            // out which field(s) matched this.\r
             Map<String,String> matchingAuthRefFields = authRefFieldsByService.get(docType);\r
             if (matchingAuthRefFields == null || matchingAuthRefFields.isEmpty()) {\r
                 throw new RuntimeException(\r
@@ -219,20 +319,21 @@ public class RefNameServiceUtils {
             String authRefAncestorField = "";\r
             String authRefDescendantField = "";\r
             String sourceField = "";\r
-            boolean fRefFound = false;\r
+            int nRefsFoundInDoc = 0;\r
             // Use this if we go to qualified field names\r
             for (String path : matchingAuthRefFields.keySet()) {\r
                 try {\r
                        // This is the field name we show in the return info\r
+                       // Returned as a schema-qualified property path\r
                     authRefAncestorField = (String) matchingAuthRefFields.get(path);\r
                     // This is the qualified field we have to get from the doc model\r
                     authRefDescendantField = DocumentUtils.getDescendantOrAncestor(path);\r
                     // The ancestor field is part-schema (tablename) qualified\r
-                    String[] strings = authRefAncestorField.split(":");\r
-                    if (strings.length != 2) {\r
-                        throw new RuntimeException(\r
-                                "getAuthorityRefDocs: Bad configuration of path to authority reference field.");\r
-                    }\r
+                    //String[] strings = authRefAncestorField.split(":");\r
+                    //if (strings.length != 2) {\r
+                    //   throw new RuntimeException(\r
+                    //            "getAuthorityRefDocs: Bad configuration of path to authority reference field.");\r
+                    //}\r
                     // strings[0] holds a schema name, such as "intakes_common"\r
                     //\r
                     // strings[1] holds:\r
@@ -243,13 +344,19 @@ public class RefNameServiceUtils {
                     //   field, such as "fieldCollector".\r
                     // TODO - if the value is not simple, or repeating scalar, need a more\r
                     // sophisticated fetch. \r
-                    Object fieldValue = docModel.getProperty(strings[0], strings[1]);\r
-                    // We cannot be sure why we have this doc, so look for matches\r
-                    boolean fRefMatches = refNameFoundInField(refName, fieldValue);\r
-                    if (fRefMatches) {\r
+                    // Change this to an XPath model\r
+                    //Object fieldValue = docModel.getProperty(strings[0], strings[1]);\r
+                    // This will have to handle repeating complex fields by iterating over the possibilities\r
+                    // and finding the one that matches.\r
+                    Property fieldValue = docModel.getProperty(authRefAncestorField);\r
+                    // We know this doc should have a match somewhere, but it may not be in this field\r
+                    // If we are just building up the refItems, then it is enough to know we found a match.\r
+                    // If we are patching refName values, then we have to replace each match.\r
+                    int nRefsMatchedInField = refNameFoundInField(refName, fieldValue, newAuthorityRefName);\r
+                    if (nRefsMatchedInField > 0) {\r
                         sourceField = authRefDescendantField;\r
                         // Handle multiple fields matching in one Doc. See CSPACE-2863.\r
-                       if(fRefFound) {\r
+                       if(nRefsFoundInDoc > 0) {\r
                                // We already added ilistItem, so we need to clone that and add again\r
                                if(ilistItem != null) {\r
                                        ilistItem = cloneAuthRefDocItem(ilistItem, sourceField);\r
@@ -258,11 +365,11 @@ public class RefNameServiceUtils {
                                if(ilistItem != null) {\r
                                        ilistItem.setSourceField(sourceField);\r
                                }\r
-                            fRefFound = true;\r
                        }\r
                                if(ilistItem != null) {\r
                                        list.add(ilistItem);\r
                                }\r
+                               nRefsFoundInDoc += nRefsMatchedInField;\r
                     }\r
 \r
                 } catch (ClientException ce) {\r
@@ -270,13 +377,14 @@ public class RefNameServiceUtils {
                             "getAuthorityRefDocs: Problem fetching: " + sourceField, ce);\r
                 }\r
             }\r
-            if (!fRefFound) {\r
+            if (nRefsFoundInDoc == 0) {\r
                 throw new RuntimeException(\r
                         "getAuthorityRefDocs: Could not find refname in object:"\r
                         + docType + ":" + NuxeoUtils.getCsid(docModel));\r
             }\r
+            nRefsFoundTotal += nRefsFoundInDoc;\r
         }\r
-\r
+        return nRefsFoundTotal;\r
     }\r
     \r
     private static AuthorityRefDocList.AuthorityRefDocItem cloneAuthRefDocItem(\r
@@ -293,6 +401,7 @@ public class RefNameServiceUtils {
 \r
     /*\r
      * Identifies whether the refName was found in the supplied field.\r
+     * If passed a new RefName, will set that into fields in which the old one was found.\r
      *\r
      * Only works for:\r
      * * Scalar fields\r
@@ -302,24 +411,37 @@ public class RefNameServiceUtils {
      * * Structured fields (complexTypes)\r
      * * Repeatable structured fields (repeatable complexTypes)\r
      */\r
-    private static boolean refNameFoundInField(String refName, Object fieldValue) {\r
-\r
-        boolean result = false;\r
-        if (fieldValue instanceof List) {\r
-            List<String> fieldValueList = (List) fieldValue;\r
-            for (String listItemValue : fieldValueList) {\r
-                if (refName.equalsIgnoreCase(listItemValue)) {\r
-                    result = true;\r
-                    break;\r
-                }\r
-\r
-            }\r
-        } else if (fieldValue instanceof String){\r
-            if (refName.equalsIgnoreCase((String)fieldValue)) {\r
-                result = true;\r
-            }\r
-        }\r
-        return result;\r
+    private static int refNameFoundInField(String oldRefName, Property fieldValue, String newRefName) {\r
+       int nFound = 0;\r
+       if (fieldValue instanceof List) {\r
+               List<Property> fieldValueList = (List) fieldValue;\r
+               for (Property listItemValue : fieldValueList) {\r
+                       try {\r
+                               if ((listItemValue instanceof StringProperty)\r
+                                               && oldRefName.equalsIgnoreCase((String)listItemValue.getValue())) {\r
+                                       nFound++;\r
+                                       if(newRefName!=null) {\r
+                                               fieldValue.setValue(newRefName);\r
+                                       } else {\r
+                                               // We cannot quit after the first, if we are replacing values.\r
+                                               // If we are just looking (not replacing), finding one is enough.\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       } catch( PropertyException pe ) {}\r
+               }\r
+       } else {\r
+               try {\r
+                       if ((fieldValue instanceof StringProperty)\r
+                                       && oldRefName.equalsIgnoreCase((String)fieldValue.getValue())) {\r
+                                       nFound++;\r
+                               if(newRefName!=null) {\r
+                                       fieldValue.setValue(newRefName);\r
+                               }\r
+                       }\r
+               } catch( PropertyException pe ) {}\r
+       }\r
+       return nFound;\r
     }\r
 }\r
 \r
index 9235008b3be17fffca8dbecc8b2474b979b960df..84cb9cfa16abf18ba6b9c473c0001cdeb4c3b527 100644 (file)
@@ -80,6 +80,10 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
         updateRefnameForAuthority(wrapDoc, authorityCommonSchemaName);//CSPACE-3178
     }
 
+    /**
+     * If no short identifier was provided in the input payload,
+     * generate a short identifier from the display name.
+     */
     private void handleDisplayNameAsShortIdentifier(DocumentModel docModel, String schemaName) throws Exception {
         String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER);
         String displayName = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.DISPLAY_NAME);
@@ -89,24 +93,29 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
             docModel.setProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER, generatedShortIdentifier);
         }
     }
-    
+    /**
+     * Generate a refName for the authority from the short identifier
+     * and display name.
+     * 
+     * All refNames for authorities are generated.  If a client supplies
+     * a refName, it will be overwritten during create (per this method) 
+     * or discarded during update (per filterReadOnlyPropertiesForPart).
+     * 
+     * @see #filterReadOnlyPropertiesForPart(Map<String, Object>, org.collectionspace.services.common.service.ObjectPartType)
+     * 
+     */
     protected void updateRefnameForAuthority(DocumentWrapper<DocumentModel> wrapDoc, String schemaName) throws Exception {
         DocumentModel docModel = wrapDoc.getWrappedObject();
-        String suppliedRefName = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.REF_NAME);
-        // CSPACE-3178:
-        // Temporarily accept client-supplied refName values, rather than always generating such values,
-        // Remove the surrounding 'if' statement when clients should no longer supply refName values.
-        if (suppliedRefName == null || suppliedRefName.isEmpty()) {
-            String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER);
-            String displayName = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.DISPLAY_NAME);
-            MultipartServiceContext ctx = (MultipartServiceContext) getServiceContext();
-            RefName.Authority authority = RefName.buildAuthority(ctx.getTenantName(),
-                    ctx.getServiceName(),
-                    shortIdentifier,
-                    displayName);
-            String refName = authority.toString();
-            docModel.setProperty(schemaName, AuthorityJAXBSchema.REF_NAME, refName);
-        }
+        String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER);
+        String displayName = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.DISPLAY_NAME);
+        MultipartServiceContext ctx = (MultipartServiceContext) getServiceContext();
+        RefName.Authority authority = RefName.buildAuthority(ctx.getTenantName(),
+                ctx.getServiceName(),
+                shortIdentifier,
+                displayName);
+        String refName = authority.toString();
+        docModel.setProperty(schemaName, AuthorityJAXBSchema.REF_NAME, refName);
     }
 
     public String getShortIdentifier(DocumentWrapper<DocumentModel> wrapDoc, String schemaName) {
@@ -134,9 +143,7 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
         if (partMeta.getLabel().equalsIgnoreCase(commonPartLabel)) {
             objectProps.remove(AuthorityJAXBSchema.CSID);
             objectProps.remove(AuthorityJAXBSchema.SHORT_IDENTIFIER);
-            // Enable when clients should no longer supply refName values
-            // objectProps.remove(AuthorityItemJAXBSchema.REF_NAME); // CSPACE-3178
-
+            objectProps.remove(AuthorityJAXBSchema.REF_NAME);
         }
     }
 }
index 29dbd50c2b456c145b123a329765e2338e9db435..40f0b12498f693de09351158ff7952ca532ca682 100644 (file)
@@ -33,7 +33,9 @@ import org.collectionspace.services.common.api.CommonAPI;
 import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.context.MultipartServiceContext;
+import org.collectionspace.services.common.context.ServiceBindingUtils;
 import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.document.DocumentWrapperImpl;
 import org.collectionspace.services.common.relation.IRelationsManager;
@@ -44,6 +46,7 @@ import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
 import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.common.service.ListResultField;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.relation.RelationResource;
 import org.collectionspace.services.relation.RelationsCommon;
@@ -80,7 +83,6 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
      */
     protected String inAuthority;
     protected String authorityRefNameBase;
-    
     // Used to determine when the displayName changes as part of the update.
     protected String oldDisplayNameOnUpdate = null;
     protected String oldRefNameOnUpdate = null;
@@ -118,6 +120,58 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         this.authorityRefNameBase = value;
     }
 
+    @Override
+    public List<ListResultField> getListItemsArray() throws DocumentException {
+        List<ListResultField> list = super.getListItemsArray();
+        int nFields = list.size();
+        // Ensure some common fields so do not depend upon config for general logic
+        boolean hasDisplayName = false;
+        boolean hasShortId = false;
+        boolean hasRefName = false;
+        boolean hasTermStatus = false;
+        for (int i = 0; i < nFields; i++) {
+            ListResultField field = list.get(i);
+            String elName = field.getElement();
+            if (AuthorityItemJAXBSchema.DISPLAY_NAME.equals(elName)) {
+                hasDisplayName = true;
+            } else if (AuthorityItemJAXBSchema.SHORT_IDENTIFIER.equals(elName)) {
+                hasShortId = true;
+            } else if (AuthorityItemJAXBSchema.REF_NAME.equals(elName)) {
+                hasRefName = true;
+            } else if (AuthorityItemJAXBSchema.TERM_STATUS.equals(elName)) {
+                hasTermStatus = true;
+            }
+        }
+        ListResultField field;
+        if (!hasDisplayName) {
+            field = new ListResultField();
+            field.setElement(AuthorityItemJAXBSchema.DISPLAY_NAME);
+            field.setXpath(AuthorityItemJAXBSchema.DISPLAY_NAME);
+            list.add(field);
+        }
+        if (!hasShortId) {
+            field = new ListResultField();
+            field.setElement(AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
+            field.setXpath(AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
+            list.add(field);
+        }
+        if (!hasRefName) {
+            field = new ListResultField();
+            field.setElement(AuthorityItemJAXBSchema.REF_NAME);
+            field.setXpath(AuthorityItemJAXBSchema.REF_NAME);
+            list.add(field);
+        }
+        if (!hasTermStatus) {
+            field = new ListResultField();
+            field.setElement(AuthorityItemJAXBSchema.TERM_STATUS);
+            field.setXpath(AuthorityItemJAXBSchema.TERM_STATUS);
+            list.add(field);
+        }
+        return list;
+
+    }
+
+
     /* (non-Javadoc)
      * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper)
      */
@@ -127,41 +181,41 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         super.handleCreate(wrapDoc);
         // Ensure we have required fields set properly
         handleInAuthority(wrapDoc.getWrappedObject());
-        
-       handleComputedDisplayNames(wrapDoc.getWrappedObject());
-       String displayName = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName, 
-                               AuthorityItemJAXBSchema.DISPLAY_NAME);
-       if(Tools.isEmpty(displayName)) {
-               logger.warn("Creating Authority Item with no displayName!");
-       }
+
+        handleComputedDisplayNames(wrapDoc.getWrappedObject());
+        String displayName = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName,
+                AuthorityItemJAXBSchema.DISPLAY_NAME);
+        if (Tools.isEmpty(displayName)) {
+            logger.warn("Creating Authority Item with no displayName!");
+        }
         // CSPACE-3178:
         handleDisplayNameAsShortIdentifier(wrapDoc.getWrappedObject(), authorityItemCommonSchemaName);
         // refName includes displayName, so we force a correct value here.
         updateRefnameForAuthorityItem(wrapDoc, authorityItemCommonSchemaName, getAuthorityRefNameBase());
     }
-    
+
     /* (non-Javadoc)
      * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleUpdate(org.collectionspace.services.common.document.DocumentWrapper)
      */
     @Override
     public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       // First, get a copy of the old displayName
-       oldDisplayNameOnUpdate = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName, 
-                                                                                                                               AuthorityItemJAXBSchema.DISPLAY_NAME);
-       oldRefNameOnUpdate = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName, 
-                                                                                                                                       AuthorityItemJAXBSchema.REF_NAME);
-       super.handleUpdate(wrapDoc);
-       handleComputedDisplayNames(wrapDoc.getWrappedObject());
-       String newDisplayName = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName, 
-                                                                                                                                       AuthorityItemJAXBSchema.DISPLAY_NAME);
-       if(newDisplayName != null && !newDisplayName.equals(oldDisplayNameOnUpdate)) {
-               // Need to update the refName, and then fix all references.
-               newRefNameOnUpdate = handleItemRefNameUpdateForDisplayName(wrapDoc.getWrappedObject(), newDisplayName);
-       } else {
-               // Mark as not needing attention in completeUpdate phase.
-               newRefNameOnUpdate = null;
-               oldRefNameOnUpdate = null;
-       }
+        // First, get a copy of the old displayName
+        oldDisplayNameOnUpdate = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName,
+                AuthorityItemJAXBSchema.DISPLAY_NAME);
+        oldRefNameOnUpdate = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName,
+                AuthorityItemJAXBSchema.REF_NAME);
+        super.handleUpdate(wrapDoc);
+        handleComputedDisplayNames(wrapDoc.getWrappedObject());
+        String newDisplayName = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName,
+                AuthorityItemJAXBSchema.DISPLAY_NAME);
+        if (newDisplayName != null && !newDisplayName.equals(oldDisplayNameOnUpdate)) {
+            // Need to update the refName, and then fix all references.
+            newRefNameOnUpdate = handleItemRefNameUpdateForDisplayName(wrapDoc.getWrappedObject(), newDisplayName);
+        } else {
+            // Mark as not needing attention in completeUpdate phase.
+            newRefNameOnUpdate = null;
+            oldRefNameOnUpdate = null;
+        }
     }
 
     /**
@@ -171,7 +225,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
      * @throws Exception the exception
      */
     protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
-       // Do nothing by default.
+        // Do nothing by default.
     }
 
     /**
@@ -179,17 +233,16 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
      * Assumes refName is already correct. Just ensures it is right.
      *
      * @param docModel the doc model
+     * @param newDisplayName the new display name
      * @throws Exception the exception
      */
     protected String handleItemRefNameUpdateForDisplayName(DocumentModel docModel,
             String newDisplayName) throws Exception {
-        //String suppliedRefName = (String) docModel.getProperty(authorityItemCommonSchemaName, 
-        //                                                                                                             AuthorityItemJAXBSchema.REF_NAME);
         RefName.AuthorityItem authItem = RefName.AuthorityItem.parse(oldRefNameOnUpdate);
-        if(authItem == null) {
-               String err = "Authority Item has illegal refName: "+oldRefNameOnUpdate;
-               logger.debug(err);
-               throw new IllegalArgumentException(err);
+        if (authItem == null) {
+            String err = "Authority Item has illegal refName: " + oldRefNameOnUpdate;
+            logger.debug(err);
+            throw new IllegalArgumentException(err);
         }
         authItem.displayName = newDisplayName;
         String updatedRefName = authItem.toString();
@@ -197,21 +250,37 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         return updatedRefName;
     }
 
-    
     /**
      * Checks to see if the refName has changed, and if so, 
      * uses utilities to find all references and update them.
      */
     protected void handleItemRefNameReferenceUpdate() {
-       if(newRefNameOnUpdate != null && oldRefNameOnUpdate!= null) {
-               // We have work to do.
-               logger.debug("Need to find and update references to Item.");
-               logger.debug("Old refName" + oldRefNameOnUpdate);
-               logger.debug("New refName" + newRefNameOnUpdate);
-       }
+        if (newRefNameOnUpdate != null && oldRefNameOnUpdate != null) {
+            // We have work to do.
+            if (logger.isDebugEnabled()) {
+                String eol = System.getProperty("line.separator");
+                logger.debug("Need to find and update references to Item." + eol
+                        + "   Old refName" + oldRefNameOnUpdate + eol
+                        + "   New refName" + newRefNameOnUpdate);
+            }
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
+            RepositoryClient repoClient = getRepositoryClient(ctx);
+            // FIXME HACK - this should be defined for each handler, as with 
+            // AuthorityResource.getRefPropName()
+            String refNameProp = ServiceBindingUtils.AUTH_REF_PROP;
+
+            int nUpdated = RefNameServiceUtils.updateAuthorityRefDocs(ctx, repoClient,
+                    oldRefNameOnUpdate, newRefNameOnUpdate, refNameProp);
+            if (logger.isDebugEnabled()) {
+                logger.debug("Updated " + nUpdated + " instances of oldRefName to newRefName");
+            }
+        }
     }
 
-
+    /**
+     * If no short identifier was provided in the input payload,
+     * generate a short identifier from the display name.
+     */
     private void handleDisplayNameAsShortIdentifier(DocumentModel docModel, String schemaName) throws Exception {
         String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
         String displayName = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.DISPLAY_NAME);
@@ -222,38 +291,35 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
             // Do nothing on exception. Some vocabulary schemas may not include a short display name.
         }
         if (Tools.isEmpty(shortIdentifier)) {
-            String generatedShortIdentifier = AuthorityIdentifierUtils.generateShortIdentifierFromDisplayName(displayName, shortDisplayName);
+            String generatedShortIdentifier =
+                    AuthorityIdentifierUtils.generateShortIdentifierFromDisplayName(displayName, shortDisplayName);
             docModel.setProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER, generatedShortIdentifier);
         }
     }
 
+    /**
+     * Generate a refName for the authority item from the short identifier
+     * and display name.
+     * 
+     * All refNames for authority items are generated.  If a client supplies
+     * a refName, it will be overwritten during create (per this method) 
+     * or discarded during update (per filterReadOnlyPropertiesForPart).
+     * 
+     * @see #filterReadOnlyPropertiesForPart(Map<String, Object>, org.collectionspace.services.common.service.ObjectPartType)
+     * 
+     */
     protected void updateRefnameForAuthorityItem(DocumentWrapper<DocumentModel> wrapDoc,
             String schemaName,
             String authorityRefBaseName) throws Exception {
         DocumentModel docModel = wrapDoc.getWrappedObject();
-        String suppliedRefName = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.REF_NAME);
-        // CSPACE-3178:
-        // Temporarily accept client-supplied refName values, rather than always generating such values.
-        // Remove first block and the surrounding 'if' statement when clients should no longer supply refName values.
-        if(!Tools.isEmpty(suppliedRefName) ) {
-               // Supplied refName must at least be legal
-               RefName.AuthorityItem item = RefName.AuthorityItem.parse(suppliedRefName);
-               if(item==null) {
-                logger.error("Passed refName for authority item not legal: "+suppliedRefName);
-                suppliedRefName = null; // Clear this and compute a new one below.
-               }
-        } 
-        // Recheck, in case we cleared it for being illegal
-        if(Tools.isEmpty(suppliedRefName) ) {
-            String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
-            String displayName = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.DISPLAY_NAME);
-            if (Tools.isEmpty(authorityRefBaseName)) {
-                throw new Exception("Could not create the refName for this authority term, because the refName for its authority parent was empty.");
-            }
-            RefName.Authority authority = RefName.Authority.parse(authorityRefBaseName);
-            String refName = RefName.buildAuthorityItem(authority, shortIdentifier, displayName).toString();
-            docModel.setProperty(schemaName, AuthorityItemJAXBSchema.REF_NAME, refName);
+        String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
+        String displayName = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.DISPLAY_NAME);
+        if (Tools.isEmpty(authorityRefBaseName)) {
+            throw new Exception("Could not create the refName for this authority term, because the refName for its authority parent was empty.");
         }
+        RefName.Authority authority = RefName.Authority.parse(authorityRefBaseName);
+        String refName = RefName.buildAuthorityItem(authority, shortIdentifier, displayName).toString();
+        docModel.setProperty(schemaName, AuthorityItemJAXBSchema.REF_NAME, refName);
     }
 
     /**
@@ -278,7 +344,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
             throws Exception {
         Map<String, Object> unQObjectProperties = super.extractPart(docModel, schema, partMeta);
 
-        // Add the CSID to the common part
+        // Add the CSID to the common part, since they may have fetched via the shortId.
         if (partMeta.getLabel().equalsIgnoreCase(authorityItemCommonSchemaName)) {
             String csid = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
             unQObjectProperties.put("csid", csid);
@@ -305,9 +371,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
             objectProps.remove(AuthorityItemJAXBSchema.IN_AUTHORITY);
             objectProps.remove(AuthorityItemJAXBSchema.CSID);
             objectProps.remove(AuthorityJAXBSchema.SHORT_IDENTIFIER);
-            // Enable when clients should no longer supply refName values
-            // objectProps.remove(AuthorityItemJAXBSchema.REF_NAME); // CSPACE-3178
-
+            objectProps.remove(AuthorityItemJAXBSchema.REF_NAME);
         }
     }
 
@@ -447,13 +511,13 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         PoxPayloadIn input = (PoxPayloadIn) ctx.getInput();
         DocumentModel documentModel = (wrapDoc.getWrappedObject());
         String itemCsid = documentModel.getName();
-
+        
         //UPDATE and CREATE will call.   Updates relations part
         RelationsCommonList relationsCommonList = updateRelations(itemCsid, input, wrapDoc);
-
+        
         PayloadOutputPart payloadOutputPart = new PayloadOutputPart(RelationClient.SERVICE_COMMON_LIST_NAME, relationsCommonList);
         ctx.setProperty(RelationClient.SERVICE_COMMON_LIST_NAME, payloadOutputPart);
-        */
+         */
     }
 
     public void completeCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
@@ -466,7 +530,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         handleRelationsPayload(wrapDoc, true);
         handleItemRefNameReferenceUpdate();
     }
-    
+
     // Note that we must do this after we have completed the Update, so that the repository has the
     // info for the item itself. The relations code must call into the repo to get info for each end.
     // This could be optimized to pass in the parent docModel, since it will often be one end.
@@ -508,10 +572,10 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
     parent-a
      */
     private RelationsCommonList updateRelations(
-               String itemCSID, PoxPayloadIn input, DocumentWrapper<DocumentModel> wrapDoc, boolean fUpdate)
+            String itemCSID, PoxPayloadIn input, DocumentWrapper<DocumentModel> wrapDoc, boolean fUpdate)
             throws Exception {
-        if(logger.isTraceEnabled()) {
-               logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID);
+        if (logger.isTraceEnabled()) {
+            logger.trace("AuthItemDocHndler.updateRelations for: " + itemCSID);
         }
         PayloadInputPart part = input.getPart(RelationClient.SERVICE_COMMON_LIST_NAME);        //input.getPart("relations_common");
         if (part == null) {
@@ -532,44 +596,44 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         UriInfo uriInfo = ctx.getUriInfo();
         MultivaluedMap queryParams = uriInfo.getQueryParameters();
 
-        if(fUpdate) {
-               //Run getList() once as sent to get childListOuter:
-               String predicate = RelationshipType.HAS_BROADER.value();
-               queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
-               queryParams.putSingle(IRelationsManager.SUBJECT_QP, null);
-               queryParams.putSingle(IRelationsManager.SUBJECT_TYPE_QP, null);
-               queryParams.putSingle(IRelationsManager.OBJECT_QP, itemCSID);
-               queryParams.putSingle(IRelationsManager.OBJECT_TYPE_QP, null);
-               RelationsCommonList childListOuter = (new RelationResource()).getList(ctx.getUriInfo());    //magically knows all query params because they are in the context.
-       
-               //Now run getList() again, leaving predicate, swapping subject and object, to get parentListOuter.
-               queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
-               queryParams.putSingle(IRelationsManager.SUBJECT_QP, itemCSID);
-               queryParams.putSingle(IRelationsManager.OBJECT_QP, null);
-               RelationsCommonList parentListOuter = (new RelationResource()).getList(ctx.getUriInfo());
-       
-
-               childList = childListOuter.getRelationListItem();
-               parentList = parentListOuter.getRelationListItem();
-
-               if (parentList.size() > 1) {
-                   throw new Exception("Too many parents for object: " + itemCSID + " list: " + dumpList(parentList, "parentList"));
-               }
-        
-               if(logger.isTraceEnabled()) {
-                       logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID+" got existing relations.");
-               }
+        if (fUpdate) {
+            //Run getList() once as sent to get childListOuter:
+            String predicate = RelationshipType.HAS_BROADER.value();
+            queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
+            queryParams.putSingle(IRelationsManager.SUBJECT_QP, null);
+            queryParams.putSingle(IRelationsManager.SUBJECT_TYPE_QP, null);
+            queryParams.putSingle(IRelationsManager.OBJECT_QP, itemCSID);
+            queryParams.putSingle(IRelationsManager.OBJECT_TYPE_QP, null);
+            RelationsCommonList childListOuter = (new RelationResource()).getList(ctx.getUriInfo());    //magically knows all query params because they are in the context.
+
+            //Now run getList() again, leaving predicate, swapping subject and object, to get parentListOuter.
+            queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
+            queryParams.putSingle(IRelationsManager.SUBJECT_QP, itemCSID);
+            queryParams.putSingle(IRelationsManager.OBJECT_QP, null);
+            RelationsCommonList parentListOuter = (new RelationResource()).getList(ctx.getUriInfo());
+
+
+            childList = childListOuter.getRelationListItem();
+            parentList = parentListOuter.getRelationListItem();
+
+            if (parentList.size() > 1) {
+                throw new Exception("Too many parents for object: " + itemCSID + " list: " + dumpList(parentList, "parentList"));
+            }
+
+            if (logger.isTraceEnabled()) {
+                logger.trace("AuthItemDocHndler.updateRelations for: " + itemCSID + " got existing relations.");
+            }
         }
 
 
         for (RelationsCommonList.RelationListItem inboundItem : inboundList) {
-               // Note that the relations may specify the other (non-item) bit with a refName, not a CSID,
-               // and so the CSID for those may be null
-            if (itemCSID.equals(inboundItem.getObject().getCsid()) 
-                       && inboundItem.getPredicate().equals(HAS_BROADER)) {
+            // Note that the relations may specify the other (non-item) bit with a refName, not a CSID,
+            // and so the CSID for those may be null
+            if (itemCSID.equals(inboundItem.getObject().getCsid())
+                    && inboundItem.getPredicate().equals(HAS_BROADER)) {
                 //then this is an item that says we have a child.  That child is inboundItem
-                RelationsCommonList.RelationListItem childItem = 
-                               (childList==null)?null:findInList(childList, inboundItem);
+                RelationsCommonList.RelationListItem childItem =
+                        (childList == null) ? null : findInList(childList, inboundItem);
                 if (childItem != null) {
                     removeFromList(childList, childItem);    //exists, just take it off delete list
                 } else {
@@ -578,10 +642,10 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                 ensureChildHasNoOtherParents(ctx, queryParams, inboundItem.getSubject().getCsid());
 
             } else if (itemCSID.equals(inboundItem.getSubject().getCsid())
-                       && inboundItem.getPredicate().equals(HAS_BROADER)) {
+                    && inboundItem.getPredicate().equals(HAS_BROADER)) {
                 //then this is an item that says we have a parent.  inboundItem is that parent.
-                RelationsCommonList.RelationListItem parentItem = 
-                               (parentList==null)?null:findInList(parentList, inboundItem);
+                RelationsCommonList.RelationListItem parentItem =
+                        (parentList == null) ? null : findInList(parentList, inboundItem);
                 if (parentItem != null) {
                     removeFromList(parentList, parentItem);    //exists, just take it off delete list
                 } else {
@@ -592,26 +656,26 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                 //not dealing with: hasNarrower or any other predicate.
             }
         }
-        if(logger.isTraceEnabled()) {
-               String dump = dumpLists(itemCSID, parentList, childList, actionList);
-               //System.out.println("====dump====="+CR+dump);
-               logger.trace("~~~~~~~~~~~~~~~~~~~~~~dump~~~~~~~~~~~~~~~~~~~~~~~~" + CR + dump);
+        if (logger.isTraceEnabled()) {
+            String dump = dumpLists(itemCSID, parentList, childList, actionList);
+            //System.out.println("====dump====="+CR+dump);
+            logger.trace("~~~~~~~~~~~~~~~~~~~~~~dump~~~~~~~~~~~~~~~~~~~~~~~~" + CR + dump);
         }
-        if(fUpdate) {
-            if(logger.isTraceEnabled()) {
-               logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID+" deleting "
-                                       +parentList.size()+" existing parents and "+childList.size()+" existing children.");
+        if (fUpdate) {
+            if (logger.isTraceEnabled()) {
+                logger.trace("AuthItemDocHndler.updateRelations for: " + itemCSID + " deleting "
+                        + parentList.size() + " existing parents and " + childList.size() + " existing children.");
             }
-               deleteRelations(parentList, ctx, "parentList");               //todo: there are items appearing on both lists....april 20.
-               deleteRelations(childList, ctx, "childList");
+            deleteRelations(parentList, ctx, "parentList");               //todo: there are items appearing on both lists....april 20.
+            deleteRelations(childList, ctx, "childList");
         }
-        if(logger.isTraceEnabled()) {
-               logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID+" adding "
-                               +actionList.size()+" new parents and children.");
+        if (logger.isTraceEnabled()) {
+            logger.trace("AuthItemDocHndler.updateRelations for: " + itemCSID + " adding "
+                    + actionList.size() + " new parents and children.");
         }
         createRelations(actionList, ctx);
-        if(logger.isTraceEnabled()) {
-               logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID+" done.");
+        if (logger.isTraceEnabled()) {
+            logger.trace("AuthItemDocHndler.updateRelations for: " + itemCSID + " done.");
         }
         //We return all elements on the inbound list, since we have just worked to make them exist in the system
         // and be non-redundant, etc.  That list came from relationsCommonListBody, so it is still attached to it, just pass that back.
@@ -682,13 +746,13 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                 inboundItemObject.setCsid(itemCSID);
                 //inboundItemObject.setUri(getUri(docModel));
             } else {
-               /*
+                /*
                 String objectCsid = inboundItemObject.getCsid();
                 DocumentModel itemDocModel = NuxeoUtils.getDocFromCsid(getRepositorySession(), ctx, objectCsid);    //null if not found.
                 DocumentWrapper wrapper = new DocumentWrapperImpl(itemDocModel);
                 String uri = this.getRepositoryClient(ctx).getDocURI(wrapper);
                 inboundItemObject.setUri(uri);    //CSPACE-4037
-                */
+                 */
             }
             //uriPointsToSameAuthority(thisURI, inboundItemObject.getUri());    //CSPACE-4042
 
@@ -697,13 +761,13 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                 inboundItemSubject.setCsid(itemCSID);
                 //inboundItemSubject.setUri(getUri(docModel));
             } else {
-               /*
+                /*
                 String subjectCsid = inboundItemSubject.getCsid();
                 DocumentModel itemDocModel = NuxeoUtils.getDocFromCsid(getRepositorySession(), ctx, subjectCsid);    //null if not found.
                 DocumentWrapper wrapper = new DocumentWrapperImpl(itemDocModel);
                 String uri = this.getRepositoryClient(ctx).getDocURI(wrapper);
                 inboundItemSubject.setUri(uri);    //CSPACE-4037
-                */
+                 */
             }
             //uriPointsToSameAuthority(thisURI, inboundItemSubject.getUri());  //CSPACE-4042
 
@@ -723,12 +787,10 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
             // Either value might be null for for each of Subject and Object 
             String subjectCsid = itemSubject.getCsid();
             rc.setSubjectCsid(subjectCsid);
-            rc.setDocumentId1(subjectCsid); // populate legacy field for backward compatibility
 
             String objCsid = itemObject.getCsid();
             rc.setObjectCsid(objCsid);
-            rc.setDocumentId2(objCsid); // populate legacy field for backward compatibility
-            
+
             rc.setSubjectRefName(itemSubject.getRefName());
             rc.setObjectRefName(itemObject.getRefName());
 
@@ -739,9 +801,6 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
             // This is superfluous, since it will be fetched by the Relations Create logic.
             rc.setSubjectDocumentType(itemSubject.getDocumentType());
             rc.setObjectDocumentType(itemObject.getDocumentType());
-            // populate legacy fields for backward compatibility
-            rc.setDocumentType1(itemSubject.getDocumentType());
-            rc.setDocumentType2(itemObject.getDocumentType());
 
             // This is superfluous, since it will be fetched by the Relations Create logic.
             rc.setSubjectUri(itemSubject.getUri());
@@ -753,10 +812,9 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
             PoxPayloadOut payloadOut = new PoxPayloadOut(RelationClient.SERVICE_PAYLOAD_NAME);
             PayloadOutputPart outputPart = new PayloadOutputPart(RelationClient.SERVICE_COMMONPART_NAME, rc);
             payloadOut.addPart(outputPart);
-            //System.out.println("\r\n==== TO CREATE: "+rc.getDocumentId1()+"==>"+rc.getPredicate()+"==>"+rc.getDocumentId2());
             RelationResource relationResource = new RelationResource();
-            Object res = relationResource.create(ctx.getResourceMap(), 
-                       ctx.getUriInfo(), payloadOut.toXML());    //NOTE ui recycled from above to pass in unknown query params.
+            Object res = relationResource.create(ctx.getResourceMap(),
+                    ctx.getUriInfo(), payloadOut.toXML());    //NOTE ui recycled from above to pass in unknown query params.
         }
     }
 
index fcaa5e616cf2a5dbda96b92eeb61847333ee0764..808976073d1572d63d2eba73e44f0c735e2a1204 100644 (file)
@@ -153,10 +153,10 @@ public class CreateAndLinkLoanOutBatchJob implements BatchInvocable {
                String relationPayload = "<document name=\"relations\">"
                        + "<ns2:relations_common xmlns:ns2=\"http://collectionspace.org/services/relation\"" 
                        +               " xmlns:ns3=\"http://collectionspace.org/services/jaxb\">"
-                       +   "<documentId1>"+loanCSID+"</documentId1>"
-                       +   "<documentType1>"+LOAN_DOCTYPE+"</documentType1>"
-                       +   "<documentId2>"+toCSID+"</documentId2>"
-                       +   "<documentType2>"+context.getDocType()+"</documentType2>"
+                       +   "<subjectCsid>"+loanCSID+"</subjectCsid>"
+                       +   "<subjectDocumentType>"+LOAN_DOCTYPE+"</subjectDocumentType>"
+                       +   "<objectCsid>"+toCSID+"</objectCsid>"
+                       +   "<objectDocumentType>"+context.getDocType()+"</objectDocumentType>"
                        +   "<relationshipType>"+RELATION_TYPE+"</relationshipType>"
                        +   "<predicateDisplayName>"+RELATION_PREDICATE_DISP+"</predicateDisplayName>"
                        + "</ns2:relations_common></document>";
index eb029c315382dba205ad8709008cedf7237565af..cbc5707d25e0110900c1eb713835fc8b7fd800bc 100644 (file)
     <xs:element name="name" type="xs:string" />\r
     <xs:element name="length" type="xs:string" />\r
     <xs:element name="digest" type="xs:string" />\r
-    <xs:element name="dimensionGroupList" type="dimensionGroupList"/>\r
+    <!-- Changed name from dimensionGroupList (type="dimensionGroupList") in v1.13 when adding repeatable sub group -->\r
+    <xs:element name="measuredPartGroupList" type="measuredPartGroupList"/>\r
     <xs:element name="uri" type="xs:string" />\r
     <xs:element name="repositoryId" type="xs:string" />\r
     \r
-    <xs:complexType name="dimensionGroupList">\r
+    <!-- Changed names, as of v1.13: dimensionGroupList became measuredPartGroupList, dimensionGroup became measuredPartGroup. -->\r
+    <xs:complexType name="measuredPartGroupList">\r
         <xs:sequence>\r
-            <xs:element name="dimensionGroup" type="dimensionGroup" minOccurs="0"\r
-                maxOccurs="unbounded"/>\r
+            <xs:element name="measuredPartGroup" type="measuredPartGroup" minOccurs="0"\r
+                   maxOccurs="unbounded"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
-    <xs:complexType name="dimensionGroup"> <!-- //FIXME: The "dimensionGroup" type should be declared in one place since other services use it -->\r
+    <xs:complexType name="measuredPartGroup">\r
         <xs:sequence>\r
             <xs:element name="measuredPart" type="xs:string"/>\r
+            <xs:element name="dimensionSummary" type="xs:string"/>\r
+            <xs:element name="dimensionSubGroupList" type="dimensionSubGroupList"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <xs:complexType name="dimensionSubGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="dimensionSubGroup" type="dimensionSubGroup" minOccurs="0" maxOccurs="unbounded" />\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <xs:complexType name="dimensionSubGroup">\r
+        <xs:sequence>\r
             <xs:element name="dimension" type="xs:string"/>\r
             <xs:element name="measuredBy" type="xs:string"/>\r
             <xs:element name="measurementUnit" type="xs:string"/>\r
             <xs:element name="measurementMethod" type="xs:string"/>\r
             <xs:element name="value" type="xs:decimal"/>\r
-            <xs:element name="valueDate" type="xs:string"/>\r
+            <xs:element name="valueDate" type="xs:date"/>\r
             <xs:element name="valueQualifier" type="xs:string"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
-    \r
+\r
 </xs:schema>\r
index 493d5fa3af58f0c6ea68acc27f4a3aa93c397819..ceac6ee94d6a0ed56fa877dac2089af549dc9719 100644 (file)
@@ -56,6 +56,19 @@ public interface IQueryManager {
        \r
        public String createWhereClauseFromAdvancedSearch(String advancedSearch);\r
 \r
+       final static boolean FILTER_EXCLUDE = true;\r
+       final static boolean FILTER_INCLUDE = false;\r
+       \r
+       /**\r
+        * Creates a query to filter a qualified (string) field according to a list of string values. \r
+        * @param qualifiedField The schema-qualified field to filter on\r
+        * @param filterTerms the list of one or more strings to filter on\r
+        * @param fExclude If true, will require qualifiedField NOT match the filters strings.\r
+        *                                      If false, will require qualifiedField does match one of the filters strings.\r
+        * @return queryString\r
+        */\r
+       public String createWhereClauseToFilterFromStringList(String qualifiedField, String[] filterTerms, boolean fExclude);\r
+       \r
        /**\r
         * Creates the where clause for partial term match.\r
         * \r
index 40118113dc549ee66d016e7fff20235d643bfe4a..895a69a7d415a60987f0cc35185ee8776f333c59 100644 (file)
   <xs:element name="catalogDate" type="xs:string"/>\r
   -->\r
 \r
-  <xs:element name="labelHeader" type="xs:string"/>\r
-  <xs:element name="labelFooter" type="xs:string"/>\r
+    <xs:element name="labelHeader" type="xs:string"/>\r
+    <xs:element name="labelFooter" type="xs:string"/>\r
 \r
-  <xs:element name="fieldLocVerbatim" type="xs:string"/>\r
-  <xs:element name="fieldCollectionDateEarliest" type="xs:string"/>\r
-  <xs:element name="fieldCollectionDateLatest" type="xs:string"/>\r
-  <xs:element name="fieldLocLatDecimal" type="xs:string"/>\r
-  <xs:element name="fieldLocLongDecimal" type="xs:string"/>\r
-  <xs:element name="fieldLocElevation" type="xs:string"/>\r
+    <xs:element name="fieldLocVerbatim" type="xs:string"/>\r
+    <xs:element name="fieldCollectionDateEarliest" type="xs:string"/>\r
+    <xs:element name="fieldCollectionDateLatest" type="xs:string"/>\r
+    <xs:element name="fieldLocLatDecimal" type="xs:string"/>\r
+    <xs:element name="fieldLocLongDecimal" type="xs:string"/>\r
+    <xs:element name="fieldLocElevation" type="xs:string"/>\r
 \r
   <!-- These will become contolled lists -->\r
-  <xs:element name="fieldLocGeodeticDatum" type="xs:string"/>\r
-  <xs:element name="fieldLocCoordinateSystem" type="xs:string"/>\r
-  <xs:element name="fieldLocCounty" type="xs:string"/>\r
-  <xs:element name="fieldLocState" type="xs:string"/>\r
-  <xs:element name="fieldLocCountry" type="xs:string"/>\r
-  <xs:element name="fieldLocHigherGeography" type="xs:string"/>\r
+    <xs:element name="fieldLocGeodeticDatum" type="xs:string"/>\r
+    <xs:element name="fieldLocCoordinateSystem" type="xs:string"/>\r
+    <xs:element name="fieldLocCounty" type="xs:string"/>\r
+    <xs:element name="fieldLocState" type="xs:string"/>\r
+    <xs:element name="fieldLocCountry" type="xs:string"/>\r
+    <xs:element name="fieldLocHigherGeography" type="xs:string"/>\r
 \r
-  <xs:element name="taxonomicIdentGroupList" type="taxonomicIdentGroupList"/>\r
-  <xs:element name="typeSpecimenGroupList" type="typeSpecimenGroupList"/>\r
-  <xs:element name="fieldCollElevationGroupList" type="fieldCollElevationGroupList"/>\r
-  <xs:element name="fieldCollDepthGroupList" type="fieldCollDepthGroupList"/>\r
-  <xs:element name="associatedTaxaGroupList" type="associatedTaxaGroupList"/>\r
+    <xs:element name="taxonomicIdentGroupList" type="taxonomicIdentGroupList"/>\r
+    <xs:element name="typeSpecimenGroupList" type="typeSpecimenGroupList"/>\r
+    <xs:element name="fieldCollElevationGroupList" type="fieldCollElevationGroupList"/>\r
+    <xs:element name="fieldCollDepthGroupList" type="fieldCollDepthGroupList"/>\r
+    <xs:element name="associatedTaxaGroupList" type="associatedTaxaGroupList"/>\r
 \r
-       <xs:complexType name="taxonomicIdentGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="taxonomicIdentGroup" type="taxonomicIdentGroup" minOccurs="0"\r
+    <xs:complexType name="taxonomicIdentGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="taxonomicIdentGroup" type="taxonomicIdentGroup" minOccurs="0"\r
                                                        maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="taxonomicIdentGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="taxon" type="xs:string"/>\r
-                                       <xs:element name="qualifier" type="xs:string"/>\r
-                                       <xs:element name="identBy" type="xs:string"/>\r
-                                       <xs:element name="identDate" type="xs:string"/>\r
-                                       <xs:element name="institution" type="xs:string"/>\r
-                                       <xs:element name="identKind" type="xs:string"/>\r
-                                       <xs:element name="reference" type="xs:string"/>\r
-                                       <xs:element name="refPage" type="xs:string"/>\r
-                                       <xs:element name="notes" type="xs:string"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+    <xs:complexType name="taxonomicIdentGroup">\r
+        <xs:sequence>\r
+            <xs:element name="taxon" type="xs:string"/>\r
+            <xs:element name="qualifier" type="xs:string"/>\r
+            <xs:element name="identBy" type="xs:string"/>\r
+            <xs:element name="identDate" type="xs:string"/>\r
+            <xs:element name="institution" type="xs:string"/>\r
+            <xs:element name="identKind" type="xs:string"/>\r
+            <xs:element name="reference" type="xs:string"/>\r
+            <xs:element name="refPage" type="xs:string"/>\r
+            <xs:element name="notes" type="xs:string"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
 \r
-       <xs:complexType name="typeSpecimenGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="typeSpecimenGroup" type="typeSpecimenGroup" minOccurs="0"\r
+    <xs:complexType name="typeSpecimenGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="typeSpecimenGroup" type="typeSpecimenGroup" minOccurs="0"\r
                                                        maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="typeSpecimenGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="kindOfType" type="xs:string"/>\r
-                                       <xs:element name="reference" type="xs:string"/>\r
-                                       <xs:element name="refPage" type="xs:string"/>\r
-                                       <xs:element name="institution" type="xs:string"/>\r
-                                       <xs:element name="institutionType" type="xs:string"/>\r
-                                       <xs:element name="notes" type="xs:string"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+    <xs:complexType name="typeSpecimenGroup">\r
+        <xs:sequence>\r
+            <xs:element name="kindOfType" type="xs:string"/>\r
+            <xs:element name="reference" type="xs:string"/>\r
+            <xs:element name="refPage" type="xs:string"/>\r
+            <xs:element name="institution" type="xs:string"/>\r
+            <xs:element name="institutionType" type="xs:string"/>\r
+            <xs:element name="notes" type="xs:string"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
 \r
-       <xs:complexType name="fieldCollElevationGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="fieldCollElevationGroup" type="fieldCollElevationGroup" minOccurs="0"\r
+    <xs:complexType name="fieldCollElevationGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="fieldCollElevationGroup" type="fieldCollElevationGroup" minOccurs="0"\r
                                                        maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="fieldCollElevationGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="minElevation" type="xs:integer"/>\r
-                                       <xs:element name="maxElevation" type="xs:integer"/>\r
-                                       <xs:element name="units" type="xs:string"/>\r
-                                       <xs:element name="qualifier" type="xs:string"/>\r
-                                       <xs:element name="notes" type="xs:string"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+    <xs:complexType name="fieldCollElevationGroup">\r
+        <xs:sequence>\r
+            <xs:element name="minElevation" type="xs:integer"/>\r
+            <xs:element name="maxElevation" type="xs:integer"/>\r
+            <xs:element name="units" type="xs:string"/>\r
+            <xs:element name="qualifier" type="xs:string"/>\r
+            <xs:element name="notes" type="xs:string"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
 \r
-       <xs:complexType name="fieldCollDepthGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="fieldCollDepthGroup" type="fieldCollDepthGroup" minOccurs="0"\r
+    <xs:complexType name="fieldCollDepthGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="fieldCollDepthGroup" type="fieldCollDepthGroup" minOccurs="0"\r
                                                        maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="fieldCollDepthGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="minDepth" type="xs:integer"/>\r
-                                       <xs:element name="maxDepth" type="xs:integer"/>\r
-                                       <xs:element name="units" type="xs:string"/>\r
-                                       <xs:element name="qualifier" type="xs:string"/>\r
-                                       <xs:element name="notes" type="xs:string"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+    <xs:complexType name="fieldCollDepthGroup">\r
+        <xs:sequence>\r
+            <xs:element name="minDepth" type="xs:integer"/>\r
+            <xs:element name="maxDepth" type="xs:integer"/>\r
+            <xs:element name="units" type="xs:string"/>\r
+            <xs:element name="qualifier" type="xs:string"/>\r
+            <xs:element name="notes" type="xs:string"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
 \r
-       <xs:complexType name="associatedTaxaGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="associatedTaxaGroup" type="associatedTaxaGroup" minOccurs="0"\r
+    <xs:complexType name="associatedTaxaGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="associatedTaxaGroup" type="associatedTaxaGroup" minOccurs="0"\r
                                                        maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="associatedTaxaGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="taxon" type="xs:string"/>\r
-                                       <xs:element name="commonName" type="xs:integer"/>\r
-                                       <xs:element name="interaction" type="xs:integer"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+    <xs:complexType name="associatedTaxaGroup">\r
+        <xs:sequence>\r
+            <xs:element name="taxon" type="xs:string"/>\r
+            <xs:element name="commonName" type="xs:integer"/>\r
+            <xs:element name="interaction" type="xs:integer"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
 \r
 </xs:schema>\r
index c715c883aeb129ded1f0d5c6c4f1e0a1f55ffd69..feeb2023239a8172344260f43ed5e852a03f2d79 100644 (file)
             </xs:sequence>\r
         </xs:complexType>\r
     </xs:element>\r
-    <!-- Note: Penelope's repeatability spreadsheet identifies a Content Date -->\r
-    <!-- repeatable group, containing contentDate and dateAssociation fields. -->\r
-    <!-- Did not find the dateAssociation field in the wiki schemas, however.  -->\r
-    <!-- contentDate is itself a structured date field, containing a dateAssociation -->\r
-    <!-- field, so perhaps this may merely be a product of some confusion. -->\r
-    <xs:element name="contentDate" type="xs:string"/>\r
+    <xs:element name="contentDateGroup" type="structuredDateGroup"/>\r
     <xs:element name="contentDescription" type="xs:string"/>\r
     <xs:element name="contentEventNameGroupList" type="contentEventNameGroupList"/>\r
     <xs:element name="contentNote" type="xs:string"/>\r
         </xs:complexType>\r
     </xs:element>\r
     <xs:element name="copyNumber" type="xs:string"/>\r
-    <!-- FIXME Move this dimensionSummary field into the repeatable Dimensions group in 1.3+ -->\r
-    <xs:element name="dimensionSummary" type="xs:string"/>\r
-    <xs:element name="dimensions" type="ns:dimensionList"/>\r
-    <!-- FIXME Remove these six elements when the App/UI layer is -->\r
-    <!-- using the new repeatable 'dimensions' field: -->\r
-    <xs:element name="dimension" type="xs:string"/>\r
-    <xs:element name="dimensionMeasuredPart" type="xs:string"/>\r
-    <xs:element name="dimensionMeasurementUnit" type="xs:string"/>\r
-    <xs:element name="dimensionValue" type="xs:string"/>\r
-    <xs:element name="dimensionValueDate" type="xs:string"/>\r
-    <xs:element name="dimensionValueQualifier" type="xs:string"/>\r
-    <!-- end of six elements to be removed -->\r
+    <!-- Changed name of next field from dimensions (type="dimensionList") in v1.13 when adding repeatable sub group -->\r
+    <xs:element name="measuredPartGroupList" type="measuredPartGroupList"/>\r
     <xs:element name="editionNumber" type="xs:string"/>\r
     <xs:element name="forms">\r
         <xs:complexType>\r
     <xs:element name="objectComponentGroupList" type="objectComponentGroupList"/>\r
 \r
     <!-- Object Production Information -->\r
-\r
-    <xs:element name="objectProductionDateGroup" type="objectProductionDateGroup"/>\r
-\r
+    <xs:element name="objectProductionDateGroupList" type="objectProductionDateGroupList"/>\r
     <xs:element name="objectProductionNote" type="xs:string"/>\r
     <xs:element name="objectProductionOrganizationGroupList" type="objectProductionOrganizationGroupList"/>\r
     <xs:element name="objectProductionPeopleGroupList" type="objectProductionPeopleGroupList"/>\r
     <xs:element name="viewersPersonalExperience" type="xs:string"/>\r
     <xs:element name="viewersPersonalResponse" type="xs:string"/>\r
     <xs:element name="viewersReferences">\r
-            <xs:complexType>\r
+        <xs:complexType>\r
             <xs:sequence>\r
                 <xs:element name="viewersReference" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>\r
             </xs:sequence>\r
     </xs:complexType>\r
     <xs:complexType name="objectNameGroup">\r
         <xs:sequence>\r
-                <xs:element name="objectName" type="xs:string"/>\r
-                <xs:element name="objectNameCurrency" type="xs:string"/>\r
-                <xs:element name="objectNameLevel" type="xs:string"/>\r
-                <xs:element name="objectNameNote" type="xs:string"/>\r
-                <xs:element name="objectNameSystem" type="xs:string"/>\r
-                <xs:element name="objectNameType" type="xs:string"/>\r
-                <xs:element name="objectNameLanguage" type="xs:string"/>\r
+            <xs:element name="objectName" type="xs:string"/>\r
+            <xs:element name="objectNameCurrency" type="xs:string"/>\r
+            <xs:element name="objectNameLevel" type="xs:string"/>\r
+            <xs:element name="objectNameNote" type="xs:string"/>\r
+            <xs:element name="objectNameSystem" type="xs:string"/>\r
+            <xs:element name="objectNameType" type="xs:string"/>\r
+            <xs:element name="objectNameLanguage" type="xs:string"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
 \r
             <xs:element name="titleTranslation" type="xs:string"/>\r
             <xs:element name="titleTranslationLanguage" type="xs:string"/>\r
         </xs:sequence>\r
-     </xs:complexType>\r
+    </xs:complexType>\r
 \r
     <xs:complexType name="contentEventNameGroupList">\r
         <xs:sequence>\r
         <xs:sequence>\r
             <xs:element name="contentObject" type="xs:string"/>\r
             <xs:element name="contentObjectType" type="xs:string"/>\r
-         </xs:sequence>\r
+        </xs:sequence>\r
     </xs:complexType>\r
 \r
     <xs:complexType name="contentOtherGroupList">\r
         </xs:sequence>\r
     </xs:complexType>\r
 \r
-    <xs:complexType name="dimensionList">\r
+    <!-- Changed names, as of v1.13: dimensionList became measuredPartGroupList, dimensionGroup became measuredPartGroup. -->\r
+    <xs:complexType name="measuredPartGroupList">\r
         <xs:sequence>\r
-            <xs:element name="dimensionGroup" type="dimensionGroup" minOccurs="0"\r
+            <xs:element name="measuredPartGroup" type="measuredPartGroup" minOccurs="0"\r
                 maxOccurs="unbounded"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
-    <xs:complexType name="dimensionGroup">\r
+    <xs:complexType name="measuredPartGroup">\r
         <xs:sequence>\r
             <xs:element name="measuredPart" type="xs:string"/>\r
+            <xs:element name="dimensionSummary" type="xs:string" />\r
+            <xs:element name="dimensionSubGroupList" type="dimensionSubGroupList"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <xs:complexType name="dimensionSubGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="dimensionSubGroup" type="dimensionSubGroup" minOccurs="0" maxOccurs="unbounded" />\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <xs:complexType name="dimensionSubGroup">\r
+        <xs:sequence>\r
             <xs:element name="dimension" type="xs:string"/>\r
             <xs:element name="measuredBy" type="xs:string"/>\r
             <xs:element name="measurementUnit" type="xs:string"/>\r
             <xs:element name="measurementMethod" type="xs:string"/>\r
             <xs:element name="value" type="xs:decimal"/>\r
-            <xs:element name="valueDate" type="xs:string"/>\r
+            <xs:element name="valueDate" type="xs:dateTime"/>\r
             <xs:element name="valueQualifier" type="xs:string"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
         </xs:sequence>\r
     </xs:complexType>\r
     \r
-       <xs:complexType name="objectStatusList">\r
-               <xs:sequence>\r
-                       <xs:element name="objectStatus" type="xs:string" minOccurs="0" maxOccurs="unbounded" />\r
-               </xs:sequence>\r
-       </xs:complexType>\r
+    <xs:complexType name="objectStatusList">\r
+        <xs:sequence>\r
+            <xs:element name="objectStatus" type="xs:string" minOccurs="0" maxOccurs="unbounded" />\r
+        </xs:sequence>\r
+    </xs:complexType>\r
 \r
     <xs:complexType name="technicalAttributeGroupList">\r
         <xs:sequence>\r
         </xs:sequence>\r
     </xs:complexType>\r
 \r
-    <xs:complexType name="objectProductionDateGroup">\r
+    <xs:complexType name="objectProductionDateGroupList">\r
         <xs:sequence>\r
-            <xs:element name="dateDisplayDate" type="xs:string"/>\r
-            <xs:element name="dateAssociation" type="xs:string"/>\r
-            <xs:element name="dateEarliestSingleYear" type="xs:integer"/>\r
-            <xs:element name="dateEarliestSingleMonth" type="xs:integer"/>\r
-            <xs:element name="dateEarliestSingleDay" type="xs:integer"/>\r
-            <xs:element name="dateEarliestSingleEra" type="xs:string"/>\r
-            <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>\r
-            <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>\r
-            <xs:element name="dateEarliestSingleQualifierValue" type="xs:integer"/>\r
-            <xs:element name="dateEarliestSingleQualifierUnit" type="xs:string"/>\r
-            <xs:element name="dateLatestYear" type="xs:integer"/>\r
-            <xs:element name="dateLatestMonth" type="xs:integer"/>\r
-            <xs:element name="dateLatestDay" type="xs:integer"/>\r
-            <xs:element name="dateLatestEra" type="xs:string"/>\r
-            <xs:element name="dateLatestCertainty" type="xs:string"/>\r
-            <xs:element name="dateLatestQualifier" type="xs:string"/>\r
-            <xs:element name="dateLatestQualifierValue" type="xs:integer"/>\r
-            <xs:element name="dateLatestQualifierUnit" type="xs:string"/>\r
-            <xs:element name="datePeriod" type="xs:string"/>\r
-            <xs:element name="dateNote" type="xs:string"/>\r
+            <xs:element name="objectProductionDateGroup" type="structuredDateGroup" minOccurs="0"\r
+                maxOccurs="unbounded"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
 \r
             <xs:element name="assocObject" type="xs:string"/>\r
             <xs:element name="assocObjectType" type="xs:string"/>\r
             <xs:element name="assocObjectNote" type="xs:string"/>\r
-         </xs:sequence>\r
+        </xs:sequence>\r
     </xs:complexType>\r
 \r
     <xs:complexType name="assocOrganizationGroupList">\r
         </xs:sequence>\r
     </xs:complexType>\r
     \r
-       <xs:complexType name="referenceGroupList">\r
-               <xs:sequence>\r
-                       <xs:element name="referenceGroup" type="referenceGroup" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
+    <xs:complexType name="referenceGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="referenceGroup" type="referenceGroup" minOccurs="0" maxOccurs="unbounded"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
         \r
-       <xs:complexType name="referenceGroup">\r
-               <xs:sequence>\r
-                       <xs:element name="reference" type="xs:string"/>\r
-                       <xs:element name="referenceNote" type="xs:string"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-    \r
-    <!-- Object Description Date Information -->\r
-    <!-- This appears to be a placeholder structured date -->\r
-    <xs:element name="dateAssociation" type="xs:string"/>\r
-    <xs:element name="dateEarliestSingle" type="xs:string"/>\r
-    <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>\r
-    <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>\r
-    <xs:element name="dateLatest" type="xs:string"/>\r
-    <xs:element name="dateLatestCertainty" type="xs:string"/>\r
-    <xs:element name="dateLatestQualifier" type="xs:string"/>\r
-    <xs:element name="datePeriod" type="xs:string"/>\r
-    <xs:element name="dateText" type="xs:string"/>\r
+    <xs:complexType name="referenceGroup">\r
+        <xs:sequence>\r
+            <xs:element name="reference" type="xs:string"/>\r
+            <xs:element name="referenceNote" type="xs:string"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <!-- Before (re)using this generic complex type in any record type -->\r
+    <!-- other than CollectionObject, be sure to verify that Nuxeo handles -->\r
+    <!-- that correctly in its table creation/row linking. -->\r
+    <xs:complexType name="structuredDateGroup">\r
+        <xs:sequence>\r
+            <xs:element name="dateDisplayDate" type="xs:string"/>\r
+            <xs:element name="dateAssociation" type="xs:string"/>\r
+            <xs:element name="dateEarliestSingleYear" type="xs:integer"/>\r
+            <xs:element name="dateEarliestSingleMonth" type="xs:integer"/>\r
+            <xs:element name="dateEarliestSingleDay" type="xs:integer"/>\r
+            <xs:element name="dateEarliestSingleEra" type="xs:string"/>\r
+            <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>\r
+            <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>\r
+            <xs:element name="dateEarliestSingleQualifierValue" type="xs:integer"/>\r
+            <xs:element name="dateEarliestSingleQualifierUnit" type="xs:string"/>\r
+            <xs:element name="dateLatestYear" type="xs:integer"/>\r
+            <xs:element name="dateLatestMonth" type="xs:integer"/>\r
+            <xs:element name="dateLatestDay" type="xs:integer"/>\r
+            <xs:element name="dateLatestEra" type="xs:string"/>\r
+            <xs:element name="dateLatestCertainty" type="xs:string"/>\r
+            <xs:element name="dateLatestQualifier" type="xs:string"/>\r
+            <xs:element name="dateLatestQualifierValue" type="xs:integer"/>\r
+            <xs:element name="dateLatestQualifierUnit" type="xs:string"/>\r
+            <xs:element name="datePeriod" type="xs:string"/>\r
+            <xs:element name="dateNote" type="xs:string"/>\r
+            <xs:element name="dateEarliestScalarValue" type="xs:date"/>\r
+            <xs:element name="dateLatestScalarValue" type="xs:date"/>\r
+            <xs:element name="scalarValuesComputed" type="xs:boolean"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
 \r
 </xs:schema>\r
index f6317738a9764b8fab5ba8c5378102a775acd68d..09c7b32efbd65b4bf872e6678849c43fd91c99cf 100644 (file)
@@ -39,15 +39,19 @@ import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.collectionobject.BriefDescriptionList;
 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
 import org.collectionspace.services.collectionobject.domain.naturalhistory.CollectionobjectsNaturalhistory;
-import org.collectionspace.services.collectionobject.ResponsibleDepartmentList;
-import org.collectionspace.services.collectionobject.DimensionGroup;
-import org.collectionspace.services.collectionobject.DimensionList;
+import org.collectionspace.services.collectionobject.DimensionSubGroup;
+import org.collectionspace.services.collectionobject.DimensionSubGroupList;
+import org.collectionspace.services.collectionobject.MeasuredPartGroup;
+import org.collectionspace.services.collectionobject.MeasuredPartGroupList;
 import org.collectionspace.services.collectionobject.ObjectNameGroup;
 import org.collectionspace.services.collectionobject.ObjectNameList;
 import org.collectionspace.services.collectionobject.OtherNumber;
 import org.collectionspace.services.collectionobject.OtherNumberList;
+import org.collectionspace.services.collectionobject.ResponsibleDepartmentList;
 import org.collectionspace.services.collectionobject.TitleGroup;
 import org.collectionspace.services.collectionobject.TitleGroupList;
+import org.collectionspace.services.collectionobject.TitleTranslationSubGroup;
+import org.collectionspace.services.collectionobject.TitleTranslationSubGroupList;
 import org.collectionspace.services.common.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
@@ -77,9 +81,10 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
 
     private final String OBJECT_NAME_VALUE = "an object name";
     private final BigInteger AGE_VALUE = new BigInteger("55");
+    private final String MEASURED_PART = "light box frame";
     private final BigDecimal DIMENSION_VALUE_LENGTH = new BigDecimal("0.009");
     private final BigDecimal DIMENSION_VALUE_WIDTH = new BigDecimal("3087.56");
-    private final String UPDATED_MEASURED_PART_VALUE = "updated measured part value";
+    private final String UPDATED_MEASUREMENT_UNIT = "Angstroms";
     private final String UTF8_DATA_SAMPLE = "Audiorecording album cover signed by Lech "
             + "Wa" + '\u0142' + '\u0119' + "sa";
 
@@ -628,14 +633,26 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
 
         // Verify the number and contents of values in repeatable fields,
         // as created in the instance record used for testing.
-        DimensionList dimensionList = collectionobjectCommon.getDimensions();
-        Assert.assertNotNull(dimensionList);
-        List<DimensionGroup> dimensionsGroups = dimensionList.getDimensionGroup();
-        Assert.assertNotNull(dimensionsGroups);
-        Assert.assertTrue(dimensionsGroups.size() > 0);
-        Assert.assertNotNull(dimensionsGroups.get(0));
-        Assert.assertNotNull(dimensionsGroups.get(0).getMeasuredPart());
-
+        MeasuredPartGroupList measuredPartGroupList = collectionobjectCommon.getMeasuredPartGroupList();
+        Assert.assertNotNull(measuredPartGroupList, "Measured part group list was null");
+        List<MeasuredPartGroup> measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
+        Assert.assertNotNull(measuredPartGroups, "Measured part groups were null");
+        Assert.assertTrue(measuredPartGroups.size() > 0, "No measured part groups were returned");
+        MeasuredPartGroup mpGroup = measuredPartGroups.get(0);
+        Assert.assertNotNull(mpGroup.getMeasuredPart(), "Measured part was null");
+        Assert.assertEquals(mpGroup.getMeasuredPart(), MEASURED_PART,
+                "Measured part value returned didn't match expected value");
+        
+        DimensionSubGroupList dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
+        Assert.assertNotNull(dimensionSubGroupList, "Dimension subgroup list was null");
+        List<DimensionSubGroup> dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
+        Assert.assertNotNull(dimensionSubGroups, "Dimension subgroups were null");
+        Assert.assertTrue(dimensionSubGroups.size() > 0, "No dimension subgroups were returned");
+        DimensionSubGroup lengthDimension = dimensionSubGroups.get(0);
+        Assert.assertNotNull(lengthDimension, "Length dimension was null");
+        Assert.assertTrue(lengthDimension.getValue().compareTo(DIMENSION_VALUE_LENGTH) == 0,
+                "Dimension length value returned didn't match expected value");
+        
         /* No longer part of the "default" domain service tests for the CollectionObject record.
         if (logger.isDebugEnabled()) {
             logger.debug(testName + ": Reading Natural History part ...");
@@ -762,21 +779,32 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
 
         // Replace the existing value instances in the dimensions repeatable group
         // with entirely new value instances, also changing the number of such instances.
-        DimensionList dimensionList = collectionObjectCommon.getDimensions();
-        Assert.assertNotNull(dimensionList);
-        List<DimensionGroup> dimensionGroups = dimensionList.getDimensionGroup();
-        Assert.assertNotNull(dimensionGroups);
-        int originalDimensionGroupSize = dimensionGroups.size();
-        Assert.assertTrue(originalDimensionGroupSize >= 1);
-
-        DimensionGroup updatedDimensionGroup = new DimensionGroup();
-        updatedDimensionGroup.setMeasuredPart(UPDATED_MEASURED_PART_VALUE);
-        dimensionGroups.clear();
-        dimensionGroups.add(updatedDimensionGroup);
-        int updatedDimensionGroupSize = dimensionGroups.size();
-        Assert.assertTrue(updatedDimensionGroupSize >= 1);
-        Assert.assertTrue(updatedDimensionGroupSize != originalDimensionGroupSize);
-        collectionObjectCommon.setDimensions(dimensionList);
+        MeasuredPartGroupList measuredPartGroupList = collectionObjectCommon.getMeasuredPartGroupList();
+        Assert.assertNotNull(measuredPartGroupList);
+        List<MeasuredPartGroup> measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
+        Assert.assertNotNull(measuredPartGroups);
+        Assert.assertTrue(measuredPartGroups.size() > 0);
+        MeasuredPartGroup mpGroup = measuredPartGroups.get(0);
+        Assert.assertNotNull(mpGroup.getMeasuredPart());
+        
+        DimensionSubGroupList dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
+        Assert.assertNotNull(dimensionSubGroupList);
+        List<DimensionSubGroup> dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
+        Assert.assertNotNull(dimensionSubGroups);
+        int originalDimensionSubGroupSize = dimensionSubGroups.size();
+        Assert.assertTrue(dimensionSubGroups.size() > 0);
+        dimensionSubGroups.clear();
+        
+        DimensionSubGroup heightDimension = new DimensionSubGroup();
+        heightDimension.setDimension("height");
+        heightDimension.setMeasurementUnit(UPDATED_MEASUREMENT_UNIT);
+        dimensionSubGroups.add(heightDimension);
+        
+        int updatedDimensionGroupSize = dimensionSubGroups.size();
+        Assert.assertTrue(updatedDimensionGroupSize > 0);
+        Assert.assertTrue(updatedDimensionGroupSize != originalDimensionSubGroupSize);
+        
+        collectionObjectCommon.setMeasuredPartGroupList(measuredPartGroupList);
 
         if (logger.isDebugEnabled()) {
             logger.debug("sparse update that will be sent in update request:");
@@ -801,13 +829,22 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
                 objNameGroups.get(0).getObjectName(),
                 "Data in updated object did not match submitted data.");
         
-        dimensionList = updatedCollectionobjectCommon.getDimensions();
-        Assert.assertNotNull(dimensionList);
-        dimensionGroups = dimensionList.getDimensionGroup();
-        Assert.assertNotNull(dimensionGroups);
-        Assert.assertTrue(dimensionGroups.size() == updatedDimensionGroupSize);
-        Assert.assertEquals(UPDATED_MEASURED_PART_VALUE,
-                dimensionGroups.get(0).getMeasuredPart(),
+        measuredPartGroupList = collectionObjectCommon.getMeasuredPartGroupList();
+        Assert.assertNotNull(measuredPartGroupList);
+        measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
+        Assert.assertNotNull(measuredPartGroups);
+        Assert.assertTrue(measuredPartGroups.size() > 0);
+        mpGroup = measuredPartGroups.get(0);
+        Assert.assertNotNull(mpGroup.getMeasuredPart());
+        
+        dimensionSubGroupList = mpGroup.getDimensionSubGroupList();
+        Assert.assertNotNull(dimensionSubGroupList);
+        dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
+        Assert.assertNotNull(dimensionSubGroups);
+        Assert.assertTrue(dimensionSubGroups.size() > 0);
+        Assert.assertTrue(dimensionSubGroups.size() == updatedDimensionGroupSize);
+        Assert.assertEquals(UPDATED_MEASUREMENT_UNIT,
+                dimensionSubGroups.get(0).getMeasurementUnit(),
                 "Data in updated object did not match submitted data.");
 
     }
@@ -1237,6 +1274,7 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
 
         TitleGroupList titleGroupList = new TitleGroupList();
         List<TitleGroup> titleGroups = titleGroupList.getTitleGroup();
+        Assert.assertNotNull(titleGroups);
         TitleGroup titleGroup = new TitleGroup();
         titleGroup.setTitle("a title");
         titleGroups.add(titleGroup);
@@ -1249,22 +1287,32 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
         objNameGroups.add(objectNameGroup);
         collectionObject.setObjectNameList(objNameList);
 
-        DimensionList dimensionList = new DimensionList();
-        List<DimensionGroup> dimensionGroups = dimensionList.getDimensionGroup();
-        DimensionGroup dimensionGroup1 = new DimensionGroup();
-        dimensionGroup1.setMeasuredPart("head");
-        dimensionGroup1.setDimension("length");
-        dimensionGroup1.setValue(DIMENSION_VALUE_LENGTH);
-        dimensionGroup1.setMeasurementUnit("cm");
-        DimensionGroup dimensionGroup2 = new DimensionGroup();
-        dimensionGroup2.setMeasuredPart("leg");
-        dimensionGroup2.setDimension("width");
-        dimensionGroup2.setValue(DIMENSION_VALUE_WIDTH);
-        dimensionGroup2.setMeasurementUnit("m");
-        dimensionGroup2.setValueQualifier("");  // test null string
-        dimensionGroups.add(dimensionGroup1);
-        dimensionGroups.add(dimensionGroup2);
-        collectionObject.setDimensions(dimensionList);
+        MeasuredPartGroupList measuredPartGroupList = new MeasuredPartGroupList();
+        List<MeasuredPartGroup> measuredPartGroups = measuredPartGroupList.getMeasuredPartGroup();
+        Assert.assertNotNull(measuredPartGroups, "Measured part groups are null");
+        MeasuredPartGroup measuredPartGroup = new MeasuredPartGroup();
+        measuredPartGroup.setMeasuredPart(MEASURED_PART);
+
+        DimensionSubGroupList dimensionSubGroupList = new DimensionSubGroupList();
+        List<DimensionSubGroup> dimensionSubGroups = dimensionSubGroupList.getDimensionSubGroup();
+        Assert.assertNotNull(dimensionSubGroups, "Dimension subgroups are null");
+
+        DimensionSubGroup lengthDimension = new DimensionSubGroup();
+        lengthDimension.setDimension("length");
+        lengthDimension.setValue(DIMENSION_VALUE_LENGTH);
+        lengthDimension.setMeasurementUnit("cm");
+        dimensionSubGroups.add(lengthDimension);
+        
+        DimensionSubGroup widthDimension = new DimensionSubGroup();
+        widthDimension.setDimension("width");
+        widthDimension.setValue(DIMENSION_VALUE_WIDTH);
+        widthDimension.setMeasurementUnit("m");
+        widthDimension.setValueQualifier(""); // test empty string
+        dimensionSubGroups.add(widthDimension);
+        
+        measuredPartGroup.setDimensionSubGroupList(dimensionSubGroupList);
+        measuredPartGroups.add(measuredPartGroup);
+        collectionObject.setMeasuredPartGroupList(measuredPartGroupList);
 
         // Repeatable scalar fields
         
index 1101a1a4ad515a5ee3d16289d28a6c578b4bcd18..08d00c9fb5c979644e882e7c7169d2edebab569e 100644 (file)
@@ -63,7 +63,7 @@
                 <!-- Object Description - Content Information -->
                 <xs:element name="contentActivities" type="contentActivityList"/>
                 <xs:element name="contentConcepts" type="contentConceptList"/>
-                <xs:element name="contentDate" type="xs:string"/>
+                <xs:element name="contentDateGroup" type="structuredDateGroup"/>
                 <xs:element name="contentDescription" type="xs:string"/>
                 <xs:element name="contentEventNameGroupList" type="contentEventNameGroupList"/>
                 <xs:element name="contentNote" type="xs:string"/>
                 <xs:element name="contentPositions" type="contentPositionList"/>
                 <xs:element name="contentScripts" type="contentScriptList"/>
                 <xs:element name="copyNumber" type="xs:string"/>
-                <xs:element name="dimensionSummary" type="xs:string"/>
-                <xs:element name="dimensions" type="ns:dimensionList"/>
-
-                <!-- Remove these six elements when the App/UI layer is -->
-                <!-- using the new repeatable 'dimensions' field: -->
-                <xs:element name="dimension" type="xs:string"/>
-                <xs:element name="dimensionMeasuredPart" type="xs:string"/>
-                <xs:element name="dimensionMeasurementUnit" type="xs:string"/>
-                <xs:element name="dimensionValue" type="xs:string"/>
-                <xs:element name="dimensionValueDate" type="xs:string"/>
-                <xs:element name="dimensionValueQualifier" type="xs:string"/>
-                
+                <!-- Changed name of next field from dimensions (type="dimensionList") in v1.13 when adding repeatable sub group -->
+                <xs:element name="measuredPartGroupList" type="measuredPartGroupList"/>
                 <xs:element name="editionNumber" type="xs:string"/>
                 <xs:element name="forms" type="formList"/>
 
                 <xs:element name="objectComponentGroupList" type="objectComponentGroupList"/>
 
                 <!-- Object Production Information -->
-
-                <xs:element name="objectProductionDateGroup" type="objectProductionDateGroup"/>
-
+                <xs:element name="objectProductionDateGroupList" type="objectProductionDateGroupList"/>
                 <xs:element name="objectProductionNote" type="xs:string"/>
                 <xs:element name="objectProductionOrganizationGroupList" type="objectProductionOrganizationGroupList"/>
                 <xs:element name="objectProductionPeopleGroupList" type="objectProductionPeopleGroupList"/>
     </xs:complexType>
     <xs:complexType name="objectNameGroup">
         <xs:sequence>
-                <xs:element name="objectName" type="xs:string"/>
-                <xs:element name="objectNameCurrency" type="xs:string"/>
-                <xs:element name="objectNameLevel" type="xs:string"/>
-                <xs:element name="objectNameNote" type="xs:string"/>
-                <xs:element name="objectNameSystem" type="xs:string"/>
-                <xs:element name="objectNameType" type="xs:string"/>
-                <xs:element name="objectNameLanguage" type="xs:string"/>
+            <xs:element name="objectName" type="xs:string"/>
+            <xs:element name="objectNameCurrency" type="xs:string"/>
+            <xs:element name="objectNameLevel" type="xs:string"/>
+            <xs:element name="objectNameNote" type="xs:string"/>
+            <xs:element name="objectNameSystem" type="xs:string"/>
+            <xs:element name="objectNameType" type="xs:string"/>
+            <xs:element name="objectNameLanguage" type="xs:string"/>
         </xs:sequence>
     </xs:complexType>
 
             <xs:element name="titleTranslation" type="xs:string"/>
             <xs:element name="titleTranslationLanguage" type="xs:string"/>
         </xs:sequence>
-     </xs:complexType>
+    </xs:complexType>
 
-        <xs:complexType name="contentEventNameGroupList">
+    <xs:complexType name="contentEventNameGroupList">
         <xs:sequence>
             <xs:element name="contentEventNameGroup" type="contentEventNameGroup" minOccurs="0"
                 maxOccurs="unbounded"/>
         <xs:sequence>
             <xs:element name="contentObject" type="xs:string"/>
             <xs:element name="contentObjectType" type="xs:string"/>
-         </xs:sequence>
+        </xs:sequence>
     </xs:complexType>
     
     <xs:complexType name="contentOtherGroupList">
             <xs:element name="contentScript" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
-    
-    <xs:complexType name="dimensionList">
+
+    <!-- Changed names, as of v1.13: dimensions (type="dimensionList") became measuredPartGroupList, dimensionGroup became measuredPartGroup. -->
+    <xs:complexType name="measuredPartGroupList">
         <xs:sequence>
-            <xs:element name="dimensionGroup" type="dimensionGroup" minOccurs="0"
+            <xs:element name="measuredPartGroup" type="measuredPartGroup" minOccurs="0"
                 maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
-    <xs:complexType name="dimensionGroup">
+    <xs:complexType name="measuredPartGroup">
         <xs:sequence>
             <xs:element name="measuredPart" type="xs:string"/>
+            <xs:element name="dimensionSummary" type="xs:string" />
+            <xs:element name="dimensionSubGroupList" type="dimensionSubGroupList"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="dimensionSubGroupList">
+        <xs:sequence>
+            <xs:element name="dimensionSubGroup" type="dimensionSubGroup" minOccurs="0" maxOccurs="unbounded" />
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="dimensionSubGroup">
+        <xs:sequence>
             <xs:element name="dimension" type="xs:string"/>
             <xs:element name="measuredBy" type="xs:string"/>
             <xs:element name="measurementUnit" type="xs:string"/>
             <xs:element name="measurementMethod" type="xs:string"/>
             <xs:element name="value" type="xs:decimal"/>
-            <xs:element name="valueDate" type="xs:string"/>
+            <xs:element name="valueDate" type="xs:date"/>
             <xs:element name="valueQualifier" type="xs:string"/>
         </xs:sequence>
     </xs:complexType>
         </xs:sequence>
     </xs:complexType>
     
-       <xs:complexType name="objectStatusList">
-               <xs:sequence>
-                       <xs:element name="objectStatus" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
-               </xs:sequence>
-       </xs:complexType>
+    <xs:complexType name="objectStatusList">
+        <xs:sequence>
+            <xs:element name="objectStatus" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
+        </xs:sequence>
+    </xs:complexType>
 
     <xs:complexType name="styleList">
         <xs:sequence>
         </xs:sequence>
     </xs:complexType>
 
-    <xs:complexType name="objectProductionDateList">
+    <xs:complexType name="objectProductionDateGroupList">
         <xs:sequence>
-            <xs:element name="objectProductionDate" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
-        </xs:sequence>
-    </xs:complexType>
-
-    <xs:complexType name="objectProductionDateGroup">
-        <xs:sequence>
-            <xs:element name="dateDisplayDate" type="xs:string"/>
-            <xs:element name="dateAssociation" type="xs:string"/>
-            <xs:element name="dateEarliestSingleYear" type="xs:integer"/>
-            <xs:element name="dateEarliestSingleMonth" type="xs:integer"/>
-            <xs:element name="dateEarliestSingleDay" type="xs:integer"/>
-            <xs:element name="dateEarliestSingleEra" type="xs:string"/>
-            <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>
-            <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>
-            <xs:element name="dateEarliestSingleQualifierValue" type="xs:integer"/>
-            <xs:element name="dateEarliestSingleQualifierUnit" type="xs:string"/>
-            <xs:element name="dateLatestYear" type="xs:integer"/>
-            <xs:element name="dateLatestMonth" type="xs:integer"/>
-            <xs:element name="dateLatestDay" type="xs:integer"/>
-            <xs:element name="dateLatestEra" type="xs:string"/>
-            <xs:element name="dateLatestCertainty" type="xs:string"/>
-            <xs:element name="dateLatestQualifier" type="xs:string"/>
-            <xs:element name="dateLatestQualifierValue" type="xs:integer"/>
-            <xs:element name="dateLatestQualifierUnit" type="xs:string"/>
-            <xs:element name="datePeriod" type="xs:string"/>
-            <xs:element name="dateNote" type="xs:string"/>
+            <xs:element name="objectProductionDateGroup" type="structuredDateGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
 
         </xs:sequence>
     </xs:complexType>
 
-         <xs:complexType name="objectProductionPlaceGroupList">
+    <xs:complexType name="objectProductionPlaceGroupList">
         <xs:sequence>
             <xs:element name="objectProductionPlaceGroup" type="objectProductionPlaceGroup" minOccurs="0"
                 maxOccurs="unbounded"/>
             <xs:element name="assocObject" type="xs:string"/>
             <xs:element name="assocObjectType" type="xs:string"/>
             <xs:element name="assocObjectNote" type="xs:string"/>
-         </xs:sequence>
+        </xs:sequence>
     </xs:complexType>
 
     <xs:complexType name="assocOrganizationGroupList">
         </xs:sequence>
     </xs:complexType>
 
-       <xs:complexType name="referenceGroupList">
-               <xs:sequence>
-                       <xs:element name="referenceGroup" type="referenceGroup" minOccurs="0" maxOccurs="unbounded"/>
-               </xs:sequence>
-       </xs:complexType>
+    <xs:complexType name="referenceGroupList">
+        <xs:sequence>
+            <xs:element name="referenceGroup" type="referenceGroup" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
         
-       <xs:complexType name="referenceGroup">
-               <xs:sequence>
-                       <xs:element name="reference" type="xs:string"/>
-                       <xs:element name="referenceNote" type="xs:string"/>
-               </xs:sequence>
-       </xs:complexType>
+    <xs:complexType name="referenceGroup">
+        <xs:sequence>
+            <xs:element name="reference" type="xs:string"/>
+            <xs:element name="referenceNote" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
 
     <xs:complexType name="fieldCollectionMethodList">
         <xs:sequence>
             <xs:element name="fieldColEventName" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
+    
+    <xs:complexType name="structuredDateGroup">
+        <xs:sequence>
+            <xs:element name="dateDisplayDate" type="xs:string"/>
+            <xs:element name="dateAssociation" type="xs:string"/>
+            <xs:element name="dateEarliestSingleYear" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleMonth" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleDay" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleEra" type="xs:string"/>
+            <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>
+            <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>
+            <xs:element name="dateEarliestSingleQualifierValue" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleQualifierUnit" type="xs:string"/>
+            <xs:element name="dateLatestYear" type="xs:integer"/>
+            <xs:element name="dateLatestMonth" type="xs:integer"/>
+            <xs:element name="dateLatestDay" type="xs:integer"/>
+            <xs:element name="dateLatestEra" type="xs:string"/>
+            <xs:element name="dateLatestCertainty" type="xs:string"/>
+            <xs:element name="dateLatestQualifier" type="xs:string"/>
+            <xs:element name="dateLatestQualifierValue" type="xs:integer"/>
+            <xs:element name="dateLatestQualifierUnit" type="xs:string"/>
+            <xs:element name="datePeriod" type="xs:string"/>
+            <xs:element name="dateNote" type="xs:string"/>
+            <xs:element name="dateEarliestScalarValue" type="xs:date"/>
+            <xs:element name="dateLatestScalarValue" type="xs:date"/>
+            <xs:element name="scalarValuesComputed" type="xs:boolean"/>
+        </xs:sequence>
+    </xs:complexType>
         
 </xs:schema>
 
index dff7526a1fa6eea502744fedd5f087ff8495e282..c1bac1fa83479bcb4125a3fa9dfaa90f0df84625 100755 (executable)
@@ -171,6 +171,7 @@ public class Tools {
         }\r
         StringBuffer sb = new StringBuffer();\r
         int i = 0;\r
+        // BUG - \n is not the separator on all systems. Have to use the system line separator.\r
         String[] foo = result.split("\n");\r
         for (String line: foo){\r
             i++;\r
index 98d9ac8bd05f3811743d04c9cbaa0f4de5314290..c1e94aa76a39d9d7b552d94fc49d59a9131daeae 100644 (file)
         </copy>
     </target>
        
+    <target name="deploy_tenantconfig"
+            description="deploy tenant configuration">
+        <copy todir="${jee.server.cspace}/cspace/config/services">
+            <fileset dir="${basedir}/src/main/cspace/config/services"/>
+        </copy>
+    </target>
+       
 
     <target name="deploy" depends="install"
             description="deploy common elements in ${jee.server.cspace}">
         <antcall target="deploy_spring" />
         <antcall target="deploy_slf4j" />
         <antcall target="deploy_xmlmerge" />
-       
-        <copy todir="${jee.server.cspace}/cspace/config/services">
-            <fileset dir="${basedir}/src/main/cspace/config/services"/>
-        </copy>
-       
+       <antcall target="deploy_tenantconfig" />
     </target>
 
     <target name="undeploy"
index 01d127ad63a0016e6750d10f573756930f674caa..75603635909d5a72d590ebed8f7e6bf07a2df24f 100644 (file)
       <!-- <types:item><types:key>localeLanguage</types:key><types:value>da</types:value></types:item> -->
     </tenant:properties>               
     <!-- begin idgenerators service meta-data -->
-    <tenant:serviceBindings id="idgenerators" name="idgenerators" version="0.1">
+    <tenant:serviceBindings id="idgenerators" name="idgenerators" type="utility" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
     </tenant:serviceBindings>
     <!-- end idgenerator service meta-data -->
     <!-- begin id service meta-data -->
-    <tenant:serviceBindings id="id" name="id" version="0.1">
+    <tenant:serviceBindings id="id" name="id" type="utility" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /idgenerators/*/ids
     </tenant:serviceBindings>
     <!--end collectionobject service meta-data -->
     <!-- begin blob service meta-data -->
+               <!-- This should likely be type="object" -->
     <tenant:serviceBindings id="Blobs" name="Blobs" type="procedure" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/blobs/*/workflow/</service:uriPath>
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
               <types:key>authRef</types:key>
               <types:value>borrowersAuthorizer</types:value>
             </types:item>
-            <!-- To be added to Loan In records per CSPACE-3269 -->
-            <!--
             <types:item xmlns:types="http://collectionspace.org/services/common/types">
                <types:key>authRef</types:key>
                <types:value>borrowersContact</types:value>
             </types:item>
-            -->
             <!-- Commented out for now, as searching within a field in a complexType breaks searches -->
             <!--
             <types:item xmlns:types="http://collectionspace.org/services/common/types">
     </tenant:serviceBindings>
     <!-- end imports service meta-data -->
     <!-- begin media service meta-data -->
-    <tenant:serviceBindings id="Media" name="Media" type="procedure" version="0.1">
+               <!-- This should likely be type="object" -->
+     <tenant:serviceBindings id="Media" name="Media" type="procedure" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/media/*/workflow/</service:uriPath>
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.media.nuxeo.MediaDocumentModelHandler</service:documentHandler>
     </tenant:serviceBindings>
     <!-- end report service meta-data -->
     <!-- begin vocabulary service meta-data -->
-    <tenant:serviceBindings id="Vocabularies" name="Vocabularies" version="0.1">
+    <tenant:serviceBindings id="Vocabularies" name="Vocabularies" type="utility" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularies/*/workflow/</service:uriPath>
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularies/*/items/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
             Note there is no Vocabularyitem service, but there is a
             Repository workspace so we have to configure that.
         -->
-    <tenant:serviceBindings id="Vocabularyitems" name="Vocabularyitems" version="0.1">
+    <tenant:serviceBindings id="Vocabularyitems" name="Vocabularyitems" type="authority" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/vocabularyitems/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
       <!--
       <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
         <service:params>
           <service:ListResultsFields>
-            <service:ListResultField>
-              <service:element>displayName</service:element>
-              <service:xpath>displayName</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>shortIdentifier</service:element>
-              <service:xpath>shortIdentifier</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>refName</service:element>
-              <service:xpath>refName</service:xpath>
-            </service:ListResultField>
+                                               <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
             <service:ListResultField>
               <service:element>order</service:element>
               <service:xpath>order</service:xpath>
     </tenant:serviceBindings>
     <!-- end vocabulary service meta-data -->
     <!-- begin orgauthority service meta-data -->
-    <tenant:serviceBindings id="Orgauthorities" name="Orgauthorities" version="0.1">
+    <tenant:serviceBindings id="Orgauthorities" name="Orgauthorities" type="utility" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/orgauthorities/*/workflow/</service:uriPath>
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/orgauthorities/*/items/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
              Note there is no Organization service, but there is a
              Repository workspace so we have to configure that.
         -->
-    <tenant:serviceBindings id="Organizations" name="Organizations" version="0.1">
+    <tenant:serviceBindings id="Organizations" name="Organizations" type="authority" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /orgauthorities/*/items/
       <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
         <service:params>
           <service:ListResultsFields>
-            <service:ListResultField>
-              <service:element>displayName</service:element>
-              <service:xpath>displayName</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>shortIdentifier</service:element>
-              <service:xpath>shortIdentifier</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>refName</service:element>
-              <service:xpath>refName</service:xpath>
-            </service:ListResultField>
+                                       <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
     </tenant:serviceBindings>
     <!-- end organization service meta-data -->
     <!-- begin personauthority service meta-data -->
-    <tenant:serviceBindings id="Personauthorities" name="Personauthorities" version="0.1">
+    <tenant:serviceBindings id="Personauthorities" name="Personauthorities" type="utility" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/personauthorities/*/workflow/</service:uriPath>
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/personauthorities/*/items/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
              Note there is no Person service, but there is a
              Repository workspace so we have to configure that.
         -->
-    <tenant:serviceBindings id="Persons" name="Persons" version="0.1">
+    <tenant:serviceBindings id="Persons" name="Persons" type="authority" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /personauthorities/*/items/
       <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
         <service:params>
           <service:ListResultsFields>
-            <service:ListResultField>
-              <service:element>displayName</service:element>
-              <service:xpath>displayName</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>shortIdentifier</service:element>
-              <service:xpath>shortIdentifier</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>refName</service:element>
-              <service:xpath>refName</service:xpath>
-            </service:ListResultField>
+                                       <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
       </service:properties>
       <service:object xmlns:service="http://collectionspace.org/services/common/service" id="1" name="Person" version="0.1">
         <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="persons-system" updated="" order="0">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
+          </service:content>
+        </service:part>
+        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="persons_common" updated="" order="1">
+          <service:content contentType="application/xml">
+            <service:xmlContent namespaceURI="http://collectionspace.org/services/person" schemaLocation="http://collectionspace.org/services/person http://services.collectionspace.org/person/persons_common.xsd" />
+          </service:content>
           <service:properties>
             <!-- Place Authority reference -->
             <types:item xmlns:types="http://collectionspace.org/services/common/types">
             </types:item>
             -->
           </service:properties>
-          <service:content contentType="application/xml">
-            <service:xmlContent namespaceURI="http://collectionspace.org/services/common/system" schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd" />
-          </service:content>
-        </service:part>
-        <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="persons_common" updated="" order="1">
-          <service:content contentType="application/xml">
-            <service:xmlContent namespaceURI="http://collectionspace.org/services/person" schemaLocation="http://collectionspace.org/services/person http://services.collectionspace.org/person/persons_common.xsd" />
-          </service:content>
         </service:part>
         <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
           <service:content contentType="application/xml">
     </tenant:serviceBindings>
     <!-- end person service meta-data -->
     <!-- begin locationauthority service meta-data -->
-    <tenant:serviceBindings id="Locationauthorities" name="Locationauthorities" version="0.1">
+    <tenant:serviceBindings id="Locationauthorities" name="Locationauthorities" type="utility" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/locationauthorities/*/workflow/</service:uriPath>
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/locationauthorities/*/items/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
              Note there is no Location service, but there is a
              Repository workspace so we have to configure that.
         -->
-    <tenant:serviceBindings id="Locations" name="Locations" version="0.1">
+    <tenant:serviceBindings id="Locations" name="Locations" type="authority" version="0.1">
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.location.nuxeo.LocationDocumentModelHandler</service:documentHandler>
       <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
         <service:params>
           <service:ListResultsFields>
-            <service:ListResultField>
-              <service:element>displayName</service:element>
-              <service:xpath>displayName</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>shortIdentifier</service:element>
-              <service:xpath>shortIdentifier</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>refName</service:element>
-              <service:xpath>refName</service:xpath>
-            </service:ListResultField>
+                                       <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
     </tenant:serviceBindings>
     <!-- end location service meta-data -->
     <!-- begin taxonomyauthority service meta-data -->
-    <tenant:serviceBindings id="Taxonomyauthority" name="Taxonomyauthority" version="0.1">
+    <tenant:serviceBindings id="Taxonomyauthority" name="Taxonomyauthority" type="utility" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthority/*/workflow/</service:uriPath>
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/taxonomyauthority/*/items/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
              Note there is no Taxon service, but there is a
              Repository workspace so we have to configure that.
         -->
-    <tenant:serviceBindings id="Taxon" name="Taxon" version="0.1">
+    <tenant:serviceBindings id="Taxon" name="Taxon" type="authority" version="0.1">
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.taxonomy.nuxeo.TaxonDocumentModelHandler</service:documentHandler>
       <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
         <service:params>
           <service:ListResultsFields>
-            <service:ListResultField>
-              <service:element>displayName</service:element>
-              <service:xpath>displayName</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>shortIdentifier</service:element>
-              <service:xpath>shortIdentifier</service:xpath>
-            </service:ListResultField>
-            <service:ListResultField>
-              <service:element>refName</service:element>
-              <service:xpath>refName</service:xpath>
-            </service:ListResultField>
+                                       <!-- Omit the standard AuthorityItem items (they are handled by the code) -->
           </service:ListResultsFields>
         </service:params>
       </service:DocHandlerParams>
     </tenant:serviceBindings>
     <!-- end acquisition service meta-data -->
     <!-- begin relation service meta-data -->
-    <tenant:serviceBindings id="Relations" name="Relations" version="0.1">
+    <tenant:serviceBindings id="Relations" name="Relations" type="utility" version="0.1">
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/relations/*/workflow/</service:uriPath>
       <!-- other URI paths using which this service could be accessed -->
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
       <service:properties xmlns:service="http://collectionspace.org/services/common/service">
         <types:item xmlns:types="http://collectionspace.org/services/common/types">
           <types:key>objectNameProperty</types:key>
-          <types:value>documentId1</types:value>
+          <types:value>subjectCsid</types:value>
         </types:item>
         <types:item xmlns:types="http://collectionspace.org/services/common/types">
           <types:key>objectNumberProperty</types:key>
           </service:field>
           <service:field>
             <service:table>relations_common</service:table>
-            <service:param>documentid1,documentid2</service:param>
+            <service:param>subjectcsid,objectcsid</service:param>
           </service:field>
         </service:params>
       </service:initHandler>
     </tenant:serviceBindings>
     <!-- end relation service meta-data -->
     <!-- begin account service meta-data -->
-    <tenant:serviceBindings id="Accounts" name="Accounts" version="0.1">
+    <tenant:serviceBindings id="Accounts" name="Accounts" type="security" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.account.storage.AccountDocumentHandler</service:documentHandler>
       <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
     </tenant:serviceBindings>
     <!-- end account service meta-data -->
     <!-- begin dimension service meta-data -->
-    <tenant:serviceBindings id="Dimensions" name="Dimensions" version="0.1">
+    <tenant:serviceBindings id="Dimensions" name="Dimensions" type="utility" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <service:uriPath xmlns:service="http://collectionspace.org/services/common/service">/dimensions/*/workflow/</service:uriPath>
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
     </tenant:serviceBindings>
     <!-- end dimension service meta-data -->
     <!-- begin contact service meta-data -->
-    <tenant:serviceBindings id="Contacts" name="Contacts" version="0.1">
+    <tenant:serviceBindings id="Contacts" name="Contacts" type="utility" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /personauthorities/*/items/*/contacts
     </tenant:serviceBindings>
     <!-- end contact service meta-data -->
     <!-- begin note service meta-data -->
-    <tenant:serviceBindings id="Notes" name="Notes" version="0.1">
+    <tenant:serviceBindings id="Notes" name="Notes" type="utility" version="0.1">
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.note.nuxeo.NoteDocumentModelHandler</service:documentHandler>
       <service:object xmlns:service="http://collectionspace.org/services/common/service" name="CSNote" version="0.1">
     </tenant:serviceBindings>
     <!-- end note service meta-data -->
     <!-- begin role service meta-data -->
-    <tenant:serviceBindings id="authorization/roles" name="authorization/roles" version="0.1">
+    <tenant:serviceBindings id="authorization/roles" name="authorization/roles" type="security" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.RoleDocumentHandler</service:documentHandler>
       <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.RoleValidatorHandler</service:validatorHandler>
     </tenant:serviceBindings>
     <!-- end role service meta-data -->
     <!-- begin permission service meta-data -->
-    <tenant:serviceBindings id="authorization/permissions" name="authorization/permissions" version="0.1">
+    <tenant:serviceBindings id="authorization/permissions" name="authorization/permissions" type="security" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionDocumentHandler</service:documentHandler>
       <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.authorization.storage.PermissionValidatorHandler</service:validatorHandler>
     <!-- begin permission-role service meta-data -->
     <!-- the following service is same as authorization/roles/permroles service -->
     <!-- except that it is available as a sub resource of the permission service -->
-    <tenant:serviceBindings id="authorization/permissions/permroles" name="authorization/permissions/permroles" version="0.1">
+    <tenant:serviceBindings id="authorization/permissions/permroles" name="authorization/permissions/permroles" type="security" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /authorization/permissions/*/permroles/
     </tenant:serviceBindings>
     <!-- end permission-role service meta-data -->
     <!-- begin account-role service meta-data -->
-    <tenant:serviceBindings id="accounts/accountroles" name="accounts/accountroles" version="0.1">
+    <tenant:serviceBindings id="accounts/accountroles" name="accounts/accountroles" type="security" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /accounts/*/accountroles/
     <!-- begin role-permission service meta-data -->
     <!-- the following service is same as authorization/permissions/permroles service -->
     <!-- except that it is available as a sub resource of the role service -->
-    <tenant:serviceBindings id="authorization/roles/permroles" name="authorization/roles/permroles" version="0.1">
+    <tenant:serviceBindings id="authorization/roles/permroles" name="authorization/roles/permroles" type="security" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /authorization/roles/*/permroles/
     <!-- begin role-account service meta-data -->
     <!-- the following service is same as account/accountroles service -->
     <!-- except that it is available as a sub resource of the role service -->
-    <tenant:serviceBindings id="authorization/roles/accountroles" name="authorization/roles/accountroles" version="0.1">
+    <tenant:serviceBindings id="authorization/roles/accountroles" name="authorization/roles/accountroles" type="security" version="0.1">
       <!-- other URI paths using which this service could be accessed -->
       <!--            <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
                 /authorization/roles/*/accountroles/
index c3a7c8deb7361b7b275920c42589cedb0ba913aa..edde4fe634f086cedc2f90a2aa4732e8929de57f 100644 (file)
@@ -393,12 +393,12 @@ public class TenantBindingConfigReaderImpl
      * @return
      */
     public List<ServiceBindingType> getServiceBindingsByType(
-            String tenantId, String serviceType) {
+            String tenantId, List<String> serviceTypes) {
         ArrayList<ServiceBindingType> list = null;
         TenantBindingType tenant = tenantBindings.get(tenantId);
         if (tenant != null) {
             for (ServiceBindingType sb : tenant.getServiceBindings()) {
-                if (serviceType.equals(sb.getType())) {
+                if (serviceTypes.contains(sb.getType())) {
                     if (list == null) {
                         list = new ArrayList<ServiceBindingType>();
                     }
index d4b4f0ea2c8702cfec7992436b9d0f97da32c87e..eae2b3da6caae2dda0b8fd565856225d561f0882 100644 (file)
@@ -24,6 +24,9 @@ public class ServiceBindingUtils {
        public static final String SERVICE_TYPE_PROP = "type";\r
        public static final String SERVICE_TYPE_OBJECT = "object";\r
        public static final String SERVICE_TYPE_PROCEDURE = "procedure";\r
+       public static final String SERVICE_TYPE_AUTHORITY = "authority";\r
+       public static final String SERVICE_TYPE_UTILITY = "utility";\r
+       public static final String SERVICE_TYPE_SECURITY = "security";\r
        \r
     public static String getTenantQualifiedDocType(String tenantId, String docType) {\r
        String result = docType + ServiceContext.TENANT_SUFFIX + tenantId;\r
index 9c3af532f1b8c8913b81196f5848c142c28e64f4..373b9c0d4a0beb3bb0290c65a71236b43a4dbfea 100644 (file)
@@ -54,7 +54,7 @@ public class DateTimeFormatUtils {
     final static String LOCALE_LANGUAGE_CODE_PROPERTY_NAME = "localeLanguage";
     final static Locale NULL_LOCALE = null;
     final static List<String> isoLanguageCodes = new ArrayList(Arrays.asList(Locale.getISOLanguages()));
-    final static String ISO_8601_FLOATING_DATE_PATTERN = "yyyy-MM-dd";
+    final static String ISO_8601_DATE_PATTERN = "yyyy-MM-dd";
     final static String ISO_8601_UTC_TIMESTAMP_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'";
     static Map<String,List<DateFormat>> dateFormatters = new HashMap<String,List<DateFormat>>();
     static Map<String,List<String>> datePatterns = new HashMap<String,List<String>>();
@@ -346,6 +346,20 @@ public class DateTimeFormatUtils {
         return formatGregorianCalendarDate(cal, GregorianCalendarDateTimeUtils.UTCTimeZone(),
                 getDateFormatter(ISO_8601_UTC_TIMESTAMP_PATTERN));
     }
+    
+    /**
+     * Returns a representation of a calendar date and time instance,
+     * as an ISO 8601-formatted date.
+     *
+     * @param cal a calendar date and time instance.
+     *
+     * @return    a representation of that calendar date and time instance,
+     *            as an ISO 8601-formatted date.
+     */
+    public static String formatAsISO8601Date(GregorianCalendar cal) {
+        return formatGregorianCalendarDate(cal, GregorianCalendarDateTimeUtils.UTCTimeZone(),
+                getDateFormatter(ISO_8601_DATE_PATTERN));
+    }
 
     /**
      * Formats a provided calendar date using a supplied date formatter,
index a37cc72359fe17bcd657441aec4b8f610ced6416..ec2217a0efae4b3268a638e871bf11a57cefeb5d 100644 (file)
@@ -86,5 +86,15 @@ public class GregorianCalendarDateTimeUtils {
     public static String timestampUTC() {
         return DateTimeFormatUtils.formatAsISO8601Timestamp(currentDateAndTime(UTCTimeZone()));
     }
+    
+   /**
+    * Returns a String representing the current date and time instance.
+    * in the UTC time zone, formatted as an ISO 8601 date.
+    *
+    * @return A String representing the current date and time instance.
+    */
+    public static String currentDateUTC() {
+        return DateTimeFormatUtils.formatAsISO8601Date(currentDateAndTime(UTCTimeZone()));
+    }
 
 }
index b22c39a4cc39eeddfe4e8548d64a978b3daedd4d..00e0ce46e3efbc893a8c491568693ea4328e82fb 100644 (file)
@@ -1144,8 +1144,8 @@ public class DocumentUtils {
                                data.put(name, value);
                        } else  {
                                if (logger.isDebugEnabled() == true) {
-                                       logger.debug("Invalid input document. No such property was found " +
-                                                       name + " in schema " + schemaName);
+                                       logger.debug("Invalid input document. No such property was found [" +
+                                                       name + "] in schema " + schemaName);
                                }
                        }
                }
index c3fed110f27a4d1d5a365152fb088bc6dcbbdfef..e6c3b4673cadec398e14811e920281c645819e5e 100644 (file)
@@ -32,8 +32,9 @@ import java.io.InputStream;
 import java.io.FileInputStream;\r
 import java.io.BufferedInputStream;\r
 import java.io.IOException;\r
-\r
 import java.io.Serializable;\r
+import java.math.BigDecimal;\r
+import java.math.BigInteger;\r
 import java.util.ArrayList;\r
 import java.util.HashMap;\r
 import java.util.List;\r
@@ -111,12 +112,15 @@ import org.slf4j.LoggerFactory;
 import org.collectionspace.services.common.ServiceMain;\r
 import org.collectionspace.services.common.blob.BlobInput;\r
 import org.collectionspace.services.common.context.ServiceContext;\r
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;\r
 import org.collectionspace.services.common.document.DocumentUtils;\r
 import org.collectionspace.services.common.service.ListResultField;\r
 import org.collectionspace.services.common.FileUtils;\r
 import org.collectionspace.services.blob.BlobsCommon;\r
-import org.collectionspace.services.blob.DimensionGroup;\r
-import org.collectionspace.services.blob.DimensionGroupList;\r
+import org.collectionspace.services.blob.DimensionSubGroup;\r
+import org.collectionspace.services.blob.DimensionSubGroupList;\r
+import org.collectionspace.services.blob.MeasuredPartGroup;\r
+import org.collectionspace.services.blob.MeasuredPartGroupList;\r
 //import org.collectionspace.services.blob.BlobsCommonList;\r
 //import org.collectionspace.services.blob.BlobsCommonList.BlobListItem;\r
 import org.collectionspace.services.jaxb.AbstractCommonList;\r
@@ -290,47 +294,57 @@ public class NuxeoImageUtils {
            return metadataMap;\r
        }\r
                \r
-       static private DimensionGroupList getDimensions(DocumentModel documentModel, Blob nuxeoBlob) {\r
-               DimensionGroupList result = null;\r
+       static private MeasuredPartGroupList getDimensions(DocumentModel documentModel, Blob nuxeoBlob) {\r
+               MeasuredPartGroupList result = null;\r
                try {\r
                    ImagingService service = Framework.getService(ImagingService.class);                        \r
                    ImageInfo imageInfo = service.getImageInfo(nuxeoBlob);\r
                    Map<String, Object> metadataMap = getMetadata(nuxeoBlob);\r
                    \r
                    if (imageInfo != null) {\r
-                       DimensionGroupList dimensionGroupList = new DimensionGroupList();\r
-                       List<DimensionGroup> dgList = dimensionGroupList.getDimensionGroup();\r
+                        MeasuredPartGroupList measuredPartGroupList = new MeasuredPartGroupList();\r
+                        List<MeasuredPartGroup> measuredPartList = measuredPartGroupList.getMeasuredPartGroup();\r
+                        \r
+                        MeasuredPartGroup mpGroup = new MeasuredPartGroup();\r
+                        mpGroup.setMeasuredPart(PART_IMAGE);\r
+                        \r
+                       DimensionSubGroupList dimensionSubGroupList = mpGroup.getDimensionSubGroupList();\r
+                       List<DimensionSubGroup> dgList = dimensionSubGroupList.getDimensionSubGroup();\r
+                        \r
+                        String valueDate = GregorianCalendarDateTimeUtils.timestampUTC(); \r
+\r
                        //\r
                        // Set the width\r
                        //\r
-                       DimensionGroup widthDimension = new DimensionGroup();\r
-                       widthDimension.setMeasuredPart(PART_IMAGE);\r
+                       DimensionSubGroup widthDimension = new DimensionSubGroup();\r
                        widthDimension.setDimension(WIDTH);\r
                        widthDimension.setMeasurementUnit(UNIT_PIXELS);\r
-                       widthDimension.setValue(Integer.toString(imageInfo.getWidth()));\r
+                       widthDimension.setValue(intToBigDecimal(imageInfo.getWidth()));\r
+                        widthDimension.setValueDate(valueDate);\r
                        dgList.add(widthDimension);\r
                        //\r
                        // Set the height\r
                        //\r
-                       DimensionGroup heightDimension = new DimensionGroup();\r
-                       heightDimension.setMeasuredPart(PART_IMAGE);\r
+                       DimensionSubGroup heightDimension = new DimensionSubGroup();\r
                        heightDimension.setDimension(HEIGHT);\r
                        heightDimension.setMeasurementUnit(UNIT_PIXELS);\r
-                       heightDimension.setValue(Integer.toString(imageInfo.getHeight()));\r
+                       heightDimension.setValue(intToBigDecimal(imageInfo.getHeight()));\r
+                        heightDimension.setValueDate(valueDate);\r
                        dgList.add(heightDimension);\r
                        //\r
                        // Set the depth\r
                        //\r
-                       DimensionGroup depthDimension = new DimensionGroup();\r
-                       depthDimension.setMeasuredPart(PART_IMAGE);\r
+                       DimensionSubGroup depthDimension = new DimensionSubGroup();\r
                        depthDimension.setDimension(DEPTH);\r
                        depthDimension.setMeasurementUnit(UNIT_BITS);\r
-                       depthDimension.setValue(Integer.toString(imageInfo.getDepth()));\r
+                       depthDimension.setValue(intToBigDecimal(imageInfo.getDepth()));\r
+                        depthDimension.setValueDate(valueDate);\r
                        dgList.add(depthDimension);\r
                        //\r
                        // Now set out result\r
                        //\r
-                       result = dimensionGroupList;\r
+                        measuredPartList.add(mpGroup);\r
+                       result = measuredPartGroupList;\r
                    } else {\r
                        if (logger.isWarnEnabled() == true) {\r
                                logger.warn("Could not synthesize a dimension list of the blob: " + documentModel.getName());\r
@@ -342,6 +356,13 @@ public class NuxeoImageUtils {
                \r
                return result;\r
        }\r
+        \r
+        // FIXME: Add error checking here, as none of these calls return an Exception\r
+        static private BigDecimal intToBigDecimal(int i) {\r
+            BigInteger bigint = BigInteger.valueOf(i);\r
+            BigDecimal bigdec = new BigDecimal(bigint);\r
+            return bigdec;\r
+        }\r
 \r
        static private BlobsCommon createBlobsCommon(DocumentModel documentModel, Blob nuxeoBlob) {\r
                BlobsCommon result = new BlobsCommon();\r
@@ -351,9 +372,9 @@ public class NuxeoImageUtils {
                        result.setName(nuxeoBlob.getFilename());\r
                        result.setLength(Long.toString(nuxeoBlob.getLength()));\r
                        result.setRepositoryId(documentModel.getId());\r
-                       DimensionGroupList dimensionGroupList = getDimensions(documentModel, nuxeoBlob);\r
-                       if (dimensionGroupList != null) {\r
-                               result.setDimensionGroupList(dimensionGroupList);\r
+                       MeasuredPartGroupList measuredPartGroupList = getDimensions(documentModel, nuxeoBlob);\r
+                       if (measuredPartGroupList != null) {\r
+                               result.setMeasuredPartGroupList(measuredPartGroupList);\r
                        }\r
                }\r
                                \r
index 8a0e0c0a0c262d3a0048392e165a1b54bc7df90a..86be6ed1cce31938a97813534a395919c5748a25 100644 (file)
@@ -63,6 +63,19 @@ public class QueryManager {
                return queryManager.createWhereClauseForPartialMatch(field, partialTerm);\r
        }\r
        \r
+       /**\r
+        * Creates a query to filter a qualified (string) field according to a list of string values. \r
+        * @param qualifiedField The schema-qualified field to filter on\r
+        * @param filterTerms the list of one or more strings to filter on\r
+        * @param fExclude If true, will require qualifiedField NOT match the filters strings.\r
+        *                                      If false, will require qualifiedField does match one of the filters strings.\r
+        * @return queryString\r
+        */\r
+       static public String createWhereClauseToFilterFromStringList(String qualifiedField, String[] filterTerms, boolean fExclude) {\r
+               return queryManager.createWhereClauseToFilterFromStringList(qualifiedField, filterTerms, fExclude);\r
+       }\r
+\r
+       \r
        /**\r
         * Creates a filtering where clause from docType, for invocables.\r
         * \r
index 894ab2a9117617bb0ff611f3d8a4fff785a9f8ee..242f715b3c7fb1b6e5f0d9c53b4fe6d05486d2fa 100644 (file)
@@ -102,7 +102,7 @@ public class QueryManagerNuxeoImpl implements IQueryManager {
                        RepositoryInstance repoSession = client.openRepository();\r
 \r
                        DocumentModelList docModelList = repoSession\r
-                                       .query("SELECT * FROM Relation WHERE relation:relationtype.documentId1='updated-Subject-1'");\r
+                                       .query("SELECT * FROM Relation WHERE relations_common:subjectCsid='updated-Subject-1'");\r
                        // DocumentModelList docModelList =\r
                        // repoSession.query("SELECT * FROM Relation");\r
                        // DocumentModelList docModelList =\r
@@ -113,9 +113,9 @@ public class QueryManagerNuxeoImpl implements IQueryManager {
                                System.out.println(docModel.getPathAsString());\r
                                System.out.println(docModel.getName());\r
                                System.out.println(docModel.getPropertyValue("dc:title"));\r
-                               // System.out.println("documentId1=" +\r
-                               // docModel.getProperty("relation",\r
-                               // "relationtype/documentId1").toString());\r
+                               // System.out.println("subjectCsid=" +\r
+                               // docModel.getProperty("relations_common",\r
+                               // "subjectCsid").toString());\r
                        }\r
 \r
                } catch (Exception e) {\r
@@ -300,4 +300,36 @@ public class QueryManagerNuxeoImpl implements IQueryManager {
 \r
                return fFilteredChars;\r
        }\r
+       \r
+       /**\r
+        * Creates a query to filter a qualified (string) field according to a list of string values. \r
+        * @param qualifiedField The schema-qualified field to filter on\r
+        * @param filterTerms the list of one or more strings to filter on\r
+        * @param fExclude If true, will require qualifiedField NOT match the filters strings.\r
+        *                                      If false, will require qualifiedField does match one of the filters strings.\r
+        * @return queryString\r
+        */\r
+       @Override\r
+       public String createWhereClauseToFilterFromStringList(String qualifiedField, String[] filterTerms, boolean fExclude) {\r
+       // Start with the qualified termStatus field\r
+       StringBuilder filterClause = new StringBuilder(qualifiedField);\r
+       if(filterTerms.length == 1) {\r
+               filterClause.append(fExclude?" <> '":" = '");\r
+               filterClause.append(filterTerms[0]);\r
+               filterClause.append('\'');  \r
+       } else {\r
+               filterClause.append(fExclude?" NOT IN (":" IN (");\r
+               for(int i=0; i<filterTerms.length; i++) {\r
+                       if(i>0) {\r
+                               filterClause.append(',');\r
+                       }\r
+                       filterClause.append('\'');  \r
+                       filterClause.append(filterTerms[i]);\r
+                       filterClause.append('\'');  \r
+               }\r
+               filterClause.append(')');  \r
+       }\r
+       return filterClause.toString();\r
+       }\r
+\r
 }\r
index f5c8e2f34d20a7df8af974776b9b87ebef88981c..c28d367c5544dc5bf196d9fc2938fdb9dbee8628 100644 (file)
@@ -39,33 +39,21 @@ public interface RelationJAXBSchema {
        /** The Constant CSID. */\r
        final static String CSID = "csid";\r
        \r
-       /** The Constant DOCUMENT_ID_1. */\r
-       final static String DOCUMENT_ID_1 = "documentId1";\r
-       \r
-       /** The Constant DOCUMENT_TYPE_1. */\r
-       final static String DOCUMENT_TYPE_1 = "documentType1";\r
-       \r
-       /** The Constant DOCUMENT_ID_2. */\r
-       final static String DOCUMENT_ID_2 = "documentId2";\r
-       \r
-       /** The Constant DOCUMENT_TYPE_2. */\r
-       final static String DOCUMENT_TYPE_2 = "documentType2";\r
-       \r
        /** The Constant RELATIONSHIP_TYPE. */\r
        final static String RELATIONSHIP_TYPE = "relationshipType";\r
        \r
        /** The Constant RELATIONSHIP_TYPE_DISPLAYNAME. */\r
        final static String RELATIONSHIP_TYPE_DISPLAYNAME = "predicateDisplayName";\r
 \r
-    final static String SUBJECT_URI = "subjectUri";\r
-    final static String SUBJECT_CSID = "subjectCsid";\r
-    final static String SUBJECT_REFNAME = "subjectRefName";\r
-    final static String SUBJECT_DOCTYPE = "subjectDocumentType";\r
+    final static String SUBJECT_URI =          "subjectUri";\r
+    final static String SUBJECT_CSID =         "subjectCsid";\r
+    final static String SUBJECT_REFNAME =      "subjectRefName";\r
+    final static String SUBJECT_DOCTYPE =      "subjectDocumentType";\r
 \r
-    final static String OBJECT_URI = "objectUri";\r
-    final static String OBJECT_CSID = "objectCsid";\r
-    final static String OBJECT_REFNAME = "objectRefName";\r
-    final static String OBJECT_DOCTYPE = "objectDocumentType";\r
+    final static String OBJECT_URI =           "objectUri";\r
+    final static String OBJECT_CSID =          "objectCsid";\r
+    final static String OBJECT_REFNAME =       "objectRefName";\r
+    final static String OBJECT_DOCTYPE =       "objectDocumentType";\r
 \r
 }\r
 \r
index 2d4240b0d8047cd6e30410d2c088a0e4778ddc53..3c1b664243fa78af007ae6bf638e42e240a1ab1e 100644 (file)
@@ -58,15 +58,16 @@ public class RelationsUtils {
        StringBuilder stringBuilder = new StringBuilder();
        if (subject != null) {
                stringBuilder.append(RelationConstants.NUXEO_SCHEMA_NAME + ":" +
-                               RelationJAXBSchema.DOCUMENT_ID_1 + " = " + "'" + subject + "'");
+                               RelationJAXBSchema.SUBJECT_CSID + " = " + "'" + subject + "'");
        }
        
        if (subjectType != null) {
                if (stringBuilder.length() > 0) {
                        stringBuilder.append(IQueryManager.SEARCH_QUALIFIER_AND);
                }
+               // BUG - this should use the new field RelationJAXBSchema.SUBJECT_DOCTYPE
                stringBuilder.append(RelationConstants.NUXEO_SCHEMA_NAME + ":" +
-                               RelationJAXBSchema.DOCUMENT_TYPE_1 + " = " + "'" + subjectType + "'");
+                               RelationJAXBSchema.SUBJECT_DOCTYPE + " = " + "'" + subjectType + "'");
        }
        
        if (predicate != null) {
@@ -82,15 +83,16 @@ public class RelationsUtils {
                        stringBuilder.append(IQueryManager.SEARCH_QUALIFIER_AND);
                }
                stringBuilder.append(RelationConstants.NUXEO_SCHEMA_NAME + ":" +
-                               RelationJAXBSchema.DOCUMENT_ID_2 + " = " + "'" + object + "'");
+                               RelationJAXBSchema.OBJECT_CSID + " = " + "'" + object + "'");
        }
        
        if (objectType != null) {
                if (stringBuilder.length() > 0) {
                        stringBuilder.append(IQueryManager.SEARCH_QUALIFIER_AND);
                }
+               // BUG - this should use the new field RelationJAXBSchema.OBJECT_DOCTYPE
                stringBuilder.append(RelationConstants.NUXEO_SCHEMA_NAME + ":" +
-                               RelationJAXBSchema.DOCUMENT_TYPE_2 + " = " + "'" + objectType + "'");
+                               RelationJAXBSchema.OBJECT_DOCTYPE + " = " + "'" + objectType + "'");
        }
        
        if (stringBuilder.length() > 0) {
index bc92588a615ae3afeecc97084f8ec453d97fecee..43acb2113d3513bdb1d10b2257a283d459db7e9b 100644 (file)
@@ -133,9 +133,9 @@ public interface RepositoryClient<IT, OT> extends StorageClient {
      * @param ctx 
      * @param docTypes a list of DocType names to match
      * @param where the clause to qualify on
-     * @param pageSize 
-     * @param pageNum 
-     * @param computeTotal 
+     * @param pageSize (0 for all of them)
+     * @param pageNum  (0 for the first one)
+     * @param computeTotal
      * @param domain the domain for the associated services
      * @return document wrapper
      * @throws DocumentNotFoundException 
index 2ce34ae91170b67f3d0ce1ccdc9452f83e868d15..91ae0a9b2450428d75b481800834d42e2ca8ed1c 100755 (executable)
@@ -163,6 +163,14 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
         return commonList;\r
     }\r
 \r
+       public static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {\r
+                       GregorianCalendar cal = (GregorianCalendar)\r
+                                                               docModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,\r
+                                                                                       COLLECTIONSPACE_CORE_UPDATED_AT);\r
+                       String updatedAt = DateTimeFormatUtils.formatAsISO8601Timestamp(cal);\r
+                       return updatedAt;\r
+       }\r
+\r
     @Override\r
     public AbstractCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {\r
         String classname = getDocHandlerParams().getAbstractCommonListClassname();\r
@@ -192,11 +200,7 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
             item.put(fields[0], id);\r
             String uri = getUri(docModel);\r
             item.put(fields[1], uri);\r
-            GregorianCalendar cal = (GregorianCalendar)\r
-                                               docModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,\r
-                                                                       COLLECTIONSPACE_CORE_UPDATED_AT);\r
-            String updatedAt = DateTimeFormatUtils.formatAsISO8601Timestamp(cal);\r
-            item.put(fields[2], updatedAt);\r
+            item.put(fields[2], getUpdatedAtAsString(docModel));\r
 \r
             for (ListResultField field : resultsFields ){\r
                String schema = field.getSchema();\r
index 0eaafcae75ed3700af7573b62c55fe3486c9db84..fbdfe55587c8b05f233ee94c18e1c81dbc761446 100644 (file)
@@ -112,12 +112,16 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
                    String partLabel = part.getLabel();
                 try{
                     ObjectPartType partMeta = partsMetaMap.get(partLabel);
-        //            extractPart(docModel, partLabel, partMeta);
-                    Map<String, Object> unQObjectProperties = extractPart(docModel, partLabel, partMeta);
-                    addOutputPart(unQObjectProperties, partLabel, partMeta);
+                    // CSPACE-4030 - generates NPE if the part is missing.
+                    if(partMeta!=null) {
+                           Map<String, Object> unQObjectProperties = extractPart(docModel, partLabel, partMeta);
+                           if(unQObjectProperties!=null) {
+                               addOutputPart(unQObjectProperties, partLabel, partMeta);
+                           }
+                    }
                 } catch (Throwable t){
 
-                    System.out.println("===============================\r\nUnable to addOutputPart: "+partLabel
+                    logger.error("Unable to addOutputPart: "+partLabel
                                                +" in serviceContextPath: "+this.getServiceContextPath()
                                                +" with URI: "+this.getServiceContext().getUriInfo().getPath()
                                                +" error: "+t);
index 85b2bf1146af1031a79ffcabe26c9a4d69341214..cc4d9fd65776884333ba1b3d7b0c83d51a92cd43 100644 (file)
@@ -711,6 +711,80 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             }
         }
     }
+    
+    /**
+     * Save a documentModel to the Nuxeo repository, using the current session,
+     * bypassing the normal document handler processing (validation, etc.)
+     * NOTE: This should be called only in specific circumstances, e.g., to
+     * update known cached values like refNames. DO NOT USE this for any normal
+     * document processing.
+     * NOTE: Does not release session, as it should be called in a wider session context.
+     *  Caller is responsible for releasing the session.
+     * 
+     * @param ctx service context under which this method is invoked
+     * @param docModel the document to save
+     * @param fSaveSession if TRUE, will call CoreSession.save() to save accumulated changes.
+     * @throws DocumentException
+     */
+    public void saveDocWithoutHandlerProcessing(
+            ServiceContext ctx, DocumentModel docModel, boolean fSaveSession)
+            throws ClientException, DocumentException {
+        RepositoryInstance repoSession = null;
+        DocumentWrapper<DocumentModel> wrapDoc = null;
+
+        try {
+            repoSession = getRepositorySession();
+            repoSession.saveDocument(docModel);
+            if(fSaveSession)
+               repoSession.save();
+        } catch (ClientException ce) {
+            throw ce;
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception ", e);
+            }
+            throw new DocumentException(e);
+        }
+    }
+
+
+    /**
+     * Save a list of documentModels to the Nuxeo repository, using the current session,
+     * bypassing the normal document handler processing (validation, etc.)
+     * NOTE: This should be called only in specific circumstances, e.g., to
+     * update known cached values like refNames. DO NOT USE this for any normal
+     * document processing.
+     * NOTE: Does not release session, as it should be called in a wider session context.
+     *  Caller is responsible for releasing the session.
+     * 
+     * @param ctx service context under which this method is invoked
+     * @param docModel the document to save
+     * @param fSaveSession if TRUE, will call CoreSession.save() to save accumulated changes.
+     * @throws DocumentException
+     */
+    public void saveDocListWithoutHandlerProcessing(
+            ServiceContext ctx, DocumentModelList docList, boolean fSaveSession)
+            throws ClientException, DocumentException {
+        RepositoryInstance repoSession = null;
+        DocumentWrapper<DocumentModel> wrapDoc = null;
+
+        try {
+            repoSession = getRepositorySession();
+            DocumentModel[] docModelArray = new DocumentModel[docList.size()];
+            repoSession.saveDocuments(docList.toArray(docModelArray));
+            if(fSaveSession)
+               repoSession.save();
+        } catch (ClientException ce) {
+            throw ce;
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception ", e);
+            }
+            throw new DocumentException(e);
+        }
+    }
+
+
 
     /**
      * delete a document from the Nuxeo repository
index 36e720d6a3635ef8ca38f5efa30424c523a5c650..7494b590bda48002ce7008693b49967d00bbba54 100644 (file)
@@ -109,7 +109,8 @@ public abstract class AuthorityResourceWithContacts<AuthCommon, AuthItemHandler>
     public Response createContact(
             @PathParam("parentcsid") String parentspecifier,
             @PathParam("itemcsid") String itemspecifier,
-            String xmlPayload) {
+            String xmlPayload,
+            @Context UriInfo ui) {
         try {
             PoxPayloadIn input = new PoxPayloadIn(xmlPayload);
             String parentcsid = lookupParentCSID(parentspecifier, "createContact(authority)", "CREATE_ITEM_CONTACT", null);
@@ -120,7 +121,7 @@ public abstract class AuthorityResourceWithContacts<AuthCommon, AuthItemHandler>
             // Note that we have to create the service context and document
             // handler for the Contact service, not the main service.
             ServiceContext ctx = createServiceContext(getContactServiceName(), input);
-            DocumentHandler handler = createContactDocumentHandler(ctx, parentcsid, itemcsid);
+            DocumentHandler handler = createContactDocumentHandler(ctx, parentcsid, itemcsid, ui);
             String csid = getRepositoryClient(ctx).create(ctx, handler);
             UriBuilder path = UriBuilder.fromResource(resourceClass);
             path.path("" + parentcsid + "/items/" + itemcsid + "/contacts/" + csid);
index 49c21c9621871aa7b62c3df042d099740cf1f63d..6022796c6d9ed417a1ebe57bd364f9dd02ec896d 100755 (executable)
@@ -54,7 +54,7 @@
               <contentPlace></contentPlace>\r
             </collectionobjects_common:contentPlaces>\r
             <collectionobjects_common:dateEarliestSingleCertainty/>\r
-            <collectionobjects_common:objectProductionDates/>\r
+            <collectionobjects_common:objectProductionDateGroupList/>\r
             <collectionobjects_common:contentConcepts>\r
               <contentConcept></contentConcept>\r
             </collectionobjects_common:contentConcepts>\r
@@ -98,7 +98,7 @@
                 <objectProductionPlaceRole></objectProductionPlaceRole>\r
               </objectProductionPlaceGroup>\r
             </collectionobjects_common:objectProductionPlaceGroupList>\r
-            <collectionobjects_common:contentDate></collectionobjects_common:contentDate>\r
+            <collectionobjects_common:contentDateGroup/>\r
             <collectionobjects_common:assocPlaceGroupList/>\r
             <collectionobjects_common:physicalDescription>It's pretty big - the size of an ogre.. Three arms and a hump-back</collectionobjects_common:physicalDescription>\r
             <collectionobjects_common:dimensionValue/>\r
             </collectionobjects_common:responsibleDepartments>\r
        </schema>\r
   </import>\r
-</imports>
\ No newline at end of file
+</imports>\r
index 8f8b62f249153732db1169425dbdc190de941ac5..3d222efa6527ed16d07a78c51175863062f21748 100644 (file)
@@ -24,7 +24,7 @@
     <xs:element name="currentOwner" type="xs:string"/>\r
     <xs:element name="depositor" type="xs:string"/>\r
     <xs:element name="depositorsRequirements" type="xs:string"/>\r
-    <xs:element name="entryDate" type="xs:string"/>\r
+    <xs:element name="entryDate" type="xs:date"/>\r
     <xs:element name="entryMethods">\r
         <xs:complexType>\r
             <xs:sequence>\r
@@ -36,7 +36,7 @@
     <xs:element name="entryNumber" type="xs:string"/>\r
     <xs:element name="entryReason" type="xs:string"/>\r
     <xs:element name="packingNote" type="xs:string"/>\r
-    <xs:element name="returnDate" type="xs:string"/>\r
+    <xs:element name="returnDate" type="xs:date"/>\r
     \r
     <!--  Object Collection Information Group -->\r
     <xs:element name="fieldCollectionDate" type="xs:string"/>\r
@@ -81,7 +81,7 @@
     <xs:element name="insuranceNote" type="xs:string"/>\r
     <xs:element name="insurancePolicyNumber" type="xs:string"/>\r
     <xs:element name="insuranceReferenceNumber" type="xs:string"/>\r
-    <xs:element name="insuranceRenewalDate" type="xs:string"/>\r
+    <xs:element name="insuranceRenewalDate" type="xs:date"/>\r
     <xs:element name="insurers">\r
         <xs:complexType>\r
             <xs:sequence>\r
 \r
     <xs:element name="currentLocationGroupList" type="currentLocationGroupList"/>\r
 \r
-    <xs:element name="locationDate" type="xs:string"/>\r
+    <xs:element name="locationDate" type="xs:date"/>\r
     <xs:element name="normalLocation" type="xs:string"/>\r
     \r
     <!-- Condition Check/Technical Assessment Information Group -->\r
-    <xs:element name="conditionCheckDate" type="xs:string"/>\r
+    <xs:element name="conditionCheckDate" type="xs:date"/>\r
     <xs:element name="conditionCheckMethods">\r
         <xs:complexType>\r
             <xs:sequence>\r
index eb826ced6eae3af8541763bf2da76777bf3832cd..c2c377d1862b1f35a3b8b9b776c76ebee45b9172 100644 (file)
@@ -39,6 +39,7 @@ import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.intake.ConditionCheckerOrAssessorList;
 import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.intake.InsurerList;
@@ -81,6 +82,8 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
     private String insurerRefName = null;
     private String valuerRefName = null;
     private final int NUM_AUTH_REFS_EXPECTED = 5;
+    private final static String CURRENT_DATE_UTC =
+            GregorianCalendarDateTimeUtils.currentDateUTC();
 
        @Override
        protected String getServiceName() {
@@ -126,7 +129,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest {
         IntakeClient intakeClient = new IntakeClient();
         PoxPayloadOut multipart = createIntakeInstance(
                 "entryNumber-" + identifier,
-                "entryDate-" + identifier,
+                CURRENT_DATE_UTC,
                 currentOwnerRefName,
                 depositorRefName,
                 conditionCheckerOrAssessorRefName,
index 4a5fbbfc1e66f05e210178e5cc292d5c7d94ddbc..055323dadd3975db4942fc156bbd980c18ccb131 100644 (file)
@@ -65,6 +65,8 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
     private final Logger logger = LoggerFactory.getLogger(IntakeServiceTest.class);
     /** The known resource id. */
     private String knownResourceId = null;
+    private final static String CURRENT_DATE_UTC =
+            GregorianCalendarDateTimeUtils.currentDateUTC();
 
     @Override
     protected CollectionSpaceClient getClientInstance() {
@@ -465,7 +467,6 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
 
         // Update the content of this resource.
         intakeCommons.setEntryNumber("updated-" + intakeCommons.getEntryNumber());
-        intakeCommons.setEntryDate("updated-" + intakeCommons.getEntryDate());
         if (logger.isDebugEnabled()) {
             logger.debug("to be updated object");
             logger.debug(objectAsXmlString(intakeCommons, IntakesCommon.class));
@@ -507,8 +508,8 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
 
         Assert.assertNotNull(updatedIntake);
 
-        Assert.assertEquals(updatedIntake.getEntryDate(),
-                intakeCommons.getEntryDate(),
+        Assert.assertEquals(updatedIntake.getEntryNumber(),
+                intakeCommons.getEntryNumber(),
                 "Data in updated object did not match submitted data.");
 
         currentLocationGroupList = updatedIntake.getCurrentLocationGroupList();
@@ -908,7 +909,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
     protected PoxPayloadOut createInstance(String identifier) {
         return createIntakeInstance(
                 "entryNumber-" + identifier,
-                "entryDate-" + identifier,
+                CURRENT_DATE_UTC,
                 "depositor-" + identifier);
     }
 
index 51b062e451f14e3682eadbce30b0349c692dd1e4..03cf89909d41cf2b5c33f48e414dbbb5ac9df5d9 100644 (file)
@@ -38,6 +38,7 @@ import org.collectionspace.services.client.OrgAuthorityClientUtils;
 import org.collectionspace.services.client.PayloadOutputPart;\r
 import org.collectionspace.services.client.PoxPayloadOut;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;\r
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;\r
 import org.collectionspace.services.intake.ConditionCheckerOrAssessorList;\r
 import org.collectionspace.services.intake.IntakesCommon;\r
 import org.collectionspace.services.intake.InsurerList;\r
@@ -82,6 +83,8 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
     private String insurerRefName = null;\r
     private String valuerRefName = null;\r
     private final int NUM_AUTH_REF_DOCS_EXPECTED = 1;\r
+    private final static String CURRENT_DATE_UTC =\r
+            GregorianCalendarDateTimeUtils.currentDateUTC();\r
 \r
        @Override\r
        protected String getServiceName() {\r
@@ -126,7 +129,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest {
         IntakeClient intakeClient = new IntakeClient();\r
         PoxPayloadOut multipart = createIntakeInstance(\r
                 "entryNumber-" + identifier,\r
-                "entryDate-" + identifier,\r
+                CURRENT_DATE_UTC,\r
                 currentOwnerRefName,\r
                 // Use currentOwnerRefName twice to test fix for CSPACE-2863\r
                 currentOwnerRefName,    //depositorRefName,\r
index 8d99147c62e9a52555e8834a2382c04940c0a01a..0cbb97b3efe5f6971a501681099ccceaa2761c4e 100644 (file)
@@ -38,6 +38,7 @@ import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.intake.ConditionCheckerOrAssessorList;
 import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.intake.InsurerList;
@@ -84,6 +85,8 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
     private String valuerRefName = null;
     private String valuerShortId = null;
     private final int NUM_AUTH_REF_DOCS_EXPECTED = 1;
+    private final static String CURRENT_DATE_UTC =
+            GregorianCalendarDateTimeUtils.currentDateUTC();
 
     @Override
     public String getServiceName() { 
@@ -128,7 +131,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
         IntakeClient intakeClient = new IntakeClient();
         PoxPayloadOut multipart = createIntakeInstance(
                 "entryNumber-" + identifier,
-                "entryDate-" + identifier,
+                CURRENT_DATE_UTC,
                 currentOwnerRefName,
                 depositorRefName,
                 conditionCheckerAssessorRefName,
index 76f5c4f1711a621e7ab1c965384bce9057aa6c95..6b555c17609cafce9fe6cb2f8c736689b3089329 100644 (file)
@@ -47,6 +47,7 @@
                                                                        <xs:element name="docName"         type="xs:string" minOccurs="0" />
                                                                        <xs:element name="sourceField"     type="xs:string" minOccurs="1" />
                                                                        <xs:element name="uri"             type="xs:anyURI" minOccurs="1" />
+                                                                       <xs:element name="updatedAt"       type="xs:string" minOccurs="1" />
                                                                </xs:sequence>
                                                        </xs:complexType>
                                                </xs:element>
index 1ac4adc5b5765e53cd35da483445e8ab156f8da8..25286555786211dd8532d1a336c8628946496cd3 100644 (file)
                 <xs:element name="name" type="xs:string" />
                 <xs:element name="length" type="xs:string" />
                 <xs:element name="digest" type="xs:string" />
-                <xs:element name="dimensionGroupList" type="dimensionGroupList"/>
+                <xs:element name="measuredPartGroupList" type="measuredPartGroupList"/>
                 <xs:element name="uri" type="xs:string" />
                 <xs:element name="repositoryId" type="xs:string" />
-          </xs:sequence>
+            </xs:sequence>
         </xs:complexType>
     </xs:element>
     
-    <xs:complexType name="dimensionGroupList">
+    <xs:complexType name="measuredPartGroupList">
         <xs:sequence>
-            <xs:element name="dimensionGroup" type="dimensionGroup" minOccurs="0"
-                maxOccurs="unbounded"/>
+            <xs:element name="measuredPartGroup" type="measuredPartGroup" minOccurs="0"
+                   maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
-    
-    <xs:complexType name="dimensionGroup"> <!-- //FIXME: The "dimensionGroup" type should be declared in one place since other services use it -->
+    <xs:complexType name="measuredPartGroup">
         <xs:sequence>
             <xs:element name="measuredPart" type="xs:string"/>
+               <!-- Next field added to group in v1.13 -->
+            <xs:element name="dimensionSummary" type="xs:string"/>
+            <xs:element name="dimensionSubGroupList" type="dimensionSubGroupList"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="dimensionSubGroupList">
+        <xs:sequence>
+            <xs:element name="dimensionSubGroup" type="dimensionSubGroup" minOccurs="0" maxOccurs="unbounded" />
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="dimensionSubGroup">
+        <xs:sequence>
             <xs:element name="dimension" type="xs:string"/>
             <xs:element name="measuredBy" type="xs:string"/>
             <xs:element name="measurementUnit" type="xs:string"/>
             <xs:element name="measurementMethod" type="xs:string"/>
-            <xs:element name="value" type="xs:string"/>
+            <xs:element name="value" type="xs:decimal"/>
             <xs:element name="valueDate" type="xs:string"/>
             <xs:element name="valueQualifier" type="xs:string"/>
         </xs:sequence>
index bccb241b72ba74be50f02f6f8593e3d45894ec17..48e5fe1f36347479e933bdc2c75926f1c094a236 100644 (file)
         <xs:complexType>\r
             <xs:sequence>\r
                <xs:element name="csid" type="xs:string" />            \r
-                <xs:element name="documentId1" type="xs:string" minOccurs="1"/>\r
-                <xs:element name="documentType1" type="xs:string" minOccurs="1"/>\r
-                <xs:element name="documentId2" type="xs:string" minOccurs="1"/>\r
-                <xs:element name="documentType2" type="xs:string" minOccurs="1"/>\r
                 <!-- type of relationship between two entities -->\r
                 <xs:element name="relationshipType" type="xs:string" minOccurs="1"/>\r
                 <xs:element name="predicateDisplayName" type="xs:string" minOccurs="1"/>\r
index b6ec0d8821e7905116b9a0faa48c14c88eb7eeb1..6503d151b04fcfee0e706bfa7380936d923d29fa 100644 (file)
     <xs:element name="loanInNumber" type="xs:string"/>\r
     <xs:element name="lenderGroupList" type="lenderGroupList"/>\r
     <xs:element name="loanInContact" type="xs:string"/>\r
+    <xs:element name="borrowersContact" type="xs:string"/>\r
     <xs:element name="borrowersAuthorizer" type="xs:string"/>\r
+    <xs:element name="borrowersAuthorizationDate" type="xs:date"/>\r
     <xs:element name="loanInConditions" type="xs:string"/>\r
-    <xs:element name="loanInDate" type="xs:string"/>\r
-    <xs:element name="loanReturnDate" type="xs:string"/>\r
-    <xs:element name="loanRenewalApplicationDate" type="xs:string"/>\r
+    <xs:element name="loanInDate" type="xs:date"/>\r
+    <xs:element name="loanReturnDate" type="xs:date"/>\r
+    <xs:element name="loanRenewalApplicationDate" type="xs:date"/>\r
     <xs:element name="loanInNote" type="xs:string"/>\r
     <xs:element name="loanPurpose" type="xs:string"/>\r
+    <xs:element name="loanStatusGroupList" type="loanStatusGroupList"/>\r
 \r
     <xs:complexType name="lenderGroupList">\r
        <xs:sequence>\r
        <xs:sequence>\r
            <xs:element name="lender" type="xs:string"/>\r
            <xs:element name="lendersAuthorizer" type="xs:string"/>\r
-           <xs:element name="lendersAuthorizationDate" type="xs:string"/>\r
+           <xs:element name="lendersAuthorizationDate" type="xs:date"/>\r
            <xs:element name="lendersContact" type="xs:string"/>\r
        </xs:sequence>\r
     </xs:complexType>\r
+    \r
+    <xs:complexType name="loanStatusGroupList">\r
+       <xs:sequence>\r
+           <xs:element name="loanStatusGroup" type="loanStatusGroup" minOccurs="0"\r
+                   maxOccurs="unbounded"/>\r
+       </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <xs:complexType name="loanStatusGroup">\r
+       <xs:sequence>\r
+           <xs:element name="loanStatus" type="xs:string"/>\r
+           <xs:element name="loanStatusDate" type="xs:date"/>\r
+           <xs:element name="loanStatusNote" type="xs:string"/>\r
+       </xs:sequence>\r
+    </xs:complexType>\r
 \r
 </xs:schema>\r
index f6e2dcf3cffadd8773da45be6b7c8b4983a5713e..c21b3a400185b36724600539ec7de991365d1cb1 100644 (file)
@@ -41,6 +41,7 @@ import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanin.LenderGroup;
 import org.collectionspace.services.loanin.LenderGroupList;
@@ -83,6 +84,8 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
     // FIXME: Value changed from 5 to 2 when repeatable / multivalue 'lenders'
     // group was added to tenant-bindings.xml
     private final int NUM_AUTH_REFS_EXPECTED = 2;
+    private final static String CURRENT_DATE_UTC =
+            GregorianCalendarDateTimeUtils.currentDateUTC();
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
@@ -126,7 +129,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest {
         LoaninClient loaninClient = new LoaninClient();
         PoxPayloadOut multipart = createLoaninInstance(
                 "loanInNumber-" + identifier,
-                "returnDate-" + identifier,
+                CURRENT_DATE_UTC,
                lenderRefName,
                 lendersAuthorizerRefName,
                 lendersContactRefName,
index a101f882307788277cb52d478cf0867a44aad9e2..a2820ff57907e6e64d83174f3b06c152670a26dd 100644 (file)
@@ -34,6 +34,7 @@ import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.AbstractCommonListUtils;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanin.LenderGroup;
 import org.collectionspace.services.loanin.LenderGroupList;
@@ -65,7 +66,9 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
     /** The known resource id. */
     private String knownResourceId = null;
     private String LENDER_REF_NAME =
-            "urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth):person:name(Harry Lender)'Harry Lender'";
+            "urn:cspace:org.collectionspace.demo:personauthorities:name(TestPersonAuth):item:name(HarryLender)'Harry Lender'";
+    private final static String CURRENT_DATE_UTC =
+            GregorianCalendarDateTimeUtils.currentDateUTC();
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
@@ -477,7 +480,6 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
 
         // Update the content of this resource.
         loaninCommon.setLoanInNumber("updated-" + loaninCommon.getLoanInNumber());
-        loaninCommon.setLoanReturnDate("updated-" + loaninCommon.getLoanReturnDate());
         loaninCommon.setLoanInNote("updated-" + loaninCommon.getLoanInNote());
         if (logger.isDebugEnabled()) {
             logger.debug("to be updated object");
@@ -513,8 +515,8 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
         Assert.assertNotNull(updatedLoaninCommon);
 
         // Check selected fields in the updated common part.
-        Assert.assertEquals(updatedLoaninCommon.getLoanReturnDate(),
-                loaninCommon.getLoanReturnDate(),
+        Assert.assertEquals(updatedLoaninCommon.getLoanInNumber(),
+                loaninCommon.getLoanInNumber(),
                 "Data in updated object did not match submitted data.");
 
         if (logger.isDebugEnabled()) {
@@ -831,7 +833,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl {
 
         LoansinCommon loaninCommon = new LoansinCommon();
         loaninCommon.setLoanInNumber(loaninNumber);
-        loaninCommon.setLoanReturnDate(returnDate);
+        loaninCommon.setLoanReturnDate(CURRENT_DATE_UTC);
         LenderGroupList lenderGroupList = new LenderGroupList();
         LenderGroup lenderGroup = new LenderGroup();
         lenderGroup.setLender(LENDER_REF_NAME);
index 9fe86ee6784d333bdeb427b090d9d2ec624e61a9..f330feae4768b1e8cd30c7105b0a8421cffb8649 100644 (file)
 -->
 <!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+In+Schema -->    
     
-    <!-- loanin -->
+    <!--  Loan In Information Group -->
     <xs:element name="loansin_common">
         <xs:complexType>
-            <xs:sequence>                
-                <!--  Loan In Information Group -->
+            <xs:sequence> 
                 <xs:element name="loanInNumber" type="xs:string"/>
                 <xs:element name="lenderGroupList" type="lenderGroupList"/>
                 <xs:element name="loanInContact" type="xs:string"/>
+                <xs:element name="borrowersContact" type="xs:string"/>
                 <xs:element name="borrowersAuthorizer" type="xs:string"/>
+                <xs:element name="borrowersAuthorizationDate" type="xs:string"/>
                 <xs:element name="loanInConditions" type="xs:string"/>
                 <xs:element name="loanInDate" type="xs:string"/>
                 <xs:element name="loanReturnDate" type="xs:string"/>
                 <xs:element name="loanRenewalApplicationDate" type="xs:string"/>
                 <xs:element name="loanInNote" type="xs:string"/>
                 <xs:element name="loanPurpose" type="xs:string"/>
+                <xs:element name="loanStatusGroupList" type="loanStatusGroupList"/>
             </xs:sequence>
         </xs:complexType>
     </xs:element>
 
     <xs:complexType name="lenderGroupList">
-       <xs:sequence>
-           <xs:element name="lenderGroup" type="lenderGroup" minOccurs="0"
+        <xs:sequence>
+            <xs:element name="lenderGroup" type="lenderGroup" minOccurs="0"
                    maxOccurs="unbounded"/>
-       </xs:sequence>
+        </xs:sequence>
     </xs:complexType>
 
     <xs:complexType name="lenderGroup">
-       <xs:sequence>
-           <xs:element name="lender" type="xs:string"/>
-           <xs:element name="lendersAuthorizer" type="xs:string"/>
-           <xs:element name="lendersAuthorizationDate" type="xs:string"/>
-           <xs:element name="lendersContact" type="xs:string"/>
-       </xs:sequence>
+        <xs:sequence>
+            <xs:element name="lender" type="xs:string"/>
+            <xs:element name="lendersAuthorizer" type="xs:string"/>
+            <xs:element name="lendersAuthorizationDate" type="xs:string"/>
+            <xs:element name="lendersContact" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="loanStatusGroupList">
+        <xs:sequence>
+            <xs:element name="loanStatusGroup" type="loanStatusGroup" minOccurs="0"
+                   maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="loanStatusGroup">
+        <xs:sequence>
+            <xs:element name="loanStatus" type="xs:string"/>
+            <xs:element name="loanStatusDate" type="xs:string"/>
+            <xs:element name="loanStatusNote" type="xs:string"/>
+        </xs:sequence>
     </xs:complexType>
     
 </xs:schema>
index 428076085428e60fe46017d3bf08becd0663947f..beee4fe4938e60a40c4e4d3a157592b15bce2d1c 100644 (file)
     <!--  Loan Out Information Group -->\r
     <xs:element name="loanOutNumber" type="xs:string"/>\r
     <xs:element name="borrower" type="xs:string"/>\r
+    <xs:element name="borrowersAuthorizer" type="xs:string"/>\r
+    <xs:element name="borrowersAuthorizationDate" type="xs:date"/>\r
     <xs:element name="borrowersContact" type="xs:string"/>\r
     <xs:element name="lendersAuthorizer" type="xs:string"/>\r
-    <xs:element name="lendersAuthorizationDate" type="xs:string"/>\r
+    <xs:element name="lendersAuthorizationDate" type="xs:date"/>\r
     <xs:element name="lendersContact" type="xs:string"/>\r
 \r
-    <xs:element name="loanedObjectStatusGroupList" type="loanedObjectStatusGroupList"/>\r
+    <xs:element name="loanStatusGroupList" type="loanStatusGroupList"/>\r
     \r
-    <xs:element name="loanOutDate" type="xs:string"/>\r
-    <xs:element name="loanReturnDate" type="xs:string"/>\r
-    <xs:element name="loanRenewalApplicationDate" type="xs:string"/>\r
+    <xs:element name="loanOutDate" type="xs:date"/>\r
+    <xs:element name="loanReturnDate" type="xs:date"/>\r
+    <xs:element name="loanRenewalApplicationDate" type="xs:date"/>\r
     <xs:element name="specialConditionsOfLoan" type="xs:string"/>\r
     <xs:element name="loanOutNote" type="xs:string"/>\r
     <xs:element name="loanPurpose" type="xs:string"/>\r
 \r
-    <xs:complexType name="loanedObjectStatusGroupList">\r
+    <xs:complexType name="loanStatusGroupList">\r
         <xs:sequence>\r
-            <xs:element name="loanedObjectStatusGroup" type="loanedObjectStatusGroup" minOccurs="0" maxOccurs="unbounded"/>\r
+            <xs:element name="loanStatusGroup" type="loanStatusGroup" minOccurs="0" maxOccurs="unbounded"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
 \r
-    <xs:complexType name="loanedObjectStatusGroup">\r
+    <xs:complexType name="loanStatusGroup">\r
         <xs:sequence>\r
-            <xs:element name="loanedObjectStatus" type="xs:string"/>\r
-            <xs:element name="loanedObjectStatusDate" type="xs:string"/>\r
-            <xs:element name="loanedObjectStatusNote" type="xs:string"/>\r
+            <xs:element name="loanStatus" type="xs:string"/>\r
+            <xs:element name="loanStatusDate" type="xs:date"/>\r
+            <xs:element name="loanStatusNote" type="xs:string"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
     \r
index dd96fe9cc2906a9864925bfbab5068263e581c2f..543f355d90ab1105d80992beb35e8f0a711b6afa 100644 (file)
@@ -40,6 +40,7 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
 //import org.collectionspace.services.common.authorityref.AuthorityRefList.AuthorityRefItem;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.loanout.LoansoutCommon;
 //import org.collectionspace.services.loanout.LoansoutCommonList;
@@ -82,6 +83,9 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
     // authority - as an authRef to tests below, and increase the
     // number of expected authRefs to 4.
     private final int NUM_AUTH_REFS_EXPECTED = 4;
+    
+    private final static String CURRENT_DATE_UTC =
+            GregorianCalendarDateTimeUtils.currentDateUTC();
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
@@ -125,7 +129,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest {
         LoanoutClient loanoutClient = new LoanoutClient();
         PoxPayloadOut multipart = createLoanoutInstance(
                 "loanOutNumber-" + identifier,
-                "returnDate-" + identifier,
+                CURRENT_DATE_UTC,
                 borrowerRefName,
                 borrowersContactRefName,
                 lendersAuthorizerRefName,
index 960397b6468a3d7472fa1f6eda3e885c6763a453..346b757f10abe97e84e8d7b27d80e972b344f455 100644 (file)
@@ -33,9 +33,10 @@ import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.AbstractCommonListUtils;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.loanout.LoanedObjectStatusGroup;
-import org.collectionspace.services.loanout.LoanedObjectStatusGroupList;
+import org.collectionspace.services.loanout.LoanStatusGroup;
+import org.collectionspace.services.loanout.LoanStatusGroupList;
 import org.collectionspace.services.loanout.LoansoutCommon;
 
 import org.jboss.resteasy.client.ClientResponse;
@@ -60,6 +61,8 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     /** The known resource id. */
     private String knownResourceId = null;
+    private final static String CURRENT_DATE_UTC =
+        GregorianCalendarDateTimeUtils.currentDateUTC();
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
@@ -303,14 +306,14 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         // Check selected fields in the common part.
         Assert.assertNotNull(loanoutCommon.getLoanOutNumber());
 
-        LoanedObjectStatusGroupList statusGroupList = loanoutCommon.getLoanedObjectStatusGroupList();
+        LoanStatusGroupList statusGroupList = loanoutCommon.getLoanStatusGroupList();
         Assert.assertNotNull(statusGroupList);
-        List<LoanedObjectStatusGroup> statusGroups = statusGroupList.getLoanedObjectStatusGroup();
+        List<LoanStatusGroup> statusGroups = statusGroupList.getLoanStatusGroup();
         Assert.assertNotNull(statusGroups);
         Assert.assertTrue(statusGroups.size() > 0);
-        LoanedObjectStatusGroup statusGroup = statusGroups.get(0);
+        LoanStatusGroup statusGroup = statusGroups.get(0);
         Assert.assertNotNull(statusGroup);
-        Assert.assertNotNull(statusGroup.getLoanedObjectStatus());
+        Assert.assertNotNull(statusGroup.getLoanStatus());
 
         // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
         if (logger.isDebugEnabled()) {
@@ -436,19 +439,18 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
 
         // Update the content of this resource.
         loanoutCommon.setLoanOutNumber("updated-" + loanoutCommon.getLoanOutNumber());
-        loanoutCommon.setLoanReturnDate("updated-" + loanoutCommon.getLoanReturnDate());
-        LoanedObjectStatusGroupList statusGroupList = loanoutCommon.getLoanedObjectStatusGroupList();
+        LoanStatusGroupList statusGroupList = loanoutCommon.getLoanStatusGroupList();
         Assert.assertNotNull(statusGroupList);
-        List<LoanedObjectStatusGroup> statusGroups = statusGroupList.getLoanedObjectStatusGroup();
+        List<LoanStatusGroup> statusGroups = statusGroupList.getLoanStatusGroup();
         Assert.assertNotNull(statusGroups);
         Assert.assertTrue(statusGroups.size() > 0);
-        LoanedObjectStatusGroup statusGroup = statusGroups.get(0);
+        LoanStatusGroup statusGroup = statusGroups.get(0);
         Assert.assertNotNull(statusGroup);
-        String loanedObjectStatus = statusGroup.getLoanedObjectStatus();
-        Assert.assertNotNull(loanedObjectStatus);
-        String updatedLoanedObjectStatus = "updated-" + loanedObjectStatus;
-        statusGroups.get(0).setLoanedObjectStatus(updatedLoanedObjectStatus);
-        loanoutCommon.setLoanedObjectStatusGroupList(statusGroupList);
+        String loanStatus = statusGroup.getLoanStatus();
+        Assert.assertNotNull(loanStatus);
+        String updatedLoanStatus = "updated-" + loanStatus;
+        statusGroups.get(0).setLoanStatus(updatedLoanStatus);
+        loanoutCommon.setLoanStatusGroupList(statusGroupList);
         if (logger.isDebugEnabled()) {
             logger.debug("to be updated object");
             logger.debug(objectAsXmlString(loanoutCommon, LoansoutCommon.class));
@@ -480,20 +482,20 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         Assert.assertNotNull(updatedLoanoutCommon);
 
         // Check selected fields in the updated resource.
-        Assert.assertEquals(updatedLoanoutCommon.getLoanReturnDate(),
-                loanoutCommon.getLoanReturnDate(),
+        Assert.assertEquals(updatedLoanoutCommon.getLoanOutNumber(),
+                loanoutCommon.getLoanOutNumber(),
                 "Data in updated object did not match submitted data.");
 
-        LoanedObjectStatusGroupList updatedStatusGroupList =
-                updatedLoanoutCommon.getLoanedObjectStatusGroupList();
+        LoanStatusGroupList updatedStatusGroupList =
+                updatedLoanoutCommon.getLoanStatusGroupList();
         Assert.assertNotNull(updatedStatusGroupList);
-        List<LoanedObjectStatusGroup> updatedStatusGroups =
-                updatedStatusGroupList.getLoanedObjectStatusGroup();
+        List<LoanStatusGroup> updatedStatusGroups =
+                updatedStatusGroupList.getLoanStatusGroup();
         Assert.assertNotNull(updatedStatusGroups);
         Assert.assertTrue(updatedStatusGroups.size() > 0);
         Assert.assertNotNull(updatedStatusGroups.get(0));
-        Assert.assertEquals(updatedLoanedObjectStatus,
-                updatedStatusGroups.get(0).getLoanedObjectStatus(),
+        Assert.assertEquals(updatedLoanStatus,
+                updatedStatusGroups.get(0).getLoanStatus(),
                 "Data in updated object did not match submitted data.");
 
         // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
@@ -773,7 +775,7 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
     private PoxPayloadOut createLoanoutInstance(String identifier) {
         return createLoanoutInstance(
                 "loanoutNumber-" + identifier,
-                "returnDate-" + identifier);
+                CURRENT_DATE_UTC);
     }
 
     /**
@@ -789,17 +791,17 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         loanoutCommon.setLoanOutNumber(loanOutNumber);
         loanoutCommon.setLoanReturnDate(returnDate);
         loanoutCommon.setBorrower(
-                "urn:cspace:org.collectionspace.demo:orgauthority:name(TestOrgAuth):organization:name(Northern Climes Museum)'Northern Climes Museum'");
+                "urn:cspace:org.collectionspace.demo:orgauthorities:name(TestOrgAuth):item:name(NorthernClimesMuseum)'Northern Climes Museum'");
         loanoutCommon.setBorrowersContact(
-                "urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth):person:name(Chris Contact)'Chris Contact'");
+                "urn:cspace:org.collectionspace.demo:personauthorities:name(TestPersonAuth):item:name(ChrisContact)'Chris Contact'");
         loanoutCommon.setLoanPurpose("Allow people in cold climes to share the magic of Surfboards of the 1960s.");
-        LoanedObjectStatusGroupList statusGroupList = new LoanedObjectStatusGroupList();
-        List<LoanedObjectStatusGroup> statusGroups = statusGroupList.getLoanedObjectStatusGroup();
-        LoanedObjectStatusGroup statusGroup = new LoanedObjectStatusGroup();
-        statusGroup.setLoanedObjectStatus("returned");
-        statusGroup.setLoanedObjectStatusNote("Left under the front mat.");
+        LoanStatusGroupList statusGroupList = new LoanStatusGroupList();
+        List<LoanStatusGroup> statusGroups = statusGroupList.getLoanStatusGroup();
+        LoanStatusGroup statusGroup = new LoanStatusGroup();
+        statusGroup.setLoanStatus("returned");
+        statusGroup.setLoanStatusNote("Left under the front mat.");
         statusGroups.add(statusGroup);
-        loanoutCommon.setLoanedObjectStatusGroupList(statusGroupList);
+        loanoutCommon.setLoanStatusGroupList(statusGroupList);
         loanoutCommon.setLoanOutNote(getUTF8DataFragment());  // For UTF-8 tests
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
index 6f69e019fa3a07e1d9c3fc2165cecd07b192940e..0bbb9b50e24e74a6f56e6e1e46d2f3df61309a47 100644 (file)
                 <!--  Loan Out Information Group -->
                 <xs:element name="loanOutNumber" type="xs:string"/>
                 <xs:element name="borrower" type="xs:string"/>
+                <xs:element name="borrowersAuthorizer" type="xs:string"/>
+                <xs:element name="borrowersAuthorizationDate" type="xs:string"/>
                 <xs:element name="borrowersContact" type="xs:string"/>
                 <xs:element name="lendersAuthorizer" type="xs:string"/>
                 <xs:element name="lendersAuthorizationDate" type="xs:string"/>
                 <xs:element name="lendersContact" type="xs:string"/>
                 
-                <xs:element name="loanedObjectStatusGroupList" type="loanedObjectStatusGroupList"/>
+                <xs:element name="loanStatusGroupList" type="loanStatusGroupList"/>
 
                 <xs:element name="loanOutDate" type="xs:string"/>
                 <xs:element name="loanReturnDate" type="xs:string"/>
         </xs:complexType>
     </xs:element>
 
-    <xs:complexType name="loanedObjectStatusGroupList">
+    <xs:complexType name="loanStatusGroupList">
         <xs:sequence>
-            <xs:element name="loanedObjectStatusGroup" type="loanedObjectStatusGroup" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="loanStatusGroup" type="loanStatusGroup" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
 
-    <xs:complexType name="loanedObjectStatusGroup">
+    <xs:complexType name="loanStatusGroup">
         <xs:sequence>
-            <xs:element name="loanedObjectStatus" type="xs:string"/>
-            <xs:element name="loanedObjectStatusDate" type="xs:string"/>
-            <xs:element name="loanedObjectStatusNote" type="xs:string"/>
+            <xs:element name="loanStatus" type="xs:string"/>
+            <xs:element name="loanStatusDate" type="xs:date"/>
+            <xs:element name="loanStatusNote" type="xs:string"/>
         </xs:sequence>
     </xs:complexType>
     
-    
 </xs:schema>
 
index 738bf80abe1ad858e587361e9c239782321cfcf1..d0c24796d62b98aa80a3b813270c96559947a25c 100644 (file)
@@ -49,7 +49,7 @@
     <xs:complexType name="conditionGroup">
         <xs:sequence>
                                        <xs:element name="conditionNote" type="xs:string"/>
-                                       <xs:element name="conditionNoteDate" type="xs:string"/>
+                                       <xs:element name="conditionNoteDate" type="xs:date"/>
         </xs:sequence>
     </xs:complexType>
     
index 0f4e44fc3e61f8068a57ecd362710f8a053fc03c..e6df03a94e7b69e7abbb1bf477c818c15d245a79 100644 (file)
@@ -34,6 +34,7 @@ import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.AbstractCommonListUtils;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.client.LocationAuthorityClient;
 import org.collectionspace.services.client.LocationAuthorityClientUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
@@ -65,6 +66,8 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     private final Logger logger = LoggerFactory.getLogger(LocationAuthorityServiceTest.class);
     private final String REFNAME = "refName";
     private final String DISPLAYNAME = "displayName";
+    private final static String CURRENT_DATE_UTC =
+        GregorianCalendarDateTimeUtils.currentDateUTC();
 
        @Override
        public String getServicePathComponent() {
@@ -94,7 +97,7 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     final String TEST_NAME = "Shelf 1";
     final String TEST_SHORTID = "shelf1";
     final String TEST_CONDITION_NOTE = "Basically clean";
-    final String TEST_CONDITION_NOTE_DATE = "June 11, 1979";
+    final String TEST_CONDITION_NOTE_DATE = CURRENT_DATE_UTC;
     final String TEST_SECURITY_NOTE = "Kind of safe";
     final String TEST_ACCESS_NOTE = "Only right-thinkers may see";
     final String TEST_ADDRESS = "123 Main Street, Anytown USA";
index 74e1265db443b93b74e13f63be5b34cac6765342..d3b9f05dc984e6c933869997d1d75964422eaf38 100644 (file)
@@ -36,8 +36,9 @@
     <xs:element name="dateCreated" type="xs:string"/>\r
     <xs:element name="dateModified" type="xs:string"/>\r
     <xs:element name="description" type="xs:string"/>\r
-    <xs:element name="dimensionSummary" type="xs:string"/>\r
-    <xs:element name="dimensionGroupList" type="dimensionGroupList"/>\r
+\r
+     <!-- Changed name of next field from dimensionGroupList (type="dimensionGroupList") in v1.13 when adding repeatable sub group -->\r
+    <xs:element name="measuredPartGroupList" type="measuredPartGroupList"/>\r
     <xs:element name="filename" type="xs:string"/>\r
     <xs:element name="format" type="xs:string"/>\r
     <xs:element name="identificationNumber" type="xs:string"/>\r
     <xs:element name="uri" type="xs:string" />\r
     <xs:element name="blobCsid" type="xs:string" />\r
 \r
-    <xs:complexType name="dimensionGroupList">\r
+    <!-- Changed names, as of v1.13: dimensionGroupList became measuredPartGroupList, dimensionGroup became measuredPartGroup. -->\r
+    <xs:complexType name="measuredPartGroupList">\r
         <xs:sequence>\r
-            <xs:element name="dimensionGroup" type="dimensionGroup" minOccurs="0"\r
+            <xs:element name="measuredPartGroup" type="measuredPartGroup" minOccurs="0"\r
                 maxOccurs="unbounded"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
-    <xs:complexType name="dimensionGroup">\r
+    <xs:complexType name="measuredPartGroup">\r
         <xs:sequence>\r
             <xs:element name="measuredPart" type="xs:string"/>\r
+            <xs:element name="dimensionSummary" type="xs:string"/>\r
+            <xs:element name="dimensionSubGroupList" type="dimensionSubGroupList"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <xs:complexType name="dimensionSubGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="dimensionSubGroup" type="dimensionSubGroup" minOccurs="0" maxOccurs="unbounded" />\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <xs:complexType name="dimensionSubGroup">\r
+        <xs:sequence>\r
             <xs:element name="dimension" type="xs:string"/>\r
             <xs:element name="measuredBy" type="xs:string"/>\r
             <xs:element name="measurementUnit" type="xs:string"/>\r
             <xs:element name="measurementMethod" type="xs:string"/>\r
             <xs:element name="value" type="xs:decimal"/>\r
-            <xs:element name="valueDate" type="xs:string"/>\r
+            <xs:element name="valueDate" type="xs:date"/>\r
             <xs:element name="valueQualifier" type="xs:string"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
index 8150912dce2ba3bcc74cd17441852fd58f34bc71..2040536da6f24c6cffbec22f99fa141c5bab8e0f 100644 (file)
@@ -40,8 +40,8 @@
                 <xs:element name="dateCreated" type="xs:string"/>
                 <xs:element name="dateModified" type="xs:string"/>
                 <xs:element name="description" type="xs:string"/>
-                <xs:element name="dimensionSummary" type="xs:string"/>
-                <xs:element name="dimensionGroupList" type="dimensionGroupList"/>
+                 <!-- Changed name of next field from dimensionGroupList (type="dimensionGroupList") in v1.13 when adding repeatable sub group -->
+                <xs:element name="measuredPartGroupList" type="measuredPartGroupList"/>
                 <xs:element name="filename" type="xs:string"/>
                 <xs:element name="format" type="xs:string"/>
                 <xs:element name="identificationNumber" type="xs:string"/>
@@ -50,8 +50,8 @@
                 <xs:element name="publisher" type="xs:string"/>
                 <xs:element name="relationList" type="relationList"/>
                 <xs:element name="rightsHolder" type="xs:string"/>
-                           <xs:element name="source" type="xs:string"/>
-                           <xs:element name="sourceUrl" type="xs:string"/>
+                <xs:element name="source" type="xs:string"/>
+                <xs:element name="sourceUrl" type="xs:string"/>
                 <xs:element name="subjectList" type="subjectList"/>
                 <xs:element name="title" type="xs:string"/>
                 <xs:element name="typeList" type="typeList"/>
         </xs:sequence>
     </xs:complexType>
 
-    <xs:complexType name="dimensionGroupList">
+    <!-- Changed names, as of v1.13: dimensionGroupList became measuredPartGroupList, dimensionGroup became measuredPartGroup. -->
+    <xs:complexType name="measuredPartGroupList">
         <xs:sequence>
-            <xs:element name="dimensionGroup" type="dimensionGroup" minOccurs="0"
+            <xs:element name="measuredPartGroup" type="measuredPartGroup" minOccurs="0"
                 maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
-    <xs:complexType name="dimensionGroup">
+    <xs:complexType name="measuredPartGroup">
         <xs:sequence>
             <xs:element name="measuredPart" type="xs:string"/>
+            <xs:element name="dimensionSummary" type="xs:string"/>
+            <xs:element name="dimensionSubGroupList" type="dimensionSubGroupList"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="dimensionSubGroupList">
+        <xs:sequence>
+            <xs:element name="dimensionSubGroup" type="dimensionSubGroup" minOccurs="0" maxOccurs="unbounded" />
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="dimensionSubGroup">
+        <xs:sequence>
             <xs:element name="dimension" type="xs:string"/>
             <xs:element name="measuredBy" type="xs:string"/>
             <xs:element name="measurementUnit" type="xs:string"/>
index 5cdf43fcbce79dfc4bff326710bd4f0e13313f45..21261a2bf4470c6089a59d412566be494e33418f 100644 (file)
@@ -24,7 +24,7 @@
     <xs:element name="currentLocation" type="xs:string"/>\r
     <xs:element name="currentLocationFitness" type="xs:string"/>\r
     <xs:element name="currentLocationNote" type="xs:string"/>\r
-    <xs:element name="locationDate" type="xs:dateTime"/>\r
+    <xs:element name="locationDate" type="xs:date"/>\r
     <xs:element name="normalLocation" type="xs:string"/>\r
     \r
     <!--  Movement Information Group -->\r
@@ -38,8 +38,8 @@
     </xs:element>\r
     <xs:element name="movementNote" type="xs:string"/>\r
     <xs:element name="movementReferenceNumber" type="xs:string"/>\r
-    <xs:element name="plannedRemovalDate" type="xs:dateTime"/>\r
-    <xs:element name="removalDate" type="xs:dateTime"/>\r
+    <xs:element name="plannedRemovalDate" type="xs:date"/>\r
+    <xs:element name="removalDate" type="xs:date"/>\r
     <xs:element name="reasonForMove" type="xs:string"/>\r
     \r
 </xs:schema>\r
index 2a10656982183af6f33719502be320d41ed5d0e0..e2cd068b5647616043c716f7f3ca6ef23aadc719 100644 (file)
@@ -69,7 +69,8 @@ public class MovementServiceTest extends AbstractServiceTestImpl {
 
     // Instance variables specific to this test.
     private String knownResourceId = null;
-    private final static String TIMESTAMP_UTC = GregorianCalendarDateTimeUtils.timestampUTC();
+    private final static String TIMESTAMP_UTC =
+            GregorianCalendarDateTimeUtils.timestampUTC();
     
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
@@ -824,70 +825,4 @@ public class MovementServiceTest extends AbstractServiceTestImpl {
         return multipart;
     }
 
-    // FIXME Should be moved to a common class, as these are general utilities.
-    // FIXME Should be refactored to become a convenience variant of a
-    // general method to return a current datestamp or timestamp in any
-    // provided time zone.
-
-   /**
-    * Returns an ISO 8601 formatted timestamp of the
-    * current time instance in the UTC time zone.
-    */
-    public String datestampUTC() {
-        final String ISO_8601_DATE_FORMAT_PATTERN = "yyyy-MM-dd";
-        final DateFormat ISO_8601_DATE_FORMAT =
-            new SimpleDateFormat(ISO_8601_DATE_FORMAT_PATTERN);
-
-        final String UTC_TIMEZONE_IDENTIFIER = "UTC";
-        final TimeZone UTC_TIMEZONE = TimeZone.getTimeZone(UTC_TIMEZONE_IDENTIFIER);
-
-        Date timestamp = new Date();
-        return formatDate(timestamp, UTC_TIMEZONE, ISO_8601_DATE_FORMAT);
-    }
-
-   /**
-    * Returns an ISO 8601 formatted timestamp of the
-    * current time instance in the UTC time zone.
-    */
-    public String timestampUTC() {
-        final String ISO_8601_FORMAT_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'";
-        final DateFormat ISO_8601_FORMAT =
-            new SimpleDateFormat(ISO_8601_FORMAT_PATTERN);
-
-        final String UTC_TIMEZONE_IDENTIFIER = "UTC";
-        final TimeZone UTC_TIMEZONE = TimeZone.getTimeZone(UTC_TIMEZONE_IDENTIFIER);
-
-        Date timestamp = new Date();
-        return formatDate(timestamp, UTC_TIMEZONE, ISO_8601_FORMAT);
-    }
-
-   /**
-    * Formats a provided date using a provided date formatter,
-    * in the default system time zone.
-    *
-    * @param date  A date to format.
-    * @param df    A date formatter to apply.
-    * @return      A formatted date string.
-    */
-    public String formatDate(Date date, DateFormat df) {
-        return formatDate(date, TimeZone.getDefault(), df);
-    }
-
-    // FIXME Add error handling.
-
-   /**
-    * Formats a provided date using a provided date formatter,
-    * in a provided time zone.
-    *
-    * @param date  A date to format.
-    * @param tz    The time zone qualifier for the date to format.
-    * @param df    A date formatter to apply.
-    *
-    * @return      A formatted date string.
-    */
-    public String formatDate(Date date, TimeZone tz, DateFormat df) {
-        df.setTimeZone(tz);
-        return df.format(date);
-    }
-
 }
index 1aef98e8d08f72c37ef206e1ef03dd3a0edaf937..d2045e3c5499295e2f2f5baf0fa5fb6bc2180179 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
 \r
 <!--\r
-    Loan Out schema (XSD)\r
+    Object Exit schema (XSD)\r
     \r
     Entity  : ObjectExit\r
     Part    : Common\r
@@ -23,7 +23,7 @@
     <!--  ObjectExit Information Group -->\r
     <xs:element name="currentOwner" type="xs:string"/>\r
     <xs:element name="depositor" type="xs:string"/>\r
-    <xs:element name="exitDate" type="xs:string"/>\r
+    <xs:element name="exitDate" type="xs:date"/>\r
     <xs:element name="exitMethods">\r
         <xs:complexType>\r
             <xs:sequence>\r
index 9edd7371b3e1c7ebf5f6da98f43686077cb68f5b..6f55f6b105539c03755caf1ae0519f25e882b225 100644 (file)
@@ -40,6 +40,7 @@ import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.objectexit.ObjectexitCommon;
 
@@ -70,6 +71,8 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
     private String depositorRefName = null;
     private String exitDate = null;
     private String exitNumber = null;
+    private final static String CURRENT_DATE_UTC =
+            GregorianCalendarDateTimeUtils.currentDateUTC();
 
     @Override
        public String getServicePathComponent() {
@@ -116,7 +119,8 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
         // Create a new Loans In resource. One or more fields in this resource will be PersonAuthority
         //    references, and will refer to Person resources by their refNames.
         ObjectExitClient objectexitClient = new ObjectExitClient();
-        PoxPayloadOut multipart = createObjectExitInstance(depositorRefName, "exitNumber-" + identifier, "exitDate-" + identifier);
+        PoxPayloadOut multipart = createObjectExitInstance(depositorRefName,
+                "exitNumber-" + identifier, CURRENT_DATE_UTC);
         ClientResponse<Response> res = objectexitClient.create(multipart);
         assertStatusCode(res, testName);
         if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
@@ -171,7 +175,6 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest {
 
         // Check a couple of fields
         Assert.assertEquals(objectexit.getDepositor(), depositorRefName);
-        Assert.assertEquals(objectexit.getExitDate(), exitDate);
         Assert.assertEquals(objectexit.getExitNumber(), exitNumber);
 
         // Get the auth refs and check them
index c82c14a5c53a1cc77a72f47b3142c585fa13770b..0fb56d74033db97ac0d66ad685a543ea35029abe 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 
 <!--
-    Loan Out schema (XSD)
+    Object Exit schema (XSD)
     
     Entity  : ObjectExit
     Part    : Common
index 6fb6ac67d0d5603170251a23df943cbb3972fd7b..70e2ceeb161707d52a9a189dd3dfe7fecbd8cf7f 100644 (file)
@@ -61,18 +61,20 @@ public class PersonAuthorityValidatorHandler implements ValidatorHandler {
             String msg = "";
             boolean invalid = false;
 
-            // Validation specific to creates or updates
-            if (action.equals(Action.CREATE)) {
-                String shortId = personAuth.getShortIdentifier();
-                // Per CSPACE-2215, shortIdentifier values that are null (missing)
-                // oe the empty string are now legally accepted in create payloads.
-                // In either of those cases, a short identifier will be synthesized from
-                // a display name or supplied in another manner.
-                if ((shortId != null) && (shortIdBadPattern.matcher(shortId).find())) {
-                    invalid = true;
-                    msg += "shortIdentifier must only contain standard word characters";
-                }
-            } else if (action.equals(Action.UPDATE)) {
+            if(personAuth != null) {   // No guarantee that there is a common part in every post/update.
+                   // Validation specific to creates or updates
+                   if (action.equals(Action.CREATE)) {
+                       String shortId = personAuth.getShortIdentifier();
+                       // Per CSPACE-2215, shortIdentifier values that are null (missing)
+                       // oe the empty string are now legally accepted in create payloads.
+                       // In either of those cases, a short identifier will be synthesized from
+                       // a display name or supplied in another manner.
+                       if ((shortId != null) && (shortIdBadPattern.matcher(shortId).find())) {
+                           invalid = true;
+                           msg += "shortIdentifier must only contain standard word characters";
+                       }
+                   } else if (action.equals(Action.UPDATE)) {
+                   }
             }
 
             if (invalid) {
index 491d7a697e3bfb5b1f7105c84041d97738c00f78..beed33cf2d04ad86696af482923e602479d4d109 100644 (file)
@@ -163,24 +163,6 @@ public class PersonDocumentModelHandler
                return newStr.toString();
     }
     
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#extractPart(org.nuxeo.ecm.core.api.DocumentModel, java.lang.String, org.collectionspace.services.common.service.ObjectPartType)
-     */
-    @Override
-    protected Map<String, Object> extractPart(DocumentModel docModel, String schema, ObjectPartType partMeta)
-            throws Exception {
-       Map<String, Object> unQObjectProperties = super.extractPart(docModel, schema, partMeta);
-       
-       // Add the CSID to the common part
-       if (partMeta.getLabel().equalsIgnoreCase(COMMON_PART_LABEL)) {
-               String csid = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-               unQObjectProperties.put("csid", csid);
-       }
-       
-       return unQObjectProperties;
-    }
-    
     /**
      * getQProperty converts the given property to qualified schema property
      * @param prop
index cde5cf21b4d8be9f86e97430a9e2a7ee7bacbdc4..f84e6c06e8eb4d299ce12eef6edbfcac2b36118b 100644 (file)
@@ -59,25 +59,27 @@ public class PersonValidatorHandler implements ValidatorHandler {
             String msg = "";
             boolean invalid = false;
             
-            // Validation occurring on both creates and updates
-            String displayName = person.getDisplayName();
-            if (!person.isDisplayNameComputed() && ((displayName == null) || displayName.trim().isEmpty())) {
-                invalid = true;
-                msg += "displayName must be non-null and non-blank if displayNameComputed is false!";
-            }
-            
-            // Validation specific to creates or updates
-            if (action.equals(Action.CREATE)) {
-                String shortId = person.getShortIdentifier();
-                // Per CSPACE-2215, shortIdentifier values that are null (missing)
-                // oe the empty string are now legally accepted in create payloads.
-                // In either of those cases, a short identifier will be synthesized from
-                // a display name or supplied in another manner.
-                if ((shortId != null) && (shortIdBadPattern.matcher(shortId).find())) {
-                    invalid = true;
-                    msg += "shortIdentifier must only contain standard word characters";
-                }
-            } else if (action.equals(Action.UPDATE)) {
+            if(person != null) {       // No guarantee that there is a common part in every post/update.
+                   // Validation occurring on both creates and updates
+                   String displayName = person.getDisplayName();
+                   if (!person.isDisplayNameComputed() && ((displayName == null) || displayName.trim().isEmpty())) {
+                       invalid = true;
+                       msg += "displayName must be non-null and non-blank if displayNameComputed is false!";
+                   }
+                   
+                   // Validation specific to creates or updates
+                   if (action.equals(Action.CREATE)) {
+                       String shortId = person.getShortIdentifier();
+                       // Per CSPACE-2215, shortIdentifier values that are null (missing)
+                       // oe the empty string are now legally accepted in create payloads.
+                       // In either of those cases, a short identifier will be synthesized from
+                       // a display name or supplied in another manner.
+                       if ((shortId != null) && (shortIdBadPattern.matcher(shortId).find())) {
+                           invalid = true;
+                           msg += "shortIdentifier must only contain standard word characters";
+                       }
+                   } else if (action.equals(Action.UPDATE)) {
+                   }
             }
 
             if (invalid) {
index ff58c8e364771b78e92a77ceb5f8efe662a43a50..57e5f09a830115659e61935ea27d0e5a45f10ac0 100644 (file)
             </templates>            
             <rows>
                 <row><widget>relationshipType</widget></row>
-                <row><widget>documentId1</widget></row>
-                <row><widget>documentType1</widget></row>
-                <row><widget>documentId2</widget></row>
-                <row><widget>documentType2</widget></row>
+                <row><widget>subjectCsid</widget></row>
+                <row><widget>subjectDocumentType</widget></row>
+                <row><widget>objectCsid</widget></row>
+                <row><widget>objectDocumentType</widget></row>
             </rows>
             
             <widget name="relationshipType" type="text">
                 </properties>
             </widget>
             
-            <widget name="documentId1" type="text">
+            <widget name="subjectCsid" type="text">
                 <labels>
-                    <label mode="any">Document ID 1</label>
+                    <label mode="any">Subject CSID</label>
                 </labels>
                 <translated>true</translated>
                 <fields>
-                    <field schema="relations_common">documentId1</field>
+                    <field schema="relations_common">subjectCsid</field>
                 </fields>
                 <properties widgetMode="edit">
                     <property name="styleClass">dataInputText</property>
                 </properties>
             </widget>
             
-            <widget name="documentType1" type="text">
+            <widget name="subjectDocumentType" type="text">
                 <labels>
-                    <label mode="any">Document Type 1</label>
+                    <label mode="any">Subject Document Type</label>
                 </labels>
                 <translated>true</translated>
                 <fields>
-                    <field schema="relations_common">documentType1</field>
+                    <field schema="relations_common">subjectDocumentType</field>
                 </fields>
                 <properties widgetMode="edit">
                     <property name="styleClass">dataInputText</property>
                 </properties>
             </widget>
             
-            <widget name="documentId2" type="text">
+            <widget name="objectCsid" type="text">
                 <labels>
-                    <label mode="any">Document ID 2</label>
+                    <label mode="any">Object CSID</label>
                 </labels>
                 <translated>true</translated>
                 <fields>
-                    <field schema="relations_common">documentId2</field>
+                    <field schema="relations_common">objectCsid</field>
                 </fields>
                 <properties widgetMode="edit">
                     <property name="styleClass">dataInputText</property>
                 </properties>
             </widget>
             
-            <widget name="documentType2" type="text">
+            <widget name="objectDocumentType" type="text">
                 <labels>
-                    <label mode="any">Document Type 2</label>
+                    <label mode="any">Object Document Type</label>
                 </labels>
                 <translated>true</translated>
                 <fields>
-                    <field schema="relations_common">documentType2</field>
+                    <field schema="relations_common">objectDocumentType</field>
                 </fields>
                 <properties widgetMode="edit">
                     <property name="styleClass">dataInputText</property>
index 6c28e5ceaa937dfe02446c64c486580e1a10a897..7654170098794d215ee3a14e69b4c7c149f3f516 100644 (file)
             <!-- document-type-1 would be the doc-type of the container collectionobject -->\r
             <!-- document-id-2 would be the id of the contained (or child) collectionobject -->\r
             <!-- document-type-2 would be the doc-type of the collectionobejct -->\r
-    <xs:element name="documentId1" type="xs:string"  minOccurs="1" maxOccurs="1"/>\r
     <xs:element name="subjectCsid" type="xs:string"  minOccurs="1" maxOccurs="1"/>     <!-- new name for documentId1 -->\r
-    <xs:element name="documentType1" type="xs:string"  minOccurs="1" maxOccurs="1"/>\r
     <xs:element name="subjectDocumentType" type="xs:string"  minOccurs="1" maxOccurs="1"/>     <!-- new name for documentType1 -->\r
 \r
-    <xs:element name="documentId2" type="xs:string"  minOccurs="1" maxOccurs="1"/>\r
     <xs:element name="objectCsid" type="xs:string"  minOccurs="1" maxOccurs="1"/>        <!-- new name for documentId2 -->\r
-    <xs:element name="documentType2" type="xs:string"  minOccurs="1" maxOccurs="1"/>\r
     <xs:element name="objectDocumentType" type="xs:string"  minOccurs="1" maxOccurs="1"/>        <!-- new name for documentType2 -->\r
 \r
             <!-- type of relationship between two entities -->\r
index 76f0254c0f9ca42a1ac55b9401923704d5e64ad0..37309dded9022b420e296921459e7ff6012d240b 100644 (file)
@@ -229,7 +229,7 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         String identifier = createIdentifier();
         RelationsCommon relationsCommon = createRelationsCommon(identifier);
         // Make the subject ID equal to the object ID
-        relationsCommon.setDocumentId1(relationsCommon.getDocumentId2());
+        relationsCommon.setSubjectCsid(relationsCommon.getObjectCsid());
         PoxPayloadOut multipart = createRelationInstance(relationsCommon);
         ClientResponse<Response> res = client.create(multipart);
         int statusCode = res.getStatus();
@@ -618,13 +618,13 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
         final String msg2 =
                 "Data in updated object was not correctly computed.";
         Assert.assertEquals(
-                updatedRelationCommon.getDocumentId1(), newSubjectId, msg);
+                updatedRelationCommon.getSubjectCsid(), newSubjectId, msg);
         Assert.assertEquals(
-                updatedRelationCommon.getDocumentType1(), newSubjectDocType, msg2);
+                updatedRelationCommon.getSubjectDocumentType(), newSubjectDocType, msg2);
         Assert.assertEquals(
-                updatedRelationCommon.getDocumentId2(), newObjectId, msg);
+                updatedRelationCommon.getObjectCsid(), newObjectId, msg);
         Assert.assertEquals(
-                updatedRelationCommon.getDocumentType2(), newObjectDocType, msg2);
+                updatedRelationCommon.getObjectDocumentType(), newObjectDocType, msg2);
         Assert.assertEquals(
                 updatedRelationCommon.getPredicateDisplayName(), relationCommon.getPredicateDisplayName(), msg);
 
@@ -936,21 +936,21 @@ public class RelationServiceTest extends AbstractServiceTestImpl {
      * Fills the relation.
      *
      * @param relationCommon the relation
-     * @param documentId1 the document id1
-     * @param documentType1 the document type1
-     * @param documentId2 the document id2
-     * @param documentType2 the document type2
+     * @param subjectCsid the subject document id
+     * @param subjectDocumentType the subject document type
+     * @param objectCsid the object document id
+     * @param objectDocumentType the object document type
      * @param rt the rt
      */
     private void fillRelation(RelationsCommon relationCommon,
-            String documentId1, String documentType1,
-            String documentId2, String documentType2,
+            String subjectCsid, String subjectDocumentType,
+            String objectCsid, String objectDocumentType,
             String rt,
             String rtDisplayName) {
-        relationCommon.setDocumentId1(documentId1);
-        relationCommon.setDocumentType1(documentType1);
-        relationCommon.setDocumentId2(documentId2);
-        relationCommon.setDocumentType2(documentType2);
+        relationCommon.setSubjectCsid(subjectCsid);
+        relationCommon.setSubjectDocumentType(subjectDocumentType);
+        relationCommon.setObjectCsid(objectCsid);
+        relationCommon.setObjectDocumentType(objectDocumentType);
 
         relationCommon.setRelationshipType(rt);
         relationCommon.setPredicateDisplayName(rtDisplayName);
index dc38d6e6de17c4cfb4fef2b56676ecabb7e28262..9c9827691be2eca5a5ffe4de494d06ce24b77db4 100644 (file)
@@ -197,38 +197,45 @@ public class RelationDocumentModelHandler
         String id = getCsid(docModel);
         relationListItem.setCsid(id);
 
-        relationListItem.setSubjectCsid((String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_ID_1));
+        relationListItem.setSubjectCsid((String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.SUBJECT_CSID));
 
-        String predicate = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.RELATIONSHIP_TYPE);
+        String predicate = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.RELATIONSHIP_TYPE);
         relationListItem.setRelationshipType(predicate);
         relationListItem.setPredicate(predicate); //predicate is new name for relationshipType.
-        relationListItem.setPredicateDisplayName((String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.RELATIONSHIP_TYPE_DISPLAYNAME));
+        relationListItem.setPredicateDisplayName((String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.RELATIONSHIP_TYPE_DISPLAYNAME));
 
-        relationListItem.setObjectCsid((String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_ID_2));
+        relationListItem.setObjectCsid((String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.OBJECT_CSID));
 
         relationListItem.setUri(serviceContextPath + id);
 
         //Now fill in summary info for the related docs: subject and object.
         String subjectCsid = relationListItem.getSubjectCsid();
-        String documentType = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_TYPE_1);
-        RelationsDocListItem subject = createRelationsDocListItem(ctx, sbt, subjectCsid, tReader, documentType);
+        String subjectDocumentType = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.SUBJECT_DOCTYPE);
+        RelationsDocListItem subject = createRelationsDocListItem(ctx, sbt, subjectCsid, tReader, subjectDocumentType);
 
-        //Object o1 =  docModel.getProperty(ctx.getCommonPartLabel(), "subject");
-        //Object o2 =  docModel.getProperty(ctx.getCommonPartLabel(), "object");
-
-        String subjectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.SUBJECT_URI);
+        String subjectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.SUBJECT_URI);
         subject.setUri(subjectUri);
-        String subjectRefName = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.SUBJECT_REFNAME);
+        String subjectRefName = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.SUBJECT_REFNAME);
         subject.setRefName(subjectRefName);
         relationListItem.setSubject(subject);
 
         String objectCsid = relationListItem.getObjectCsid();
-        String documentType2 = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_TYPE_2);
-        RelationsDocListItem object = createRelationsDocListItem(ctx, sbt, objectCsid, tReader, documentType2);
+        String objectDocumentType = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.OBJECT_DOCTYPE);
+        RelationsDocListItem object = createRelationsDocListItem(ctx, sbt, objectCsid, tReader, objectDocumentType);
 
-        String objectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.OBJECT_URI);
+        String objectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.OBJECT_URI);
         object.setUri(objectUri);
-        String objectRefName = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.OBJECT_REFNAME);
+        String objectRefName = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
+                                                                                                       RelationJAXBSchema.OBJECT_REFNAME);
         object.setRefName(objectRefName);
         relationListItem.setObject(object);
 
@@ -242,33 +249,16 @@ public class RelationDocumentModelHandler
             TenantBindingConfigReaderImpl tReader,
             String documentType) throws Exception {
         RelationsDocListItem item = new RelationsDocListItem();
-        item.setDocumentType(documentType);//this one comes from the record, as documentType1, documentType2.
-        // CSPACE-4037 REMOVING: item.setService(documentType);//this one comes from the record, as documentType1, documentType2.   Current app seems to use servicename for this.
+        item.setDocumentType(documentType);//this one comes from the record, as subjectDocumentType, objectDocumentType.
         item.setCsid(itemCsid);
 
         DocumentModel itemDocModel = NuxeoUtils.getDocFromCsid(getRepositorySession(), ctx, itemCsid);    //null if not found.
         if (itemDocModel != null) {
             String itemDocType = itemDocModel.getDocumentType().getName();
-            // CSPACE-4037 REMOVING: item.setDocumentTypeFromModel(itemDocType);           //this one comes from the nuxeo documentType
-
-            //DEBUG: System.out.println("\r\n******** AuthorityItemDocumentModelHandlder documentType **************\r\n\tdocModel: "+itemDocType+"\r\n\tpayload: "+documentType);
-            //boolean usedDocumentTypeFromPayload = true;
-            /*if ( ! Tools.isBlank(documentType)){
-            if (documentType.equals(itemDocType)){
-            //usedDocumentTypeFromPayload = true;
-            }  else {
-            // Laramie20110510 CSPACE-3739  throw the exception for 3739, otherwise, don't throw it.
-            //throw new Exception("documentType supplied was wrong.  supplied: "+documentType+" required: "+itemDocType+ " itemCsid: "+itemCsid );
-            }
-            } else {
-            //usedDocumentTypeFromPayload = false;
-            item.setDocumentType(itemDocType);
-            }   */
             if (Tools.isBlank(documentType)) {
                 item.setDocumentType(itemDocType);
             }
 
-            // TODO: clean all the output statements out of here when CSPACE-4037 is done.
             //TODO: ensure that itemDocType is really the entry point, i.e. servicename==doctype
             //ServiceBindingType itemSbt2 = tReader.getServiceBinding(ctx.getTenantId(), itemDocType);
             String propName = "ERROR-FINDING-PROP-VALUE";
@@ -277,13 +267,11 @@ public class RelationDocumentModelHandler
                 propName = ServiceBindingUtils.getPropertyValue(itemSbt, ServiceBindingUtils.OBJ_NAME_PROP);
                 String itemDocname = ServiceBindingUtils.getMappedFieldInDoc(itemSbt, ServiceBindingUtils.OBJ_NAME_PROP, itemDocModel);
                 if (propName == null || itemDocname == null) {
-                    //System.out.println("=== prop NOT found: "+ServiceBindingUtils.OBJ_NAME_PROP+"::"+propName+"="+itemDocname+" documentType: "+documentType);
                 } else {
                     item.setName(itemDocname);
-                    //System.out.println("=== found prop : "+ServiceBindingUtils.OBJ_NAME_PROP+"::"+propName+"="+itemDocname+" documentType: "+documentType);
                 }
             } catch (Throwable t) {
-                System.out.println("====Error finding objectNameProperty: " + itemDocModel + " field " + ServiceBindingUtils.OBJ_NAME_PROP + "=" + propName
+               logger.error("====Error finding objectNameProperty: " + itemDocModel + " field " + ServiceBindingUtils.OBJ_NAME_PROP + "=" + propName
                         + " not found in itemDocType: " + itemDocType + " inner: " + t.getMessage());
             }
             propName = "ERROR-FINDING-PROP-VALUE";
@@ -292,12 +280,8 @@ public class RelationDocumentModelHandler
                 String itemDocnumber = ServiceBindingUtils.getMappedFieldInDoc(itemSbt, ServiceBindingUtils.OBJ_NUMBER_PROP, itemDocModel);
 
                 if (propName == null || itemDocnumber == null) {
-                    //System.out.println("=== prop NOT found: "+ServiceBindingUtils.OBJ_NUMBER_PROP+"::"+propName+"="+itemDocnumber
-                    //                          +" documentType: "+documentType);
                 } else {
                     item.setNumber(itemDocnumber);
-                    //System.out.println("============ found prop : "+ServiceBindingUtils.OBJ_NUMBER_PROP+"::"+propName+"="+itemDocnumber
-                    //                          +" documentType: "+documentType);
                 }
             } catch (Throwable t) {
                 logger.error("====Error finding objectNumberProperty: " + ServiceBindingUtils.OBJ_NUMBER_PROP + "=" + propName
@@ -331,11 +315,6 @@ public class RelationDocumentModelHandler
         try {
             csid = (String) relationDocModel.getProperty(commonPartLabel, 
                        (fSubject?RelationJAXBSchema.SUBJECT_CSID:RelationJAXBSchema.OBJECT_CSID));
-            // FIXME: Remove this entire 'if' statement when legacy fields are removed from the Relation record:
-            if (Tools.isBlank(csid)) {
-                csid = (String) relationDocModel.getProperty(commonPartLabel, 
-                                       (fSubject?RelationJAXBSchema.DOCUMENT_ID_1:RelationJAXBSchema.DOCUMENT_ID_2));
-            }
         } catch (PropertyException pe) {
             // Per CSPACE-4468, ignore any property exception here.
             // The objectCsid and/or subjectCsid field in a relation record
@@ -373,16 +352,10 @@ public class RelationDocumentModelHandler
                String doctype = (String) subjectOrObjectDocModel.getType();
                properties.put((fSubject?RelationJAXBSchema.SUBJECT_DOCTYPE:RelationJAXBSchema.OBJECT_DOCTYPE),
                                                        doctype);
-               // FIXME: Remove the line below when legacy fields are removed from the Relation record:
-               properties.put((fSubject?RelationJAXBSchema.DOCUMENT_TYPE_1:RelationJAXBSchema.DOCUMENT_TYPE_2), 
-                                                       doctype);
        
                String csid = (String) subjectOrObjectDocModel.getName();
                properties.put((fSubject?RelationJAXBSchema.SUBJECT_CSID:RelationJAXBSchema.OBJECT_CSID),
                                                        csid);
-               // FIXME: Remove the two lines immediately below when legacy fields are removed from the Relation record:
-               properties.put((fSubject?RelationJAXBSchema.DOCUMENT_ID_1:RelationJAXBSchema.DOCUMENT_ID_2),
-                                                       csid);
        
                String uri = (String) subjectOrObjectDocModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,
                                                                                                                                        COLLECTIONSPACE_CORE_URI);
index 048da5ab694719b91a62bf9e9317d43848396944..c93a8bc1e88e664380e065cd3cf8b9f3c1439bfd 100644 (file)
@@ -38,8 +38,8 @@ public class RelationValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn,
                        logger.trace(relationsCommon.toString());\r
                }\r
                \r
-            String subjectCsid = getSubjectCsid(relationsCommon);\r
-            String objectCsid = getObjectCsid(relationsCommon);\r
+            String subjectCsid = relationsCommon.getSubjectCsid();\r
+            String objectCsid = relationsCommon.getObjectCsid();\r
                \r
             // If no CSID for a subject or object is included in the create payload,\r
             // a refName must be provided for that subject or object as an alternate identifier.\r
@@ -83,24 +83,6 @@ public class RelationValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn,
        protected void handleDelete() {\r
                // TODO Auto-generated method stub\r
     }\r
-               \r
-    private String getSubjectCsid(RelationsCommon relationsCommon) {\r
-        String subjectCsid = relationsCommon.getSubjectCsid();\r
-        // FIXME: Remove this entire 'if' statement when legacy fields are removed from the Relation record:\r
-        if (Tools.isBlank(subjectCsid)) {\r
-            subjectCsid = relationsCommon.getDocumentId1();\r
-       }\r
-        return subjectCsid;\r
-    }\r
-\r
-    private String getObjectCsid(RelationsCommon relationsCommon) {\r
-        String objectCsid = relationsCommon.getObjectCsid();\r
-        // FIXME: Remove this entire 'if' statement when legacy fields are removed from the Relation record:\r
-        if (Tools.isBlank(objectCsid)) {\r
-            objectCsid = relationsCommon.getDocumentId2();\r
-}\r
-        return objectCsid;\r
-    }\r
 \r
     private boolean hasCsid(String csid) {\r
         boolean hasCsid = false;\r
index 886b7ba32a39ec2603bfab5cf2638c0a5fe64b75..b7c5ba99ed21ae149c5d105bbf6912ad008c9350 100644 (file)
@@ -23,6 +23,7 @@
  */
 package org.collectionspace.services.taxonomy.nuxeo;
 
+import org.collectionspace.services.client.TaxonomyAuthorityClient;
 import org.collectionspace.services.TaxonJAXBSchema;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
@@ -50,6 +51,10 @@ public class TaxonDocumentModelHandler
     public TaxonDocumentModelHandler() {
         super(COMMON_PART_LABEL);
     }
+    
+    public String getAuthorityServicePath(){
+        return TaxonomyAuthorityClient.SERVICE_PATH_COMPONENT;
+    }
 
     /**
      * Handle display name.