Java Code Examples for org.alfresco.service.ServiceRegistry#getWorkflowService()

The following examples show how to use org.alfresco.service.ServiceRegistry#getWorkflowService() . 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: ActivitiTimerExecutionTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Before
public void before() throws Exception
{
	 ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
     this.workflowService = registry.getWorkflowService();
     this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
     this.nodeService = registry.getNodeService();
     
     this.transactionHelper = (RetryingTransactionHelper) this.applicationContext
     	.getBean("retryingTransactionHelper");
     
     this.activitiProcessEngine = (ProcessEngine) this.applicationContext.getBean("activitiProcessEngine");
     
     MutableAuthenticationService authenticationService = registry.getAuthenticationService();
     PersonService personService = registry.getPersonService();

     this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
     
     authenticationComponent.setSystemUserAsCurrentUser();
}
 
Example 2
Source File: ProcessesImplTest.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Before
public void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS);

    processes = (Processes) applicationContext.getBean(PROCESSES_BEAN_NAME);

    ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    workflowService = registry.getWorkflowService();
    personService = registry.getPersonService();

    transaction = registry.getTransactionService().getUserTransaction();
    transaction.begin();

    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    AuthenticationUtil.setRunAsUser(AuthenticationUtil.getAdminUserName());

    NodeRef adminUserNodeRef = personService.getPerson(AuthenticationUtil.getAdminUserName());

    WorkflowDefinition workflowDefinition = findAppropriateWorkflowDefinitionId();

    for (int i = 0; i < ACTIVE_WORKFLOWS_INITIAL_AMOUNT; i++)
    {
        startWorkflow(workflowDefinition, adminUserNodeRef);
    }
}
 
Example 3
Source File: JscriptWorkflowTask.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new instance of a workflow task from a WorkflowTask from the CMR workflow object model
 * 
 * @param task
 *            an instance of WorkflowTask from CMR workflow object model
 * @param serviceRegistry
 *            Service Registry object
 */
public JscriptWorkflowTask(WorkflowTask task, 
            ServiceRegistry serviceRegistry,
            Scriptable scope)
{
    this.serviceRegistry = serviceRegistry;
    this.namespaceProvider = new DefaultNamespaceProvider(serviceRegistry.getNamespaceService());
    this.workflowService = serviceRegistry.getWorkflowService();
    this.nodeService = serviceRegistry.getNodeService();
    this.dictionaryService = serviceRegistry.getDictionaryService();
    this.authenticationService = serviceRegistry.getAuthenticationService();
    this.task = task;
    this.setScope(scope);
}
 
Example 4
Source File: AbstractWorkflowServiceIntegrationTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Before
public void before() throws Exception
{
    serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    this.workflowService = serviceRegistry.getWorkflowService();
    this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
    this.nodeService = serviceRegistry.getNodeService();
    this.historyService = (HistoryService) applicationContext.getBean("activitiHistoryService");
    Repository repositoryHelper = (Repository) applicationContext.getBean("repositoryHelper");
    this.companyHome = repositoryHelper.getCompanyHome();
    try
    {
        this.transactionService = (TransactionServiceImpl) serviceRegistry.getTransactionService();
    }
    catch (ClassCastException e)
    {
        throw new AlfrescoRuntimeException("The AbstractWorkflowServiceIntegrationTest needs direct access to the TransactionServiceImpl");
    }

    MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
    AuthorityService authorityService = serviceRegistry.getAuthorityService();
    PersonService personService = serviceRegistry.getPersonService();

    authenticationComponent.setSystemUserAsCurrentUser();

    WorkflowAdminServiceImpl workflowAdminService = (WorkflowAdminServiceImpl) applicationContext.getBean(WorkflowAdminServiceImpl.NAME);
    this.wfTestHelper = new WorkflowTestHelper(workflowAdminService, getEngine(), true);
    
    // create test users
    this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
    this.groupManager = new TestGroupManager(authorityService);
    
    personManager.createPerson(USER1);
    personManager.createPerson(USER2);
    personManager.createPerson(USER3);
    personManager.createPerson(USER4);

    // create test groups
    groupManager.addGroupToParent(GROUP, SUB_GROUP);
    
    // add users to groups
    groupManager.addUserToGroup(GROUP, USER1);
    groupManager.addUserToGroup(SUB_GROUP, USER2);
    
    personManager.setUser(USER1);
}