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
* @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
* 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
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++;
}
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++;
}
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
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
<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
<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
<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
--- /dev/null
+<?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
--- /dev/null
+<?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>
+
--- /dev/null
+<?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
--- /dev/null
+<?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
<?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
--- /dev/null
+<?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>
+
--- /dev/null
+<?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
--- /dev/null
+<?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
<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
--- /dev/null
+<?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&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
<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
<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
<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
</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
<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
<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
</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
--- /dev/null
+<?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
--- /dev/null
+<?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
--- /dev/null
+<?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
<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>
<?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>
<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
<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>
<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
* 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
<!-- 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
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;
// 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()
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();
@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;
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);
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.
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*/);
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
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
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
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
// 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
/*\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
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
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
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
// 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
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
"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
\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
* * 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
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);
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) {
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);
}
}
}
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;
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;
*/
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;
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)
*/
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;
+ }
}
/**
* @throws Exception the exception
*/
protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
- // Do nothing by default.
+ // Do nothing by default.
}
/**
* 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();
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);
// 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);
}
/**
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);
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);
}
}
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 {
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.
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) {
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 {
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 {
//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.
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
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
// 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());
// 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());
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.
}
}
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>";
<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
\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
<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
</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
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;
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";
// 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 ...");
// 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:");
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.");
}
TitleGroupList titleGroupList = new TitleGroupList();
List<TitleGroup> titleGroups = titleGroupList.getTitleGroup();
+ Assert.assertNotNull(titleGroups);
TitleGroup titleGroup = new TitleGroup();
titleGroup.setTitle("a title");
titleGroups.add(titleGroup);
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
<!-- 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>
}\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
</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"
<!-- <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/
* @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>();
}
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
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>>();
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,
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()));
+ }
}
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);
}
}
}
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
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
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
\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
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
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
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
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
\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
/** 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
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) {
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) {
* @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
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
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
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);
}
}
}
+
+ /**
+ * 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
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);
// 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);
<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
<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
<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
<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
<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
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;
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() {
IntakeClient intakeClient = new IntakeClient();
PoxPayloadOut multipart = createIntakeInstance(
"entryNumber-" + identifier,
- "entryDate-" + identifier,
+ CURRENT_DATE_UTC,
currentOwnerRefName,
depositorRefName,
conditionCheckerOrAssessorRefName,
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() {
// 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));
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();
protected PoxPayloadOut createInstance(String identifier) {
return createIntakeInstance(
"entryNumber-" + identifier,
- "entryDate-" + identifier,
+ CURRENT_DATE_UTC,
"depositor-" + identifier);
}
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
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
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
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;
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() {
IntakeClient intakeClient = new IntakeClient();
PoxPayloadOut multipart = createIntakeInstance(
"entryNumber-" + identifier,
- "entryDate-" + identifier,
+ CURRENT_DATE_UTC,
currentOwnerRefName,
depositorRefName,
conditionCheckerAssessorRefName,
<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>
<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>
<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
<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
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;
// 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()
LoaninClient loaninClient = new LoaninClient();
PoxPayloadOut multipart = createLoaninInstance(
"loanInNumber-" + identifier,
- "returnDate-" + identifier,
+ CURRENT_DATE_UTC,
lenderRefName,
lendersAuthorizerRefName,
lendersContactRefName,
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;
/** 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()
// 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");
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()) {
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);
-->
<!-- 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>
<!-- 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
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;
// 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()
LoanoutClient loanoutClient = new LoanoutClient();
PoxPayloadOut multipart = createLoanoutInstance(
"loanOutNumber-" + identifier,
- "returnDate-" + identifier,
+ CURRENT_DATE_UTC,
borrowerRefName,
borrowersContactRefName,
lendersAuthorizerRefName,
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;
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()
// 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()) {
// 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));
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.
private PoxPayloadOut createLoanoutInstance(String identifier) {
return createLoanoutInstance(
"loanoutNumber-" + identifier,
- "returnDate-" + identifier);
+ CURRENT_DATE_UTC);
}
/**
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());
<!-- 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>
<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>
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;
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() {
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";
<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
<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"/>
<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"/>
<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
</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
// 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()
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);
- }
-
}
<?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
<!-- 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
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;
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() {
// 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.
// 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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
- Loan Out schema (XSD)
+ Object Exit schema (XSD)
Entity : ObjectExit
Part : Common
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) {
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
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) {
</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>
<!-- 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
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();
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);
* 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);
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);
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";
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";
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
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
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);
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
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
*/
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;
public TaxonDocumentModelHandler() {
super(COMMON_PART_LABEL);
}
+
+ public String getAuthorityServicePath(){
+ return TaxonomyAuthorityClient.SERVICE_PATH_COMPONENT;
+ }
/**
* Handle display name.