mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-6941 added slf4j and test [ags]
This commit is contained in:
@@ -45,4 +45,4 @@ rm.action.create.transfer.container.child-error-message=You can't create items i
|
|||||||
rm.action.create.transfer.child-error-message=You can't create items in Transfer Folders.
|
rm.action.create.transfer.child-error-message=You can't create items in Transfer Folders.
|
||||||
rm.action.create.record.folder.child-error-message=You can only create records in record folders and this was a {0}.
|
rm.action.create.record.folder.child-error-message=You can only create records in record folders and this was a {0}.
|
||||||
rm.action.transfer-non-editable=You can't edit transfer folder or container metadata.
|
rm.action.transfer-non-editable=You can't edit transfer folder or container metadata.
|
||||||
rm.action.node.frozen.error-message=Unable to perform action {0} because node is frozen or has frozen children.
|
rm.action.node.frozen.error-message=Unable to perform action {0} because the node is frozen or has frozen children.
|
||||||
|
@@ -80,7 +80,7 @@
|
|||||||
<property name="searchService" ref="searchService" />
|
<property name="searchService" ref="searchService" />
|
||||||
<property name="personService" ref="personService" />
|
<property name="personService" ref="personService" />
|
||||||
<property name="recordsManagementActionService" ref="recordsManagementActionService" />
|
<property name="recordsManagementActionService" ref="recordsManagementActionService" />
|
||||||
<property name="freezeService" ref="freezeService"/>
|
<property name="freezeService" ref="freezeService"/>
|
||||||
<property name="batchSize" value="${rm.dispositionlifecycletrigger.batchsize}"/>
|
<property name="batchSize" value="${rm.dispositionlifecycletrigger.batchsize}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@@ -953,6 +953,7 @@
|
|||||||
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.hasFrozenChildren=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.hasFrozenChildren=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.getFreezeDate=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.getFreezeDate=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.getFreezeInitiator=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.getFreezeInitiator=RM_ALLOW
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.isFrozenOrHasFrozenChildren=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.*=RM_DENY
|
org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService.*=RM_DENY
|
||||||
]]>
|
]]>
|
||||||
</value>
|
</value>
|
||||||
|
@@ -141,6 +141,11 @@
|
|||||||
<artifactId>spring-test</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@@ -54,10 +54,9 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RecordsManagementActionServiceImpl implements RecordsManagementActionService {
|
public class RecordsManagementActionServiceImpl implements RecordsManagementActionService
|
||||||
/**
|
{
|
||||||
* I18N
|
/** I18N */
|
||||||
*/
|
|
||||||
private static final String MSG_NOT_DEFINED = "rm.action.not-defined";
|
private static final String MSG_NOT_DEFINED = "rm.action.not-defined";
|
||||||
private static final String MSG_NO_IMPLICIT_NODEREF = "rm.action.no-implicit-noderef";
|
private static final String MSG_NO_IMPLICIT_NODEREF = "rm.action.no-implicit-noderef";
|
||||||
private static final String MSG_NODE_FROZEN = "rm.action.node.frozen.error-message";
|
private static final String MSG_NODE_FROZEN = "rm.action.node.frozen.error-message";
|
||||||
@@ -70,19 +69,13 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
|
|
||||||
private Map<String, RecordsManagementAction> dispositionActions = new HashMap<>(5);
|
private Map<String, RecordsManagementAction> dispositionActions = new HashMap<>(5);
|
||||||
|
|
||||||
/**
|
/** Policy component */
|
||||||
* Policy component
|
|
||||||
*/
|
|
||||||
private PolicyComponent policyComponent;
|
private PolicyComponent policyComponent;
|
||||||
|
|
||||||
/**
|
/** Node service */
|
||||||
* Node service
|
|
||||||
*/
|
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
/**
|
/** Policy delegates */
|
||||||
* Policy delegates
|
|
||||||
*/
|
|
||||||
private ClassPolicyDelegate<BeforeRMActionExecution> beforeRMActionExecutionDelegate;
|
private ClassPolicyDelegate<BeforeRMActionExecution> beforeRMActionExecutionDelegate;
|
||||||
private ClassPolicyDelegate<OnRMActionExecution> onRMActionExecutionDelegate;
|
private ClassPolicyDelegate<OnRMActionExecution> onRMActionExecutionDelegate;
|
||||||
|
|
||||||
@@ -94,7 +87,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* @param freezeService freeze service
|
* @param freezeService freeze service
|
||||||
*/
|
*/
|
||||||
public void setFreezeService(FreezeService freezeService) {
|
public void setFreezeService(FreezeService freezeService)
|
||||||
|
{
|
||||||
this.freezeService = freezeService;
|
this.freezeService = freezeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,21 +97,24 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
*/
|
*/
|
||||||
private List<String> retentionActions;
|
private List<String> retentionActions;
|
||||||
|
|
||||||
public void setRetentionActions(List<String> retentionActions) {
|
public void setRetentionActions(List<String> retentionActions)
|
||||||
|
{
|
||||||
this.retentionActions = retentionActions;
|
this.retentionActions = retentionActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Policy component
|
* @return Policy component
|
||||||
*/
|
*/
|
||||||
protected PolicyComponent getPolicyComponent() {
|
protected PolicyComponent getPolicyComponent()
|
||||||
|
{
|
||||||
return this.policyComponent;
|
return this.policyComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Node Service
|
* @return Node Service
|
||||||
*/
|
*/
|
||||||
protected NodeService getNodeService() {
|
protected NodeService getNodeService()
|
||||||
|
{
|
||||||
return this.nodeService;
|
return this.nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,23 +123,26 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
*
|
*
|
||||||
* @param policyComponent policy component
|
* @param policyComponent policy component
|
||||||
*/
|
*/
|
||||||
public void setPolicyComponent(PolicyComponent policyComponent) {
|
public void setPolicyComponent(PolicyComponent policyComponent)
|
||||||
|
{
|
||||||
this.policyComponent = policyComponent;
|
this.policyComponent = policyComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the node service
|
* Set the node service
|
||||||
*
|
*
|
||||||
* @param nodeService node service
|
* @param nodeService node service
|
||||||
*/
|
*/
|
||||||
public void setNodeService(NodeService nodeService) {
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise RM action service
|
* Initialise RM action service
|
||||||
*/
|
*/
|
||||||
public void init() {
|
public void init()
|
||||||
|
{
|
||||||
// Register the various policies
|
// Register the various policies
|
||||||
beforeRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(BeforeRMActionExecution.class);
|
beforeRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(BeforeRMActionExecution.class);
|
||||||
onRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(OnRMActionExecution.class);
|
onRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(OnRMActionExecution.class);
|
||||||
@@ -151,18 +151,23 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#register(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#register(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction)
|
||||||
*/
|
*/
|
||||||
public void register(RecordsManagementAction rmAction) {
|
public void register(RecordsManagementAction rmAction)
|
||||||
if (!rmActions.containsKey(rmAction.getName())) {
|
{
|
||||||
|
if (!rmActions.containsKey(rmAction.getName()))
|
||||||
|
{
|
||||||
rmActions.put(rmAction.getName(), rmAction);
|
rmActions.put(rmAction.getName(), rmAction);
|
||||||
|
|
||||||
if (rmAction.isDispositionAction()) {
|
if (rmAction.isDispositionAction())
|
||||||
|
{
|
||||||
dispositionActions.put(rmAction.getName(), rmAction);
|
dispositionActions.put(rmAction.getName(), rmAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(RecordsManagementActionCondition rmCondition) {
|
public void register(RecordsManagementActionCondition rmCondition)
|
||||||
if (!rmConditions.containsKey(rmCondition.getBeanName())) {
|
{
|
||||||
|
if (!rmConditions.containsKey(rmCondition.getBeanName()))
|
||||||
|
{
|
||||||
rmConditions.put(rmCondition.getBeanName(), rmCondition);
|
rmConditions.put(rmCondition.getBeanName(), rmCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,11 +175,12 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* Invoke beforeRMActionExecution policy
|
* Invoke beforeRMActionExecution policy
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
* @param name action name
|
* @param name action name
|
||||||
* @param parameters action parameters
|
* @param parameters action parameters
|
||||||
*/
|
*/
|
||||||
protected void invokeBeforeRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters) {
|
protected void invokeBeforeRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters)
|
||||||
|
{
|
||||||
// get qnames to invoke against
|
// get qnames to invoke against
|
||||||
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef);
|
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef);
|
||||||
// execute policy for node type and aspects
|
// execute policy for node type and aspects
|
||||||
@@ -185,11 +191,12 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* Invoke onRMActionExecution policy
|
* Invoke onRMActionExecution policy
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
* @param name action name
|
* @param name action name
|
||||||
* @param parameters action parameters
|
* @param parameters action parameters
|
||||||
*/
|
*/
|
||||||
protected void invokeOnRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters) {
|
protected void invokeOnRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters)
|
||||||
|
{
|
||||||
// get qnames to invoke against
|
// get qnames to invoke against
|
||||||
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef);
|
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef);
|
||||||
// execute policy for node type and aspects
|
// execute policy for node type and aspects
|
||||||
@@ -200,7 +207,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActions()
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActions()
|
||||||
*/
|
*/
|
||||||
public List<RecordsManagementAction> getRecordsManagementActions() {
|
public List<RecordsManagementAction> getRecordsManagementActions()
|
||||||
|
{
|
||||||
List<RecordsManagementAction> result = new ArrayList<>(this.rmActions.size());
|
List<RecordsManagementAction> result = new ArrayList<>(this.rmActions.size());
|
||||||
result.addAll(this.rmActions.values());
|
result.addAll(this.rmActions.values());
|
||||||
return Collections.unmodifiableList(result);
|
return Collections.unmodifiableList(result);
|
||||||
@@ -210,7 +218,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActionConditions()
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActionConditions()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<RecordsManagementActionCondition> getRecordsManagementActionConditions() {
|
public List<RecordsManagementActionCondition> getRecordsManagementActionConditions()
|
||||||
|
{
|
||||||
List<RecordsManagementActionCondition> result = new ArrayList<>(rmConditions.size());
|
List<RecordsManagementActionCondition> result = new ArrayList<>(rmConditions.size());
|
||||||
result.addAll(rmConditions.values());
|
result.addAll(rmConditions.values());
|
||||||
return Collections.unmodifiableList(result);
|
return Collections.unmodifiableList(result);
|
||||||
@@ -223,10 +232,12 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
* @return List of records management action
|
* @return List of records management action
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public List<RecordsManagementAction> getDispositionActions(NodeRef nodeRef) {
|
public List<RecordsManagementAction> getDispositionActions(NodeRef nodeRef)
|
||||||
|
{
|
||||||
List<RecordsManagementAction> result = new ArrayList<>(this.rmActions.size());
|
List<RecordsManagementAction> result = new ArrayList<>(this.rmActions.size());
|
||||||
|
|
||||||
for (RecordsManagementAction action : this.rmActions.values()) {
|
for (RecordsManagementAction action : this.rmActions.values())
|
||||||
|
{
|
||||||
// TODO check the permissions on the action ...
|
// TODO check the permissions on the action ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +247,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionActions()
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionActions()
|
||||||
*/
|
*/
|
||||||
public List<RecordsManagementAction> getDispositionActions() {
|
public List<RecordsManagementAction> getDispositionActions()
|
||||||
|
{
|
||||||
List<RecordsManagementAction> result = new ArrayList<>(dispositionActions.size());
|
List<RecordsManagementAction> result = new ArrayList<>(dispositionActions.size());
|
||||||
result.addAll(dispositionActions.values());
|
result.addAll(dispositionActions.values());
|
||||||
return Collections.unmodifiableList(result);
|
return Collections.unmodifiableList(result);
|
||||||
@@ -245,47 +257,54 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionAction(java.lang.String)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionAction(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public RecordsManagementAction getDispositionAction(String name) {
|
public RecordsManagementAction getDispositionAction(String name)
|
||||||
|
{
|
||||||
return dispositionActions.get(name);
|
return dispositionActions.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementAction(java.lang.String)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementAction(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public RecordsManagementAction getRecordsManagementAction(String name) {
|
public RecordsManagementAction getRecordsManagementAction(String name)
|
||||||
|
{
|
||||||
return this.rmActions.get(name);
|
return this.rmActions.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name) {
|
public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name)
|
||||||
|
{
|
||||||
return executeRecordsManagementAction(nodeRef, name, null);
|
return executeRecordsManagementAction(nodeRef, name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public Map<NodeRef, RecordsManagementActionResult> executeRecordsManagementAction(List<NodeRef> nodeRefs, String name) {
|
public Map<NodeRef, RecordsManagementActionResult> executeRecordsManagementAction(List<NodeRef> nodeRefs, String name)
|
||||||
|
{
|
||||||
return executeRecordsManagementAction(nodeRefs, name, null);
|
return executeRecordsManagementAction(nodeRefs, name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map)
|
||||||
*/
|
*/
|
||||||
public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name, Map<String, Serializable> parameters) {
|
public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name, Map<String, Serializable> parameters)
|
||||||
|
{
|
||||||
log.debug("Executing record management action on " + nodeRef);
|
log.debug("Executing record management action on " + nodeRef);
|
||||||
log.debug(" actionName = " + name);
|
log.debug(" actionName = " + name);
|
||||||
log.debug(" parameters = " + parameters);
|
log.debug(" parameters = " + parameters);
|
||||||
|
|
||||||
RecordsManagementAction rmAction = this.rmActions.get(name);
|
RecordsManagementAction rmAction = this.rmActions.get(name);
|
||||||
if (rmAction == null) {
|
if (rmAction == null)
|
||||||
|
{
|
||||||
String msg = I18NUtil.getMessage(MSG_NOT_DEFINED, name);
|
String msg = I18NUtil.getMessage(MSG_NOT_DEFINED, name);
|
||||||
log.warn(msg);
|
log.warn(msg);
|
||||||
throw new AlfrescoRuntimeException(msg);
|
throw new AlfrescoRuntimeException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freezeService.isFrozenOrHasFrozenChildren(nodeRef) && retentionActions.contains(name.toLowerCase())) {
|
if (freezeService.isFrozenOrHasFrozenChildren(nodeRef) && retentionActions.contains(name.toLowerCase()))
|
||||||
|
{
|
||||||
String msg = I18NUtil.getMessage(MSG_NODE_FROZEN, name);
|
String msg = I18NUtil.getMessage(MSG_NODE_FROZEN, name);
|
||||||
|
|
||||||
log.debug(msg);
|
log.debug(msg);
|
||||||
@@ -296,7 +315,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
// Execute action
|
// Execute action
|
||||||
invokeBeforeRMActionExecution(nodeRef, name, parameters);
|
invokeBeforeRMActionExecution(nodeRef, name, parameters);
|
||||||
RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters);
|
RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters);
|
||||||
if (getNodeService().exists(nodeRef)) {
|
if (getNodeService().exists(nodeRef))
|
||||||
|
{
|
||||||
invokeOnRMActionExecution(nodeRef, name, parameters);
|
invokeOnRMActionExecution(nodeRef, name, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,15 +326,18 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.lang.String, java.util.Map)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.lang.String, java.util.Map)
|
||||||
*/
|
*/
|
||||||
public RecordsManagementActionResult executeRecordsManagementAction(String name, Map<String, Serializable> parameters) {
|
public RecordsManagementActionResult executeRecordsManagementAction(String name, Map<String, Serializable> parameters)
|
||||||
|
{
|
||||||
RecordsManagementAction rmAction = rmActions.get(name);
|
RecordsManagementAction rmAction = rmActions.get(name);
|
||||||
|
|
||||||
NodeRef implicitTargetNode = rmAction.getImplicitTargetNodeRef();
|
NodeRef implicitTargetNode = rmAction.getImplicitTargetNodeRef();
|
||||||
if (implicitTargetNode == null) {
|
if (implicitTargetNode == null)
|
||||||
|
{
|
||||||
String msg = I18NUtil.getMessage(MSG_NO_IMPLICIT_NODEREF, name);
|
String msg = I18NUtil.getMessage(MSG_NO_IMPLICIT_NODEREF, name);
|
||||||
log.warn(msg);
|
log.warn(msg);
|
||||||
throw new AlfrescoRuntimeException(msg);
|
throw new AlfrescoRuntimeException(msg);
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
return this.executeRecordsManagementAction(implicitTargetNode, name, parameters);
|
return this.executeRecordsManagementAction(implicitTargetNode, name, parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,10 +345,12 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
|||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String, java.util.Map)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String, java.util.Map)
|
||||||
*/
|
*/
|
||||||
public Map<NodeRef, RecordsManagementActionResult> executeRecordsManagementAction(List<NodeRef> nodeRefs, String name, Map<String, Serializable> parameters) {
|
public Map<NodeRef, RecordsManagementActionResult> executeRecordsManagementAction(List<NodeRef> nodeRefs, String name, Map<String, Serializable> parameters)
|
||||||
|
{
|
||||||
// Execute the action on each node in the list
|
// Execute the action on each node in the list
|
||||||
Map<NodeRef, RecordsManagementActionResult> results = new HashMap<>(nodeRefs.size());
|
Map<NodeRef, RecordsManagementActionResult> results = new HashMap<>(nodeRefs.size());
|
||||||
for (NodeRef nodeRef : nodeRefs) {
|
for (NodeRef nodeRef : nodeRefs)
|
||||||
|
{
|
||||||
RecordsManagementActionResult result = executeRecordsManagementAction(nodeRef, name, parameters);
|
RecordsManagementActionResult result = executeRecordsManagementAction(nodeRef, name, parameters);
|
||||||
results.put(nodeRef, result);
|
results.put(nodeRef, result);
|
||||||
}
|
}
|
||||||
|
@@ -66,20 +66,15 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
*/
|
*/
|
||||||
public class FreezeServiceImpl extends ServiceBaseImpl
|
public class FreezeServiceImpl extends ServiceBaseImpl
|
||||||
implements FreezeService,
|
implements FreezeService,
|
||||||
RecordsManagementModel {
|
RecordsManagementModel
|
||||||
/**
|
{
|
||||||
* I18N
|
/** I18N */
|
||||||
*/
|
|
||||||
private static final String MSG_HOLD_NAME = "rm.hold.name";
|
private static final String MSG_HOLD_NAME = "rm.hold.name";
|
||||||
|
|
||||||
/**
|
/** File Plan Service */
|
||||||
* File Plan Service
|
|
||||||
*/
|
|
||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
|
|
||||||
/**
|
/** Hold service */
|
||||||
* Hold service
|
|
||||||
*/
|
|
||||||
private HoldService holdService;
|
private HoldService holdService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -398,10 +393,13 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
|||||||
* @return <code>true</code> if the node is frozen or has frozen children, <code>false</code> otherwise
|
* @return <code>true</code> if the node is frozen or has frozen children, <code>false</code> otherwise
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isFrozenOrHasFrozenChildren(NodeRef nodeRef) {
|
public boolean isFrozenOrHasFrozenChildren(NodeRef nodeRef)
|
||||||
if (recordFolderService.isRecordFolder(nodeRef)) {
|
{
|
||||||
|
if (recordFolderService.isRecordFolder(nodeRef))
|
||||||
|
{
|
||||||
return isFrozen(nodeRef) || hasFrozenChildren(nodeRef);
|
return isFrozen(nodeRef) || hasFrozenChildren(nodeRef);
|
||||||
} else if (recordService.isRecord(nodeRef)) {
|
} else if (recordService.isRecord(nodeRef))
|
||||||
|
{
|
||||||
return isFrozen(nodeRef);
|
return isFrozen(nodeRef);
|
||||||
}
|
}
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
|
@@ -59,46 +59,31 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecuter {
|
public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecuter {
|
||||||
/**
|
|
||||||
* batching properties
|
/** batching properties */
|
||||||
*/
|
|
||||||
private int batchSize;
|
private int batchSize;
|
||||||
public static final int DEFAULT_BATCH_SIZE = 500;
|
public static final int DEFAULT_BATCH_SIZE = 500;
|
||||||
private static final String MSG_NODE_FROZEN = "rm.action.node.frozen.error-message";
|
private static final String MSG_NODE_FROZEN = "rm.action.node.frozen.error-message";
|
||||||
|
|
||||||
/**
|
/** list of disposition actions to automatically execute */
|
||||||
* list of disposition actions to automatically execute
|
|
||||||
*/
|
|
||||||
private List<String> dispositionActions;
|
private List<String> dispositionActions;
|
||||||
|
|
||||||
/**
|
/** query string */
|
||||||
* query string
|
|
||||||
*/
|
|
||||||
private String query;
|
private String query;
|
||||||
|
|
||||||
/**
|
/** records management action service */
|
||||||
* records management action service
|
|
||||||
*/
|
|
||||||
private RecordsManagementActionService recordsManagementActionService;
|
private RecordsManagementActionService recordsManagementActionService;
|
||||||
|
|
||||||
/**
|
/** node service */
|
||||||
* node service
|
|
||||||
*/
|
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
/**
|
/** search service */
|
||||||
* search service
|
|
||||||
*/
|
|
||||||
private SearchService searchService;
|
private SearchService searchService;
|
||||||
|
|
||||||
/**
|
/** person service */
|
||||||
* person service
|
|
||||||
*/
|
|
||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
|
|
||||||
/**
|
/** freeze service */
|
||||||
* Freeze Service
|
|
||||||
*/
|
|
||||||
private FreezeService freezeService;
|
private FreezeService freezeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,32 +98,37 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
*
|
*
|
||||||
* @param dispositionActions disposition actions
|
* @param dispositionActions disposition actions
|
||||||
*/
|
*/
|
||||||
public void setDispositionActions(List<String> dispositionActions) {
|
public void setDispositionActions(List<String> dispositionActions)
|
||||||
|
{
|
||||||
this.dispositionActions = dispositionActions;
|
this.dispositionActions = dispositionActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBatchSize(int batchSize) {
|
public void setBatchSize(int batchSize)
|
||||||
|
{
|
||||||
this.batchSize = batchSize;
|
this.batchSize = batchSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recordsManagementActionService records management action service
|
* @param recordsManagementActionService records management action service
|
||||||
*/
|
*/
|
||||||
public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) {
|
public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService)
|
||||||
|
{
|
||||||
this.recordsManagementActionService = recordsManagementActionService;
|
this.recordsManagementActionService = recordsManagementActionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService node service
|
* @param nodeService node service
|
||||||
*/
|
*/
|
||||||
public void setNodeService(NodeService nodeService) {
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param searchService search service
|
* @param searchService search service
|
||||||
*/
|
*/
|
||||||
public void setSearchService(SearchService searchService) {
|
public void setSearchService(SearchService searchService)
|
||||||
|
{
|
||||||
this.searchService = searchService;
|
this.searchService = searchService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,18 +137,24 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
*
|
*
|
||||||
* @return job query string
|
* @return job query string
|
||||||
*/
|
*/
|
||||||
protected String getQuery() {
|
protected String getQuery()
|
||||||
if (query == null) {
|
{
|
||||||
|
if (query == null)
|
||||||
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append("TYPE:\"rma:dispositionAction\" AND ");
|
sb.append("TYPE:\"rma:dispositionAction\" AND ");
|
||||||
sb.append("(@rma\\:dispositionAction:(");
|
sb.append("(@rma\\:dispositionAction:(");
|
||||||
|
|
||||||
boolean bFirst = true;
|
boolean bFirst = true;
|
||||||
for (String dispositionAction : dispositionActions) {
|
for (String dispositionAction : dispositionActions)
|
||||||
if (bFirst) {
|
{
|
||||||
|
if (bFirst)
|
||||||
|
{
|
||||||
bFirst = false;
|
bFirst = false;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sb.append(" OR ");
|
sb.append(" OR ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,11 +178,14 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
* @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute()
|
* @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void executeImpl() {
|
public void executeImpl()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
log.debug("Job Starting");
|
log.debug("Job Starting");
|
||||||
|
|
||||||
if (dispositionActions == null || dispositionActions.isEmpty()) {
|
if (dispositionActions == null || dispositionActions.isEmpty())
|
||||||
|
{
|
||||||
log.debug("Job Finished as disposition action is empty");
|
log.debug("Job Finished as disposition action is empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -194,14 +193,16 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
boolean hasMore = true;
|
boolean hasMore = true;
|
||||||
int skipCount = 0;
|
int skipCount = 0;
|
||||||
|
|
||||||
if (batchSize < 1) {
|
if (batchSize < 1)
|
||||||
|
{
|
||||||
log.debug("Invalid value for batch size: " + batchSize + " default value used instead.");
|
log.debug("Invalid value for batch size: " + batchSize + " default value used instead.");
|
||||||
batchSize = DEFAULT_BATCH_SIZE;
|
batchSize = DEFAULT_BATCH_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.trace("Using batch size of " + batchSize);
|
log.trace("Using batch size of " + batchSize);
|
||||||
|
|
||||||
while (hasMore) {
|
while (hasMore)
|
||||||
|
{
|
||||||
SearchParameters params = new SearchParameters();
|
SearchParameters params = new SearchParameters();
|
||||||
params.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
params.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||||
params.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
params.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
||||||
@@ -219,12 +220,14 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
log.debug("Processing " + resultNodes.size() + " nodes");
|
log.debug("Processing " + resultNodes.size() + " nodes");
|
||||||
|
|
||||||
// process search results
|
// process search results
|
||||||
if (!resultNodes.isEmpty()) {
|
if (!resultNodes.isEmpty())
|
||||||
|
{
|
||||||
executeAction(resultNodes);
|
executeAction(resultNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.debug("Job Finished");
|
log.debug("Job Finished");
|
||||||
} catch (AlfrescoRuntimeException exception) {
|
} catch (AlfrescoRuntimeException exception)
|
||||||
|
{
|
||||||
log.debug(exception.getMessage());
|
log.debug(exception.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,39 +237,47 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
|||||||
*
|
*
|
||||||
* @param actionNodes - the disposition actions to execute
|
* @param actionNodes - the disposition actions to execute
|
||||||
*/
|
*/
|
||||||
private void executeAction(final List<NodeRef> actionNodes) {
|
private void executeAction(final List<NodeRef> actionNodes)
|
||||||
|
{
|
||||||
RetryingTransactionCallback<Boolean> processTranCB = () -> {
|
RetryingTransactionCallback<Boolean> processTranCB = () -> {
|
||||||
for (NodeRef actionNode : actionNodes) {
|
for (NodeRef actionNode : actionNodes)
|
||||||
if (!nodeService.exists(actionNode)) {
|
{
|
||||||
|
if (!nodeService.exists(actionNode))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String dispAction = (String) nodeService.getProperty(actionNode, PROP_DISPOSITION_ACTION);
|
final String dispAction = (String) nodeService.getProperty(actionNode, PROP_DISPOSITION_ACTION);
|
||||||
|
|
||||||
// Run disposition action
|
// Run disposition action
|
||||||
if (dispAction == null || !dispositionActions.contains(dispAction)) {
|
if (dispAction == null || !dispositionActions.contains(dispAction))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChildAssociationRef parent = nodeService.getPrimaryParent(actionNode);
|
ChildAssociationRef parent = nodeService.getPrimaryParent(actionNode);
|
||||||
if (!parent.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) {
|
if (!parent.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Map<String, Serializable> props = Map.of(PARAM_NO_ERROR_CHECK, false);
|
Map<String, Serializable> props = Map.of(PARAM_NO_ERROR_CHECK, false);
|
||||||
|
|
||||||
if (freezeService.isFrozenOrHasFrozenChildren(parent.getParentRef())) {
|
if (freezeService.isFrozenOrHasFrozenChildren(parent.getParentRef()))
|
||||||
|
{
|
||||||
log.debug(I18NUtil.getMessage(MSG_NODE_FROZEN, dispAction));
|
log.debug(I18NUtil.getMessage(MSG_NODE_FROZEN, dispAction));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
// execute disposition action
|
// execute disposition action
|
||||||
recordsManagementActionService
|
recordsManagementActionService
|
||||||
.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
|
.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
|
||||||
|
|
||||||
log.debug("Processed action: " + dispAction + "on" + parent);
|
log.debug("Processed action: " + dispAction + "on" + parent);
|
||||||
|
|
||||||
} catch (AlfrescoRuntimeException exception) {
|
} catch (AlfrescoRuntimeException exception)
|
||||||
|
{
|
||||||
log.debug(exception.getMessage());
|
log.debug(exception.getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -41,11 +41,13 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class FreezeServiceImplTest extends BaseRMTestCase {
|
public class FreezeServiceImplTest extends BaseRMTestCase
|
||||||
|
{
|
||||||
private List<NodeRef> holdAssocs;
|
private List<NodeRef> holdAssocs;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isRecordTest() {
|
protected boolean isRecordTest()
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,12 +56,15 @@ public class FreezeServiceImplTest extends BaseRMTestCase {
|
|||||||
*
|
*
|
||||||
* @deprecated as of 2.2
|
* @deprecated as of 2.2
|
||||||
*/
|
*/
|
||||||
public void testFreezeService() throws Exception {
|
public void testFreezeService() throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
doTestInTransaction(new Test<Void>() {
|
doTestInTransaction(new Test<Void>()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception
|
||||||
|
{
|
||||||
assertTrue(recordService.isRecord(recordOne));
|
assertTrue(recordService.isRecord(recordOne));
|
||||||
assertTrue(recordService.isRecord(recordTwo));
|
assertTrue(recordService.isRecord(recordTwo));
|
||||||
assertTrue(recordService.isRecord(recordThree));
|
assertTrue(recordService.isRecord(recordThree));
|
||||||
@@ -122,25 +127,30 @@ public class FreezeServiceImplTest extends BaseRMTestCase {
|
|||||||
assertNotNull(holdAssocs);
|
assertNotNull(holdAssocs);
|
||||||
assertEquals(2, holdAssocs.size());
|
assertEquals(2, holdAssocs.size());
|
||||||
|
|
||||||
for (NodeRef hold : holdAssocs) {
|
for (NodeRef hold : holdAssocs)
|
||||||
|
{
|
||||||
String reason = holdService.getHoldReason(hold);
|
String reason = holdService.getHoldReason(hold);
|
||||||
if (reason.equals("Freeze a set of nodes")) {
|
if (reason.equals("Freeze a set of nodes"))
|
||||||
|
{
|
||||||
assertEquals(newHold, hold);
|
assertEquals(newHold, hold);
|
||||||
frozenNodes = holdService.getHeld(hold);
|
frozenNodes = holdService.getHeld(hold);
|
||||||
assertNotNull(frozenNodes);
|
assertNotNull(frozenNodes);
|
||||||
assertEquals(3, frozenNodes.size());
|
assertEquals(3, frozenNodes.size());
|
||||||
} else if (reason.equals("NewFreezeReason")) {
|
} else if (reason.equals("NewFreezeReason"))
|
||||||
|
{
|
||||||
frozenNodes = holdService.getHeld(hold);
|
frozenNodes = holdService.getHeld(hold);
|
||||||
assertNotNull(frozenNodes);
|
assertNotNull(frozenNodes);
|
||||||
assertEquals(1, frozenNodes.size());
|
assertEquals(1, frozenNodes.size());
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds.");
|
throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the nodes are frozen
|
// Check the nodes are frozen
|
||||||
final List<NodeRef> testRecords = Arrays.asList(new NodeRef[]{recordOne, recordTwo, recordThree});
|
final List<NodeRef> testRecords = Arrays.asList(new NodeRef[] { recordOne, recordTwo, recordThree });
|
||||||
for (NodeRef nr : testRecords) {
|
for (NodeRef nr : testRecords)
|
||||||
|
{
|
||||||
assertTrue(freezeService.isFrozen(nr));
|
assertTrue(freezeService.isFrozen(nr));
|
||||||
assertNotNull(freezeService.getFreezeDate(nr));
|
assertNotNull(freezeService.getFreezeDate(nr));
|
||||||
assertNotNull(freezeService.getFreezeInitiator(nr));
|
assertNotNull(freezeService.getFreezeInitiator(nr));
|
||||||
@@ -152,17 +162,21 @@ public class FreezeServiceImplTest extends BaseRMTestCase {
|
|||||||
holdAssocs = holdService.getHolds(filePlan);
|
holdAssocs = holdService.getHolds(filePlan);
|
||||||
assertNotNull(holdAssocs);
|
assertNotNull(holdAssocs);
|
||||||
assertEquals(2, holdAssocs.size());
|
assertEquals(2, holdAssocs.size());
|
||||||
for (NodeRef hold : holdAssocs) {
|
for (NodeRef hold : holdAssocs)
|
||||||
|
{
|
||||||
String reason = holdService.getHoldReason(hold);
|
String reason = holdService.getHoldReason(hold);
|
||||||
if (reason.equals("Freeze a set of nodes")) {
|
if (reason.equals("Freeze a set of nodes"))
|
||||||
|
{
|
||||||
frozenNodes = holdService.getHeld(hold);
|
frozenNodes = holdService.getHeld(hold);
|
||||||
assertNotNull(frozenNodes);
|
assertNotNull(frozenNodes);
|
||||||
assertEquals(2, frozenNodes.size());
|
assertEquals(2, frozenNodes.size());
|
||||||
} else if (reason.equals("NewFreezeReason")) {
|
} else if (reason.equals("NewFreezeReason"))
|
||||||
|
{
|
||||||
frozenNodes = holdService.getHeld(hold);
|
frozenNodes = holdService.getHeld(hold);
|
||||||
assertNotNull(frozenNodes);
|
assertNotNull(frozenNodes);
|
||||||
assertEquals(1, frozenNodes.size());
|
assertEquals(1, frozenNodes.size());
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds.");
|
throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,9 +194,11 @@ public class FreezeServiceImplTest extends BaseRMTestCase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//Splitting transaction to fix onCreateNodePolicy issue where there was a node not found exception
|
//Splitting transaction to fix onCreateNodePolicy issue where there was a node not found exception
|
||||||
doTestInTransaction(new Test<Void>() {
|
doTestInTransaction(new Test<Void>()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception
|
||||||
|
{
|
||||||
// Relinquish the first hold
|
// Relinquish the first hold
|
||||||
NodeRef holdNodeRef = holdAssocs.iterator().next();
|
NodeRef holdNodeRef = holdAssocs.iterator().next();
|
||||||
holdService.deleteHold(holdNodeRef);
|
holdService.deleteHold(holdNodeRef);
|
||||||
@@ -230,9 +246,11 @@ public class FreezeServiceImplTest extends BaseRMTestCase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//Splitting transaction to fix onCreateNodePolicy issue where there was a node not found exception
|
//Splitting transaction to fix onCreateNodePolicy issue where there was a node not found exception
|
||||||
doTestInTransaction(new Test<Void>() {
|
doTestInTransaction(new Test<Void>()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception
|
||||||
|
{
|
||||||
// Relinquish the first hold
|
// Relinquish the first hold
|
||||||
holdService.deleteHold(holdAssocs.iterator().next());
|
holdService.deleteHold(holdAssocs.iterator().next());
|
||||||
|
|
||||||
@@ -247,10 +265,12 @@ public class FreezeServiceImplTest extends BaseRMTestCase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
doTestInTransaction(new Test<Void>() {
|
doTestInTransaction(new Test<Void>()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception
|
||||||
NodeRef hold101 = holdService.createHold(filePlan, "freezename 101", "FreezeReason", null);
|
{
|
||||||
|
NodeRef hold101 = holdService.createHold(filePlan, "freezename 103", "FreezeReason", null);
|
||||||
// Freeze a record folder
|
// Freeze a record folder
|
||||||
assertNotNull(hold101);
|
assertNotNull(hold101);
|
||||||
holdService.addToHold(hold101, rmFolder);
|
holdService.addToHold(hold101, rmFolder);
|
||||||
@@ -260,14 +280,16 @@ public class FreezeServiceImplTest extends BaseRMTestCase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
doTestInTransaction(new Test<Void>() {
|
doTestInTransaction(new Test<Void>()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception
|
||||||
NodeRef hold101 = holdService.createHold(filePlan, "freezename 101", "FreezeReason", null);
|
{
|
||||||
|
NodeRef hold101 = holdService.createHold(filePlan, "freezename 104", "FreezeReason", null);
|
||||||
// Freeze a record inside a record folder
|
// Freeze a record inside a record folder
|
||||||
assertNotNull(hold101);
|
assertNotNull(hold101);
|
||||||
holdService.addToHold(hold101, recordThree);
|
holdService.addToHold(hold101, recordThree);
|
||||||
assertTrue(recordService.isRecord(rmFolder));
|
assertTrue(recordService.isRecord(recordThree));
|
||||||
assertTrue(freezeService.isFrozenOrHasFrozenChildren(rmFolder));
|
assertTrue(freezeService.isFrozenOrHasFrozenChildren(rmFolder));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
3
pom.xml
3
pom.xml
@@ -851,10 +851,11 @@
|
|||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.20</version>
|
<version>1.18.20</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
Reference in New Issue
Block a user