Search in sources :

Example 1 with WorkflowQNameConverter

use of org.alfresco.repo.workflow.WorkflowQNameConverter in project alfresco-repository by Alfresco.

the class DelegateExecutionScriptBase method checkFullyAuthenticatedUser.

/**
 * Checks a valid Fully Authenticated User is set.
 * If none is set then attempts to set the workflow owner
 * @param execution the execution
 * @return <code>true</code> if the Fully Authenticated User was changed, otherwise <code>false</code>.
 */
private boolean checkFullyAuthenticatedUser(final DelegateExecution execution) {
    if (AuthenticationUtil.getFullyAuthenticatedUser() == null) {
        NamespaceService namespaceService = getServiceRegistry().getNamespaceService();
        WorkflowQNameConverter qNameConverter = new WorkflowQNameConverter(namespaceService);
        String ownerVariableName = qNameConverter.mapQNameToName(ContentModel.PROP_OWNER);
        String userName = (String) execution.getVariable(ownerVariableName);
        if (userName != null) {
            AuthenticationUtil.setFullyAuthenticatedUser(userName);
            return true;
        }
    }
    return false;
}
Also used : WorkflowQNameConverter(org.alfresco.repo.workflow.WorkflowQNameConverter) NamespaceService(org.alfresco.service.namespace.NamespaceService)

Example 2 with WorkflowQNameConverter

use of org.alfresco.repo.workflow.WorkflowQNameConverter 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)

Example 3 with WorkflowQNameConverter

use of org.alfresco.repo.workflow.WorkflowQNameConverter in project alfresco-repository by Alfresco.

the class ActivitiWorkflowManagerFactory method getObject.

/**
 * {@inheritDoc}
 */
@Override
public ActivitiWorkflowManager getObject() throws Exception {
    if (messageService == null) {
        throw new WorkflowException("MessageService not specified");
    }
    if (serviceRegistry == null) {
        throw new WorkflowException("ServiceRegistry not specified");
    }
    if (tenantService == null) {
        throw new WorkflowException("TenantService not specified");
    }
    ActivitiNodeConverter nodeConverter = new ActivitiNodeConverter(serviceRegistry);
    DefaultWorkflowPropertyHandler defaultPropertyHandler = new DefaultWorkflowPropertyHandler();
    defaultPropertyHandler.setMessageService(messageService);
    defaultPropertyHandler.setNodeConverter(nodeConverter);
    WorkflowQNameConverter qNameConverter = new WorkflowQNameConverter(namespaceService);
    WorkflowPropertyHandlerRegistry handlerRegistry = new WorkflowPropertyHandlerRegistry(defaultPropertyHandler, qNameConverter);
    WorkflowAuthorityManager authorityManager = new WorkflowAuthorityManager(authorityDAO);
    QName defaultStartTaskType = WorkflowModel.TYPE_ACTIVTI_START_TASK;
    WorkflowObjectFactory factory = new WorkflowObjectFactory(qNameConverter, tenantService, messageService, dictionaryService, engineId, defaultStartTaskType);
    ActivitiUtil activitiUtil = new ActivitiUtil(processEngine, deployWorkflowsInTenant, retentionHistoricProcessInstance);
    ActivitiPropertyConverter propertyConverter = new ActivitiPropertyConverter(activitiUtil, factory, handlerRegistry, authorityManager, messageService, nodeConverter);
    ActivitiTypeConverter typeConverter = new ActivitiTypeConverter(processEngine, factory, propertyConverter, deployWorkflowsInTenant);
    ActivitiWorkflowEngine workflowEngine = new ActivitiWorkflowEngine();
    workflowEngine.setActivitiUtil(activitiUtil);
    workflowEngine.setAuthorityManager(authorityManager);
    workflowEngine.setBPMEngineRegistry(bpmEngineRegistry);
    workflowEngine.setEngineId(engineId);
    workflowEngine.setFactory(factory);
    workflowEngine.setMessageService(messageService);
    workflowEngine.setNamespaceService(namespaceService);
    workflowEngine.setNodeConverter(nodeConverter);
    workflowEngine.setDictionaryService(dictionaryService);
    workflowEngine.setNodeService(nodeService);
    workflowEngine.setPersonService(personService);
    workflowEngine.setPropertyConverter(propertyConverter);
    workflowEngine.setTenantService(tenantService);
    workflowEngine.setTypeConverter(typeConverter);
    workflowEngine.setRepositoryHelper(repositoryHelper);
    return new ActivitiWorkflowManager(workflowEngine, propertyConverter, handlerRegistry, nodeConverter, authorityManager);
}
Also used : QName(org.alfresco.service.namespace.QName) WorkflowException(org.alfresco.service.cmr.workflow.WorkflowException) WorkflowQNameConverter(org.alfresco.repo.workflow.WorkflowQNameConverter) WorkflowAuthorityManager(org.alfresco.repo.workflow.WorkflowAuthorityManager) WorkflowPropertyHandlerRegistry(org.alfresco.repo.workflow.WorkflowPropertyHandlerRegistry) ActivitiPropertyConverter(org.alfresco.repo.workflow.activiti.properties.ActivitiPropertyConverter) DefaultWorkflowPropertyHandler(org.alfresco.repo.workflow.DefaultWorkflowPropertyHandler) WorkflowObjectFactory(org.alfresco.repo.workflow.WorkflowObjectFactory)

Aggregations

WorkflowQNameConverter (org.alfresco.repo.workflow.WorkflowQNameConverter)3 WorkflowObjectFactory (org.alfresco.repo.workflow.WorkflowObjectFactory)2 StartFormData (org.activiti.engine.form.StartFormData)1 ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)1 DefaultWorkflowPropertyHandler (org.alfresco.repo.workflow.DefaultWorkflowPropertyHandler)1 WorkflowAuthorityManager (org.alfresco.repo.workflow.WorkflowAuthorityManager)1 WorkflowPropertyHandlerRegistry (org.alfresco.repo.workflow.WorkflowPropertyHandlerRegistry)1 ActivitiPropertyConverter (org.alfresco.repo.workflow.activiti.properties.ActivitiPropertyConverter)1 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)1 TypeDefinition (org.alfresco.service.cmr.dictionary.TypeDefinition)1 WorkflowException (org.alfresco.service.cmr.workflow.WorkflowException)1 NamespaceService (org.alfresco.service.namespace.NamespaceService)1 QName (org.alfresco.service.namespace.QName)1