RM-631 (The records management team can create a rule to request information about an undeclared record)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@49119 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2013-04-11 14:55:30 +00:00
parent b7815fd9d5
commit 276066fb88
3 changed files with 37 additions and 6 deletions

View File

@@ -48,6 +48,7 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase
/** Parameter names */ /** Parameter names */
public static final String PARAM_REQUESTED_INFO = "requestedInfo"; public static final String PARAM_REQUESTED_INFO = "requestedInfo";
public static final String PARAM_ASSIGNEES = "assignees"; public static final String PARAM_ASSIGNEES = "assignees";
public static final String PARAM_RULE_CREATOR = "ruleCreator";
/** Action name */ /** Action name */
public static final String NAME = "requestInfo"; public static final String NAME = "requestInfo";
@@ -78,6 +79,7 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase
parameters.put(WorkflowModel.ASSOC_PACKAGE, getWorkflowPackage(action, actionedUponNodeRef)); parameters.put(WorkflowModel.ASSOC_PACKAGE, getWorkflowPackage(action, actionedUponNodeRef));
parameters.put(RMWorkflowModel.RM_MIXED_ASSIGNEES, getAssignees(action)); parameters.put(RMWorkflowModel.RM_MIXED_ASSIGNEES, getAssignees(action));
parameters.put(RMWorkflowModel.RM_REQUESTED_INFORMATION, getRequestedInformation(action)); parameters.put(RMWorkflowModel.RM_REQUESTED_INFORMATION, getRequestedInformation(action));
parameters.put(RMWorkflowModel.RM_RULE_CREATOR, getRuleCreator(action));
workflowService.startWorkflow(workflowDefinitionId, parameters); workflowService.startWorkflow(workflowDefinitionId, parameters);
} }
@@ -90,6 +92,7 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase
{ {
paramList.add(new ParameterDefinitionImpl(PARAM_REQUESTED_INFO, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REQUESTED_INFO))); paramList.add(new ParameterDefinitionImpl(PARAM_REQUESTED_INFO, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REQUESTED_INFO)));
paramList.add(new ParameterDefinitionImpl(PARAM_ASSIGNEES, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_ASSIGNEES))); paramList.add(new ParameterDefinitionImpl(PARAM_ASSIGNEES, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_ASSIGNEES)));
paramList.add(new ParameterDefinitionImpl(PARAM_RULE_CREATOR, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_RULE_CREATOR)));
} }
/** /**
@@ -130,11 +133,22 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase
* Helper method for getting the requested information from the action * Helper method for getting the requested information from the action
* *
* @param action The request info action * @param action The request info action
* @return Return the requested information * @return Returns the requested information
*/ */
private Serializable getRequestedInformation(Action action) private Serializable getRequestedInformation(Action action)
{ {
return action.getParameterValue(PARAM_REQUESTED_INFO); return action.getParameterValue(PARAM_REQUESTED_INFO);
} }
/**
* Helper method for getting the rule creator
*
* @param action The request info action
* @return Returns the rule creator
*/
private Serializable getRuleCreator(Action action)
{
return action.getParameterValue(PARAM_RULE_CREATOR);
}
} }

View File

@@ -39,4 +39,7 @@ public interface RMWorkflowModel
// Requested Information // Requested Information
public static QName RM_REQUESTED_INFORMATION = QName.createQName(RM_WORKFLOW_URI, "requestedInformation"); public static QName RM_REQUESTED_INFORMATION = QName.createQName(RM_WORKFLOW_URI, "requestedInformation");
// Rule creator
public static QName RM_RULE_CREATOR = QName.createQName(RM_WORKFLOW_URI, "ruleCreator");
} }

View File

@@ -97,13 +97,21 @@ public class RequestInfoUtils
* Helper method to extract the initiator from the task * Helper method to extract the initiator from the task
* *
* @param delegateTask The delegate task * @param delegateTask The delegate task
* @return Returns the initiator of the workflow. If the initiator does not exist the admin user name will be returned. * @return Returns the initiator of the workflow. First it will be checked if
* a rule creator exists, which means the the workflow was started via rule.
* In this case the creator of the rule will receive the review task.
* If a rule creator cannot be found the code will try to find the initiator
* of the workflow. If also this is not the case the admin user will be returned.
*/ */
public static String getInitiator(DelegateTask delegateTask) public static String getInitiator(DelegateTask delegateTask)
{ {
ParameterCheck.mandatory("delegateTask", delegateTask); ParameterCheck.mandatory("delegateTask", delegateTask);
String userName = null; String userName = null;
String ruleCreator = (String) delegateTask.getVariable("rmwf_ruleCreator");
if (StringUtils.isBlank(ruleCreator) == true)
{
ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator"); ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator");
if (initiator.exists()) if (initiator.exists())
{ {
@@ -113,6 +121,12 @@ public class RequestInfoUtils
{ {
userName = AuthenticationUtil.getAdminUserName(); userName = AuthenticationUtil.getAdminUserName();
} }
}
else
{
userName = ruleCreator;
}
return userName; return userName;
} }