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;
}
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);
}
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);
}
Aggregations