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 */
public static final String PARAM_REQUESTED_INFO = "requestedInfo";
public static final String PARAM_ASSIGNEES = "assignees";
public static final String PARAM_RULE_CREATOR = "ruleCreator";
/** Action name */
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(RMWorkflowModel.RM_MIXED_ASSIGNEES, getAssignees(action));
parameters.put(RMWorkflowModel.RM_REQUESTED_INFORMATION, getRequestedInformation(action));
parameters.put(RMWorkflowModel.RM_RULE_CREATOR, getRuleCreator(action));
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_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
*
* @param action The request info action
* @return Return the requested information
* @return Returns the requested information
*/
private Serializable getRequestedInformation(Action action)
{
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
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,22 +97,36 @@ public class RequestInfoUtils
* Helper method to extract the initiator from the 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)
{
ParameterCheck.mandatory("delegateTask", delegateTask);
String userName = null;
ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator");
if (initiator.exists())
String ruleCreator = (String) delegateTask.getVariable("rmwf_ruleCreator");
if (StringUtils.isBlank(ruleCreator) == true)
{
userName = (String) initiator.getProperties().get(ContentModel.PROP_USERNAME.toString());
ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator");
if (initiator.exists())
{
userName = (String) initiator.getProperties().get(ContentModel.PROP_USERNAME.toString());
}
else
{
userName = AuthenticationUtil.getAdminUserName();
}
}
else
{
userName = AuthenticationUtil.getAdminUserName();
userName = ruleCreator;
}
return userName;
}