diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml
index 623272bc65..1492b420ba 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml
@@ -4,55 +4,7 @@
-
-
-
-
-
-
- RECORD_FOLDER
- RECORD
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -70,6 +22,42 @@
+
+
+
+
+
+
+ HOLD
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ HOLD
+
+
+
+
+
+
+
+
@@ -132,4 +120,51 @@
+
+
+
+
+
+
+
+
+
+ RECORD_FOLDER
+ RECORD
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml
index 9e2b89842f..17bbf38dee 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml
@@ -23,7 +23,7 @@
-
+
@@ -42,7 +42,7 @@
-
+
@@ -61,7 +61,7 @@
-
+
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml
index 267220f657..88b27e7d33 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml
@@ -230,42 +230,4 @@
-
-
-
-
-
-
-
- HOLD
-
-
-
-
-
-
-
-
-
-
-
-
-
- HOLD
-
-
-
-
-
-
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties
index 8369fa97f8..39dba8ecf9 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties
@@ -66,6 +66,8 @@ capability.CreateHold.title=Create Hold
capability.AddToHold.title=Add to Hold
capability.RemoveFromHold.title=Remove from Hold
capability.FileHoldReport.title=File Hold Report
+capability.DeleteHold.title=Delete Hold
+capability.EditHold.title=Edit Hold
# Audit
capability.group.audit.title=Audit
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml
index 8d938b3e37..92311a5200 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml
@@ -93,6 +93,8 @@
+
+
@@ -179,6 +181,8 @@
+
+
@@ -474,6 +478,14 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml
index af7c9c4109..648d308704 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml
@@ -51,8 +51,8 @@
-
-
+
+
@@ -132,10 +132,9 @@
-
-
-
-
+
+
+
@@ -144,9 +143,8 @@
-
-
-
+
+
@@ -155,9 +153,8 @@
-
-
-
+
+
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml
index 0749edf9b5..8b43fd854c 100755
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml
index bf0d749558..e6e817df6a 100755
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml
@@ -92,4 +92,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
index 4763dc5682..6ab10bc8e8 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
@@ -1105,7 +1105,7 @@
- org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DeleteHoldContainer
+ org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DeleteHold
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW
org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
index 82ea286697..96be6476a8 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
@@ -548,30 +548,6 @@
-
-
-
-
- RECORD_FOLDER
- RECORD
-
-
-
-
-
-
-
-
-
- RECORD_FOLDER
- RECORD
-
-
-
-
-
@@ -660,28 +636,6 @@
-
-
-
-
- HOLD
-
-
-
-
-
-
-
-
-
- HOLD
-
-
-
-
-
@@ -904,6 +858,17 @@
HOLD
-
+
+
+
+
+
+
+
+ HOLD
+
+
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json b/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json
index 85d331cd96..9a7f66d80c 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json
@@ -142,7 +142,9 @@
"CreateHold",
"AddToHold",
"RemoveFromHold",
- "FileHoldReport"
+ "FileHoldReport",
+ "DeleteHold",
+ "EditHold"
]
},
{
@@ -213,7 +215,9 @@
"CreateHold",
"AddToHold",
"RemoveFromHold",
- "FileHoldReport"
+ "FileHoldReport",
+ "DeleteHold",
+ "EditHold"
]
}
]
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java
index 3bfa54b817..77e2f8cc6d 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java
@@ -161,7 +161,7 @@ public class CreateCapability extends DeclarativeCapability
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
- if (capabilityService.getCapability(RMPermissionModel.ADD_TO_HOLD).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED)
+ if (capabilityService.getCapability(RMPermissionModel.CREATE_HOLD).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED)
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java
new file mode 100644
index 0000000000..c0582e0f26
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2005-2014 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.module.org_alfresco_module_rm.patch.v22;
+
+import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch;
+import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/**
+ * RM v2.2 patch to add new hold releated capabilities.
+ *
+ * @author Roy Wetherall
+ * @since 2.2
+ */
+public class RMv22HoldCapabilityPatch extends CapabilityPatch
+{
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef)
+ */
+ protected void applyCapabilityPatch(NodeRef filePlan)
+ {
+ // add new capability
+ addCapability(filePlan,
+ "DeleteHold",
+ FilePlanRoleService.ROLE_ADMIN,
+ FilePlanRoleService.ROLE_RECORDS_MANAGER);
+ addCapability(filePlan,
+ "EditHold",
+ FilePlanRoleService.ROLE_ADMIN,
+ FilePlanRoleService.ROLE_RECORDS_MANAGER);
+ }
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java
index 85131c6f19..a2398c0cac 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java
@@ -1075,68 +1075,72 @@ public class RecordServiceImpl extends BaseBehaviourBean
String origionalName = (String)properties.get(PROP_ORIGIONAL_NAME);
NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION);
- // first remove the secondary link association
- List parentAssocs = nodeService.getParentAssocs(nodeRef);
- for (ChildAssociationRef childAssociationRef : parentAssocs)
+ // we can only reject if the originating location is present
+ if (originatingLocation != null)
{
- if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation))
+ // first remove the secondary link association
+ List parentAssocs = nodeService.getParentAssocs(nodeRef);
+ for (ChildAssociationRef childAssociationRef : parentAssocs)
{
- nodeService.removeChildAssociation(childAssociationRef);
- break;
+ if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation))
+ {
+ nodeService.removeChildAssociation(childAssociationRef);
+ break;
+ }
}
- }
-
- // remove all RM related aspects from the node
- Set aspects = nodeService.getAspects(nodeRef);
- for (QName aspect : aspects)
- {
- if (RM_URI.equals(aspect.getNamespaceURI()))
+
+ // remove all RM related aspects from the node
+ Set aspects = nodeService.getAspects(nodeRef);
+ for (QName aspect : aspects)
{
- // remove the aspect
- nodeService.removeAspect(nodeRef, aspect);
+ if (RM_URI.equals(aspect.getNamespaceURI()))
+ {
+ // remove the aspect
+ nodeService.removeAspect(nodeRef, aspect);
+ }
}
- }
-
- // get the records primary parent association
- ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
-
- // move the record into the collaboration site
- nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
-
- // rename to the origional name
- if (origionalName != null)
- {
- fileFolderService.rename(nodeRef, origionalName);
-
- if (logger.isDebugEnabled())
+
+ // get the records primary parent association
+ ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
+
+ // move the record into the collaboration site
+ nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
+
+ // rename to the origional name
+ if (origionalName != null)
{
- String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
- logger.debug("Rename " + name + " to " + origionalName);
+ fileFolderService.rename(nodeRef, origionalName);
+
+ if (logger.isDebugEnabled())
+ {
+ String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
+ logger.debug("Rename " + name + " to " + origionalName);
+ }
}
+
+ // save the information about the rejection details
+ Map aspectProperties = new HashMap(3);
+ aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId);
+ aspectProperties.put(PROP_RECORD_REJECTION_DATE, new Date());
+ aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason);
+ nodeService.addAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS, aspectProperties);
+
+ // Restore the owner of the document
+ if (StringUtils.isBlank(documentOwner))
+ {
+ throw new AlfrescoRuntimeException("Unable to find the creator of document.");
+ }
+ ownableService.setOwner(nodeRef, documentOwner);
+
+ // clear the existing permissions
+ permissionService.clearPermission(nodeRef, null);
+
+ // restore permission inheritance
+ permissionService.setInheritParentPermissions(nodeRef, true);
+
+ // send an email to the record creator
+ notificationHelper.recordRejectedEmailNotification(nodeRef, recordId, documentOwner);
}
-
- // save the information about the rejection details
- Map aspectProperties = new HashMap(3);
- aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId);
- aspectProperties.put(PROP_RECORD_REJECTION_DATE, new Date());
- aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason);
- nodeService.addAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS, aspectProperties);
-
- // Restore the owner of the document
- if (StringUtils.isBlank(documentOwner))
- {
- throw new AlfrescoRuntimeException("Unable to find the creator of document.");
- }
- ownableService.setOwner(nodeRef, documentOwner);
-
- // clear the existing permissions
- permissionService.clearPermission(nodeRef, null);
-
- // restore permission inheritance
- permissionService.setInheritParentPermissions(nodeRef, true);
-
- // send an email to the record creator
- notificationHelper.recordRejectedEmailNotification(nodeRef, recordId, documentOwner);
}
finally
{
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
index fc80f82ff6..38ba4304e0 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
@@ -94,8 +94,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
return new String[]
{
"classpath:alfresco/application-context.xml",
- "classpath:test-context.xml",
- "classpath:test-job-context.xml"
+ "classpath:test-context.xml"
};
}
protected ApplicationContext applicationContext;