Package org.jbpm.api

Examples of org.jbpm.api.ExecutionService


            }
        }
    }
   
    public Map<String, Object> getBpmVariables(ProcessInstance pi) {
        ExecutionService es = getProcessEngine().getExecutionService();
        return es.getVariables(pi.getInternalId(), es.getVariableNames(pi.getInternalId()));
    }
View Full Code Here


        ExecutionService es = getProcessEngine().getExecutionService();
        return es.getVariables(pi.getInternalId(), es.getVariableNames(pi.getInternalId()));
    }
   
    public Object getBpmVariable(ProcessInstance pi, String variableName) {
        ExecutionService es = getProcessEngine().getExecutionService();
        return es.getVariable(pi.getInternalId(), variableName);
    }
View Full Code Here

     
      long start = System.currentTimeMillis();
       if (internalId == null) {
         return false;
       }
       ExecutionService service = getProcessEngine(ctx).getExecutionService();
       org.jbpm.api.ProcessInstance processInstance = service.findProcessInstanceById(internalId);
      
      long duration = System.currentTimeMillis() - start;
    log.severe("isProcessRunning: " +  duration);
   
   
View Full Code Here

       return processInstance != null && !processInstance.isEnded();
     }

    @Override
     protected ProcessInstance startProcessInstance(ProcessDefinitionConfig config, String externalKey, ProcessToolContext ctx, ProcessInstance pi) {
       final ExecutionService execService = getProcessEngine(ctx).getExecutionService();
       Map vars = new HashMap();
       vars.put("processInstanceId", String.valueOf(pi.getId()));
       vars.put("initiator", user.getLogin());

       org.jbpm.api.ProcessInstance instance = execService.startProcessInstanceByKey(config.getBpmDefinitionKey(), vars, externalKey);
       pi.setInternalId(instance.getId());

      
       return pi;
     }
View Full Code Here

        return new ArrayList<String>(engine.getTaskService().getOutcomes(internalId));
    }

    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

        }
        private byte[] fetchProcessResource(ProcessInstance pi, String resourceName) {
            ProcessEngine processEngine = getProcessEngine(ProcessToolContext.Util.getThreadProcessToolContext());
            RepositoryService service = processEngine.getRepositoryService();

            ExecutionService executionService = processEngine.getExecutionService();
            org.jbpm.api.ProcessInstance processInstanceById = executionService.findProcessInstanceById(pi.getInternalId());
            String processDefinitionId;
            if (processInstanceById == null) { //look in history service
                HistoryProcessInstanceQuery historyProcessInstanceQuery = processEngine.getHistoryService()
                        .createHistoryProcessInstanceQuery().processInstanceId(pi.getInternalId());
                HistoryProcessInstance historyProcessInstance = historyProcessInstanceQuery.uniqueResult();
View Full Code Here


public class AbortMigrationHandler implements MigrationHandler {

  public void migrateInstance(ProcessDefinition newProcessDefinition, ProcessInstance processInstance, MigrationDescriptor migrationDescriptor) {
    ExecutionService executionService = EnvironmentImpl.getFromCurrent(ExecutionService.class);
    if (executionService == null) return;
    executionService.endProcessInstance(processInstance.getId(), "aborted");
  }
View Full Code Here

//    HistoryEvent.fire(processInstanceMigrate);
//  }
 
  private static List<ProcessInstance> getProcessInstancesToMigrate(String processDefinitionName, MigrationDescriptor migrationDescriptor) {
    List<ProcessInstance> result = new ArrayList<ProcessInstance>();
    ExecutionService executionService = (ExecutionService) EnvironmentImpl.getFromCurrent(ExecutionService.class);
    List<ProcessDefinition> processesToMigrate = getProcessesToMigrate(processDefinitionName, migrationDescriptor);
    for (ProcessDefinition processDefinition : processesToMigrate) {
      result.addAll(
              executionService
                .createProcessInstanceQuery()
                .processDefinitionId(processDefinition.getId()).list());
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of org.jbpm.api.ExecutionService

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.