@AfterSuite
private void deletePersonRefs() {
- //
- // Delete all the persons we created for the tests
- //
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ for (String csid:personIdsCreated) {
+ Response res = personAuthClient.deleteItem(personAuthCSID, csid);
+ try {
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, this.STATUS_OK);
+ } finally {
+ res.close();
+ }
+ }
+ //
+ // Now delete the container (the parent)
+ //
+ Response res = personAuthClient.delete(personAuthCSID);
+ try {
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, this.STATUS_OK);
+ } finally {
+ res.close();
+ }
+
}
private String createPerson(String firstName, String surName, String shortId, String authRefName) {
* @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#handleWorkflowTransition(org.collectionspace.services.common.document.DocumentWrapper, org.collectionspace.services.lifecycle.TransitionDef)
*/
public void handleWorkflowTransition(DocumentWrapper<DocumentModel> wrapDoc, TransitionDef transitionDef)
- throws Exception {
- String workflowState = transitionDef.getDestinationState();
- if (subjectOrObjectInWorkflowState(wrapDoc, workflowState) == true) {
+ throws Exception {
+ if (subjectOrObjectInWorkflowState(wrapDoc, WorkflowClient.WORKFLOWSTATE_LOCKED) == true) {
throw new ServiceException(HttpURLConnection.HTTP_FORBIDDEN,
- "Cannot change a relationship if either end of it is in the workflow state: " + workflowState);
+ "Cannot change a relationship if either end of it is in the workflow state: " + WorkflowClient.WORKFLOWSTATE_LOCKED);
}
}
// And take care of ensuring all the values for the relation info are correct
populateSubjectAndObjectValues(wrapDoc);
- // both subject and object cannot be locked
+ // Neither the subject nor the object can be locked
String workflowState = WorkflowClient.WORKFLOWSTATE_LOCKED;
if (subjectOrObjectInWorkflowState(wrapDoc, workflowState) == true) {
throw new ServiceException(HttpURLConnection.HTTP_FORBIDDEN,
@Override
public void handleDelete(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
String workflowState = WorkflowClient.WORKFLOWSTATE_LOCKED;
- // both subject and object cannot be locked
+ // Neither the subject nor the object can be locked
if (subjectOrObjectInWorkflowState(wrapDoc, workflowState) == false) {
super.handleDelete(wrapDoc);
} else {