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

@@ -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;
}