Пример #1
0
 @Override
 public void setNextWorkFlowStep(StatefulKnowledgeSession statefulSession) throws DAMException {
   // TODO Auto-generated method stub
   try {
     ArrayList<Object> arrList = new ArrayList<Object>(statefulSession.getObjects());
     DynamicWorkFlow dynamicWorkFlow = null;
     for (Object ob : arrList) {
       dynamicWorkFlow = (DynamicWorkFlow) ob;
     }
     System.out.println(dynamicWorkFlow);
     FactHandle factHandle = statefulSession.getFactHandle(dynamicWorkFlow);
     System.out.println(factHandle);
     dynamicWorkFlow.setCurr_Step(dynamicWorkFlow.getNext_Step());
     System.out.println(dynamicWorkFlow);
     statefulSession.update(factHandle, dynamicWorkFlow);
     statefulSession.fireAllRules();
   } catch (Exception exp) {
     System.out.println(exp.getMessage());
     throw new DAMException(exp.getMessage());
   }
 }
Пример #2
0
  @Override
  public Long triggerDynamicWorkFlow(String suppId, String suppName) throws DAMException {
    // TODO Auto-generated method stub
    ProcessInstance procIns = null;
    try {
      JPAWorkingMemoryDbLogger auditlogger = new JPAWorkingMemoryDbLogger(statefulknowsession);
      DynamicWorkFlow dynamicWorkFlow = new DynamicWorkFlow();

      dynamicWorkFlow.setSupp_id(suppId);
      dynamicWorkFlow.setSupp_name(suppName);
      dynamicWorkFlow.setCurr_Step("");

      Map<String, Object> processMap = new HashMap<String, Object>();
      processMap.put("dynamicworkflow", dynamicWorkFlow);
      procIns = statefulknowsession.startProcess(ConstantUtil.DYNAMIC_WORKFLOW_ID, processMap);
    } catch (Exception exp) {
      System.out.println(exp.getMessage());
      throw new DAMException(exp.getMessage());
    }

    return procIns.getId();
  }