Search in sources :

Example 1 with WorkflowObjectFactory

use of org.alfresco.repo.workflow.WorkflowObjectFactory in project alfresco-remote-api by Alfresco.

the class ProcessDefinitionsImpl method getStartFormModel.

@Override
public CollectionWithPagingInfo<FormModelElement> getStartFormModel(String definitionId, Paging paging) {
    // first validate if user is allowed to access the process definition if workflows are deployed per tenant
    if (tenantService.isEnabled() && deployWorkflowsInTenant) {
        ProcessDefinitionQuery query = activitiProcessEngine.getRepositoryService().createProcessDefinitionQuery().processDefinitionId(definitionId);
        query.processDefinitionKeyLike("@" + TenantUtil.getCurrentDomain() + "@%");
        org.activiti.engine.repository.ProcessDefinition processDefinition = query.singleResult();
        if (processDefinition == null) {
            throw new EntityNotFoundException(definitionId);
        }
    }
    StartFormData startFormData = activitiProcessEngine.getFormService().getStartFormData(definitionId);
    if (startFormData == null) {
        throw new EntityNotFoundException(definitionId);
    }
    if (qNameConverter == null) {
        qNameConverter = new WorkflowQNameConverter(namespaceService);
    }
    if (workflowFactory == null) {
        workflowFactory = new WorkflowObjectFactory(qNameConverter, tenantService, messageService, dictionaryService, engineId, defaultStartTaskType);
    }
    // Lookup type definition for the startTask
    TypeDefinition startTaskType = workflowFactory.getTaskFullTypeDefinition(startFormData.getFormKey(), true);
    return getFormModelElements(startTaskType, paging);
}
Also used : WorkflowQNameConverter(org.alfresco.repo.workflow.WorkflowQNameConverter) StartFormData(org.activiti.engine.form.StartFormData) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) EntityNotFoundException(org.alfresco.rest.framework.core.exceptions.EntityNotFoundException) WorkflowObjectFactory(org.alfresco.repo.workflow.WorkflowObjectFactory) TypeDefinition(org.alfresco.service.cmr.dictionary.TypeDefinition)

Aggregations

StartFormData (org.activiti.engine.form.StartFormData)1 ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)1 WorkflowObjectFactory (org.alfresco.repo.workflow.WorkflowObjectFactory)1 WorkflowQNameConverter (org.alfresco.repo.workflow.WorkflowQNameConverter)1 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)1 TypeDefinition (org.alfresco.service.cmr.dictionary.TypeDefinition)1