Package org.jbpm.api

Examples of org.jbpm.api.Execution


    @Override
    public Object updateProcess(Object executionId, Map variables) throws Exception
    {
        // Get Process ID
        String processId;
        Execution execution = processEngine.getExecutionService().findExecutionById((String) executionId);
        if (execution == null)
        {
            throw new IllegalArgumentException("No process execution found with id = " + executionId + " (it may have already terminated)");
        }
        if (execution.getProcessInstance() != null)
        {
            processId = execution.getProcessInstance().getId();
        }
        else
        {
            processId = execution.getId();
        }

        // Set any process variables.
        if (variables != null && !variables.isEmpty())
        {
View Full Code Here


        if (taskList.isEmpty()) {
            loger.warning("No tasks found in queue: " + pq.getName());
            return null;
        }
        Task task = taskList.get(0);
        Execution exec = processEngine.getExecutionService().findExecutionById(task.getExecutionId());
        String internalId = exec.getProcessInstance().getId();
        ProcessInstance pi = getProcessData(internalId, ctx);
        if (pi == null) {
            loger.warning("Process instance not found for instance id: " + internalId);
            return null;
        }
View Full Code Here

     private List<BpmTask> findProcessInstancesForTasks(List<Task> tasks, final ProcessToolContext ctx) {
       Map<String, List<Task>> tasksByProcessId = pl.net.bluesoft.util.lang.Collections.group(tasks, new Transformer<Task, String>() {
               @Override
               public String transform(Task task) {
                   Execution exec = getProcessEngine(ctx).getExecutionService().findExecutionById(task.getExecutionId());
                   return exec.getProcessInstance().getId();
               }
           });
       final Map<String, ProcessInstance> instances = ctx.getProcessInstanceDAO().getProcessInstanceByInternalIdMap(tasksByProcessId.keySet());
       final List<BpmTask> result = new ArrayList<BpmTask>();
    for (Map.Entry<String, List<Task>> entry : tasksByProcessId.entrySet()) {
View Full Code Here

      long duration = System.currentTimeMillis() - start;
    log.severe("assignTaskToUser: " +  duration);
     }

     protected Map<String, Execution> getActiveExecutions(String internalId, ProcessToolContext ctx) {
       Execution exec = getProcessEngine(ctx).getExecutionService().findExecutionById(internalId);
       if (exec == null) {
         loger.warning("Unable to find execution by process internal id: " + internalId);
         return new HashMap<String, Execution>();
       }
       Collection<Execution> executions = getActiveExecutions(exec, new Predicate<Execution>() {
               @Override
               public boolean apply(Execution exec) {
                   return Execution.STATE_ACTIVE_ROOT.equals(exec.getState()) || Execution.STATE_ACTIVE_CONCURRENT.equals(exec.getState());
               }
           });
       return pl.net.bluesoft.util.lang.Collections.transform(executions, new Transformer<Execution, String>() {
               @Override
               public String transform(Execution obj) {
View Full Code Here

    }

    public boolean updateSubprocess(final ProcessInstance parentPi, String executionId, ProcessToolContext ctx) {
        ProcessEngine engine = getProcessEngine(ctx);
        ExecutionService executionService = engine.getExecutionService();
    Execution jbpmPi = executionService.findExecutionById(executionId);
        if(jbpmPi != null){
          Execution subprocess = jbpmPi.getSubProcessInstance();
          if(subprocess != null){
            ctx.getHibernateSession().refresh(subprocess);
           
            if (ctx.getProcessInstanceDAO().getProcessInstanceByInternalId(subprocess.getId()) == null)
            {
          String processDefinitionId = subprocess.getProcessDefinitionId().replaceFirst("-\\d+$", "");
          ProcessDefinitionConfig config = ctx.getProcessDefinitionDAO().getActiveConfigurationByKey(
              processDefinitionId);

          /* Create new instance of parent process' subprocess */
          ProcessInstance subProcessInstance = createSubprocessInstance(config, ctx, parentPi, "parent_process", subprocess.getId());
           
          long subPiId = ctx.getProcessInstanceDAO().saveProcessInstance(subProcessInstance);
         
          executionService.createVariable(subprocess.getId(), "processInstanceId", String.valueOf(subPiId),
              false);
         
          return true;
        }
          }
View Full Code Here

TOP

Related Classes of org.jbpm.api.Execution

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.