use of org.activiti.engine.form.StartFormData in project alfresco-repository by Alfresco.
the class ActivitiUtil method getStartTaskTypeName.
public String getStartTaskTypeName(String processDefinitionId) {
String startTaskName = null;
StartFormData startFormData = formService.getStartFormData(processDefinitionId);
if (startFormData != null) {
startTaskName = startFormData.getFormKey();
}
return startTaskName;
}
use of org.activiti.engine.form.StartFormData in project alfresco-repository by Alfresco.
the class ActivitiWorkflowEngine method getTaskDefinitions.
/**
* {@inheritDoc}
*/
public List<WorkflowTaskDefinition> getTaskDefinitions(String workflowDefinitionId) {
List<WorkflowTaskDefinition> defs = new ArrayList<WorkflowTaskDefinition>();
String processDefinitionId = createLocalId(workflowDefinitionId);
// This should return all task definitions, including the start-task
ReadOnlyProcessDefinition processDefinition = ((RepositoryServiceImpl) repoService).getDeployedProcessDefinition(processDefinitionId);
String processName = ((ProcessDefinition) processDefinition).getKey();
factory.checkDomain(processName);
// Process start task definition
PvmActivity startEvent = processDefinition.getInitial();
String startTaskName = null;
StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
if (startFormData != null) {
startTaskName = startFormData.getFormKey();
}
// Add start task definition
defs.add(typeConverter.getTaskDefinition(startEvent, startTaskName, processDefinition.getId(), true));
// Now, continue through process, finding all user-tasks
Collection<PvmActivity> taskActivities = typeConverter.findUserTasks(startEvent);
for (PvmActivity act : taskActivities) {
String formKey = typeConverter.getFormKey(act, processDefinition);
defs.add(typeConverter.getTaskDefinition(act, formKey, processDefinition.getId(), false));
}
return defs;
}
use of org.activiti.engine.form.StartFormData in project alfresco-repository by Alfresco.
the class ActivitiTypeConverter method getVirtualStartTask.
private WorkflowTask getVirtualStartTask(ProcessInstance processInstance, boolean inProgress) {
String processInstanceId = processInstance.getId();
if (!activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && !isCorrectTenantRuntime(processInstanceId)) {
return null;
}
String id = ActivitiConstants.START_TASK_PREFIX + processInstanceId;
WorkflowTaskState state = null;
if (inProgress) {
state = WorkflowTaskState.IN_PROGRESS;
} else {
state = WorkflowTaskState.COMPLETED;
}
WorkflowPath path = convert((Execution) processInstance);
// Convert start-event to start-task Node
String definitionId = processInstance.getProcessDefinitionId();
ReadOnlyProcessDefinition procDef = activitiUtil.getDeployedProcessDefinition(definitionId);
WorkflowNode startNode = convert(procDef.getInitial(), true);
String key = ((ProcessDefinition) procDef).getKey();
StartFormData startFormData = getStartFormData(definitionId, key);
String taskDefId = null;
if (startFormData != null) {
taskDefId = startFormData.getFormKey();
}
WorkflowTaskDefinition taskDef = factory.createTaskDefinition(taskDefId, startNode, taskDefId, true);
// Add properties based on HistoricProcessInstance
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
Map<QName, Serializable> properties = propertyConverter.getStartTaskProperties(historicProcessInstance, taskDefId, !inProgress);
// TODO: Figure out what name/description should be used for the start-task, start event's name?
String defaultTitle = null;
String defaultDescription = null;
return factory.createTask(id, taskDef, taskDef.getId(), defaultTitle, defaultDescription, state, path, properties);
}
Aggregations