RM-895: Can't Freeze record and folder witch contains record if updated rule to Freeze is set

* also dealt with exception that was not being handled by background job



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@55153 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-09-10 06:32:12 +00:00
parent 24ff46e982
commit c351d6fcdb
4 changed files with 159 additions and 113 deletions

View File

@@ -37,21 +37,32 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
/** Indicates whether the action is auditable or not */
protected boolean auditable = true;
/** Application context */
protected ApplicationContext applicationContext;
/** Records management audit service */
private RecordsManagementAuditService auditService;
/**
* @param auditable true if auditable, false otherwise
*/
public void setAuditable(boolean auditable)
{
this.auditable = auditable;
}
/**
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
this.applicationContext = applicationContext;
}
/**
* @return records management audit service
*/
private RecordsManagementAuditService getAuditService()
{
if (auditService == null)
@@ -61,6 +72,9 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
return auditService;
}
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#init()
*/
@Override
public void init()
{

View File

@@ -47,6 +47,9 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
private static final String MSG_NOT_NEXT_DISP = "rm.action.not-next-disp";
private static final String MSG_NOT_RECORD_FOLDER = "rm.action.not-record-folder";
/** Parameter value indicating whether we should be doing non-error raising state checks */
public static final String PARAM_NO_ERROR_CHECK = "rm.no-error-check";
/**
* All children of this implementation are disposition actions.
*
@@ -97,13 +100,21 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
//
NodeRef nextDispositionActionNodeRef = getNextDispostionAction(actionedUponNodeRef);
// determine whether we should be raising errors during state checking or not
boolean checkError = true;
Boolean checkErrorValue = (Boolean)action.getParameterValue(PARAM_NO_ERROR_CHECK);
if (checkErrorValue != null)
{
checkError = checkErrorValue.booleanValue();
}
// Check the validity of the action (is it the next action, are we dealing with the correct type of object for
// the disposition level?
DispositionSchedule di = checkDispositionActionExecutionValidity(actionedUponNodeRef, nextDispositionActionNodeRef, true);
DispositionSchedule di = checkDispositionActionExecutionValidity(actionedUponNodeRef, nextDispositionActionNodeRef, checkError);
if (di != null)
{
// Check the eligibility of the action
if (checkEligibility(actionedUponNodeRef) == false ||
dispositionService.isNextDispositionActionEligible(actionedUponNodeRef) == true)
@@ -184,6 +195,7 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_ELIGIBLE, getName(), actionedUponNodeRef.toString()));
}
}
}
/**
* @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List)

View File

@@ -57,8 +57,11 @@ public class FreezeAction extends RMActionExecuterAbstractBase
if (nodeService.exists(actionedUponNodeRef) == true &&
nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) == false &&
(recordService.isRecord(actionedUponNodeRef) == true ||
recordsManagementService.isRecordFolder(actionedUponNodeRef) == true))
recordsManagementService.isRecordFolder(actionedUponNodeRef) == true) &&
freezeService.isFrozen(actionedUponNodeRef) == false)
{
System.out.println("I am trying to freeze " + actionedUponNodeRef.toString());
freezeService.freeze((String) action.getParameterValue(PARAM_REASON), actionedUponNodeRef);
}
}

View File

@@ -19,8 +19,13 @@
package org.alfresco.module.org_alfresco_module_rm.job;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
@@ -72,6 +77,8 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
* @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute()
*/
public void executeImpl()
{
try
{
logger.debug("Job Starting");
@@ -113,7 +120,9 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
ChildAssociationRef parent = nodeService.getPrimaryParent(currentNode);
if (parent.getTypeQName().equals(RecordsManagementModel.ASSOC_NEXT_DISPOSITION_ACTION))
{
recordsManagementActionService.executeRecordsManagementAction(parent.getParentRef(), dispAction);
Map<String, Serializable> props = new HashMap<String, Serializable>(1);
props.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE);
recordsManagementActionService.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
if (logger.isDebugEnabled())
{
logger.debug("Processed action: " + dispAction + "on" + parent);
@@ -134,4 +143,12 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
logger.debug("Job Finished");
}
catch (AlfrescoRuntimeException exception)
{
if (logger.isDebugEnabled() == true)
{
logger.debug(exception);
}
}
}
}