]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
Adding support for marking local items as deprecated.
authorRichard Millet <remillet@yahoo.com>
Thu, 21 Apr 2016 15:43:19 +0000 (08:43 -0700)
committerRichard Millet <remillet@yahoo.com>
Thu, 21 Apr 2016 15:43:19 +0000 (08:43 -0700)
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityServiceUtils.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java

index 8b694b8cde195f1db5730d9976e188b6230a171f..e195c4801112009c9286b6a38984178c46f87b16 100644 (file)
@@ -83,13 +83,14 @@ public class AuthorityServiceUtils {
        return result;
     }
     
-    static public boolean setAuthorityItemDeprecated(DocumentModel docModel, String authorityItemCommonSchemaName, Boolean flag) throws Exception {
+    static public boolean setAuthorityItemDeprecated(ServiceContext ctx,
+               DocumentModel docModel, String authorityItemCommonSchemaName, Boolean flag) throws Exception {
        boolean result = false;
        
        docModel.setProperty(authorityItemCommonSchemaName, AuthorityItemJAXBSchema.DEPRECATED,
                        new Boolean(flag));
-       CoreSessionInterface session = (CoreSessionInterface) docModel.getCoreSession();
-       session.saveDocument(docModel);
+       CoreSessionInterface repoSession = (CoreSessionInterface) ctx.getCurrentRepositorySession();
+       repoSession.saveDocument(docModel);
        result = true;
        
        return result;
@@ -107,7 +108,7 @@ public class AuthorityServiceUtils {
        
        try {
                DocumentModel docModel = NuxeoUtils.getDocFromCsid(ctx, (CoreSessionInterface)ctx.getCurrentRepositorySession(), itemCsid);
-               result = setAuthorityItemDeprecated(docModel, authorityItemCommonSchemaName, AuthorityServiceUtils.DEPRECATED);
+               result = setAuthorityItemDeprecated(ctx, docModel, authorityItemCommonSchemaName, AuthorityServiceUtils.DEPRECATED);
        } catch (Exception e) {
                logger.warn(String.format("Could not mark item '%s' as deprecated.", itemCsid), e);
                throw e;
index fd6d102f36b10d9a5525f16ad0678ea6ed4c57f0..ee779e6a8ceae897b38c71d3caad060a9ef51941 100644 (file)
@@ -465,7 +465,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                                //
                                // This exception means we tried unsuccessfully to soft-delete (workflow transition 'delete') an item that still has references to it from other records.
                                //
-                               AuthorityServiceUtils.setAuthorityItemDeprecated(itemDocModel, authorityItemCommonSchemaName, AuthorityServiceUtils.DEPRECATED);  // Since we can't sof-delete it, we need to mark it as deprecated since it is soft-deleted on the SAS
+                               AuthorityServiceUtils.setAuthorityItemDeprecated(ctx, itemDocModel, authorityItemCommonSchemaName, AuthorityServiceUtils.DEPRECATED);  // Since we can't sof-delete it, we need to mark it as deprecated since it is soft-deleted on the SAS
                                logger.warn(String.format("Could not transition item CSID='%s' from workflow state '%s' to '%s'.  Check the services log file for details.",
                                                localItemCsid, localItemWorkflowState, sasWorkflowState));
                        }