Package org.huihoo.workflow.xpdl

Examples of org.huihoo.workflow.xpdl.WorkflowActivity


      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List activies = workflowProcess.getWorkflowActivities();
      int activitySize = activies.size();
      for (int j = 0; j < activitySize; ++j)
      {
        WorkflowActivity activity = (WorkflowActivity) activies.get(j);

        String className = activity.getListenerClassName();
        if (className != null && className.length() > 0)
        {
          try
          {
            Class implClass = loader.loadClass(className);
            WorkflowActivityListener listener = (WorkflowActivityListener) implClass.newInstance();

            activity.addWorkflowActivityListener(listener);
          }
          catch (Throwable ex)
          {
            errorList.add(new WorkflowException("Can not load class :" + className, ex));
            System.err.println("Can not load class :" + className);
View Full Code Here


    WorkflowWork dispWork,
    List trueTransitions,
    List falseTransitions)
    throws SQLException, WorkflowException
  {
    WorkflowActivity dispActivity = dispWork.getWorkflowActivity();
    SplitType splitType = dispActivity.getSplitType();
    if (!SplitType.SPLIT_OR.equals(splitType))
    {
      return;
    }

    if (trueTransitions.size() == 0)
    {
      throw new WorkflowException("signalOrJoinActivity trueTransitions.size()==0 ");
    }

    log.debug(
      "\n"
        + "dispActivity==>"
        + dispActivity
        + "\ntrueTransitions==>"
        + trueTransitions
        + "\nfalseTransitions==>"
        + falseTransitions
        + "\n\n");

    WorkflowProcess workflowProcess = dispWork.getWorkflowCase().getWorkflowProcess();

    WorkflowActivity trueJoinActivity = null;
    WorkflowActivity falseJoinActivity = null;
    WorkflowActivity orJoinActivity = null;

    List swap_trueTransitions = null;
    List swap_falseTransitions = null;

    //-------------------------------------------------------------------
    //  1.���� TRUE ·��ѡ�񷽰� ����TRUE TOKEN ����·��
    //-------------------------------------------------------------------

    trueJoinActivity = ((WorkflowTransition) trueTransitions.get(0)).getToWorkflowActivity();
    swap_trueTransitions = trueTransitions;

    boolean forceLoopTrueJoinActivity = false;
    boolean forceLoopFalseJoinActivity = false;

    LoopTrueJoinActivity : while (
      forceLoopTrueJoinActivity
        || (trueJoinActivity != null && !JoinType.JOIN_OR.equals(trueJoinActivity.getJoinType())))
    {
      forceLoopTrueJoinActivity = false;
      orJoinActivity = null;
     
      //---------------------------------------------------------------------------
      //  1.1 ���� TRUE ·��ѡ�񷽰�, ����next Activity û�� ׷�ݵ�OR Join Activity
      //  [����XPDL End Activity]
      //---------------------------------------------------------------------------
      swap_trueTransitions = trueJoinActivity.getOutgoingTransitions();
      if (swap_trueTransitions == null || swap_trueTransitions.size() == 0)
      {
        throw new WorkflowException("signalOrJoinActivity : outgoingTransitions.size()==0," + trueJoinActivity);
      }

      //---------------------------------------------------------------------------
      //  1.2 ���� TRUE ·��ѡ�񷽰�, ����next Activity û�� ׷�ݵ�OR Join Activity
      //  [��������XPDL �߼�����]
      //---------------------------------------------------------------------------
      trueJoinActivity = nextPossibleActivityFinder(trueJoinActivity, swap_trueTransitions);
      if (trueJoinActivity == null)
      {
        throw new WorkflowException("nextPossibleActivityFinder : nextOrJoinActivity is null");
      }

      //---------------------------------------------------------------------------
      //  1.3 ���� TRUE ·��ѡ�񷽰�, ѡ���next Acitivity ���� OR Join Activity
      //---------------------------------------------------------------------------
      if (!JoinType.JOIN_OR.equals(trueJoinActivity.getJoinType()))
      {
        //find next possible trueJoinActivity
        continue LoopTrueJoinActivity;
      }

      //---------------------------------------------------------------------------
      //  1.4 ���� TRUE ·��ѡ�񷽰�, ������ OR Join Activity
      //---------------------------------------------------------------------------
      log.debug("FOUND TRUE OR-JOIN-ACTIVITY : " +  trueJoinActivity.getInfo());

      //-------------------------------------------------------------------
      //  2.���� FALSE ·��ѡ�񷽰� ����FALSE TOKEN ����·��
      //------------------------------------------------------------------- 
      //---------------------------------------------------------------------------
      //  2.1 ���� FALSE ·��ѡ�񷽰�, �ַ�Activity next ·��ȫ����ѡ��
      //---------------------------------------------------------------------------
      swap_falseTransitions = falseTransitions;
      if (swap_falseTransitions == null || swap_falseTransitions.size() == 0)
      {
        //----------------------------------------
        // [����]  �������Ϸ��� OR Join Activity
        //----------------------------------------
        //or-split's all outTransitions are selected to process
        orJoinActivity = trueJoinActivity;
        break LoopTrueJoinActivity;
      }

      falseJoinActivity = ((WorkflowTransition) swap_falseTransitions.get(0)).getToWorkflowActivity();
      if(JoinType.JOIN_OR.equals(falseJoinActivity.getJoinType()))
      {
        //һ��OR Split  Activity ֱ�Ӻ�� Activity �� JoinType ��Ӧ��Ϊ OR
        throw new WorkflowException("Bad Format XPDL Data : OR Split Activity's next direct Activity's JoinType should not be 'OR'  ");
      }
     
      LoopFalseJoinActivity : while (
        forceLoopFalseJoinActivity
          || (falseJoinActivity != null && !JoinType.JOIN_OR.equals(falseJoinActivity.getJoinType())))
      {
        forceLoopFalseJoinActivity =false;
       
        swap_falseTransitions = falseJoinActivity.getOutgoingTransitions();
        //---------------------------------------------------------------------------
        //  2.2 ���� FLASE ·��ѡ�񷽰�, ���� next Activity û�� ׷�ݵ� OR Join Activity
        //      [����XPDL End Activity]
        //---------------------------------------------------------------------------
        if (swap_falseTransitions == null || swap_falseTransitions.size() == 0)
        {
          break LoopFalseJoinActivity;
        }

        falseJoinActivity = nextPossibleActivityFinder(falseJoinActivity, swap_falseTransitions);

        //---------------------------------------------------------------------------
        //  2.3 ���� FLASE ·��ѡ�񷽰�, ����next Activity û�� ׷�ݵ� OR Join Activity
        //      [��������XPDL �߼�����]
        //---------------------------------------------------------------------------
        if (falseJoinActivity == null)
        {
          break LoopFalseJoinActivity;
        }
        //---------------------------------------------------------------------------
        //  2.4 ���� FALSE ·��ѡ�񷽰�, ѡ���next Acitivity ���� OR Join Activity
        //      [����]  �ƶ� FALSE TOKEN ��ѡ����һ�� OR Join Activity ���в���
        //---------------------------------------------------------------------------
        if (!JoinType.JOIN_OR.equals(falseJoinActivity.getJoinType()))
        {
          //find next possible falseJoinActivity
          continue LoopFalseJoinActivity;
        }

        //---------------------------------------------------------------------------
        //  2.5 ���� FALSE ·��ѡ�񷽰�, ������ OR Join Activity
        //---------------------------------------------------------------------------
        log.debug("FOUND FALSE OR-JOIN-ACTIVITY : " + falseJoinActivity.getInfo());


        if (falseJoinActivity.getUUID().equals(trueJoinActivity.getUUID()))
        {
          //---------------------------------------------------------------------------
          //  2.6.1 ���� TRUE/FALSE ·��ѡ�񷽰�, ������ �Ϸ��� OR Join Activity
          //         [����]  �������Ϸ��� OR Join Activity
          //---------------------------------------------------------------------------
         
          //OR-JOIN Activity found
          orJoinActivity = falseJoinActivity;
          break LoopTrueJoinActivity;
        }
        else
        {
          //---------------------------------------------------------------------------
          //  2.6.2 ���� TRUE/FALSE ·��ѡ�񷽰�, û�м����� �Ϸ��� OR Join Activity
          //         [����]  �ƶ� FALSE TOKEN ��ѡ����һ�� OR Join Activity ���в���
          //---------------------------------------------------------------------------
          forceLoopFalseJoinActivity=true;
          continue LoopFalseJoinActivity;
        }

      } //~end while (falseJoinActivity != null && !JoinType.JOIN_OR.equals(falseJoinActivity.getJoinType()))

      //---------------------------------------------------------------------------
      //  1.5 ���� TRUE/FALSE ·��ѡ�񷽰�, û�м����� OR Join Activity
      //      [����] �ƶ� TRUE TOKEN ��ѡ����һ�� OR Join Activity ���в���
      //---------------------------------------------------------------------------               
      //find next possible orJoinActivity
      forceLoopTrueJoinActivity = true;
      continue LoopTrueJoinActivity;

      //------------------------------------------------------------------------------       
    } //~end while (trueJoinActivity != null && !JoinType.JOIN_OR.equals(trueJoinActivity.getJoinType()))

    if (orJoinActivity == null)
    {
      throw new WorkflowException("signalOrJoinActivity : orJoinActivity not found");
    }

    log.debug("orJoinActivity : " + orJoinActivity.getInfo());

    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    String packageId = workflowProcess.getWorkflowPackage().getUUID();
    String processId = workflowProcess.getUUID();
    String caseId = dispWork.getWorkflowCase().getUUID();

    int size = falseTransitions.size();
    for (int i = 0; i < size; ++i)
    {
      WorkflowTransition falseTransition = (WorkflowTransition) falseTransitions.get(i);
      WorkflowActivity falseActivity = falseTransition.getToWorkflowActivity();
      WorkflowTransition falseJoinTransition = null;

      while (falseActivity != null)
      {
        if (falseActivity.getUUID().equals(orJoinActivity.getUUID()))
        {
          falseJoinTransition = falseTransition;
          break;
        }

        swap_falseTransitions = falseActivity.getOutgoingTransitions();
        if (swap_falseTransitions == null || swap_falseTransitions.size() == 0)
        {
          break;
        }
        else
        {
          falseTransition = ((WorkflowTransition) swap_falseTransitions.get(0));
          falseActivity = nextPossibleActivityFinder(falseActivity, swap_falseTransitions);
        }
      } //while (falseActivity != null)

      log.debug("falseJoinTransition : " + falseJoinTransition.getInfo());

      if (falseJoinTransition != null)
      {
        //OR-JOIN Activity found,set false falseJoinActivity#vc_disp_flag
        //insert into database table(rt_p_activity_dispatch)
        //@see  database table(rt_p_activity_dispatch)
       
        WorkflowActivity ins_falseActivity = falseJoinTransition.getFromWorkflowActivity();
        String ins_falseActivityId = ins_falseActivity.getUUID();
        String ins_owner_processid = ins_falseActivity.getWorkflowProcess().getUUID();

        PreparedStatement pstmt = null;
        String strSQL = null;

        strSQL =
View Full Code Here

  }

  private static WorkflowActivity nextPossibleActivityFinder(WorkflowActivity fromActivity, List outTransitions)
  {
    WorkflowActivity joinActivity = null;
   
    if (outTransitions.size() == 1)
    {
      log.debug("[" + fromActivity + "] only one outgoing transition ,select as or-join-transition unconditionally");
      joinActivity = ((WorkflowTransition) outTransitions.get(0)).getToWorkflowActivity();
View Full Code Here

    {
      target = (WorkflowTransition) workflowProcess.getWorkflowTransitions().get(i);
      transitions.add(new SerialTransition(target));
    }
   
    WorkflowActivity target2 = null;
    for (int i = 0; i < workflowProcess.getWorkflowActivities().size(); ++i)
    {
      target2 = (WorkflowActivity) workflowProcess.getWorkflowActivities().get(i);
      activities.add(new SerialActivity(target2));
    }
View Full Code Here

    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    PreparedStatement pstmt = null;
    String strSQL = null;
    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowActivity dispActivity = workflowTransition.getFromWorkflowActivity();
    String disp_owner_process_id = dispActivity.getWorkflowProcess().getUUID();
    String disp_activity_id = dispActivity.getUUID();

    String packageId = workflowProcess.getWorkflowPackage().getUUID();
    String processId = workflowProcess.getUUID();
    String caseId = workflowCase.getUUID();
   
View Full Code Here

    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    PreparedStatement pstmt = null;
    String strSQL = null;
    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowActivity dispActivity = workflowTransition.getFromWorkflowActivity();
    String disp_owner_process_id = dispActivity.getWorkflowProcess().getUUID();
    String disp_activity_id = dispActivity.getUUID();

    String packageId = workflowProcess.getWorkflowPackage().getUUID();
    String processId = workflowProcess.getUUID();
    String caseId = workflowCase.getUUID();
   
View Full Code Here

    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    PreparedStatement pstmt = null;
    String strSQL = null;
    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowActivity dispActivity = workflowTransition.getFromWorkflowActivity();
    String disp_owner_process_id = dispActivity.getWorkflowProcess().getUUID();
    String disp_activity_id = dispActivity.getUUID();

    String packageId = workflowProcess.getWorkflowPackage().getUUID();
    String processId = workflowProcess.getUUID();
    String caseId = workflowCase.getUUID();
View Full Code Here

    throws WorkflowException
  {
    log.debug(
      "[dispatch_routeJoin] workitem: " + workflowWork.getInfo() + " | transition: " + workflowTransition.getInfo());

    WorkflowActivity routeActivity = workflowTransition.getToWorkflowActivity();

    String orJoinWorkId = null;
    orJoinWorkId =
      caseDatabase.createWorkflowWork(
        workflowProcess,
View Full Code Here

    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    PreparedStatement pstmt = null;
    String strSQL = null;
    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowActivity dispActivity = workflowTransition.getFromWorkflowActivity();
    String disp_owner_process_id = dispActivity.getWorkflowProcess().getUUID();
    String disp_activity_id = dispActivity.getUUID();

    String packageId = workflowProcess.getWorkflowPackage().getUUID();
    String processId = workflowProcess.getUUID();
    String caseId = workflowCase.getUUID();
   
View Full Code Here

    {
      throw new WorkflowException(eventResult.getException());
    }

    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowActivity dispActivity = workflowTransition.getFromWorkflowActivity();
    String disp_owner_process_id = dispActivity.getWorkflowProcess().getUUID();
    String disp_activity_id = dispActivity.getUUID();

    String packageId = workflowProcess.getWorkflowPackage().getUUID();
    String processId = workflowProcess.getUUID();
    String caseId = workflowCase.getUUID();
   
    log.debug("\ninstanceXorJoin monitorEvent == > "+monitorEvent);
   
    if (eventResult.first())
    {
      String xor_work_id = eventResult.getJoinWorkID();
      WorkflowWork xorJoinWork =
        caseDatabase.findWorkflowWork(
          workflowProcess,
          operator,
          userTransaction,
          workflowWork.getWorkflowCase(),
          xor_work_id);

      String batchNo =
        caseDatabase.getCaseIdGenerator().genWorkflowPathBatch(packageId, processId, dispActivity.getUUID(), caseId);
      caseDatabase.createWorkflowPath(
        workflowProcess,
        operator,
        userTransaction,
        workflowWork.getWorkflowCase(),
View Full Code Here

TOP

Related Classes of org.huihoo.workflow.xpdl.WorkflowActivity

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.