targetNamespace="http://collectionspace.org/collectionobject/" version="0.1">\r
\r
<xs:element name="remNumber" type="ns:otherNumber"/>\r
+\r
<!-- Object identification information -->\r
<xs:element name="objectNumber" type="xs:string"/>\r
<xs:element name="otherNumberList" type="ns:otherNumberList"/>\r
\r
- <!-- Remove these two elements when the App/UI layer is using the new repeatable 'otherNumbers' field -->\r
+ <!-- Remove these two elements when the App/UI layer is using -->\r
+ <!-- the new repeatable 'otherNumbers' field: -->\r
<xs:element name="otherNumber" type="xs:string"/>\r
<xs:element name="otherNumberType" type="xs:string"/>\r
\r
</xs:sequence>\r
</xs:complexType>\r
</xs:element>\r
-\r
- <!-- Object Description - Content Information -->\r
<xs:element name="contentActivities">\r
<xs:complexType>\r
<xs:sequence>\r
</xs:sequence>\r
</xs:complexType>\r
</xs:element>\r
-\r
<xs:element name="copyNumber" type="xs:string"/>\r
+ <xs:element name="dimensions" type="ns:dimensionList"/>\r
\r
- <!-- Object Description - Dimension Information -->\r
+ <!-- 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
\r
<!-- Object History and Association Information - Association -->\r
\r
- <!-- In the following field names, "assoc" is an abbreviation for "association". -->\r
+ <!-- In the following field names, "assoc" is an abbreviation for "associated". -->\r
<!-- See the comments to CSPACE-2501 for a discussion of the database identifier -->\r
<!-- length limit that made this abbreviation necessary. -->\r
<xs:element name="assocActivity" type="xs:string"/>\r
</xs:sequence>\r
</xs:complexType>\r
\r
+ <xs:complexType name="dimensionList">\r
+ <xs:sequence>\r
+ <xs:element name="dimensionGroup" type="dimensionGroup" minOccurs="0"\r
+ maxOccurs="unbounded"/>\r
+ </xs:sequence>\r
+ </xs:complexType>\r
+\r
+ <xs:complexType name="dimensionGroup">\r
+ <xs:sequence>\r
+ <xs:element name="dimension" type="xs:string"/>\r
+ <xs:element name="measuredPart" type="xs:string"/>\r
+ <xs:element name="measurementUnit" type="xs:string"/>\r
+ <xs:element name="value" type="xs:string"/>\r
+ <xs:element name="valueDate" type="xs:string"/>\r
+ <xs:element name="valueQualifier" 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
import org.collectionspace.services.collectionobject.domain.naturalhistory.CollectionobjectsNaturalhistory;
import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
import org.collectionspace.services.collectionobject.ResponsibleDepartmentList;
+import org.collectionspace.services.collectionobject.DimensionGroup;
+import org.collectionspace.services.collectionobject.DimensionList;
import org.collectionspace.services.collectionobject.ObjectNameGroup;
import org.collectionspace.services.collectionobject.ObjectNameList;
import org.collectionspace.services.collectionobject.OtherNumber;
private String knownResourceId = null;
private final String OBJECT_NAME_VALUE = "an object name";
+ private final String UPDATED_MEASURED_PART_VALUE = "updated measured part value";
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
client.getCommonPartName(), CollectionobjectsCommon.class);
Assert.assertNotNull(collectionObject);
+ // Verify the number and contents of values in repeatable fields,
+ // as created in the instance record used for testing.
+ DimensionList dimensionList = collectionObject.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());
+
if (logger.isDebugEnabled()) {
logger.debug(testName + ": Reading Natural History part ...");
}
Assert.assertNotNull(collectionObject);
// Change the content of one or more fields in the common part.
+
collectionObject.setObjectNumber("updated-" + collectionObject.getObjectNumber());
-
+
+ // Change the object name in the first value instance in the
+ // object name repeatable group.
ObjectNameList objNameList = collectionObject.getObjectNameList();
List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
Assert.assertNotNull(objNameGroups);
objNameGroups.get(0).setObjectName(updatedObjectName);
collectionObject.setObjectNameList(objNameList);
+ // Replace the existing value instances in the dimensions repeatable group
+ // with entirely new value instances, also changing the number of such instances.
+ DimensionList dimensionList = collectionObject.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);
+ collectionObject.setDimensions(dimensionList);
+
if (logger.isDebugEnabled()) {
logger.debug("sparse update that will be sent in update request:");
logger.debug(objectAsXmlString(collectionObject,
Assert.assertEquals(updatedObjectName,
objNameGroups.get(0).getObjectName(),
"Data in updated object did not match submitted data.");
+
+ dimensionList = collectionObject.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(),
+ "Data in updated object did not match submitted data.");
}
remNumber.setNumberValue("2271966-" + System.currentTimeMillis());
collectionObject.setRemNumber(remNumber);
+ // Scalar fields
+ collectionObject.setTitle("atitle");
+ collectionObject.setObjectNumber(objectNumber);
+ collectionObject.setAge(""); //test for null string
+
+ // FIXME this can be removed when the repeatable other number list
+ // is supported by the application layers
+ collectionObject.setOtherNumber("urn:org.walkerart.id:123");
+
+ // Repeatable structured groups
+
+ ObjectNameList objNameList = new ObjectNameList();
+ List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
+ ObjectNameGroup objectNameGroup = new ObjectNameGroup();
+ objectNameGroup.setObjectName(OBJECT_NAME_VALUE);
+ 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("30");
+ dimensionGroup1.setMeasurementUnit("cm");
+ DimensionGroup dimensionGroup2 = new DimensionGroup();
+ dimensionGroup2.setMeasuredPart("leg");
+ dimensionGroup2.setDimension("width");
+ dimensionGroup2.setValue("2.57");
+ dimensionGroup2.setMeasurementUnit("m");
+ dimensionGroup2.setValueQualifier(""); // test null string
+ dimensionGroups.add(dimensionGroup1);
+ dimensionGroups.add(dimensionGroup2);
+ collectionObject.setDimensions(dimensionList);
+
+ // Repeatable scalar fields
+
BriefDescriptionList descriptionList = new BriefDescriptionList();
List<String> descriptions = descriptionList.getBriefDescription();
descriptions.add("Papier mache bird cow mask with horns, "
+ "painted red with black and yellow spots. "
+ "Puerto Rico. ca. 8" high, 6" wide, projects 10" (with horns).");
- descriptions.add("Papier mache bird cow mask with horns, "
- + "painted red with black and yellow spots. "
- + "Puerto Rico. ca. 8" high, 6" wide, projects 10" (with horns).");
+ descriptions.add("Acrylic rabbit mask with wings, "
+ + "painted red with green and aquamarine spots. "
+ + "Puerto Rico. ca. 8" high, 6" wide, projects 10" (with wings).");
+ collectionObject.setBriefDescriptions(descriptionList);
ResponsibleDepartmentList deptList = new ResponsibleDepartmentList();
List<String> depts = deptList.getResponsibleDepartment();
// in this example test record. The following are mere placeholders.
depts.add("urn:org.collectionspace.services.department:Registrar");
depts.add("urn:org.walkerart.department:Fine Art");
+ collectionObject.setResponsibleDepartments(deptList);
OtherNumberList otherNumList = new OtherNumberList();
List<OtherNumber> otherNumbers = otherNumList.getOtherNumber();
-
OtherNumber otherNumber1 = new OtherNumber();
otherNumber1.setNumberValue("101." + objectName);
otherNumber1.setNumberType("integer");
otherNumbers.add(otherNumber1);
-
OtherNumber otherNumber2 = new OtherNumber();
otherNumber2.setNumberValue("101.502.23.456." + objectName);
otherNumber2.setNumberType("ipaddress");
- otherNumbers.add(otherNumber2);
-
- //FIXME: Title does not need to be set.
- collectionObject.setTitle("atitle");
- collectionObject.setResponsibleDepartments(deptList);
- collectionObject.setObjectNumber(objectNumber);
-
+ otherNumbers.add(otherNumber2);
collectionObject.setOtherNumberList(otherNumList);
- // FIXME this can be removed when the repeatable other number list
- // is supported by the application layers
- collectionObject.setOtherNumber("urn:org.walkerart.id:123");
-
- ObjectNameList objNameList = new ObjectNameList();
- List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
- ObjectNameGroup objectNameGroup = new ObjectNameGroup();
- objectNameGroup.setObjectName(OBJECT_NAME_VALUE);
- objNameGroups.add(objectNameGroup);
- collectionObject.setObjectNameList(objNameList);
-
- collectionObject.setAge(""); //test for null string
- collectionObject.setBriefDescriptions(descriptionList);
+ // Add instances of fields from an extension schema
CollectionobjectsNaturalhistory conh = new CollectionobjectsNaturalhistory();
conh.setNhString("test-string");
conh.setNhInt(999);
conh.setNhLong(9999);
-
MultipartOutput multipart = createCollectionObjectInstance(commonPartName, collectionObject, conh);
return multipart;
}
<xs:element name="csid" type="xs:string"/>
<xs:element name="remNumber" type="ns:otherNumber"/>
+
<!-- Object Identification Information -->
+
<xs:element name="objectNumber" type="xs:string"/>
<xs:element name="otherNumberList" type="otherNumberList"/>
-
+
<!-- Remove these two elements when the App/UI layer is -->
- <!-- using the new repeatable 'otherNumbers' field -->
+ <!-- using the new repeatable 'otherNumbers' field: -->
<xs:element name="otherNumber" type="xs:string"/>
<xs:element name="otherNumberType" type="xs:string"/>
<xs:element name="briefDescriptions" type="briefDescriptionList"/>
-
<xs:element name="comments" type="commentList"/>
<xs:element name="distinguishingFeatures" type="xs:string"/>
<xs:element name="numberOfObjects" type="xs:string"/>
<xs:element name="contentPlaces" type="contentPlaceList"/>
<xs:element name="contentPosition" type="xs:string"/>
<xs:element name="contentScripts" type="contentScriptList"/>
-
<xs:element name="copyNumber" type="xs:string"/>
+ <xs:element name="dimensions" type="ns:dimensionList"/>
- <!-- Object Description - Dimension Information -->
+ <!-- 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"/>
<!-- Object History and Association Information - Association -->
- <!-- In the following field names, "assoc" is an abbreviation for "association". -->
+ <!-- In the following field names, "assoc" is an abbreviation for "associated". -->
<!-- See the comments to CSPACE-2501 for a discussion of the database identifier -->
<!-- length limit that made this abbreviation necessary. -->
<xs:element name="assocActivity" type="xs:string"/>
<xs:element name="contentScript" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
+
+ <xs:complexType name="dimensionList">
+ <xs:sequence>
+ <xs:element name="dimensionGroup" type="dimensionGroup" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="dimensionGroup">
+ <xs:sequence>
+ <xs:element name="dimension" type="xs:string"/>
+ <xs:element name="measuredPart" type="xs:string"/>
+ <xs:element name="measurementUnit" type="xs:string"/>
+ <xs:element name="value" type="xs:string"/>
+ <xs:element name="valueDate" type="xs:string"/>
+ <xs:element name="valueQualifier" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="formList">
<xs:sequence>