mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-2994 : fixed issue
- issue title: Copy/Move/Link actions don't take place and errors are thrown when running rules that perform them. - regression caused by RM-2072 merged forward from v2.2 - the retrying transaction helper was missing from copyTo, moveTo and linkTo beans and was causing NullPointerException - createOrResolvePath method calls getContext on a node created in the current transaction which is not visible in the new transaction and it throws a FileNotFoundException - solution: I moved the creation of the new transaction after the context was retrieved as the concurrency exception reported in RM-2072 was being caused by property updates
This commit is contained in:
@@ -791,6 +791,7 @@
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="publicAction" value="true"/>
|
||||
<property name="allowParameterSubstitutions" value="true"/>
|
||||
<property name="retryingTransactionHelper" ref="retryingTransactionHelper" />
|
||||
</bean>
|
||||
|
||||
<!-- Move To -->
|
||||
@@ -819,6 +820,7 @@
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="publicAction" value="true"/>
|
||||
<property name="allowParameterSubstitutions" value="true"/>
|
||||
<property name="retryingTransactionHelper" ref="retryingTransactionHelper" />
|
||||
</bean>
|
||||
|
||||
<!-- Link Record -->
|
||||
@@ -847,6 +849,7 @@
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="publicAction" value="true"/>
|
||||
<property name="allowParameterSubstitutions" value="true"/>
|
||||
<property name="retryingTransactionHelper" ref="retryingTransactionHelper" />
|
||||
</bean>
|
||||
|
||||
<!-- Unlink Record -->
|
||||
|
@@ -116,7 +116,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
protected synchronized void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
|
||||
protected synchronized void executeImpl(Action action, final NodeRef actionedUponNodeRef)
|
||||
{
|
||||
String actionName = action.getActionDefinitionName();
|
||||
if (isOkToProceedWithAction(actionedUponNodeRef, actionName))
|
||||
@@ -139,24 +139,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
||||
if (recordFolder == null)
|
||||
{
|
||||
final boolean finaltargetIsUnfiledRecords = targetIsUnfiledRecords;
|
||||
recordFolder = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef execute() throws Throwable
|
||||
{
|
||||
NodeRef result = null;
|
||||
try
|
||||
{
|
||||
// get the reference to the record folder based on the relative path
|
||||
result = createOrResolvePath(action, actionedUponNodeRef, finaltargetIsUnfiledRecords);
|
||||
}
|
||||
catch (DuplicateChildNodeNameException ex)
|
||||
{
|
||||
throw new ConcurrencyFailureException("Cannot create or resolve path.", ex);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}, false, true);
|
||||
recordFolder = createOrResolvePath(action, actionedUponNodeRef, finaltargetIsUnfiledRecords);
|
||||
}
|
||||
|
||||
// now we have the reference to the target folder we can do some final checks to see if the action is valid
|
||||
@@ -282,23 +265,39 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
||||
* @param targetisUnfiledRecords true is the target is in unfiled records
|
||||
* @return
|
||||
*/
|
||||
private NodeRef createOrResolvePath(Action action, NodeRef actionedUponNodeRef, boolean targetisUnfiledRecords)
|
||||
private NodeRef createOrResolvePath(final Action action, final NodeRef actionedUponNodeRef, final boolean targetisUnfiledRecords)
|
||||
{
|
||||
// get the starting context
|
||||
NodeRef context = getContext(action, actionedUponNodeRef, targetisUnfiledRecords);
|
||||
final NodeRef context = getContext(action, actionedUponNodeRef, targetisUnfiledRecords);
|
||||
NodeRef path = context;
|
||||
|
||||
// get the path we wish to resolve
|
||||
String pathParameter = (String)action.getParameterValue(PARAM_PATH);
|
||||
String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true);
|
||||
final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true);
|
||||
if((pathElementsArray != null) && (pathElementsArray.length > 0))
|
||||
{
|
||||
// get the create parameter
|
||||
Boolean createValue = (Boolean)action.getParameterValue(PARAM_CREATE_RECORD_PATH);
|
||||
boolean create = createValue == null ? false : createValue.booleanValue();
|
||||
final boolean create = createValue == null ? false : createValue.booleanValue();
|
||||
|
||||
// create or resolve the specified path
|
||||
path = createOrResolvePath(action, context, actionedUponNodeRef, Arrays.asList(pathElementsArray), targetisUnfiledRecords, create, false);
|
||||
path = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef execute() throws Throwable
|
||||
{
|
||||
NodeRef path = null;
|
||||
try
|
||||
{
|
||||
path = createOrResolvePath(action, context, actionedUponNodeRef, Arrays.asList(pathElementsArray), targetisUnfiledRecords,
|
||||
create, false);
|
||||
}
|
||||
catch (DuplicateChildNodeNameException ex)
|
||||
{
|
||||
throw new ConcurrencyFailureException("Cannot create or resolve path.", ex);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}, false, true);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
Reference in New Issue
Block a user