Package org.huihoo.workflow.runtime

Examples of org.huihoo.workflow.runtime.WorkflowCase


    for (int i = 0; i < listeners.length; ++i)
    {
      listeners[i].beforeDispatched(event);
    }

    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowPackage workflowPackage = workflowProcess.getWorkflowPackage();

    workflowWork.setDispatchTime(new java.util.Date());
    caseDatabase.updateWorkflowWork(workflowProcess, operator, userTransaction, workflowWork);

    //------------------------------------------------------------------------------------
    //------------------------------------------------------------------------------------
    WorkflowTransition customizedTransition = dispatch_revert(workflowService,workflowProcess,operator,caseDatabase,userTransaction,workflowWork);

    List filterTrans = null;

    if (customizedTransition == null)
    {
      filterTrans =
        OutTransitionFilter.filterOutTransition(workflowService,
          operator,
          caseDatabase,
          userTransaction,
          workflowWork);
    }
    else
    {
      filterTrans = new ArrayList();
      filterTrans.add(customizedTransition);
    }

    int sizeTrans = filterTrans.size();

    if (sizeTrans > 0)
    {
      WorkflowTransition transition = null;

      //-------------------------------------------------------------
      //   �������ɷ������Ĺ�����ʹ����ͬ���ɷ��Ǻ�
      //--------------------------------------------------------------
      String pathDispBatch = null;
      pathDispBatch =
        caseDatabase.getCaseIdGenerator().genWorkflowPathBatch(
          workflowPackage.getUUID(),
          workflowProcess.getUUID(),
          workflowActivity.getUUID(),
          workflowCase.getUUID());
     
      ParallelThread pThreads[] =new ParallelThread[sizeTrans];
      for (int i = 0; i < sizeTrans; ++i)
      {
        transition = (WorkflowTransition) filterTrans.get(i);
View Full Code Here


        + "AND    vc_to=? ";

    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    PreparedStatement pstmt = null;

    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowPackage workflowPackage = workflowProcess.getWorkflowPackage();

    String fromWorkID = null;
    String batchNo = null;
    try
    {
      pstmt = conn.prepareStatement(strSQL);
      pstmt.setString(1, workflowPackage.getUUID());
      pstmt.setString(2, workflowProcess.getUUID());
      pstmt.setString(3, workflowCase.getUUID());
      pstmt.setString(4, workflowWork.getUUID());

      ResultSet rs = pstmt.executeQuery();
      if (rs.next())
      {
        fromWorkID = rs.getString("vc_from");
        batchNo = rs.getString("vc_batchNo");

        rs.close();
        pstmt.close();

        strSQL =
          "SELECT count(*) FROM "
            + caseDatabase.getSchemaContext().getTableName(SchemaContext.SCHEMA_PATH)
            + "  "
            + "WHERE  vc_packageid=? "
            + "AND    vc_processid=? "
            + "AND    vc_caseid=?  "
            + "AND    vc_from=? "
            + "AND    vc_batchNo=? ";
        pstmt = conn.prepareStatement(strSQL);
        pstmt.setString(1, workflowPackage.getUUID());
        pstmt.setString(2, workflowProcess.getUUID());
        pstmt.setString(3, workflowCase.getUUID());
        pstmt.setString(4, fromWorkID);
        pstmt.setString(5, batchNo);

        rs = pstmt.executeQuery();
        if (rs.next())
        {
          int count = rs.getInt(1);

          if (count > 1)
          {
            //ǰ�̻�ַ���Ψһ,���ܽ��л���
            throw new WorkflowException("WorkflowWork broadcast dispatch");
          }
        }
        else
        {
          //never to reach here
          throw new WorkflowException("WorkflowPath not found");
        }
      }
      else
      {
        throw new WorkflowException("WorkflowPath not found ");
      }
    }
    catch (SQLException ex)
    {
      throw new WorkflowException(ex);
    }
    finally
    {
      ConnUtils.cleanupNoThrow(pstmt);
    }

    WorkflowWork fromWork =
      caseDatabase.findWorkflowWork(
        workflowProcess,
        operator,
        userTransaction,
        workflowCase,
        fromWorkID);
    WorkflowParticipant participant = fromWork.getPerformer();

    String dispWorkId =
      caseDatabase.createWorkflowWork(
        workflowProcess,
        operator,
        userTransaction,
        workflowCase,
        activity,
        participant,
        workflowWork.getDispatchTime());
    String pathDispBatch =
      caseDatabase.getCaseIdGenerator().genWorkflowPathBatch(
        workflowPackage.getUUID(),
        workflowProcess.getUUID(),
        activity.getUUID(),
        workflowCase.getUUID());

    WorkflowWork dispWork =
      caseDatabase.findWorkflowWork(workflowProcess, operator, workflowCase, dispWorkId);
    caseDatabase.createWorkflowPath(
      workflowProcess,
View Full Code Here

        + "AND    vc_from=? ";

    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    PreparedStatement pstmt = null;

    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowPackage workflowPackage = workflowProcess.getWorkflowPackage();

    try
    {
      pstmt = conn.prepareStatement(strSQL);
      pstmt.setString(1, workflowPackage.getUUID());
      pstmt.setString(2, workflowProcess.getUUID());
      pstmt.setString(3, workflowCase.getUUID());
      pstmt.setString(4, workflowWork.getUUID());

      ResultSet rs = pstmt.executeQuery();
      if (rs.next())
      {
View Full Code Here

    UserTransaction userTransaction,
    WorkflowWork workflowWork)
    throws WorkflowException
  {
    WorkflowActivity workflowActivity = workflowWork.getWorkflowActivity();
    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    WorkflowPackage workflowPackage = workflowProcess.getWorkflowPackage();

    WorkflowTransition rever_transition = null;

    //�ɷ��Ĺ��������ɻ���(revert)�����Ĺ������Ҫ���⴦��
    String strSQL =
      "SELECT    vc_from,vc_owner_processid,vc_transitionid FROM "
        + caseDatabase.getSchemaContext().getTableName(SchemaContext.SCHEMA_PATH)
        + "  "
        + "WHERE  vc_packageid=? "
        + "AND    vc_processid=? "
        + "AND    vc_caseid=?  "
        + "AND    vc_to=? "
        + "AND    int_eventType=? ";

    Connection conn = (Connection) userTransaction.getStoreConnection().get();
    PreparedStatement pstmt = null;

    try
    {
      pstmt = conn.prepareStatement(strSQL);
      pstmt.setString(1, workflowPackage.getUUID());
      pstmt.setString(2, workflowProcess.getUUID());
      pstmt.setString(3, workflowCase.getUUID());
      pstmt.setString(4, workflowWork.getUUID());
      pstmt.setInt(5, WorkflowActivityEvent.WORK_REVERT);//<-----very important

      ResultSet rs = pstmt.executeQuery();
      if (rs.next())
      {
        String fromWorkID = rs.getString("vc_from");

        //----------------------------------------------------------------------------
        // ֧�ֻ��˴���Ĺ���������ڵ���Ҫ�����ϸ���߼�����
        //
        // ���Ի��˴���Ĺ�����ǰ�̹��������Ψһ��
        // ͬʱǰ�̹������ֻ��Ψһ�ĺ�̹����� (�߼��ϵ�����,���ݽṹ)
        //----------------------------------------------------------------------------       
        if (rs.next())
        {
          throw new WorkflowException("Fatal WorkflowService Engine Error");
        }

        WorkflowWork fromWork =
          caseDatabase.findWorkflowWork(
            workflowProcess,
            operator,
            userTransaction,
            workflowCase,
            fromWorkID);

        String vc_owner_processid = rs.getString("vc_owner_processid");
        if (vc_owner_processid != null && !"".equals(vc_owner_processid))
        {
          String vc_transitionid = rs.getString("vc_transitionid");
          WorkflowProcess owner_processid = workflowPackage.findWorkflowProcess(vc_owner_processid);
          rever_transition = owner_processid.findWorkflowTransition(vc_transitionid);
        }
        else
        {
          rever_transition =
            workflowProcess.findWorkflowTransition(
              workflowWork.getWorkflowActivity(),
              fromWork.getWorkflowActivity());
        }

        //�����ߴ����߼��������ڲ����ݽṹ�����й�ϵ
        workflowCase.getCaseContext().setPerformersByTransition(
          rever_transition,
          new WorkflowParticipant[] { fromWork.getPerformer()});
      }
    }
    catch (SQLException ex)
View Full Code Here

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

    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
    caseDatabase.createWorkflowPath(
      workflowProcess,
      operator,
      userTransaction,
      workflowCase,
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();
   
    log.debug("\nandJoin monitorEvent == > "+monitorEvent);
   
    try
    {
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();
   
    log.debug("\nxorJoin monitorEvent == > "+monitorEvent);
   
    try
    {
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();

    log.debug("\norJoin monitorEvent == > "+monitorEvent);
   
    try
    {
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();
   
    log.debug("\ninstanceAndJoin monitorEvent == > "+monitorEvent);
   
    try
    {
View Full Code Here

    if (eventResult.getException() != null)
    {
      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())
    {
View Full Code Here

TOP

Related Classes of org.huihoo.workflow.runtime.WorkflowCase

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.