From: Richard Millet Date: Thu, 1 Mar 2018 19:59:25 +0000 (-0800) Subject: DRYD-306: Fixed logic that decided when a vocab/authority term can be deleted if... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=a33daec6869390c7c2739749887531ef7a8fb8b0;p=tmp%2Fjakarta-migration.git DRYD-306: Fixed logic that decided when a vocab/authority term can be deleted if referenced by another record. --- diff --git a/build.properties b/build.properties index b539b0a60..c6fda03a7 100644 --- a/build.properties +++ b/build.properties @@ -18,7 +18,7 @@ domain.nuxeo=nuxeo-server # CSpace UI cspace.ui.dest= -cspace.ui.version=1.0.0-alpha.2 +cspace.ui.version=1.0.0-alpha.10 cspace.ui.webapp=cspace#core cspace.ui.js=cspaceUI@${cspace.ui.version}.min.js diff --git a/services/collectionobject/service/pom.xml b/services/collectionobject/service/pom.xml index 17642e89a..13aa932d8 100644 --- a/services/collectionobject/service/pom.xml +++ b/services/collectionobject/service/pom.xml @@ -124,72 +124,6 @@ collectionspace-services-collectionobject - - - com.qmino - miredot-plugin - 2.0.3 - - - - restdoc - - - - - 5427820b-5465-4a49-98fb-cb39ff772f23 - - - jax-rs - - - - - Hidden - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - com.qmino - miredot-plugin - [2.0.3,) - - restdoc - - - - - - - - - - - - - - - - miredot - MireDot Releases - http://nexus.qmino.com/content/repositories/miredot - - - diff --git a/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java b/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java index 7fbe3e91b..7326e2465 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java @@ -569,22 +569,33 @@ public abstract class AbstractServiceContextImpl * @param queryParams * @return */ - private static String buildWorkflowWhereClause(MultivaluedMap queryParams) { - String result = null; - - String includeDeleted = queryParams.getFirst(WorkflowClient.WORKFLOW_QUERY_NONDELETED); - String includeOnlyDeleted = queryParams.getFirst(WorkflowClient.WORKFLOW_QUERY_ONLY_DELETED); - - if (includeDeleted != null && includeDeleted.equalsIgnoreCase(Boolean.FALSE.toString())) { - result = String.format("(ecm:currentLifeCycleState <> '%s' AND ecm:currentLifeCycleState <> '%s' AND ecm:currentLifeCycleState <> '%s')", - WorkflowClient.WORKFLOWSTATE_DELETED, WorkflowClient.WORKFLOWSTATE_LOCKED_DELETED, WorkflowClient.WORKFLOWSTATE_REPLICATED_DELETED); - } else if (includeOnlyDeleted != null && includeOnlyDeleted.equalsIgnoreCase(Boolean.TRUE.toString())) { - result = String.format("(ecm:currentLifeCycleState <> '%s' AND ecm:currentLifeCycleState <> '%s' AND ecm:currentLifeCycleState <> '%s')", - WorkflowClient.WORKFLOWSTATE_PROJECT, WorkflowClient.WORKFLOWSTATE_LOCKED, WorkflowClient.WORKFLOWSTATE_REPLICATED); - } - - return result; - } + private static String buildWorkflowWhereClause(MultivaluedMap queryParams) { + String result = null; + + String includeDeleted = queryParams.getFirst(WorkflowClient.WORKFLOW_QUERY_NONDELETED); + String includeOnlyDeleted = queryParams.getFirst(WorkflowClient.WORKFLOW_QUERY_ONLY_DELETED); // if set to true, it doesn't matter what the value is for 'includeDeleted' + + if (includeOnlyDeleted != null) { + if (Tools.isTrue(includeOnlyDeleted)) { + // + // A value of 'true' for 'includeOnlyDeleted' means we're looking *only* for soft-deleted records/documents. + // + result = String.format("(ecm:currentLifeCycleState = '%s' OR ecm:currentLifeCycleState = '%s' OR ecm:currentLifeCycleState = '%s')", + WorkflowClient.WORKFLOWSTATE_DELETED, WorkflowClient.WORKFLOWSTATE_LOCKED_DELETED, + WorkflowClient.WORKFLOWSTATE_REPLICATED_DELETED); + } + } else if (!Tools.isTrue(includeDeleted)) { + // + // We can only get here if the 'includeOnlyDeleted' query param is missing altogether. + // Ensure we don't return soft-deleted records + // + result = String.format("(ecm:currentLifeCycleState <> '%s' AND ecm:currentLifeCycleState <> '%s' AND ecm:currentLifeCycleState <> '%s')", + WorkflowClient.WORKFLOWSTATE_DELETED, WorkflowClient.WORKFLOWSTATE_LOCKED_DELETED, + WorkflowClient.WORKFLOWSTATE_REPLICATED_DELETED); + } + + return result; + } /** * Creates the document handler instance.