Java Code Examples for org.activiti.engine.impl.pvm.ReadOnlyProcessDefinition#getInitial()

The following examples show how to use org.activiti.engine.impl.pvm.ReadOnlyProcessDefinition#getInitial() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActivitiTypeConverter.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Convert a {@link ProcessDefinition} into a {@link WorkflowDefinition}.
 * @param definition ProcessDefinition
 * @return WorkflowDefinition
 */
public WorkflowDefinition convert(ProcessDefinition definition)
{
    if(definition==null)
        return null;
    
    String defId = definition.getId();
    String defName = definition.getKey();
    int version = definition.getVersion();
    String defaultTitle = definition.getName();
    
    String startTaskName = null;
    StartFormData startFormData = getStartFormData(defId, defName);
    if(startFormData != null) 
    {
        startTaskName = startFormData.getFormKey();
    }
    
    ReadOnlyProcessDefinition def = activitiUtil.getDeployedProcessDefinition(defId);
    PvmActivity startEvent = def.getInitial();
    WorkflowTaskDefinition startTask = getTaskDefinition(startEvent, startTaskName, definition.getKey(), true);
    
    return factory.createDefinition(defId,
                defName, version, defaultTitle,
                null, startTask);
}
 
Example 2
Source File: ActivitiWorkflowEngine.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* {@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;
}