Package org.uengine.kernel

Examples of org.uengine.kernel.ComplexActivity


      }

      if(handlerActivity instanceof HumanActivity){
        humanActivity = (HumanActivity)handlerActivity;
      }else if(handlerActivity instanceof ComplexActivity){
        ComplexActivity complexActivity = ((ComplexActivity)handlerActivity);
        ActivityReference initiatorHumanActivityReference = complexActivity.getInitiatorHumanActivityReference(mainProcessInstance .getProcessTransactionContext());
       
        humanActivity = (HumanActivity)initiatorHumanActivityReference.getActivity();
      }
     
      completeWorkitem(mainInstanceId, humanActivity.getTracingTag(), null, resultPayload);
View Full Code Here


 
  public GraphActivity convertToBlock(ComplexActivity resultingBlock, GraphActivity starter){
    //System.out.println("----- convertToBlk : "+ name);
    if (outgoing.size()==1 && incoming.size()<=1) {
      //System.out.println("in seq");
      ComplexActivity sequenceBlock;

     
      if (isSequenceBlock(resultingBlock)) {
        sequenceBlock = resultingBlock;
      } else {
        sequenceBlock = new ComplexActivity();       
        resultingBlock.addChildActivity(sequenceBlock);
      }
     
      sequenceBlock.addChildActivity(createBlockActivity());

      GraphActivity next = (GraphActivity)outgoing.elementAt(0);
     
      //System.out.println("in seq: next:" + next.outgoing.size());

//      if(!next.isEnd())
        next = next.convertToBlock(sequenceBlock, starter);
       
      return next;
     
     
    } else if(outgoing.size() > 1) {
     
      //starter = this;
     
      GraphActivity next = null;
      ComplexActivity innerBlock = null;
      ComplexActivity firstBlock = resultingBlock; 
     
      Vector insertedActivities = new Vector(); //for undo
     
      if (isXOR()) { //Switch block
        innerBlock = new SwitchActivity();

      } else //All block
        //System.out.println("in all");
        innerBlock = new AllActivity();
       
        if (!isSequenceBlock(resultingBlock)) {
          ComplexActivity sequenceBlock = new ComplexActivity();
                       
          resultingBlock.addChildActivity(sequenceBlock);
          resultingBlock = sequenceBlock;
        }
       
        Activity thisAct = createBlockActivity();
        resultingBlock.addChildActivity(thisAct);
       
        insertedActivities.add(resultingBlock);
        insertedActivities.add(thisAct);
       
     
     
      setAsStarterOf(innerBlock);
      resultingBlock.addChildActivity(innerBlock);
     
      insertedActivities.add(innerBlock);
     
      for (int i=0; i<outgoing.size(); i++) {
        next = (GraphActivity)outgoing.elementAt(i);
        next = next.convertToBlock(innerBlock, this);
       
        if(next == null) break;
      }
     
      if (next != null) {

        //System.out.println("next is " + next.name);
       
        if(!next.isOnceVisited() && !next.isEnd()){
          next.flagVisited()//flow only once
         
          GraphActivity findingStarter = starter;
          ComplexActivity findingBlock = resultingBlock;
         
          while (findingStarter!=null && findingStarter.isBlockWith(next)) {
            //System.out.println("in going up the level of block, the starter is " + starter.name);
            starter = findingStarter;
            resultingBlock = findingBlock;
           
            findingBlock = getParentBlockOf(resultingBlock);
            if(findingBlock==null)
              findingStarter = null;
            else
              findingStarter = getStarterOf(findingBlock)
          }
         
          //���� ��'�� seq�� �ƴϸ� seq�� ����� �� ��, �ڽ�; �ű⿡ �߰��ؾ���
          if (!(innerBlock instanceof SwitchActivity))
            resultingBlock.addChildActivity(next.createBlockActivity());
 
          ((GraphActivity)next.outgoing.elementAt(0)).convertToBlock(resultingBlock, starter);
        }
       
        return next;

      } else {
        //firstBlock.remove();
        //System.out.println("*********rebuild the block");
       
        //recode: '���� all���; ��� '�� seq�� �� �ٷ� ���� ���� seq�� ����־�� �� 
        for(int i=0; i<insertedActivities.size(); i++)
          firstBlock.removeChildActivity((Activity)insertedActivities.elementAt(i));
                 
        if(!isInAllBlock(innerBlock)){
          //System.out.println("  -- is not in all-block. the starter is " + starter.name);
          return convertToBlock(firstBlock, starter); //trace again if the first try has failed. the first try would make a little change good for retracing
        }else {
          //System.out.println("  -- is in all-block");
          return null;
        }
      }
     
           
    }else if(incoming.size()>1){  //Join node
//System.out.println("in join: ");
     
      //if(resultingBlock)// testing this join is corresponding to this block
//      System.out.println("in join:act.getParentActivity()" + resultingBlock.getParentActivity());
//      System.out.println("in join:act name = " + name + " and the resultingBlock is " + resultingBlock +" isInAllBlock is " + isInAllBlock(resultingBlock));
//      System.out.println("in join:the starter is " + starter.name);
     
      if (isInAllBlock(resultingBlock) && isXOR()) {
//        System.out.println(" case 1");
        GraphActivity next = ((GraphActivity)outgoing.elementAt(0)).convertToBlock(resultingBlock, starter); //skip this XOR act and continue tracing
        return next;
      }else if(!isInAllBlock(resultingBlock) && isXOR() && !starter.isBlockWith(this)){
//        System.out.println(" case 2: XOR split "+ starter.name );
        GraphActivity next = ((GraphActivity)outgoing.elementAt(0)).convertToBlock(resultingBlock, starter); //skip this XOR act and continue tracing
        return next;
      }else

/*      if(!isInAllBlock(resultingBlock) && !isXOR()){
System.out.println(" case 3");
        resultingBlock.addChildActivity(createBlockActivity()); //don't skip and continue tracing
        GraphActivity next = ((GraphActivity)outgoing.elementAt(0)).convertToBlock(resultingBlock, starter); //skip this XOR act and continue tracing
       
        return next;
      }else */
      {
     
     
//case 4: ���� ������� ���; ��� link�� ����� ��'�� all-block�� ���Խ�Ŵ

        ComplexActivity superBlock = getMinimumBlockOf(resultingBlock);
//        System.out.println(" case 4: resultingBlock is " + resultingBlock);
//        System.out.println("      : isBlockWith " + starter.name + " = " + starter.isBlockWith(this));
//        System.out.println("      : superBlock1 is " + superBlock);

        if(!isXOR() && !starter.isBlockWith(this) && /*isInAllBlock(resultingBlock) && */superBlock!=null && isAllBlock(superBlock)){
View Full Code Here

    sb.append("<table border=0 cellpadding=0 cellspacing=3><td style=\"border:1px dotted ").append(statusColor).append(";\">");
   
//    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

    if(isVertical) sb.append("</tr><tr>");
   
    sb.append("<td>");
    sb.append("<table border='0' cellpadding='0' cellspacing='1'><tr>");
   
    ComplexActivity cActivity = (ComplexActivity)activity;
    //System.out.println("ProcessDefinitionViewer::render : number of child activities: " + cActivity.getChildActivities().size());
   
    for(Enumeration enumeration = cActivity.getChildActivities().elements(); enumeration.hasMoreElements(); ){
      Activity child = (Activity)enumeration.nextElement();
      ActivityUtil activityUtil = new ActivityUtil();

      if (child instanceof ScopeActivity) indexOfScopeActivity++;
      if (viewOnlyScopeIndex > -1 && indexOfScopeActivity != viewOnlyScopeIndex) continue;
View Full Code Here

    assertTrue(prevActs.size() == 2);
  }
 
  public ProcessDefinition createProcessDefinition(){
    ProcessDefinition def = new ProcessDefinition();{
      ComplexActivity all1 = new AllActivity();{
        SequenceActivity seq11 = new SequenceActivity();{
          DefaultActivity act111 = new DefaultActivity("111");
          seq11.setChildActivities(new Activity[]{act111});
        }   

        AllActivity all12 = new AllActivity();{
          SequenceActivity seq12 = new SequenceActivity();{
            DefaultActivity act111 = new DefaultActivity("1211");
            seq12.setChildActivities(new Activity[]{act111});
          }
          SequenceActivity seq122 = new SequenceActivity();/*{
            DefaultActivity act111 = new DefaultActivity("1212");
            DefaultActivity act112 = new DefaultActivity("1213");
            seq122.setChildActivities(new Activity[]{act111, act112});
          }*/
          all12.setChildActivities(new Activity[]{seq12, seq122});
        }       
       
        all1.setChildActivities(new Activity[]{seq11, all12});
      }
     
      DefaultActivity act2 = new DefaultActivity("2");
     
      def.setChildActivities(new Activity[]{all1, act2});
View Full Code Here

    refreshPlaceHolders();   
  }

  protected void refreshPlaceHolders(){

    ComplexActivity compAct = ((ComplexActivity)getActivity());
    int size = compAct.getChildActivities().size();
   
    if(size>0){
      centerPanel.remove(firstPlaceHolder);
    }else{
      centerPanel.add(firstPlaceHolder, 1);
View Full Code Here

   
//    sb.append("<table border=1 cellpadding=0 cellspacing=3><!--td width=2 bgcolor=gray></td--><td>");
    sb.append("<table border=0 cellpadding=0 cellspacing=3><td width=2 bgcolor=black></td><td>");
    sb.append("<table border=0 cellpadding=0 cellspacing=0><tr>");
   
    ComplexActivity cActivity = (ComplexActivity)activity;
   
    int i=0;
    for(Enumeration enumeration = cActivity.getChildActivities().elements(); enumeration.hasMoreElements(); ){
      sb.append("<tr><td><font face=-2 color=gray>" + getLabel(i++, activity, instance, options) + "</font></td></tr>");
      sb.append("<tr><td>");
     
      Activity child = (Activity)enumeration.nextElement();     
      ActivityViewer viewer = DefaultActivityViewer.createViewer(child);     
View Full Code Here

    if(!isVertical){
      sb.append("<tr>");
    }
   
   
    ComplexActivity cActivity = (ComplexActivity)activity;
   
    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)) {
       
View Full Code Here

public class ComplexActivityAdapter implements Adapter{

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

    ActivityUtil activityUtil = new ActivityUtil();
    ComplexActivity srcDef = (ComplexActivity)src;
    GraphActivity previousGraphAct = null;//graphActivity;
    GraphActivity headerGA = null;

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

    }
   
    sb.append("<table border='0' cellpadding='0' cellspacing='0'>");
    if (isVertical) sb.append("<tr>");
   
    ComplexActivity cActivity = (ComplexActivity) activity;
   
    int i=0;
    for (Enumeration enumeration = cActivity.getChildActivities().elements(); enumeration.hasMoreElements(); ) {
      ActivityUtil activityUtil = new ActivityUtil();
      Activity child = (Activity) enumeration.nextElement();     
 
      if(!activityUtil.isVisible(child, options)) {
        addInnerActivityAbsoluteTracingTag(
            options,
            DefaultActivityViewer.getActivityName(activity, instance, options),
            DefaultActivityViewer.getActivityName(child, instance, options)
        );
       
        String childLabel = getLabel(i++, activity, instance, options);

        if (isVertical) {
          sb.append("<td valign='top' align='center' height='100%'>");
        } else {
          sb.append("<tr><td colspan='2'>");
        }

        if(childLabel!=null){
          sb.append("<div class='flowchart-condition-title'>[ " + childLabel + " ]</div>");
        }
       
//        boolean isGrayArrow = false;
//        if (!definitionView)
//        try {
//          isGrayArrow = Activity.STATUS_READY.equals(child.getStatus(instance));
//        } catch(Exception e) {}

//        sb.append("</tr><tr>");
        //sb.append("<td align=center><img src="+imagePathRoot+"images/arrow"+ (isVertical ? "_vertical":"")+".gif" +  (isGrayArrow ? " style='filter:alpha(opacity="+unfocusedOpacity+")'":"") +"></td>");
       
        if (isVertical) {
          sb.append("<div style='text-align:center;' class='flowchart-activity-cover-vertical'");
        } else {
          sb.append("</td></tr><td><div class='flowchart-activity-cover-horizontal'");
        }
        sb.append(" id='" + DefaultActivityViewer.getActivityName(child, instance, options) + "'>");

        ActivityViewer viewer = DefaultActivityViewer.createViewer(child);
        StringBuilder childHTML = viewer.render(child, instance, options);

//        if (!definitionView)
//          try {
//            isGrayArrow = !Activity.STATUS_COMPLETED.equals(child.getStatus(instance));
//          } catch(Exception e) {}
       
        sb.append(childHTML + "</div>");
       
        if(isVertical){
          sb.append("<div style='width:2px;'></div></td>");
          //sb.append("<tr><td align=center><img src="+imagePathRoot+"images/arrow"+ (isVertical ? "_vertical":"")+".gif" +  (isGrayArrow ? " style='filter:alpha(opacity="+unfocusedOpacity+")'":"") +"></td></tr>");
//          sb.append("</table>");
         
        }else{
          sb.append("</td></tr>");
        }
      }
    }
   
    if(activity instanceof SwitchActivity && cActivity.getChildActivities().size()==1){
//      if(childLabel!=null)
//        sb.append("<tr><td colspan=2><font face=-2 color=gray>" + childLabel + "</font></td></tr>");
      if(isVertical) {
         sb.append("<td>[ " + GlobalContext.getMessageForWeb("Otherwise", (String) options.get(viewerOptions.LOCALE)) + "]");
         sb.append("<div style='text-align:center; height:100%' class='flowchart-line-vertical'></div>");
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.