Package org.huihoo.workflow.xpdl

Examples of org.huihoo.workflow.xpdl.WorkflowActivity


    WorkflowProcess workflowProcess=workflowCase.getWorkflowProcess();
    this.caseID=workflowCase.getUUID();
    this.packageID=workflowProcess.getWorkflowPackage().getUUID();
    this.processID=workflowProcess.getUUID();
   
    WorkflowActivity workflowActivity=workflowWork.getWorkflowActivity();
    this.activityProcessID=workflowActivity.getWorkflowProcess().getUUID();
    this.activityID=workflowActivity.getUUID();
   
    WorkflowParticipant participant=workflowWork.getPerformer()
    this.performerID=(participant==null?null:participant.getUUID());
     
    this.arriveTime=workflowWork.getArriveTime();
    this.acceptTime=workflowWork.getAcceptTime();
    this.dispatchTime=workflowWork.getDispatchTime();
   
    Implementation impl=workflowActivity.getImplementation();
    if(impl instanceof PageImplementation)
    {
      this.pageURL=((PageImplementation)impl).getPageURL();
    }
  }
View Full Code Here


     
      WorkflowProcess workflowProcess=workflowTransition.getWorkflowProcess();
      this.packageID=workflowProcess.getWorkflowPackage().getUUID();
      this.processID=workflowProcess.getUUID();
     
      WorkflowActivity tempActivity=workflowTransition.getFromWorkflowActivity();
      fromActivityID=(tempActivity==null?null:tempActivity.getUUID());
     
      tempActivity=workflowTransition.getToWorkflowActivity();
      toActivityID=(tempActivity==null?null:tempActivity.getUUID());
     
      this.condition=workflowTransition.getCondition();
      this.attributes=workflowTransition.getExtendedAttributes();
     
    }
View Full Code Here

      List activies = workflowProcess.getWorkflowActivities();
      int activitySize = activies.size();

      for (int j = 0; j < activitySize; ++j)
      {
        WorkflowActivity activity = (WorkflowActivity) activies.get(j);
        ExtendedAttribute attribute = activity.findExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
        if (attribute != null)
        {
          String activity_type = (String) attribute.getValue();
          if (activity_type == null || activity_type.length() == 0)
          {
            errorList.add(
              new WorkflowException(
                "activity attribute '"
                  + XPDLGlobals.ACTIVITY_TYPE
                  + "' must be set.{packageID="
                  + workflowPackage.getUUID()
                  + ",processID="
                  + workflowProcess.getUUID()
                  + ",activityID="
                  + activity.getUUID()
                  + "}"));
          }
        }
        else
        {
          errorList.add(
            new WorkflowException(
              "activity attribute '"
                + XPDLGlobals.ACTIVITY_TYPE
                + "' must be set.{packageID="
                + workflowPackage.getUUID()
                + ",processID="
                + workflowProcess.getUUID()
                + ",activityID="
                + activity.getUUID()
                + "}"));
        }
      }
    }

    //  ---------------------------------------------------------------
    //   5. validate workflowActivity performer type
    //  --------------------------------------------------------------- 
    for (int i = 0; i < process_size; ++i)
    {
      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);
        ExtendedAttribute attribute = activity.findExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
        if (attribute != null)
        {
          if (!ActivityType.parse((String) attribute.getValue()).equals(ActivityType.ACTIVITY_BUSINESS))
          {
            continue;
          }
        }
        attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.PERFORMER_TYPE);
        if (attribute != null)
        {
          String performer_type = (String) attribute.getValue();
          if (performer_type == null || performer_type.length() == 0)
          {
            errorList.add(
              new WorkflowException(
                "activity attribute '"
                  + XPDLGlobals.PERFORMER_TYPE
                  + "' must be set.{packageID="
                  + workflowPackage.getUUID()
                  + ",processID="
                  + workflowProcess.getUUID()
                  + ",activityID="
                  + activity.getUUID()
                  + "}"));
          }
        }
        else
        {
          errorList.add(
            new WorkflowException(
              "activity attribute '"
                + XPDLGlobals.PERFORMER_TYPE
                + "' must be set.{packageID="
                + workflowPackage.getUUID()
                + ",processID="
                + workflowProcess.getUUID()
                + ",activityID="
                + activity.getUUID()
                + "}"));
        }
      }
    }

    //  ---------------------------------------------------------------
    //   6. validate workflowActivity Implementation referrence
    //  ---------------------------------------------------------------     
    for (int i = 0; i < process_size; ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List activies = workflowProcess.getWorkflowActivities();
      int activitySize = activies.size();

      WorkflowActivity activity = null;
      Implementation impl = null;
      ToolImplementation toolImpl = null;
      ToolSet toolSet = null;
      SubFlowImplementation subFlowImpl = null;

      for (int j = 0; j < activitySize; ++j)
      {
        activity = (WorkflowActivity) activies.get(j);
        impl = activity.getImplementation();

        if (impl == null)
        {
          continue;
        }

        if ((impl instanceof ToolImplementation) && ActivityType.ACTIVITY_BUSINESS.equals(activity.getActivityType()))
        {
          toolImpl = (ToolImplementation) impl;
          String appId = toolImpl.getApplicationID();
          if ((appId == null) || (workflowPackage.findWorkflowApplication(appId) == null))
          {
            errorList.add(
              new WorkflowException(
                "Tool attribute 'Id' must be set.{packageID="
                  + workflowPackage.getUUID()
                  + ",processID="
                  + workflowProcess.getUUID()
                  + ",activityID="
                  + activity.getUUID()
                  + "}"));
          }
        }

        if ((impl instanceof ToolSet) && ActivityType.ACTIVITY_BUSINESS.equals(activity.getActivityType()))
        {
          toolSet = (ToolSet) impl;
          List toolImpls = toolSet.getToolKits();
          int toolImpls_size = toolImpls.size();

          for (int k = 0; k < toolImpls_size; ++k)
          {
            toolImpl = (ToolImplementation) toolImpls.get(k);
            String appId = toolImpl.getApplicationID();
            if ((appId == null) || (workflowPackage.findWorkflowApplication(appId) == null))
            {
              errorList.add(
                new WorkflowException(
                  "Tool attribute 'Id' must be set.{packageID="
                    + workflowPackage.getUUID()
                    + ",processID="
                    + workflowProcess.getUUID()
                    + ",activityID="
                    + activity.getUUID()
                    + "}"));
            }
          }
        }

        if ((impl instanceof SubFlowImplementation)
          && ActivityType.ACTIVITY_SUBFLOW.equals(activity.getActivityType()))
        {
          subFlowImpl = (SubFlowImplementation) impl;
          String processId = subFlowImpl.getProcessID();
          if ((processId == null) || (workflowPackage.findWorkflowProcess(processId) == null))
          {
            errorList.add(
              new WorkflowException(
                "SubFlow attribute 'Id' must be set.{packageID="
                  + workflowPackage.getUUID()
                  + ",processID="
                  + workflowProcess.getUUID()
                  + ",activityID="
                  + activity.getUUID()
                  + "}"));
          }
        }
      }
    }

    //  ---------------------------------------------------------------
    //   7. validate WorkflowTransition formActivity & toActivity
    //  ---------------------------------------------------------------     
    for (int i = 0; i < process_size; ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List trans = workflowProcess.getWorkflowTransitions();
      int trans_size = trans.size();

      WorkflowTransition tran = null;

      for (int j = 0; j < trans_size; ++j)
      {
        tran = (WorkflowTransition) trans.get(j);
        if (tran.getFromWorkflowActivity() == null)
        {
          errorList.add(
            new WorkflowException(
              "Transition attribute 'From' must be set.{packageID="
                + workflowPackage.getUUID()
                + ",processID="
                + workflowProcess.getUUID()
                + ",transitionID="
                + tran.getUUID()
                + "}"));
        }

        if (tran.getToWorkflowActivity() == null)
        {
          errorList.add(
            new WorkflowException(
              "Transition attribute 'To' must be set.{packageID="
                + workflowPackage.getUUID()
                + ",processID="
                + workflowProcess.getUUID()
                + ",transitionID="
                + tran.getUUID()
                + "}"));
        }
      }
    }

    //  ---------------------------------------------------------------
    //   8. validate workflowActivity activity type match performer Type
    //  --------------------------------------------------------------- 
    for (int i = 0; i < process_size; ++i)
    {
      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);
        ExtendedAttribute attribute = activity.findExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
        if (attribute != null)
        {
          if (ActivityType.parse((String) attribute.getValue()).equals(ActivityType.ACTIVITY_BUSINESS))
          {
            continue;
          }

          attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.PERFORMER_TYPE);
          if (attribute != null
            && !(PerformerType.parse(attribute.getValue()).equals(PerformerType.PERFORMER_AUTOMATION)))
          {
            errorList.add(
              new WorkflowException(
                "activity attribute '"
                  + XPDLGlobals.PERFORMER_TYPE
                  + "' and attribute '"
                  + XPDLGlobals.ACTIVITY_TYPE
                  + "' mismatched.{packageID="
                  + workflowPackage.getUUID()
                  + ",processID="
                  + workflowProcess.getUUID()
                  + ",activityID="
                  + activity.getUUID()
                  + "}"));
          }
        }
      }
    }
View Full Code Here

    WorkflowProcess workflowProcess,
    WorkflowWork workflowWork,
    WorkflowTransition workflowTransition)
    throws WorkflowException
  {
    WorkflowActivity workflowActivity = workflowTransition.getToWorkflowActivity();
   
//    if( ! ActivityType.ACTIVITY_BUSINESS.equals(workflowActivity.getActivityType()))
//    {
//      return null;
//    }
   
    PerformerType performerType = workflowActivity.getPerformerType();
    UserDatabase userDatabase =workflowService.getUserDatabase();

    List users =null;

    if (PerformerType.PERFORMER_PARTICIPANT_BASED.equals(performerType))
View Full Code Here

    WorkflowWork workflowWork,
    WorkflowTransition workflowTransition)
    throws WorkflowException
  {
    List users = new ArrayList();
    WorkflowActivity workflowActivity = workflowTransition.getToWorkflowActivity();
    ExtendedAttribute attribute =
      (ExtendedAttribute) workflowActivity.getExtendedAttributes().get(
        XPDLGlobals.SELECTOR_QUALIFIED_CLASS_NAME);

    String implClassName = attribute.getValue();
    Class implClass = null;
    PerformerSelector selector = null;
View Full Code Here

    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List transitions = workflowProcess.getWorkflowTransitions();
      int tran_size = transitions.size();
      WorkflowTransition transition = null;
      WorkflowActivity fromActivity = null;
      WorkflowActivity toActivity = null;
      for (int j = 0; j < tran_size; ++j)
      {
        transition = (WorkflowTransition) transitions.get(j);

        fromActivity = transition.getFromWorkflowActivity();
        toActivity = transition.getToWorkflowActivity();
        if (fromActivity != null)
        {
          fromActivity.addOutgoingTransition(transition);
        }
        //        else
        //        {
        //          System.err.println("transition=" + transition.getUUID() + ",from=<null>");
        //        }
        if (toActivity != null)
        {
          toActivity.addIncomingTransition(transition);
        }
        //        else
        //        {
        //          System.err.println("transition=" + transition.getUUID() + ",to=<null>");
        //        }
      }
    }

    //  ---------------------------------------------------------------
    //   2. format transition condition
    //  --------------------------------------------------------------- 
    for (int i = 0; i < process_size; ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List transitions = workflowProcess.getWorkflowTransitions();
      int tran_size = transitions.size();
      WorkflowTransition transition = null;

      for (int j = 0; j < tran_size; ++j)
      {
        transition = (WorkflowTransition) transitions.get(j);
        WorkflowCondition condition = transition.getCondition();
        if (condition != null && condition.getContent() != null)
        {
          ExtendedAttribute attribute = transition.findExtendedAttribute(XPDLGlobals.CONDITION_TYPE);
          if (attribute != null)
          {
            ConditionType ctype = ConditionType.parse(attribute.getValue());
            if (ConditionType.CONDITION_SCRIPT.equals(ctype))
            {
              transition.setCondition(new ScriptCondition(condition.getContent()));
            }

            transition.removeExtendedAttribute(XPDLGlobals.CONDITION_TYPE);
          }
        }
      }
    }

    //  ---------------------------------------------------------------
    //   3. format activity type
    //  ---------------------------------------------------------------   
    for (int i = 0; i < processList.size(); ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List activies = workflowProcess.getWorkflowActivities();
      int activitySize = activies.size();

      WorkflowActivity activity = null;
      Implementation impl = null;
      ExtendedAttribute attribute = null;
      for (int j = 0; j < activitySize; ++j)
      {
        activity = (WorkflowActivity) activies.get(j);
        attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
        if (attribute != null)
        {
          activity.setActivityType(ActivityType.parse(attribute.getValue()));
          activity.removeExtendedAttribute(XPDLGlobals.ACTIVITY_TYPE);
        }
      }
    }

    //  ---------------------------------------------------------------
    //   4. format activity implementation
    //  ---------------------------------------------------------------
    for (int i = 0; i < processList.size(); ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List activies = workflowProcess.getWorkflowActivities();
      int activitySize = activies.size();

      WorkflowActivity activity = null;
      Implementation impl = null;
      ExtendedAttribute attribute = null;
      for (int j = 0; j < activitySize; ++j)
      {
        activity = (WorkflowActivity) activies.get(j);
        impl = activity.getImplementation();
        if (impl != null)
        {
          if (impl instanceof NoImplementation)
          {
            attribute = activity.findExtendedAttribute(XPDLGlobals.PAGE_URL);
            if (attribute != null)
            {
              activity.setImplementation(new PageImplementation(attribute.getValue()));
            }
          }
        }
      }
    }

    //  ---------------------------------------------------------------
    //   5. format performer type
    //  ---------------------------------------------------------------
    for (int i = 0; i < processList.size(); ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List activies = workflowProcess.getWorkflowActivities();
      int activitySize = activies.size();

      WorkflowActivity activity = null;
      Implementation impl = null;
      ExtendedAttribute attribute = null;
      for (int j = 0; j < activitySize; ++j)
      {
        activity = (WorkflowActivity) activies.get(j);
        attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.PERFORMER_TYPE);
        if (attribute != null)
        {
          activity.setPerformerType(PerformerType.parse(attribute.getValue()));
          activity.removeExtendedAttribute(XPDLGlobals.PERFORMER_TYPE);
        }
      }
    }

    //  ---------------------------------------------------------------
    //   6. format application QualifiedClassName
    //  --------------------------------------------------------------- 
    List wfApps = workflowPackage.getWorkflowApplications();
    int wfAppSize = wfApps.size();
    WorkflowApplication wfApp = null;
    for (int i = 0; i < wfAppSize; ++i)
    {
      wfApp = (WorkflowApplication) wfApps.get(i);
      ExtendedAttribute attribute = wfApp.findExtendedAttribute(XPDLGlobals.APPLICATION_QUALIFIED_CLASS_NAME);
      if (attribute != null)
      {
        wfApp.setQualifiedClassName(attribute.getValue());
        wfApp.removeExtendedAttribute(XPDLGlobals.APPLICATION_QUALIFIED_CLASS_NAME);
      }
    }

    //  ---------------------------------------------------------------
    //   7. validate workflowActivity Implementation & ActivityType
    //  ---------------------------------------------------------------   
    for (int i = 0; i < process_size; ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List activies = workflowProcess.getWorkflowActivities();
      int activitySize = activies.size();

      WorkflowActivity activity = null;
      Implementation impl = null;
      ToolImplementation toolImpl = null;
      ToolSet toolSet = null;
      SubFlowImplementation subFlowImpl = null;

      for (int j = 0; j < activitySize; ++j)
      {
        activity = (WorkflowActivity) activies.get(j);
        impl = activity.getImplementation();
        if (ActivityType.ACTIVITY_BUSINESS.equals(activity.getActivityType()))
        {
          if (impl != null && (impl instanceof SubFlowImplementation))
          {
            errorList.add(
              new WorkflowException(
                "ActivityType 'ACTIVITY_BUSINESS' Implementation can not be 'SubFlow'.{packageID="
                  + workflowPackage.getUUID()
                  + ",processID="
                  + workflowProcess.getUUID()
                  + ",activityID="
                  + activity.getUUID()
                  + "}"));
          }
        }

        if (ActivityType.ACTIVITY_SUBFLOW.equals(activity.getActivityType()))
        {
          if (impl != null && !(impl instanceof SubFlowImplementation))
          {
            errorList.add(
              new WorkflowException(
                "ActivityType 'ACTIVITY_SUBFLOW' Implementation must be 'SubFlow'.{packageID="
                  + workflowPackage.getUUID()
                  + ",processID="
                  + workflowProcess.getUUID()
                  + ",activityID="
                  + activity.getUUID()
                  + "}"));
          }
        }

        if (ActivityType.ACTIVITY_ROUTE.equals(activity.getActivityType()))
        {
          if (impl != null && !(impl instanceof NoImplementation))
          {
            errorList.add(
              new WorkflowException(
                "ActivityType 'ACTIVITY_ROUTE' Implementation must be 'No'.{packageID="
                  + workflowPackage.getUUID()
                  + ",processID="
                  + workflowProcess.getUUID()
                  + ",activityID="
                  + activity.getUUID()
                  + "}"));
          }
        }

      }
    }

    //  ---------------------------------------------------------------
    //   8. format workflowProcess  listener class name
    //  --------------------------------------------------------------- 
    for (int i = 0; i < process_size; ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      ExtendedAttribute attribute = workflowProcess.findExtendedAttribute(XPDLGlobals.LISTENER_QUALIFIED_CLASS_NAME);
      if (attribute != null)
      {
        workflowProcess.setListenerClassName(attribute.getValue());
        workflowProcess.removeExtendedAttribute(XPDLGlobals.LISTENER_QUALIFIED_CLASS_NAME);
      }
    }

    //  ---------------------------------------------------------------
    //   9. format workflowActivity  listener class name
    //  --------------------------------------------------------------- 
    for (int i = 0; i < processList.size(); ++i)
    {
      WorkflowProcess workflowProcess = (WorkflowProcess) processList.get(i);
      List activies = workflowProcess.getWorkflowActivities();
      int activitySize = activies.size();

      WorkflowActivity activity = null;
      Implementation impl = null;
      ExtendedAttribute attribute = null;
      for (int j = 0; j < activitySize; ++j)
      {
        activity = (WorkflowActivity) activies.get(j);
        attribute = (ExtendedAttribute) activity.findExtendedAttribute(XPDLGlobals.LISTENER_QUALIFIED_CLASS_NAME);
        if (attribute != null)
        {
          activity.setListenerClassName(attribute.getValue());
          activity.removeExtendedAttribute(XPDLGlobals.LISTENER_QUALIFIED_CLASS_NAME);
        }
      }
    }

    return errorList;
View Full Code Here

    SpiCaseDatabase caseDatabase,
    UserTransaction userTransaction,
    WorkflowWork workflowWork)
    throws WorkflowException
  {
    WorkflowActivity workActivity = workflowWork.getWorkflowActivity();
    //========================================================================
    //  ���⴦�� (����ֻ��һ��Out WorkflowTransition��WorkflowActivity)
    //========================================================================
    List disp_outTrans = workActivity.getOutgoingTransitions();
    if (disp_outTrans.size() == 1)
    {
      List filter_outTrans = new ArrayList();
      filter_outTrans.add(disp_outTrans.get(0));
      log.debug("Only one outTransition,select it unconditionally.["+workActivity+"]" );
      return filter_outTrans;
    }

    SplitType splitType = workActivity.getSplitType();
    if (SplitType.SPLIT_AND.equals(splitType))
    {
      return filterOutTransition_andSplit(workflowService, operator, caseDatabase, userTransaction, workflowWork);
    }
    else if (SplitType.SPLIT_XOR.equals(splitType))
View Full Code Here

    WorkflowWork workflowWork)
    throws WorkflowException
  {
    log.debug(" SplitType.SPLIT_AND  select all out transitions");
    List outTrans = new ArrayList();
    WorkflowActivity workActivity = workflowWork.getWorkflowActivity();
    List transList = workActivity.getOutgoingTransitions();

    int sizeTrans = transList.size();

    for (int i = 0; i < sizeTrans; ++i)
    {
View Full Code Here

    throws WorkflowException
  {
    log.debug(" SplitType.SPLIT_XOR  select (single) specific  out transitions");

    List outTrans = new ArrayList();
    WorkflowActivity workActivity = workflowWork.getWorkflowActivity();
    List transList = workActivity.getOutgoingTransitions();
    WorkflowProcess workflowProcess = workActivity.getWorkflowProcess();
    WorkflowPackage workflowPackage = workflowProcess.getWorkflowPackage();
    ScriptInterpretor interpretor = workflowService.getScriptInterpretor();

    RuntimeContext context = null;
    WorkflowCase workflowCase = workflowWork.getWorkflowCase();
View Full Code Here

    throws WorkflowException
  {
    log.debug(" SplitType.SPLIT_OR  select out transitions based on condition evaluation");

    List outTrans = new ArrayList();
    WorkflowActivity workActivity = workflowWork.getWorkflowActivity();
    List transList = workActivity.getOutgoingTransitions();
    WorkflowProcess workflowProcess = workActivity.getWorkflowProcess();
    WorkflowPackage workflowPackage = workflowProcess.getWorkflowPackage();
    ScriptInterpretor interpretor = workflowService.getScriptInterpretor();

    RuntimeContext context = null;
    WorkflowCase workflowCase = 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.