From bb207f5efd9fe82badf9d50b51e1cf0bf4000a4f Mon Sep 17 00:00:00 2001 From: remillet Date: Fri, 15 Apr 2016 18:24:42 -0700 Subject: [PATCH] CSPACE-6937: Fixed what appears to have been a bug in how we handle soft-deletes of relationships. But it appears the App layer never tries to soft-delete relationship records. --- .../client/test/RelationServiceTest.java | 30 +++++++++++++++++-- .../nuxeo/RelationDocumentModelHandler.java | 11 ++++--- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java b/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java index 7c2247f40..6f5ccd4c2 100644 --- a/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java +++ b/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java @@ -134,9 +134,33 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl 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); } } @@ -132,7 +131,7 @@ public class RelationDocumentModelHandler // 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, @@ -152,7 +151,7 @@ public class RelationDocumentModelHandler @Override public void handleDelete(DocumentWrapper 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 { -- 2.47.3