Package org.uengine.util

Examples of org.uengine.util.ActivityForLoop


          }
          }
      }
      else if (act instanceof ComplexActivity)
      {
        ActivityForLoop af = new ActivityForLoop()
        {
          public void logic(Activity activity)
          {
            if ((activity instanceof HumanActivity) || (activity instanceof LocalMessengerActivity)) {
              Role[] roles = getAssignedRoles(activity);
              stop(roles[0]);
            }
          }
        };
       
        af.run(act);
        if ((Role) af.getReturnValue() != null) {
          gPointX = appendRoleList((Role)af.getReturnValue());
        }
        setGraphActivityPoint(graph, depth);
      } else {
        setGraphActivityPoint(graph, depth);
      }
View Full Code Here


 
  public Vector getSubDefinitionsDeeply(ProcessDefinition pd) throws Exception{
    final Vector definitions = new Vector();
    final ProcessManagerBean pmb=this;
       
    ActivityForLoop forLoop = new ActivityForLoop(){
      public void logic(Activity act){
        try{
          if(act instanceof SubProcessActivity){
            SubProcessActivity spAct = (SubProcessActivity)act;
            String defVerId = spAct.getDefinitionVersionId("",null);
            definitions.add(defVerId);
           
            pmb.getSubDefinitionsDeeply(pmb.getDefinition(defVerId));
          }
        }catch(Exception e){
          throw new RuntimeException(e);
        }
      }
    };
    forLoop.run(pd);

    return definitions;
  }
View Full Code Here

      }catch (Exception e) {
        continue;
      }
                   
      //sub-process
      ActivityForLoop forLoop = new ActivityForLoop() {
        public void logic(Activity act) {
          try {
            if (act instanceof SubProcessActivity) {
              SubProcessActivity spAct = (SubProcessActivity) act;

              String oldAlias = (spAct.getDefinitionId().split("@")[0]).substring(1,(spAct.getDefinitionId().split("@")[0]).length() - 1);
              String oldDefVerId = spAct.getDefinitionId().split("@")[1];

              String newAlias = (String) newAliasListTmp.get(oldAlias);
              String newpdvId = (String) newDefVerIdListTmp.get(oldDefVerId);

              String newdefVerid = "[" + newAlias + "]@"+ newpdvId;
              spAct.setDefinitionId(newdefVerid);
            }
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
      };
      forLoop.run(pd);

      //form
      ProcessVariable[] pvs = pd.getProcessVariables();
      if (pvs != null) {
        for (int j = 0; j < pvs.length; j++) {
View Full Code Here

    final ProcessInstance instanceTemp = instance;
   
    for(int i=0 ; i<actList.size() ; i++){
      Activity actTemp= (Activity)actList.get(i);
     
      ActivityForLoop findingLoop = new ActivityForLoop() {
        public void logic(Activity activity) {
          try {
            if (activity instanceof HumanActivity&&
              activity.STATUS_COMPLETED.equals(activity.getStatus(instanceTemp))) {
              setReturnValue(activity);
            }
          } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
      };
         
      findingLoop.runBackward(actTemp);
      HumanActivity preAct =(HumanActivity)findingLoop.getReturnValue();
      if(preAct!=null) return preAct;
    }
     
    return null;
  }
View Full Code Here

 
  public void pasteSelectedActivity(){
    Activity acitivtyInClipboard = getActivityInClipboard();
   
    //clear the tracing tags recursively.
    new ActivityForLoop(){
      public void logic(Activity activity) {
        activity.setTracingTag(null);
      }           
    }.run(acitivtyInClipboard);
   
View Full Code Here

  HumanApprovalActivity draftActivity;
  public HumanApprovalActivity getDraftActivity(){
    if(draftActivity!=null)
      return draftActivity;
   
    ActivityForLoop findingLoop = new ActivityForLoop(){
      public void logic(Activity activity){
        if(activity instanceof HumanApprovalActivity){
          stop(activity);
        }
      }
    };
   
    findingLoop.run(this);   
    this.draftActivity = (HumanApprovalActivity)findingLoop.getReturnValue();
   
    return draftActivity;
  }
View Full Code Here

      }
    }
  }
 
  public Activity findChildActivity(final Class type){
    ActivityForLoop findingLoop = new ActivityForLoop(){
      public void logic(Activity activity){
        if(type.isAssignableFrom(activity.getClass())){
          ((ActivityForLoop)this).stop(activity);
        }
      }
    };
     
    findingLoop.run(this);   
    Activity findingActivity = (Activity)findingLoop.getReturnValue();
     
    return findingActivity;
  }
View Full Code Here

  public ActivityReference getInitiatorHumanActivityReference(final ProcessTransactionContext ptc){
   
//    if(!isInitiateByFirstWorkitem())
//      throw new RuntimeException("this process definition is not allowed to be initiated by the first workitem.");
   
    ActivityForLoop findingLoop = new ActivityForLoop(){
      public void logic(Activity activity){
        if(activity instanceof HumanActivity){
          stop(activity);
        }else if(activity instanceof SubProcessActivity){
         
//          if(ptc==null){
//            stop(null);
//            return;
//          }
         
            stop(null);
            if(GlobalContext.isDesignTime()){
            return;
          }
         
          SubProcessActivity spAct = (SubProcessActivity)activity;
         
          ProcessManagerRemote pm = null;
          try{
            if(ptc.getProcessManager()!=null)
              pm = ptc.getProcessManager();
            else
              pm = (new ProcessManagerFactoryBean()).getProcessManagerForReadOnly();
     
            String versionId = pm.getProcessDefinitionProductionVersion(spAct.getDefinitionIdOnly());   
            ProcessDefinition spDef = ProcessDefinitionFactory.getInstance(ptc).getDefinition(versionId);
           
            if(spDef.isInitiateByFirstWorkitem()){
              ActivityReference actRefReturnedFromSP = spDef.getInitiatorHumanActivityReference(ptc);
             
              if(actRefReturnedFromSP==null){
                stop(null);
                return;
              }
             
              String scopeOfActFromSP = actRefReturnedFromSP.getAbsoluteTracingTag();
             
              if(scopeOfActFromSP == null){
                if(actRefReturnedFromSP.getActivity()!=null){
                  actRefReturnedFromSP.setAbsoluteTracingTag(spAct.getTracingTag() + "@" + actRefReturnedFromSP.getActivity().getTracingTag());
                  stop(actRefReturnedFromSP);
                  return;
                }
               
                stop(null);
                return;
              }
             
              actRefReturnedFromSP.setAbsoluteTracingTag(spAct.getTracingTag() + "@" + scopeOfActFromSP);
             
              stop(actRefReturnedFromSP);
            }
          }catch(Exception e){
            throw new RuntimeException(e);
          }finally{
            if(ptc.getProcessManager()==null)
              try {
                pm.remove();
              } catch (Exception e) {
              }
          }
        }
      }
    };
   
    findingLoop.run(this);

    Object result = findingLoop.getReturnValue();
    if(result instanceof HumanActivity){     
      ActivityReference ref = new ActivityReference();
      ref.setActivity((Activity)result);
      ref.setAbsoluteTracingTag(((Activity)result).getTracingTag());
     
View Full Code Here

    if(!registerActivity(this, true, true)){
      ctx.add("Activity id (tracingtag) collision is detected.");
    }
   
    final HashMap tracingTagMap = new HashMap();
    ActivityForLoop findingLoopForTracingTagCollision = new ActivityForLoop(){

      public void logic(Activity activity) {
        if(tracingTagMap.containsKey(activity.getTracingTag())){
          Activity originalTTUser = (Activity)tracingTagMap.get(activity.getTracingTag());
          ctx.add(activity.getActivityLabel() + " TracingTag collision with " + originalTTUser.getActivityLabel() + ". You should choose another tag number for this activity (Change the definition source directly code in the 'XPD' Tab).");
        }else
          tracingTagMap.put(activity.getTracingTag(), activity);
      }     
     
    };
   
    findingLoopForTracingTagCollision.run(this);
   
   
    if(getRoles()!=null) {
      Role[] roles = getRoles();
      for(int i=0; i<roles.length; i++){
View Full Code Here

        "duration",
        "businessStatus",
        "status",
      };
   
    ActivityForLoop afl = new ActivityForLoop(){
      public void logic(Activity activity) {
        if(activity instanceof HumanActivity){
          Record activityNode = createRecord(activity.getName().getText(), "[activities]."+activity.getTracingTag(), isSource);
         
          activitiesNode.add(activityNode);
         
          for (int i = 0; i < activityPropertyNames.length; i++) {
            activityNode.add(createRecord(activityPropertyNames[i],"[activities]."+activity.getTracingTag() + "." + activityPropertyNames[i], isSource));
          }
        }
      }
    };
    afl.run(def);
  }
View Full Code Here

TOP

Related Classes of org.uengine.util.ActivityForLoop

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.