<expectedCodes>200</expectedCodes>\r
</test>\r
\r
+ <!-- Test with a soft-deleted related Movement record -->\r
+ <test ID="softDeleteMovement2">\r
+ <method>PUT</method>\r
+ <uri>/cspace-services/movements/${createMovement4.CSID}/workflow/delete</uri>\r
+ <expectedCodes>200</expectedCodes>\r
+ <!-- XmlReplay appears to require a filename on PUT. -->\r
+ <!-- If not present, throws "java.io.FileNotFoundException: File '' does not exist" -->\r
+ <!-- The contents of that file, sent in the PUT payload, will be ignored by the services. -->\r
+ <!-- Note that the filename below is in a different module than -->\r
+ <!-- the present XmlReplay control file. -->\r
+ <filename>relation/res/workflowState.res.xml</filename>\r
+ <vars>\r
+ <var ID="workflowState">deleted</var>\r
+ </vars>\r
+ </test>\r
+ \r
+ <test ID="invokeBatchAfterSoftDeletingMovement" auth="test" autoDeletePOSTS="false">\r
+ <method>POST</method>\r
+ <uri>/cspace-services/batch/${createBatchRecord.CSID}</uri>\r
+ <filename>batch/batch-invoke-updateobjloc-single.xml</filename>\r
+ <vars>\r
+ <var ID="collectionObjectCSID">${createCollectionObject.CSID}</var>\r
+ </vars>\r
+ <expectedCodes>200</expectedCodes>\r
+ </test>\r
+ \r
+ <!-- After soft-deleting related Movement record 4, the computedCurrentLocation -->\r
+ <!-- value should have reverted to the currentLocation value of Movement record 2. -->\r
+ <test ID="readUpdatedCollectionObjectRecordAfterSoftDeletingMovement">\r
+ <method>GET</method>\r
+ <uri>/cspace-services/collectionobjects/${createCollectionObject.CSID}</uri>\r
+ <filename>batch/updateobjloc.xml</filename>\r
+ <response>\r
+ <expected level="ADDOK" />\r
+ <filename>batch/res/collectionobject.res.xml</filename>\r
+ <vars>\r
+ <var ID="computedCurrentLocationValue">${createMovement2.currentLocation}</var>\r
+ </vars>\r
+ </response>\r
+ <expectedCodes>200</expectedCodes>\r
+ </test>\r
+ \r
</testGroup>\r
\r
<testGroup ID="invocationModeModeList" autoDeletePOSTS="true">\r
<packaging>jar</packaging>
<dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.common</artifactId>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.relation.client</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency>
<!-- External dependencies -->
<dependency>
<groupId>junit</groupId>
import org.collectionspace.services.client.AbstractCommonListUtils;
import org.collectionspace.services.client.CollectionObjectClient;
import org.collectionspace.services.client.MovementClient;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.ResourceMap;
}
- // Ray's convenience methods from his AbstractBatchJob class for the UC Berkeley Botanical Garden v2.4 implementation.
+ // #################################################################
+ // Ray's convenience methods from his AbstractBatchJob class for the
+ // UC Berkeley Botanical Garden v2.4 implementation.
+ // #################################################################
protected PoxPayloadOut findByCsid(String serviceName, String csid) throws URISyntaxException, DocumentException {
ResourceBase resource = getResourceMap().get(serviceName);
return findByCsid(resource, csid);
return new UriInfoImpl(absolutePath, baseUri, "", queryString, Collections.<PathSegment>emptyList());
}
+ // #################################################################
+ // Other convenience methods
+ // #################################################################
+
protected UriInfo createRelatedRecordsUriInfo(String query) throws URISyntaxException {
URI uri = new URI(null, null, null, query, null);
return createUriInfo(uri.getRawQuery());
// For each CollectionObject record
for (String collectionObjectCsid : csids) {
+ if (recordIsDeleted(collectionObjectCsid)) {
+ continue;
+ }
+
// Get the movement records related to this record
// Get movement records related to this record where the CollectionObject
// record is the subject of the relation
- String queryString = "rtObj=" + collectionObjectCsid; // FIXME: Get from constant
+ // FIXME: Get query string(s) from constant(s)
+ String queryString = "rtObj=" + collectionObjectCsid
+ + "&" + WorkflowClient.WORKFLOW_QUERY_NONDELETED + "=false";
UriInfo uriInfo = createRelatedRecordsUriInfo(queryString);
AbstractCommonList relatedMovements = movementResource.getList(uriInfo);
// Get movement records related to this record where the CollectionObject
// record is the object of the relation
- queryString = "rtSbj=" + collectionObjectCsid; // FIXME: Get from constant
+ // FIXME: Get query string(s) from constant(s)
+ queryString = "rtSbj=" + collectionObjectCsid
+ + "&" + WorkflowClient.WORKFLOW_QUERY_NONDELETED + "=false";
uriInfo = createRelatedRecordsUriInfo(queryString);
AbstractCommonList reverseRelatedMovements = movementResource.getList(uriInfo);
getResults().setNumAffected(numAffected);
return getResults();
}
+
+ private boolean recordIsDeleted(String collectionObjectCsid) {
+ return false;
+ // throw new UnsupportedOperationException("Not yet implemented");
+ }
}