mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-2072 (Concurrency exceptions and deadlocks on Records Management "File to" rule)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.2.1.x@102241 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -759,6 +759,7 @@
|
|||||||
<property name="filePlanService" ref="FilePlanService" />
|
<property name="filePlanService" ref="FilePlanService" />
|
||||||
<property name="publicAction" value="true"/>
|
<property name="publicAction" value="true"/>
|
||||||
<property name="allowParameterSubstitutions" value="true"/>
|
<property name="allowParameterSubstitutions" value="true"/>
|
||||||
|
<property name="retryingTransactionHelper" ref="retryingTransactionHelper" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Copy To -->
|
<!-- Copy To -->
|
||||||
|
@@ -11,6 +11,7 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
|||||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
@@ -33,6 +34,9 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
|||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(CopyMoveLinkFileToBaseAction.class);
|
private static Log logger = LogFactory.getLog(CopyMoveLinkFileToBaseAction.class);
|
||||||
|
|
||||||
|
/** Retrying transaction helper */
|
||||||
|
private RetryingTransactionHelper retryingTransactionHelper;
|
||||||
|
|
||||||
/** action parameters */
|
/** action parameters */
|
||||||
public static final String PARAM_DESTINATION_RECORD_FOLDER = "destinationRecordFolder";
|
public static final String PARAM_DESTINATION_RECORD_FOLDER = "destinationRecordFolder";
|
||||||
public static final String PARAM_PATH = "path";
|
public static final String PARAM_PATH = "path";
|
||||||
@@ -89,6 +93,14 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
|||||||
this.filePlanService = filePlanService;
|
this.filePlanService = filePlanService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param retryingTransactionHelper retrying transaction helper
|
||||||
|
*/
|
||||||
|
public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)
|
||||||
|
{
|
||||||
|
this.retryingTransactionHelper = retryingTransactionHelper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List)
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List)
|
||||||
*/
|
*/
|
||||||
@@ -359,29 +371,34 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
|||||||
*/
|
*/
|
||||||
private NodeRef createChild(final Action action, final NodeRef parent, final String childName, final boolean targetisUnfiledRecords, final boolean lastAsFolder)
|
private NodeRef createChild(final Action action, final NodeRef parent, final String childName, final boolean targetisUnfiledRecords, final boolean lastAsFolder)
|
||||||
{
|
{
|
||||||
return AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
|
return AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
|
||||||
{
|
{
|
||||||
@Override
|
public NodeRef doWork()
|
||||||
public NodeRef doWork()
|
|
||||||
{
|
{
|
||||||
NodeRef child = null;
|
return retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
|
||||||
if(targetisUnfiledRecords)
|
{
|
||||||
{
|
public NodeRef execute() throws Throwable
|
||||||
child = fileFolderService.create(parent, childName, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER).getNodeRef();
|
|
||||||
}
|
|
||||||
else if(lastAsFolder)
|
|
||||||
{
|
|
||||||
child = recordFolderService.createRecordFolder(parent, childName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(RecordsManagementModel.TYPE_RECORD_FOLDER.equals(nodeService.getType(parent)))
|
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path could not be created.");
|
NodeRef child = null;
|
||||||
|
if (targetisUnfiledRecords)
|
||||||
|
{
|
||||||
|
child = fileFolderService.create(parent, childName, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
else if (lastAsFolder)
|
||||||
|
{
|
||||||
|
child = recordFolderService.createRecordFolder(parent, childName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (RecordsManagementModel.TYPE_RECORD_FOLDER.equals(nodeService.getType(parent)))
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path could not be created.");
|
||||||
|
}
|
||||||
|
child = filePlanService.createRecordCategory(parent, childName);
|
||||||
|
}
|
||||||
|
return child;
|
||||||
}
|
}
|
||||||
child = filePlanService.createRecordCategory(parent, childName);
|
});
|
||||||
}
|
|
||||||
return child;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user