Package org.uengine.kernel

Examples of org.uengine.kernel.ProcessInstance


  }
 
  public HashMap getProcessVariable(String instanceId, ProcessManagerRemote pm) {
    HashMap processVariableMap = null;
    ProcessInstance instance = null;

    try {
      instance = pm.getProcessInstance(instanceId);
      ProcessVariable[] processVariables = instance.getProcessDefinition().getProcessVariables();
     
      processVariableMap = new HashMap();
     
      if (processVariables != null) {
        for (int i = 0; i < processVariables.length; i++) {
View Full Code Here


      loggedRoleMapping.setEndpoint(endpoint);

      Map genericContext = new HashMap();
      genericContext.put(HumanActivity.GENERICCONTEXT_CURR_LOGGED_ROLEMAPPING, loggedRoleMapping);

      ProcessInstance instance = pm.getProcessInstance(instanceId);

      setVariableValue(instance, processVariableMap);

      pm.setGenericContext(genericContext);
      pm.completeWorkitem(instanceId, tracingTag, taskId, new org.uengine.kernel.ResultPayload());
View Full Code Here

      pm.setGenericContext(genericContext);

      String defVerId = pm.getProcessDefinitionProductionVersionByAlias(alias);
      instanceId = pm.initializeProcess(defVerId);
      ProcessInstance instance = pm.getProcessInstance(instanceId);

      setVariableValue(instance, processVariableMap);

      if ("executeProcessByWorkitem".equals(type) || !UEngineUtil.isNotEmpty(type)) {
        pm.executeProcessByWorkitem(instanceId, new org.uengine.kernel.ResultPayload());
View Full Code Here

    String workedInstanceId = null;
   
    try {
     
      ProcessInstance instance = pm.getProcessInstance(instanceId);
      setVariableValue(instance, processVariableMap);

      workedInstanceId = instanceId;
     
    } catch (Exception e) {
View Full Code Here

    if(!UEngineUtil.isNotEmpty(instId)){
      if(transactionContext.getTemporaryInstance()!=null)
        return transactionContext.getTemporaryInstance();
     
      ProcessInstance temporaryInstance = ProcessInstance.create().getInstance(instId, options);
      transactionContext.setTemporaryInstance(temporaryInstance);
      return temporaryInstance;
    }
   
    ProcessInstance instance = ProcessInstance.create().getInstance(instId, options);

    return instance;
  }
View Full Code Here

     
      if(transactionContext==null)
         transactionContext = new ProcessTransactionContext(this);
   
      options.put("ptc", transactionContext);
      ProcessInstance instance = getDefinition(processDefinition).createInstance(name, options);
     
      return instance.getInstanceId();
    }catch(Exception e){
      e.printStackTrace();
      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
    }
  }
View Full Code Here

  }

  public void executeProcess(String instanceId) throws RemoteException{
    logInst("executeProcess", new Object[]{instanceId});
    try{
      ProcessInstance instance = getInstance(instanceId);
     
      instance.execute();
    } catch(Exception e) {
      e.printStackTrace();
      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
    }
  }
View Full Code Here

  }
 
  public void executeProcessByWorkitem(String instanceId, ResultPayload resultPayload) throws RemoteException{
    logInst("executeProcessByWorkitem", new Object[]{instanceId, resultPayload});
    try{
      ProcessInstance instance = getInstance(instanceId);
      ProcessDefinition definition = instance.getProcessDefinition();
     
      definition.setQueuingMechanism(instance, ProcessDefinition.QUEUINGMECH_SYNC);

      instance.execute();

      completeInitiatorWorkitem(instance, resultPayload);

      definition.setQueuingMechanism(instance, ProcessDefinition.QUEUINGMECH_JMS);
      //instance.endCaching();
View Full Code Here

  }
 
  public String[] delegateWorkitem(String instanceId, String tracingTag, RoleMapping roleMapping) throws RemoteException{
    logInst("delegateWorkitem", new Object[]{instanceId, tracingTag, roleMapping});
    try{
      ProcessInstance instance = getInstance(instanceId);
      ProcessDefinition newPd = (ProcessDefinition)instance.getProcessDefinition().clone();
      HumanActivity humanActivity = (HumanActivity)newPd.getActivity(tracingTag);
     
      String newRoleName = "_delegateRole_" + humanActivity.getRole().getName() + "_" + humanActivity.getTracingTag();
     
      Role newRole = new Role();
View Full Code Here

    executeEventByWorkitem(mainInstanceId, eventName, null, resultPayload);
  }

  public void executeEventByWorkitem(String mainInstanceId, String eventName, String triggerActivityTracingTag, ResultPayload resultPayload) throws RemoteException{
    try{
      ProcessInstance mainProcessInstance = getInstance(mainInstanceId);
     
      //send message first
      ProcessDefinition mainProcessDefinition = mainProcessInstance.getProcessDefinition();
      EventMessagePayload eventMessagePayload = new EventMessagePayload();
      eventMessagePayload.setEventName(eventName);
      eventMessagePayload.setTriggerTracingTag(triggerActivityTracingTag);
      mainProcessDefinition.fireMessage("event", mainProcessInstance, eventMessagePayload);
     
      //get the initiated sub process instance
      EventHandler[] ehs = getEventHandlersInAction(mainInstanceId);
      EventHandler theEventHandler = null;
      for(int i=0; i<ehs.length; i++){
        if(ehs[i].getName().equals(eventName)){
          theEventHandler = ehs[i];
          break;
        }
      }
     
      Activity handlerActivity = theEventHandler.getHandlerActivity();
     
      HumanActivity humanActivity = null;
     
      if(handlerActivity instanceof SubProcessActivity){
        SubProcessActivity subProcessActivity = (SubProcessActivity)theEventHandler.getHandlerActivity();
        Vector idVt = subProcessActivity.getSubprocessIds(mainProcessInstance);
       
        String subInstanceId = (String)idVt.get(0);
       
        ProcessInstance subProcessInstance = getInstance(subInstanceId);

        completeInitiatorWorkitem(subProcessInstance, resultPayload);
       
        return;
View Full Code Here

TOP

Related Classes of org.uengine.kernel.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.