Package org.uengine.kernel

Examples of org.uengine.kernel.ComplexActivity


  }
 
  public static void main(String[] args) throws Exception{
   
    Activity act;
    ComplexActivity cAct1, cAct2;
   
    Role role1 = new Role("Role1");
    Role role2 = new Role("Role2");
    Role role3 = new Role("Role3");
   
    ProcessDefinition def = new ProcessDefinition();{
      act = new HumanActivity();
      act.setName("report trouble");
      ((HumanActivity) act).setRole(role1);
      def.addChildActivity(act);

      act = new HumanActivity();
      act.setName("set the right person");
      ((HumanActivity) act).setRole(role2);     
      def.addChildActivity(act);
     
      cAct1 = new SwitchActivity();
      cAct1.setName("switch1");
      def.addChildActivity(cAct1);{
        cAct2 = new SequenceActivity();
        cAct1.addChildActivity(cAct2);{
          act = new HumanActivity();
          act.setName("Draft with resolution");
          ((HumanActivity) act).setRole(role3);
          cAct2.addChildActivity(act);
         
          act = new SQLActivity();
          act.setName("Database");
          cAct2.addChildActivity(act);
        }
        cAct2 = new LoopActivity();
        cAct1.addChildActivity(cAct2);{
          act = new HumanActivity();
          act.setName("Suggestion");
          ((HumanActivity) act).setRole(role3);
          cAct2.addChildActivity(act);
         
View Full Code Here


  @Override
  public StringBuilder render(Activity activity, ProcessInstance instance, Map options) {
    // Lee YongHong made "showRanPathOnly" option
    if ( options.containsKey("showRanPathOnly") ) {
      try {
        ComplexActivity cActivity = (ComplexActivity) activity;
        String statusOfThecActivity = cActivity.getStatus(instance);
       
        if ( statusOfThecActivity.equals(Activity.STATUS_READY)) {
          return super.render(activity, instance, options);
        } else {
          for ( Enumeration enumeration = cActivity.getChildActivities().elements() ; enumeration.hasMoreElements() ; ) {
            Activity child = (Activity) enumeration.nextElement();
            String statusOfTheChild = child.getStatus(instance);
            ActivityViewer aViewer = (ActivityViewer)UEngineUtil.getComponentByEscalation(child.getClass(), "viewer");
            if ( statusOfTheChild.equals(Activity.STATUS_FAULT) ) {             
              return aViewer.render(child, instance, options);
View Full Code Here

public class SwitchActivityAdapter implements Adapter{

  public Object convert(Object src, Hashtable keyedContext) throws Exception {

    ComplexActivity srcDef = (ComplexActivity)src;
    GraphActivity graphProcess = new GraphActivity(srcDef);
    ActivityUtil activityUtil = new ActivityUtil();

    for(int i=0; i < srcDef.getChildActivities().size(); i++){
      Activity childAct = (Activity) srcDef.getChildActivities().get(i);
     
      //if(childAct instanceof Activity){
        if (!activityUtil.isVisible(childAct, keyedContext)) {
          Adapter adapter = ProcessDefinitionAdapter.getAdapter(childAct.getClass());
          graphProcess.addNext((GraphActivity)adapter.convert(childAct, keyedContext));
View Full Code Here

      sb.append("<td>");
    }   
   
    sb.append("<table border=0 cellpadding=0 cellspacing=0><tr>");
   
    ComplexActivity cActivity = (ComplexActivity)activity;
   
    for(Enumeration enumeration = cActivity.getChildActivities().elements(); enumeration.hasMoreElements(); ){
      sb.append("<td><img src=images/arrow.gif></td><td>");
      Activity child = (Activity)enumeration.nextElement();
     
      ActivityViewer viewer = DefaultActivityViewer.createViewer(child);
      StringBuilder childHTML = viewer.render(child, instance, options);
View Full Code Here

      sb.append("<td id=leftSpacer"+loopActivitySequence+" align='center' width="+loopLabelsize+" rowspan='"+ spanSize +"'><img src='" + imagePathRoot + "images/empty.gif' width='" + loopLabelsize + "' height='0' /></td>");
    }else{
      sb.append("<td height=20 colspan="+ spanSize +"><center><table cellpadding=0 cellspacing=0 border=0><td bgcolor=white>&nbsp;<font color=gray>"+ loopLabel +"&nbsp;</td></table></td></tr><tr>");
    }
   
    ComplexActivity cActivity = (ComplexActivity)activity;
   
    sb.append("<td align='center'>");
    sb.append("<img id='start" + loopActivitySequence + "' src="+imagePathRoot+"images/feedbackpoint.gif />");
    sb.append("</td>");
   
    if(isVertical){
      sb.append("<td align=center rowspan="+ spanSize +"><table cellpadding=0 cellspacing=0 border=0><td bgcolor=white><img src='" + imagePathRoot + "images/empty.gif' width='" + loopLabelsize + "' height='0' /><div id=rightLabel"+loopActivitySequence+" style='text-align:center;'>&nbsp;<font color=gray>"+ loopLabel +"&nbsp;</div></td></table></td>");
      sb.append("</tr><tr>");
    }

    sb.append("<td align=center><img src="+imagePathRoot+"images/arrow"+ (isVertical ? "_vertical":"") +".gif" + "></td>");
   
    if(isVertical)
      sb.append("</tr>");

   
    boolean firstArrow = true;
    for(Enumeration enumeration = cActivity.getChildActivities().elements(); enumeration.hasMoreElements(); ){
      Activity child = (Activity)enumeration.nextElement();
      ActivityUtil activityUtil = new ActivityUtil();
     
      if(!activityUtil.isVisible(child, options)) {
        if(!firstArrow){
View Full Code Here

*/
  
public class ComplexActivityAdapter implements Adapter{
 
  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    ComplexActivity srcAct = (ComplexActivity)src;
    ComplexActivity dstAct = createDestinationActivity();
    Role role = (Role)keyedContext.get("role");   
           
    Vector childActivities = srcAct.getChildActivities();
    int i=0;
    for(Enumeration enumeration = childActivities.elements(); enumeration.hasMoreElements();){         
      Object item = (Object)enumeration.nextElement();
      Adapter adpt = ProcessDefinitionAdapter.getAdapter(item.getClass());
      if(adpt==null){
        continue;
      }
     
      Activity convertedAct = (Activity)adpt.convert(item, keyedContext);
      if(convertedAct!=null){
        dstAct.addChildActivity(convertedAct);
        i++;             
      }
    }   
   
    if(i==0) return null;
    if(i==1) return dstAct.getChildActivities().elementAt(0);
   
    return dstAct;
  }
View Full Code Here

      Activity approvalLineAct = draftAct.getParentActivity();
      while (!(approvalLineAct instanceof ExternalApprovalLineActivity)) {
        approvalLineAct = approvalLineAct.getParentActivity();
      }
     
      ComplexActivity parent = (ComplexActivity) approvalLineAct;
      if (parent.getChildActivities().size() > 1) {
        parent.getChildActivities().clear();
        parent.addChildActivity(draftAct);
      }
     
      String preApprovalType = null;
      for (Approver approver : approverList) {
        if (ExternalApprovalActivity.APPROVAL_TYPE_DRAFT.equalsIgnoreCase(approver.getType())) {
          approver.setTracingTag(draftAct.getTracingTag());
          approver.setTaskId(draftAct.getTaskIds(instance)[0]);
          approver.setTruthEmpCode(approver.getEmpCode());
          approver.setStatus(ExternalApprovalActivity.SIGN_DRAFT);
          approver.setEndDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
          approver.setComment(psMsg.getComment());
          approvalActs.add(draftAct);
          continue;
        }
        ExternalApprovalActivity childAct = (ExternalApprovalActivity) draftAct.clone();
        childAct.setName("결재");
        childAct.setTracingTag(null);
        childAct.setRole(null);
        childAct.setApprovalTypeByString(approver.getType());
       
        RoleMapping rm = RoleMapping.create();
        rm.setEndpoint(approver.getEmpCode());
        rm.fill(instance);
       
        // 결재 -> 합의
        if (!ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
          AllActivity allAct = new AllActivity();
          allAct.setTracingTag(null);
         
          parent.addChildActivity(allAct);
          parent = allAct;
        // 합의 -> 결재
        } else if (ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && !ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
          parent = (ComplexActivity) approvalLineAct;
        }
       
        parent.addChildActivity(childAct);
        childAct.setApprover(instance, rm);
       
        approver.setTracingTag(childAct.getTracingTag());
       
        preApprovalType = approver.getType();
View Full Code Here

    Activity approvalLineAct = draftAct.getParentActivity();
    while (!(approvalLineAct instanceof ExternalApprovalLineActivity)) {
      approvalLineAct = approvalLineAct.getParentActivity();
    }
   
    ComplexActivity parent = (ComplexActivity) approvalLineAct;
    if (parent.getChildActivities().size() > 1) {
      parent.getChildActivities().clear();
      parent.addChildActivity(draftAct);
    }
   
    String preApprovalType = null;
    for (Approver approver : approverList) {
      if (ExternalApprovalActivity.APPROVAL_TYPE_DRAFT.equalsIgnoreCase(approver.getType())) {
        approver.setTracingTag(draftAct.getTracingTag());
        approver.setTaskId(adacMsg.getTaskId());
        approver.setTruthEmpCode(approver.getEmpCode());
        approver.setStatus(ExternalApprovalActivity.SIGN_DRAFT);
        approver.setEndDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
        approver.setComment(adacMsg.getComment());
        continue;
      }
      ExternalApprovalActivity childAct = (ExternalApprovalActivity) draftAct.clone();
      childAct.setName("결재");
      childAct.setTracingTag(null);
      childAct.setRole(null);
      childAct.setApprovalTypeByString(approver.getType());
     
      RoleMapping rm = RoleMapping.create();
      rm.setEndpoint(approver.getEmpCode());
      rm.fill(instance);
     
      // 결재 -> 합의
      if (!ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
        AllActivity allAct = new AllActivity();
        allAct.setTracingTag(null);
       
        parent.addChildActivity(allAct);
        parent = allAct;
      // 합의 -> 결재
      } else if (ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && !ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
        parent = (ComplexActivity) approvalLineAct;
      }
     
      parent.addChildActivity(childAct);
      childAct.setApprover(instance, rm);
     
      approver.setTracingTag(childAct.getTracingTag());
     
      preApprovalType = approver.getType();
View Full Code Here

    Activity approvalLineAct = draftAct.getParentActivity();
    while (!(approvalLineAct instanceof ExternalApprovalLineActivity)) {
      approvalLineAct = approvalLineAct.getParentActivity();
    }
   
    ComplexActivity parent = (ComplexActivity) approvalLineAct;
    final Vector childActs = new Vector();
    ActivityForLoop forLoop = new ActivityForLoop() {
      public void logic(Activity act) {
        try {
          if (act instanceof ExternalApprovalActivity) {
            childActs.add(act);
          }
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    };
    forLoop.run(parent);
   
    int readyIndex = -1;
    for (int i = 0; i < childActs.size(); i++) {
      Activity approvalAct = (Activity) childActs.get(i);
      if (Activity.STATUS_READY.equalsIgnoreCase(approvalAct.getStatus(instance))) {
        if (readyIndex == -1) {
          readyIndex = i;
        }
        parent.removeChildActivity(approvalAct);
      }
    }
   
    if (readyIndex > 0) {
      String preApprovalType = null;
      for (int i = readyIndex; i < approverList.size(); i++) {
        Approver approver = approverList.get(i);
       
        ExternalApprovalActivity childAct = (ExternalApprovalActivity) draftAct.clone();
        childAct.setName("결재");
        childAct.setTracingTag(null);
        childAct.setRole(null);
        childAct.setApprovalTypeByString(approver.getType());
       
        RoleMapping rm = RoleMapping.create();
        rm.setEndpoint(approver.getEmpCode());
        rm.fill(instance);
       
        // 결재 -> 합의
        if (!ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
          AllActivity allAct = new AllActivity();
          allAct.setTracingTag(null);
         
          parent.addChildActivity(allAct);
          parent = allAct;
        // 합의 -> 결재
        } else if (ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && !ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
          parent = (ComplexActivity) approvalLineAct;
        }
       
        parent.addChildActivity(childAct);
        childAct.setApprover(instance, rm);
       
        approver.setTracingTag(childAct.getTracingTag());
       
        preApprovalType = approver.getType();
View Full Code Here

*/
  
public class ComplexActivityAdapter implements Adapter{
 
  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    ComplexActivity srcAct = (ComplexActivity)src;
   
    tSequence destAct = new tSequence();
    destAct.setname_Attribute(new XNCName(BPELSerializer.toSafeName(srcAct.getName().getText(), "UnnamedBlock")));
   
    Vector childActivities = srcAct.getChildActivities();
    for(Enumeration enumeration = childActivities.elements(); enumeration.hasMoreElements();){
      Object item = (Object)enumeration.nextElement();
      Adapter adpt = ProcessDefinitionAdapter.getAdapter(item.getClass());
      if(adpt==null){
        continue;
View Full Code Here

TOP

Related Classes of org.uengine.kernel.ComplexActivity

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.