本文整理汇总了Java中org.alfresco.repo.workflow.WorkflowConstants类的典型用法代码示例。如果您正苦于以下问题:Java WorkflowConstants类的具体用法?Java WorkflowConstants怎么用?Java WorkflowConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkflowConstants类属于org.alfresco.repo.workflow包,在下文中一共展示了WorkflowConstants类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notify
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
public void notify(DelegateExecution execution) throws Exception
{
// Add the workflow ID
String instanceId = BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, execution.getId());
execution.setVariable(WorkflowConstants.PROP_WORKFLOW_INSTANCE_ID, instanceId);
if(tenantService.isEnabled() || !deployWorkflowsInTenant)
{
// Add tenant as variable to the process. This will allow task-queries to filter out tasks that
// are not part of the calling user's domain
execution.setVariable(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain());
}
// MNT-9713
if (execution instanceof ExecutionEntity)
{
ExecutionEntity exc = (ExecutionEntity) execution;
if (exc.getSuperExecutionId() != null && exc.getVariable(ActivitiConstants.PROP_START_TASK_END_DATE) == null)
{
exc.setVariable(ActivitiConstants.PROP_START_TASK_END_DATE, new Date());
}
}
}
示例2: notify
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
@Override
public void notify(DelegateTask task)
{
// Set all default properties, based on the type-definition
propertyConverter.setDefaultTaskProperties(task);
String taskFormKey = getFormKey(task);
// Fetch definition and extract name again. Possible that the default is used if the provided is missing
TypeDefinition typeDefinition = propertyConverter.getWorkflowObjectFactory().getTaskTypeDefinition(taskFormKey, false);
taskFormKey = typeDefinition.getName().toPrefixString();
// The taskDefinition key is set as a variable in order to be available
// in the history
task.setVariableLocal(ActivitiConstants.PROP_TASK_FORM_KEY, taskFormKey);
// Add process initiator as involved person
ActivitiScriptNode initiatorNode = (ActivitiScriptNode) task.getExecution().getVariable(WorkflowConstants.PROP_INITIATOR);
if(initiatorNode != null) {
task.addUserIdentityLink((String) initiatorNode.getProperties().get(ContentModel.PROP_USERNAME.toPrefixString()), IdentityLinkType.STARTER);
}
}
示例3: startAdhocProcess
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
protected ProcessInstance startAdhocProcess(final String user, final String networkId, final String businessKey)
{
return TenantUtil.runAsUserTenant(new TenantRunAsWork<ProcessInstance>()
{
@Override
public ProcessInstance doWork() throws Exception
{
String processDefinitionKey = "@" + networkId + "@activitiAdhoc";
// Set required variables for adhoc process and start
Map<String, Object> variables = new HashMap<String, Object>();
ActivitiScriptNode person = getPersonNodeRef(user);
variables.put("bpm_assignee", person);
variables.put("wf_notifyMe", Boolean.FALSE);
variables.put(WorkflowConstants.PROP_INITIATOR, person);
return activitiProcessEngine.getRuntimeService().startProcessInstanceByKey(processDefinitionKey, businessKey, variables);
}
}, user, networkId);
}
示例4: cancelWorkflow
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public WorkflowInstance cancelWorkflow(String workflowId)
{
String localId = createLocalId(workflowId);
try
{
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(localId).singleResult();
if(processInstance == null)
{
throw new WorkflowException(messageService.getMessage(ERR_CANCEL_UNEXISTING_WORKFLOW));
}
// TODO: Cancel VS delete?
// Delete the process instance
runtimeService.deleteProcessInstance(processInstance.getId(), WorkflowConstants.PROP_CANCELLED);
// Convert historic process instance
HistoricProcessInstance deletedInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(processInstance.getId())
.singleResult();
WorkflowInstance result = typeConverter.convert(deletedInstance);
// Delete the historic process instance
historyService.deleteHistoricProcessInstance(deletedInstance.getId());
return result;
}
catch(ActivitiException ae)
{
String msg = messageService.getMessage(ERR_CANCEL_WORKFLOW);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
示例5: execute
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
@Override
public void execute(final JobEntity job, final String configuration, final ExecutionEntity execution,
final CommandContext commandContext)
{
// Get initiator
String userName = AuthenticationUtil.runAsSystem(new RunAsWork<String>() {
@Override
public String doWork() throws Exception {
ActivitiScriptNode ownerNode = (ActivitiScriptNode) execution.getVariable(WorkflowConstants.PROP_INITIATOR);
if(ownerNode != null && ownerNode.exists())
{
return (String) ownerNode.getProperties().get(ContentModel.PROP_USERNAME);
}
return null;
}
});
// When no initiator is set, use system user to run job
if (userName == null)
{
userName = AuthenticationUtil.getSystemUserName();
}
// Execute job
AuthenticationUtil.runAs(new RunAsWork<Void>()
{
@SuppressWarnings("synthetic-access")
public Void doWork() throws Exception
{
wrappedHandler.execute(job, configuration, execution, commandContext);
return null;
}
}, userName);
}
示例6: canUserEndWorkflow
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
/**
* Determines if the current user can cancel or delete the
* workflow instance with the given id. Throws a WebscriptException
* with status-code 404 if workflow-instance to delete wasn't found.
*
* @param instanceId The id of the workflow instance to check
* @return true if the user can end the workflow, false otherwise
*/
private boolean canUserEndWorkflow(String instanceId)
{
boolean canEnd = false;
// get the initiator
WorkflowInstance wi = workflowService.getWorkflowById(instanceId);
if (wi == null)
{
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND,
"The workflow instance to delete/cancel with id " + instanceId + " doesn't exist: ");
}
String currentUserName = authenticationService.getCurrentUserName();
// ALF-17405: Admin can always delete/cancel workflows, regardless of the initiator
if(authorityService.isAdminAuthority(currentUserName))
{
canEnd = true;
}
else
{
String ownerName = null;
// Determine if the current user is the initiator of the workflow.
// Get the username of the initiator.
NodeRef initiator = wi.getInitiator();
if (initiator != null && nodeService.exists(initiator))
{
ownerName = (String) nodeService.getProperty(initiator, ContentModel.PROP_USERNAME);
}
else
{
/*
* Fix for MNT-14411 : Re-created user can't cancel created task.
* If owner value can't be found on workflow properties
* because initiator nodeRef no longer exists get owner from
* initiatorhome nodeRef owner property.
*/
WorkflowTask startTask = workflowService.getStartTask(wi.getId());
Map<QName, Serializable> props = startTask.getProperties();
ownerName = (String) props.get(ContentModel.PROP_OWNER);
if (ownerName == null)
{
NodeRef initiatorHomeNodeRef = (NodeRef) props.get(QName.createQName("", WorkflowConstants.PROP_INITIATOR_HOME));
if (initiatorHomeNodeRef != null)
{
ownerName = (String) nodeService.getProperty(initiatorHomeNodeRef, ContentModel.PROP_OWNER);
}
}
}
// if the current user started the workflow allow the cancel action
if (currentUserName.equals(ownerName))
{
canEnd = true;
}
}
return canEnd;
}
示例7: startWorkflow
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public WorkflowPath startWorkflow(String workflowDefinitionId, Map<QName, Serializable> parameters)
{
try
{
String currentUserName = AuthenticationUtil.getFullyAuthenticatedUser();
Authentication.setAuthenticatedUserId(currentUserName);
String processDefId = createLocalId(workflowDefinitionId);
// Set start task properties. This should be done before instance is started, since it's id will be used
Map<String, Object> variables = propertyConverter.getStartVariables(processDefId, parameters);
variables.put(WorkflowConstants.PROP_CANCELLED, Boolean.FALSE);
// Add company home
Object companyHome = nodeConverter.convertNode(getCompanyHome());
variables.put(WorkflowConstants.PROP_COMPANY_HOME, companyHome);
// Add the initiator
NodeRef initiator = getPersonNodeRef(currentUserName);
if (initiator != null)
{
variables.put(WorkflowConstants.PROP_INITIATOR, nodeConverter.convertNode(initiator));
// Also add the initiator home reference, if one exists
NodeRef initiatorHome = (NodeRef) nodeService.getProperty(initiator, ContentModel.PROP_HOMEFOLDER);
if (initiatorHome != null)
{
variables.put(WorkflowConstants.PROP_INITIATOR_HOME, nodeConverter.convertNode(initiatorHome));
}
}
// Start the process-instance
CommandContext context = Context.getCommandContext();
boolean isContextSuspended = false;
if (context != null && context.getException() == null)
{
// MNT-11926: push null context to stack to avoid context reusage when new instance is not flushed
Context.setCommandContext(null);
isContextSuspended = true;
}
try
{
ProcessInstance instance = runtimeService.startProcessInstanceById(processDefId, variables);
if (instance.isEnded())
{
return typeConverter.buildCompletedPath(instance.getId(), instance.getId());
}
else
{
WorkflowPath path = typeConverter.convert((Execution) instance);
endStartTaskAutomatically(path, instance);
return path;
}
}
finally
{
if (isContextSuspended)
{
// pop null context out of stack
Context.removeCommandContext();
}
}
}
catch (ActivitiException ae)
{
String msg = messageService.getMessage(ERR_START_WORKFLOW, workflowDefinitionId);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
示例8: isInitiatorOrAssignee
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
private boolean isInitiatorOrAssignee(WorkflowTask wt, String userName)
{
if (wt == null)
{
return true;
}
NodeRef person = personService.getPerson(userName);
Map<QName, Serializable> props = wt.getProperties();
String ownerName = (String) props.get(ContentModel.PROP_OWNER);
//fix for MNT-14366; if owner value can't be found on workflow properties because initiator nodeRef no longer exists
//get owner from initiatorhome nodeRef owner property
if (ownerName == null)
{
NodeRef initiatorHomeNodeRef = (NodeRef)props.get( QName.createQName("", WorkflowConstants.PROP_INITIATOR_HOME));
if (initiatorHomeNodeRef != null )
{
ownerName = (String)nodeService.getProperty(initiatorHomeNodeRef, ContentModel.PROP_OWNER);
}
}
if (userName != null && userName.equalsIgnoreCase(ownerName))
{
return true;
}
List<NodeRef> accessUseres = new ArrayList<NodeRef>();
accessUseres.add(getUserGroupRef(props.get(WorkflowModel.ASSOC_ASSIGNEE)));
accessUseres.add(getUserGroupRef(props.get(WorkflowModel.ASSOC_GROUP_ASSIGNEE)));
accessUseres.addAll(getUserGroupRefs(props.get(WorkflowModel.ASSOC_GROUP_ASSIGNEES)));
accessUseres.addAll(getUserGroupRefs(props.get(WorkflowModel.ASSOC_ASSIGNEES)));
accessUseres.addAll(getUserGroupRefs(wt.getProperties().get(WorkflowModel.ASSOC_POOLED_ACTORS)));
accessUseres.add(wt.getPath().getInstance().getInitiator());
if (accessUseres.contains(person))
{
return true;
}
Set<String> userGroups = authorityService.getAuthoritiesForUser(userName);
for (String groupName : userGroups)
{
NodeRef groupRef = authorityService.getAuthorityNodeRef(groupName);
if (groupRef != null && accessUseres.contains(groupRef))
{
return true;
}
}
return false;
}
示例9: testGetWorkflowById
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
@Test
public void testGetWorkflowById() throws Exception
{
WorkflowDefinition def = deployTestAdhocDefinition();
Date startTime = new SimpleDateFormat("dd-MM-yyy hh:mm:ss").parse("01-01-2011 12:11:10");
// Add some variables which should be used in the WorkflowInstance
Map<String, Object> variables = new HashMap<String, Object>();
Date dueDate = Calendar.getInstance().getTime();
putVariable(variables, WorkflowModel.PROP_WORKFLOW_DUE_DATE, dueDate);
putVariable(variables, WorkflowModel.PROP_WORKFLOW_DESCRIPTION, "I'm the description");
putVariable(variables, WorkflowModel.PROP_CONTEXT, new ActivitiScriptNode(testWorkflowContext, serviceRegistry));
putVariable(variables, WorkflowModel.ASSOC_PACKAGE, new ActivitiScriptNode(testWorkflowPackage, serviceRegistry));
putVariable(variables, WorkflowModel.PROP_WORKFLOW_PRIORITY, 3);
variables.put(WorkflowConstants.PROP_INITIATOR, new ActivitiScriptNode(adminHomeNode, serviceRegistry));
ProcessInstance processInstance = runtime.startProcessInstanceById(BPMEngineRegistry.getLocalId(def.getId()), variables);
String globalProcessInstanceId = BPMEngineRegistry.createGlobalId(
ActivitiConstants.ENGINE_ID, processInstance.getProcessInstanceId());
WorkflowInstance workflowInstance = workflowEngine.getWorkflowById(globalProcessInstanceId);
assertNotNull(workflowInstance);
assertEquals(globalProcessInstanceId, workflowInstance.getId());
assertNull(workflowInstance.getEndDate());
assertTrue(workflowInstance.isActive());
assertEquals("I'm the description", workflowInstance.getDescription());
assertEquals(dueDate, workflowInstance.getDueDate());
assertEquals(def.getId(), workflowInstance.getDefinition().getId());
assertEquals(adminHomeNode, workflowInstance.getInitiator());
assertEquals(testWorkflowContext, workflowInstance.getContext());
assertEquals(testWorkflowPackage, workflowInstance.getWorkflowPackage());
assertNotNull(workflowInstance.getPriority());
assertEquals(3, workflowInstance.getPriority().intValue());
assertEquals(startTime, workflowInstance.getStartDate());
}
示例10: testGetCompletedWorkflowById
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
@Test
public void testGetCompletedWorkflowById() throws Exception
{
WorkflowDefinition def = deployTestAdhocDefinition();
Date startTime = new SimpleDateFormat("dd-MM-yyy hh:mm:ss").parse("01-01-2011 01:02:03");
// Add some variables which should be used in the WorkflowInstance
Map<String, Object> variables = new HashMap<String, Object>();
Date dueDate = Calendar.getInstance().getTime();
putVariable(variables, WorkflowModel.PROP_WORKFLOW_DUE_DATE, dueDate);
putVariable(variables, WorkflowModel.PROP_WORKFLOW_DESCRIPTION, "I'm the description");
putVariable(variables, WorkflowModel.PROP_CONTEXT, new ActivitiScriptNode(testWorkflowContext, serviceRegistry));
putVariable(variables, WorkflowModel.ASSOC_PACKAGE, new ActivitiScriptNode(testWorkflowPackage, serviceRegistry));
putVariable(variables, WorkflowModel.PROP_WORKFLOW_PRIORITY, 3);
variables.put(WorkflowConstants.PROP_INITIATOR, new ActivitiScriptNode(adminHomeNode, serviceRegistry));
ProcessInstance processInstance = runtime.startProcessInstanceById(BPMEngineRegistry.getLocalId(def.getId()), variables);
String globalProcessInstanceId = BPMEngineRegistry.createGlobalId(
ActivitiConstants.ENGINE_ID, processInstance.getProcessInstanceId());
Date endTime = new SimpleDateFormat("dd-MM-yyy hh:mm:ss").parse("01-01-2011 02:03:04");
// Finish the task
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
taskService.complete(task.getId());
WorkflowInstance workflowInstance = workflowEngine.getWorkflowById(globalProcessInstanceId);
assertNotNull(workflowInstance);
assertEquals(globalProcessInstanceId, workflowInstance.getId());
assertEquals(endTime, workflowInstance.getEndDate());
assertFalse(workflowInstance.isActive());
assertEquals("I'm the description", workflowInstance.getDescription());
assertEquals(dueDate, workflowInstance.getDueDate());
assertEquals(def.getId(), workflowInstance.getDefinition().getId());
assertEquals(adminHomeNode, workflowInstance.getInitiator());
assertEquals(testWorkflowContext, workflowInstance.getContext());
assertEquals(testWorkflowPackage, workflowInstance.getWorkflowPackage());
assertNotNull(workflowInstance.getPriority());
assertEquals(3, workflowInstance.getPriority().intValue());
assertEquals(startTime, workflowInstance.getStartDate());
}
示例11: validateIfUserAllowedToWorkWithProcess
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
/**
* Validates if the logged in user is allowed to get information about a specific process instance.
* If the user is not allowed an exception is thrown.
*
* @param processId identifier of the process instance
*/
protected List<HistoricVariableInstance> validateIfUserAllowedToWorkWithProcess(String processId)
{
List<HistoricVariableInstance> variableInstances = activitiProcessEngine.getHistoryService()
.createHistoricVariableInstanceQuery()
.processInstanceId(processId)
.list();
Map<String, Object> variableMap = new HashMap<String, Object>();
if (variableInstances != null && variableInstances.size() > 0)
{
for (HistoricVariableInstance variableInstance : variableInstances)
{
variableMap.put(variableInstance.getVariableName(), variableInstance.getValue());
}
}
else
{
throw new EntityNotFoundException(processId);
}
if (tenantService.isEnabled())
{
String tenantDomain = (String) variableMap.get(ActivitiConstants.VAR_TENANT_DOMAIN);
if (TenantUtil.getCurrentDomain().equals(tenantDomain) == false)
{
throw new PermissionDeniedException("Process is running in another tenant");
}
}
//MNT-17918 - required for initiator variable already updated as NodeRef type
Object initiator = variableMap.get(WorkflowConstants.PROP_INITIATOR);
String nodeId = ((initiator instanceof ActivitiScriptNode) ? ((ActivitiScriptNode) initiator).getNodeRef().getId() : ((NodeRef) initiator).getId());
if (initiator != null && AuthenticationUtil.getRunAsUser().equals(nodeId))
{
// user is allowed
return variableInstances;
}
String username = AuthenticationUtil.getRunAsUser();
if (authorityService.isAdminAuthority(username))
{
// Admin is allowed to read all processes in the current tenant
return variableInstances;
}
else
{
// MNT-12382 check for membership in the assigned group
ActivitiScriptNode group = (ActivitiScriptNode) variableMap.get("bpm_groupAssignee");
if (group != null)
{
// check that the process is unclaimed
Task task = activitiProcessEngine.getTaskService().createTaskQuery().processInstanceId(processId).singleResult();
if ((task != null) && (task.getAssignee() == null) && isUserInGroup(username, group.getNodeRef()))
{
return variableInstances;
}
}
// If non-admin user, involvement in the task is required (either owner, assignee or externally involved).
HistoricTaskInstanceQuery query = activitiProcessEngine.getHistoryService()
.createHistoricTaskInstanceQuery()
.processInstanceId(processId)
.taskInvolvedUser(AuthenticationUtil.getRunAsUser());
List<HistoricTaskInstance> taskList = query.list();
if (org.apache.commons.collections.CollectionUtils.isEmpty(taskList))
{
throw new PermissionDeniedException("user is not allowed to access information about process " + processId);
}
}
return variableInstances;
}
示例12: validateIfUserAllowedToWorkWithProcess
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
/**
* Validates if the logged in user is allowed to get information about a specific process instance.
* If the user is not allowed an exception is thrown.
*
* @param processId identifier of the process instance
*/
protected List<HistoricVariableInstance> validateIfUserAllowedToWorkWithProcess(String processId)
{
List<HistoricVariableInstance> variableInstances = activitiProcessEngine.getHistoryService()
.createHistoricVariableInstanceQuery()
.processInstanceId(processId)
.list();
Map<String, Object> variableMap = new HashMap<String, Object>();
if (variableInstances != null && variableInstances.size() > 0)
{
for (HistoricVariableInstance variableInstance : variableInstances)
{
variableMap.put(variableInstance.getVariableName(), variableInstance.getValue());
}
}
else
{
throw new EntityNotFoundException(processId);
}
if (tenantService.isEnabled())
{
String tenantDomain = (String) variableMap.get(ActivitiConstants.VAR_TENANT_DOMAIN);
if (TenantUtil.getCurrentDomain().equals(tenantDomain) == false)
{
throw new PermissionDeniedException("Process is running in another tenant");
}
}
ActivitiScriptNode initiator = (ActivitiScriptNode) variableMap.get(WorkflowConstants.PROP_INITIATOR);
if (initiator != null && AuthenticationUtil.getRunAsUser().equals(initiator.getNodeRef().getId()))
{
// user is allowed
return variableInstances;
}
String username = AuthenticationUtil.getRunAsUser();
if (authorityService.isAdminAuthority(username))
{
// Admin is allowed to read all processes in the current tenant
return variableInstances;
}
else
{
// MNT-12382 check for membership in the assigned group
ActivitiScriptNode group = (ActivitiScriptNode) variableMap.get("bpm_groupAssignee");
if (group != null)
{
// check that the process is unclaimed
Task task = activitiProcessEngine.getTaskService().createTaskQuery().processInstanceId(processId).singleResult();
if ((task != null) && (task.getAssignee() == null) && isUserInGroup(username, group.getNodeRef()))
{
return variableInstances;
}
}
// If non-admin user, involvement in the task is required (either owner, assignee or externally involved).
HistoricTaskInstanceQuery query = activitiProcessEngine.getHistoryService()
.createHistoricTaskInstanceQuery()
.processInstanceId(processId)
.taskInvolvedUser(AuthenticationUtil.getRunAsUser());
List<HistoricTaskInstance> taskList = query.list();
if (org.apache.commons.collections.CollectionUtils.isEmpty(taskList))
{
throw new PermissionDeniedException("user is not allowed to access information about process " + processId);
}
}
return variableInstances;
}
示例13: getStartTaskProperties
import org.alfresco.repo.workflow.WorkflowConstants; //导入依赖的package包/类
public Map<QName, Serializable> getStartTaskProperties(HistoricProcessInstance historicProcessInstance, String taskDefId, boolean completed)
{
TypeDefinition taskDef = typeManager.getStartTaskDefinition(taskDefId);
Map<QName, PropertyDefinition> taskProperties = taskDef.getProperties();
Map<QName, AssociationDefinition> taskAssociations = taskDef.getAssociations();
Map<String, Object> variables = getStartVariables(historicProcessInstance);
// Map all the properties
Map<QName, Serializable> properties =mapArbitraryProperties(variables, variables, taskProperties, taskAssociations);
// Map activiti task instance fields to properties
properties.put(WorkflowModel.PROP_TASK_ID, ActivitiConstants.START_TASK_PREFIX + historicProcessInstance.getId());
properties.put(WorkflowModel.PROP_START_DATE, historicProcessInstance.getStartTime());
// Use workflow due-date at the time of starting the process
String wfDueDateKey = factory.mapQNameToName(WorkflowModel.PROP_WORKFLOW_DUE_DATE);
String dueDateKey = factory.mapQNameToName(WorkflowModel.PROP_DUE_DATE);
Serializable dueDate = (Serializable) variables.get(wfDueDateKey);
if(dueDate == null)
{
dueDate = (Serializable) variables.get(dueDateKey);
}
properties.put(WorkflowModel.PROP_DUE_DATE, dueDate);
// TODO: is it okay to use start-date?
properties.put(WorkflowModel.PROP_COMPLETION_DATE, historicProcessInstance.getStartTime());
// Use workflow priority at the time of starting the process
String priorityKey = factory.mapQNameToName(WorkflowModel.PROP_PRIORITY);
Serializable priority = (Serializable) variables.get(priorityKey);
if(priority == null)
{
String wfPriorityKey = factory.mapQNameToName(WorkflowModel.PROP_WORKFLOW_PRIORITY);
priority = (Serializable) variables.get(wfPriorityKey);
}
properties.put(WorkflowModel.PROP_PRIORITY, priority);
properties.put(ContentModel.PROP_CREATED, historicProcessInstance.getStartTime());
// Use initiator username as owner
ActivitiScriptNode ownerNode = (ActivitiScriptNode) variables.get(WorkflowConstants.PROP_INITIATOR);
if(ownerNode != null && ownerNode.exists())
{
properties.put(ContentModel.PROP_OWNER, (Serializable) ownerNode.getProperties().get("userName"));
}
if(completed)
{
// Override default 'Not Yet Started' when start-task is completed
properties.put(WorkflowModel.PROP_STATUS, WorkflowConstants.TASK_STATUS_COMPLETED);
// Outcome is default transition
properties.put(WorkflowModel.PROP_OUTCOME, ActivitiConstants.DEFAULT_TRANSITION_NAME);
}
return filterTaskProperties(properties);
}