Package org.uengine.kernel

Examples of org.uengine.kernel.ProcessDefinition


    InputStream defIS = (InputStream)extendedContext.get("wsdl");
   
    TwisterProcess tp = (new TwisterBPELToolkit()).read(is, defIS);
    Adapter apt = new TwisterProcessAdapter();
    ProcessDefinition pd = (ProcessDefinition)apt.convert(tp, null);
       
    return pd;
  }
View Full Code Here


    try{
      //System.out.println(srcXMLPath + " to " + targetXMLPath + ".");

      Object srcObj = sourceSerialzer.deserialize(new java.io.FileInputStream(srcXMLPath), null);
     
      ProcessDefinition def = (ProcessDefinition)srcObj;       
       
     
      System.out.println(src+"="+def.getName());
      //targetSerializer.serialize(srcObj, new java.io.FileOutputStream(targetXMLPath), null);
    }catch(Exception e){
      //e.printStackTrace();
    }
View Full Code Here

 
  protected void changeBindingArguments(String pvId){
    if(pvId==null) return;
   
    try{
      ProcessDefinition pd = null;
      if(pvId.indexOf("@") > -1){
        String [] defIdAndVersionId = pvId.split("@");
        pd = loadDesign(defIdAndVersionId[1], false)//load with version id;     
      }else{
        pd = loadDesign(pvId, true)//load with definition id; 
        definitionIdInput.setValue(null); //clear picker's remained selection
        definitionIdInput.setValue(pvId + "@" + pd.getId()); //reload version
        ((XMLValueInput)definitionIdInput).setDisplayValue(pd.getName() + " Version_" + pd.getVersion());
       
        //return;
      }
System.out.println("load binding information...");   
     
      RoleParameterContext[] oldRPCs = (RoleParameterContext[])bindingRolesInput.getValue();
      HashMap oldRPCHM = new HashMap();
      if(oldRPCs!=null)
      for(int i=0; i<oldRPCs.length; i++)
        oldRPCHM.put(oldRPCs[i].getArgument(), oldRPCs[i]);
       
      Role[] roles = pd.getRoles();
      RoleParameterContext[] rolePCs = new RoleParameterContext[roles.length];
     
      for(int i=0; i<roles.length; i++){
        rolePCs[i] = new RoleParameterContext();
        rolePCs[i].setArgument(roles[i].getName());
        //rolePCs[i].setRole(roles[i]);
        //rolePCs[i].setDirection(rolePCs[i].getDirection());
       
        if(oldRPCs!=null && oldRPCHM.containsKey(rolePCs[i].getArgument())){
          RoleParameterContext theRPC = (RoleParameterContext)oldRPCHM.get(rolePCs[i].getArgument());
          rolePCs[i].setRole(theRPC.getRole());
          rolePCs[i].setDirection(theRPC.getDirection());         
        }
      }
      bindingRolesInput.setValue(rolePCs);
     
      //
      ParameterContext[] oldpvPCs = (ParameterContext[])bindingVariablesInput.getValue();
     
      HashMap oldpvPCsM = new HashMap();
      if(oldpvPCs!=null){
        for(int i=0; i<oldpvPCs.length; i++)
          oldpvPCsM.put(oldpvPCs[i].getArgument(), oldpvPCs[i]);
      }
     
      ProcessVariable[] processVariables = pd.getProcessVariables();
      ParameterContext[] pvPCs = new ParameterContext[processVariables.length];
     
      for(int i=0; i<processVariables.length; i++){
        pvPCs[i] = new SubProcessParameterContext();
        pvPCs[i].getArgument().setText(processVariables[i].getName());
View Full Code Here

      is = proxy.showProcessDefinitionWithDefinitionId(id);
    else
      is = proxy.showProcessDefinitionWithVersionId(id);
   
    //    InputStream is = new URL(UEngineUtil.getWebServerBaseURL() + ProcessDesigner.URL_showProcessDefinitionJSPWithDefinitionId + definitionId).openStream(); 
    ProcessDefinition pd = (ProcessDefinition)GlobalContext.deserialize(is, String.class);
   
    return pd;
  }
View Full Code Here

        g2d.fill(new Rectangle(10, 10, 100, 100));
    }

    public static void main(String[] args) throws Exception {
     
      ProcessDefinition sampleProcDef = new ProcessDefinition();
      sampleProcDef = (ProcessDefinition) GlobalContext.deserialize(new FileInputStream(args[0]), ProcessDefinition.class);
      ActivityDesigner actDesigner = sampleProcDef.createDesigner();
     
      SwitchActivity switchAct = new SwitchActivity();
      switchAct.addChildActivity(new HumanActivity());
      switchAct.addChildActivity(new HumanActivity());
     
View Full Code Here

 
 
  public static void main(String[] args) throws Exception{
    GraphActivity[] activities = createTestGraphProcess3();
   
    ProcessDefinition proc = new ProcessDefinition();
    activities[0].convertToBlock(proc, activities[0]);
       
    StringBuilder sb = ProcessDefinitionViewer.getInstance().render(proc, null, new Hashtable());
   
    sb.append("<ul>links<br>");
View Full Code Here

  static Hashtable adapters = new Hashtable();
 
  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    TwisterProcess srcProcDef = (TwisterProcess)src;       
    ProcessDefinition proc = new ProcessDefinition();
   
    proc.setName(srcProcDef.getName());
   
    Vector childActivities = new Vector();
    org.uengine.smcp.twister.engine.priv.core.definition.Activity activity = srcProcDef.getActivity();
    if(activity instanceof Sequence){
      Sequence seq = (Sequence)activity;
      List childList = seq.getActivities();
     
      for(Iterator iter = childList.iterator(); iter.hasNext(); ){
        activity = (org.uengine.smcp.twister.engine.priv.core.definition.Activity)iter.next();
       
        try{
          org.uengine.kernel.Activity destAct =
            (org.uengine.kernel.Activity)getAdapter(activity.getClass()).convert(activity, null);
          proc.addChildActivity(destAct)
        }catch(Exception e){
         
        }       
      }     
    }else{
      org.uengine.kernel.Activity destAct =
                (org.uengine.kernel.Activity)getAdapter(activity.getClass()).convert(activity, null);
      proc.addChildActivity(destAct);
   
       
    //getting variables
    {
      Vector pvdVector = new Vector();
   
      for(Iterator iter = srcProcDef.getVariables().iterator(); iter.hasNext();){
        Variable var = (Variable)iter.next();
       
        ProcessVariable pvd = new ProcessVariable();
       
        pvd.setName(var.getName());
        //pvd.setQName(var.gettype_Attribute().get());
        pvdVector.add(pvd);
      }
   
      ProcessVariable[] pvds = new ProcessVariable[pvdVector.size()];
      pvdVector.toArray(pvds);
      proc.setProcessVariables(pvds);     
    }
    //
   
    //setting roles
    /*{
 
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();
           
    }catch(Exception e){
      e.printStackTrace();
      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
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();
      newRole.setName(newRoleName);
      humanActivity.setRole(newRole);
     
      newPd.registerToProcessDefinition(false, false)
      changeProcessDefinition(instanceId, newPd);
     
      roleMapping.setName(newRoleName);
      humanActivity.delegate(instance, roleMapping, false);
     
View Full Code Here

      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
    }
  }
 
  private void completeInitiatorWorkitem(ProcessInstance instance, ResultPayload resultPayload) throws Exception{
    ProcessDefinition definition = instance.getProcessDefinition();
    ActivityReference initiatorHumanActivityReference = definition.getInitiatorHumanActivityReference(instance.getProcessTransactionContext());
   
//    boolean isInitiationInSubprocess = false;
    String absoluteTracingTag = initiatorHumanActivityReference.getAbsoluteTracingTag();
   

    if(absoluteTracingTag.indexOf("@")>0){
//      isInitiationInSubprocess = true;
      String[] scopesByTracingTag = absoluteTracingTag.split("@");
      for(int i=0; i<scopesByTracingTag.length-1; i++){
        String scope = scopesByTracingTag[i];
        SubProcessActivity spAct = (SubProcessActivity)definition.getActivity(scope);
        List spInstanceIds = spAct.getSubprocessIds(instance);
        if(spInstanceIds.size() == 0){
          throw new UEngineException("Activity in the subprocess ["+ absoluteTracingTag +"] cannot be found.");
        }
       
        String spInstanceId = (String)spInstanceIds.get(0);
       
        instance = getProcessInstance(spInstanceId);
        definition = instance.getProcessDefinition();
      }
    }
   
    ActivityInstanceContext firstRunningActivityInstanceCtx = instance.getCurrentRunningActivity();
    HumanActivity humanActivity = (HumanActivity)firstRunningActivityInstanceCtx.getActivity();
   
    //HumanActivity humanActivity = (HumanActivity)initiatorHumanActivityReference.getActivity();
   
    if(humanActivity==null)
      throw new UEngineException("Inconsistent status. Couldn't find the initiator HumanActivity.");
     
    String message = humanActivity.getMessage();
   
    //add task id into payload
    String[] taskIds = humanActivity.getTaskIds(instance);

    if(!(instance instanceof DefaultProcessInstance) && (taskIds==null || taskIds.length<1)) throw new UEngineException("The first human work didn't start properly.");
 
    //TODO: kind of wierd code
    if(resultPayload!=null && taskIds!=null)
    resultPayload.setExtendedValue(
        new KeyedParameter(HumanActivity.PAYLOADKEY_TASKID, taskIds[0])
    );     
    //

    definition.fireMessage(message, instance, resultPayload);
  }
View Full Code Here

TOP

Related Classes of org.uengine.kernel.ProcessDefinition

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.