Package org.activiti.engine.runtime

Examples of org.activiti.engine.runtime.ProcessInstance


        final Map<String, Object> variables = new HashMap<String, Object>();
        variables.put(USER_TO, userTO);
        variables.put(ENABLED, enabled);

        final ProcessInstance processInstance;
        try {
            processInstance = runtimeService.startProcessInstanceByKey(WF_PROCESS_ID, variables);
        } catch (ActivitiException e) {
            throw new WorkflowException("While starting " + WF_PROCESS_ID + " instance", e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        Boolean updatedEnabled = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(), ENABLED);
        if (updatedEnabled != null) {
            user.setSuspended(!updatedEnabled);
        }

        // this will make SyncopeUserValidator not to consider password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);
        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later - after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(ResourceOperation.CREATE, user.getResourceNames());

        String formTaskId = getFormTask(user);
        if (formTaskId != null) {
            // SYNCOPE-238: This is needed to simplify the task query in this.getForms()
            taskService.setVariableLocal(formTaskId, TASK_IS_FORM, Boolean.TRUE);
            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(
                        processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(
                new SimpleEntry<Long, Boolean>(user.getId(), propagateEnable), propByRes, getPerformedTasks(user));
View Full Code Here


        final Map<String, Object> variables = new HashMap<String, Object>();
        variables.put(USER_TO, userTO);
        variables.put(ENABLED, enabled);

        final ProcessInstance processInstance;
        try {
            processInstance = runtimeService.startProcessInstanceByKey("userWorkflow", variables);
        } catch (ActivitiException e) {
            throw new WorkflowException(e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        // this will make SyncopeUserValidator not to consider
        // password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);

        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later -
        // after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(PropagationOperation.CREATE, user.getResourceNames());

        if (waitingForForm(user)) {
            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(
                        processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(new DefaultMapEntry(user.getId(), propagateEnable),
                propByRes, getPerformedTasks(user));
View Full Code Here

        final Map<String, Object> variables = new HashMap<String, Object>();
        variables.put(USER_TO, userTO);
        variables.put(ENABLED, enabled);

        final ProcessInstance processInstance;
        try {
            processInstance = runtimeService.startProcessInstanceByKey(WF_PROCESS_ID, variables);
        } catch (ActivitiException e) {
            throw new WorkflowException("While starting " + WF_PROCESS_ID + " instance", e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        Boolean updatedEnabled = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(), ENABLED);
        if (updatedEnabled != null) {
            user.setSuspended(!updatedEnabled);
        }

        // this will make SyncopeUserValidator not to consider password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);
        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later - after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(ResourceOperation.CREATE, user.getResourceNames());

        String formTaskId = getFormTask(user);
        if (formTaskId != null) {
            // SYNCOPE-238: This is needed to simplify the task query in this.getForms()
            taskService.setVariableLocal(formTaskId, TASK_IS_FORM, Boolean.TRUE);
            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(
                        processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(
                new SimpleEntry<Long, Boolean>(user.getId(), propagateEnable), propByRes, getPerformedTasks(user));
View Full Code Here

        final Map<String, Object> variables = new HashMap<String, Object>();
        variables.put(USER_TO, userTO);
        variables.put(ENABLED, enabled);

        final ProcessInstance processInstance;
        try {
            processInstance = runtimeService.startProcessInstanceByKey(WF_PROCESS_ID, variables);
        } catch (ActivitiException e) {
            throw new WorkflowException("While starting " + WF_PROCESS_ID + " instance", e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        Boolean updatedEnabled = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(), ENABLED);
        if (updatedEnabled != null) {
            user.setSuspended(!updatedEnabled);
        }

        // this will make SyncopeUserValidator not to consider password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);
        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later - after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(ResourceOperation.CREATE, user.getResourceNames());

        String formTaskId = getFormTask(user);
        if (formTaskId != null) {
            // SYNCOPE-238: This is needed to simplify the task query in this.getForms()
            taskService.setVariableLocal(formTaskId, TASK_IS_FORM, Boolean.TRUE);
            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(
                        processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(
                new SimpleEntry<Long, Boolean>(user.getId(), propagateEnable), propByRes, getPerformedTasks(user));
View Full Code Here

        final Map<String, Object> variables = new HashMap<String, Object>();
        variables.put(USER_TO, userTO);
        variables.put(ENABLED, enabled);

        final ProcessInstance processInstance;
        try {
            processInstance = runtimeService.startProcessInstanceByKey(WF_PROCESS_ID, variables);
        } catch (ActivitiException e) {
            throw new WorkflowException("While starting " + WF_PROCESS_ID + " instance", e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        Boolean updatedEnabled = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(), ENABLED);
        if (updatedEnabled != null) {
            user.setSuspended(!updatedEnabled);
        }

        // this will make SyncopeUserValidator not to consider password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);
        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later - after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(ResourceOperation.CREATE, user.getResourceNames());

        String formTaskId = getFormTask(user);
        if (formTaskId != null) {
            // SYNCOPE-238: This is needed to simplify the task query in this.getForms()
            taskService.setVariableLocal(formTaskId, TASK_IS_FORM, Boolean.TRUE);
            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(
                        processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(
                new SimpleEntry<Long, Boolean>(user.getId(), propagateEnable), propByRes, getPerformedTasks(user));
View Full Code Here

        final Map<String, Object> variables = new HashMap<String, Object>();
        variables.put(USER_TO, userTO);
        variables.put(ENABLED, enabled);

        final ProcessInstance processInstance;
        try {
            processInstance = runtimeService.startProcessInstanceByKey("userWorkflow", variables);
        } catch (ActivitiException e) {
            throw new WorkflowException(e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        // this will make SyncopeUserValidator not to consider password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);
        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later - after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(PropagationOperation.CREATE, user.getResourceNames());

        String formTaskId = getFormTask(user);
        if (formTaskId != null) {
            // SYNCOPE-238: This is needed to simplify the task query in this.getForms()
            taskService.setVariableLocal(formTaskId, TASK_IS_FORM, Boolean.TRUE);

            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(
                        processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(
                new SimpleEntry<Long, Boolean>(user.getId(), propagateEnable),
View Full Code Here

    requestFormProps.put("priority", "critical");

    Date startDate = new Date();

    // create a new process instance with given form params
    ProcessInstance processInstance = formService.submitStartFormData(
        definition.getId(), requestFormProps);
    assertThat(processInstance, notNullValue());

    // test the audit process, fetch historic data
    List<HistoricDetail> historicFormProps = activitiRule
        .getHistoryService().createHistoricDetailQuery()
        .formProperties().orderByVariableName().asc().list();

    // assert that the historic data corresponds to the form data that we've
    // entered
    assertThat(historicFormProps.size(), equalTo(4));
    HistoricFormProperty historicSummary = (HistoricFormProperty) historicFormProps
        .get(0);
    assertThat(historicSummary.getPropertyId(), equalTo(DESCRIPTION_KEY));
    assertThat(historicSummary.getPropertyValue(),
        equalTo(DESCRIPTION_VALUE));
    assertThat(historicSummary.getTime(), greaterThan(startDate));

    // assert that the bad-words filter has filtered one bad word and
    // replaced it with 'xxx'
    assertThat(
        (String) activitiRule.getRuntimeService()
            .getVariable(processInstance.getProcessInstanceId(),
                DESCRIPTION_KEY),
        endsWith("I hate your xxxing shop!"));

    // get a handle on the task service
    TaskService taskService = activitiRule.getTaskService();

    // seach for a task for candidate-group 'itsupport-critical'
    Task approveCriticalIssueTask = taskService.createTaskQuery()
        .processInstanceId(processInstance.getProcessInstanceId())
        .taskCandidateGroup(itSupportGroup.getId()).singleResult();
    assertThat(approveCriticalIssueTask.getName(),
        equalTo("Approve Critical Issue"));

    // claim the task for the user 'itguy'
View Full Code Here

        final Map<String, Object> variables = new HashMap<String, Object>();
        variables.put(USER_TO, userTO);
        variables.put(ENABLED, enabled);

        final ProcessInstance processInstance;
        try {
            processInstance = runtimeService.startProcessInstanceByKey("userWorkflow", variables);
        } catch (ActivitiException e) {
            throw new WorkflowException(e);
        }

        SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                SYNCOPE_USER);

        // this will make SyncopeUserValidator not to consider password policies at all
        if (disablePwdPolicyCheck) {
            user.removeClearPassword();
        }

        updateStatus(user);
        user = userDAO.save(user);

        Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
                PROPAGATE_ENABLE);
        if (propagateEnable == null) {
            propagateEnable = enabled;
        }

        // save resources to be propagated and password for later -
        // after form submission - propagation
        PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(PropagationOperation.CREATE, user.getResourceNames());

        String formTaskId = getFormTask(user);
        if (formTaskId != null) {
            // SYNCOPE-238: This is needed to simplify the task query in this.getForms()
            taskService.setVariableLocal(formTaskId, TASK_IS_FORM, Boolean.TRUE);

            runtimeService.setVariable(processInstance.getProcessInstanceId(), PROP_BY_RESOURCE, propByRes);
            propByRes = null;

            if (StringUtils.isNotBlank(userTO.getPassword())) {
                runtimeService.setVariable(
                        processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
            }
        }

        return new WorkflowResult<Map.Entry<Long, Boolean>>(new DefaultMapEntry(user.getId(), propagateEnable),
                propByRes, getPerformedTasks(user));
View Full Code Here

  private QueueConnectionFactory connectionFactory; 
 
  public void receiveCallback(String correlationKey) {
    // Execution execution = runtimeService.createExecutionQuery().variableValueEquals("scoreResultCorrelationKey", correlationKey).singleResult();
    // This does not work because of limitation in Activiti, do workaround for http://jira.codehaus.org/browse/ACT-1106 instead:
    ProcessInstance pi = runtimeService.createProcessInstanceQuery().variableValueEquals("scoreResultCorrelationKey", correlationKey).singleResult();
    Execution execution = runtimeService.createExecutionQuery().activityId("wait_for_scoring_result").processInstanceId(pi.getId()).singleResult();
   
    System.out.println("do callback on execution " + execution.getId());

    Long customerId = (Long) runtimeService.getVariable(execution.getProcessInstanceId(), CustomerService.VARNAME_CUSTOMER_ID);
    Customer customer = entityManager.find(Customer.class, customerId);   
View Full Code Here

  @Test
  public void testProcessPath1() throws InterruptedException {
  //assign, approve YES, prepare, SVN, done!
    HashMap<String, Object> variables = new HashMap<String, Object>();
   
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(process, variables);
    String id = processInstance.getId();
    System.out.println("Started process instance id " + id);
   
    List<String> activityIds = runtimeService.getActiveActivityIds(id);
   
    //check for assignment
View Full Code Here

TOP

Related Classes of org.activiti.engine.runtime.ProcessInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.