Package org.uengine.webservices.worklist

Examples of org.uengine.webservices.worklist.WorkList


     
      //if(getRole().getRoleResolutionContext()==null)
      throw e;
    }
   
    WorkList worklist = instance.getWorkList();

    //TODO: change not to read again by the createParameter() if you don't want to cache processinstance
    Calendar dueDate = getDueDate(instance);
    if(dueDate==null)
      setDueDate(instance, instance.calculateDueDate(GlobalContext.getNow(instance.getProcessTransactionContext()), getDuration()), false);

    Map kpv = createParameter(instance);

    if(defaultStatus!=null){
      kpv.put(KeyedParameter.DEFAULT_STATUS, defaultStatus);
    }

    if(roleMapping!=null){
      int dispatchingOption = roleMapping.getDispatchingOption();
     
      if(dispatchingOption == Role.DISPATCHINGOPTION_AUTO)
        dispatchingOption = (roleMapping.size() > 1 ? Role.DISPATCHINGOPTION_RACING : Role.DISPATCHINGOPTION_ALL);

      kpv.put(KeyedParameter.DISPATCHINGOPTION, ""+dispatchingOption);
      if(
          roleMapping.getResourceName().equals(roleMapping.getEndpoint())
          || !UEngineUtil.isNotEmpty(roleMapping.getResourceName())
      )
        roleMapping.fill(instance);
      kpv.put("resourceName", roleMapping.getResourceName());

      String[] params = roleMapping.getDispatchingParameters();
      if(params!=null && params.length > 0){
        for(int i=0; i<params.length; i++){
          if(params[i]!=null){
            kpv.put("dispatchParam" + (i+1), params[i]);
          }
        }
      }

    }else
      kpv.put(KeyedParameter.DISPATCHINGOPTION, ""+getRole().getDispatchingOption());
   
    if(getRole()!=null)
      kpv.put("roleName", getRole().getName());
   
    if(getReferenceRole()!=null){
      kpv.put("referenceRoleName", getReferenceRole().getName());
     
      RoleMapping referenceRoleMapping = getReferenceRole().getMapping(instance);
      if(referenceRoleMapping!=null/* && instance.getRoleMapping(getReferenceRole().getName())==null*/){
        instance.putRoleMapping(referenceRoleMapping);
      }
    }
   
    if(getRole().getRoleResolutionContext()!=null){
      String[] params = getRole().getRoleResolutionContext().getDispatchingParameters();
     
      if(params!=null && params.length > 0 && params[0]!=null)
        kpv.put("dispatchParam1", params[0]);
    }
   
    KeyedParameter[] parameters = new KeyedParameter[kpv.size()];
   
    int i=0;
    for(Iterator iter = kpv.keySet().iterator(); iter.hasNext(); ){
      String key = (String)iter.next();
      parameters[i] = new KeyedParameter();
      parameters[i].setKey(key);
      parameters[i].setValue(kpv.get(key));
      i++;
    }   

    String[] taskIds = getTaskIds(instance);
   
    String[] taskIds2 = new String[1];//roleMapping.size()];
   
    i=0;
// Dispatching option to all users is deprecated in 2.0
//    do{
    String tID = null;
    if(taskIds!=null && taskIds.length > i)
      tID = taskIds[i];
     
    if(tID!=null && (tID.equals("null") || tID.trim().length()==0)){
      tID = null;
    }
   
    if(tID==null){
      tID = worklist.addWorkItem(roleMapping != null ? roleMapping.getEndpoint() : null, parameters, instance.getProcessTransactionContext());
    }else if(Activity.STATUS_SUSPENDED.equals(getStatus(instance))){//if suspended
      ResultPayload rp = new ResultPayload();
      rp.setExtendedValue(new KeyedParameter(KeyedParameter.DEFAULT_STATUS, DefaultWorkList.WORKITEM_STATUS_CONFIRMED)); //or WORKITEM_STATUS_RESUMED
     
      instance.getWorkList().updateWorkItem(taskIds[0], null, rp.getExtendedValues(), instance.getProcessTransactionContext());
    }else //if reserved
      worklist.addWorkItem(tID, roleMapping != null ? roleMapping.getEndpoint() : null, parameters, instance.getProcessTransactionContext());
     
    taskIds2[i++] = tID;
//    }while(roleMapping.next());
   
    setTaskIds(instance, taskIds2);   
View Full Code Here


      taskId = (String)resultPayload.getExtendedValue(PAYLOADKEY_TASKID);
    }else{//for old-version, single role mapping
      taskId = (String)instance.getProperty(getTracingTag(), PVKEY_TASKID);
    }

    WorkList worklist = instance.getWorkList();
   
    if(worklist instanceof SimulatorWorkList) return true;

    String[] taskIds = getTaskIds(instance);

    if(!UEngineUtil.isNotEmpty(taskId) && taskIds.length==1){
      taskId = taskIds[0];
    }

    KeyedParameter[] parameters = new KeyedParameter[]{};   
    worklist.completeWorkItem(taskId, parameters, instance.getProcessTransactionContext());
   
   
    if(taskIds!=null && taskIds.length>1){   
      Map map = getTaskStatusMap(instance);
      map.put(taskId, Activity.STATUS_COMPLETED);
View Full Code Here

  protected void cancelWorkItem(ProcessInstance instance) throws Exception{
    cancelWorkItem(instance, null);
  }
 
  protected void cancelWorkItem(ProcessInstance instance, String status) throws Exception{
    WorkList worklist = (new WorkListServiceLocator()).getWorkList();
   
    KeyedParameter[] parameters = new KeyedParameter[]{new KeyedParameter("status",status)};

    String[] taskIds = getTaskIds(instance);
   
    if(taskIds!=null)
      for(int i=0; i<taskIds.length; i++){
        String taskId = taskIds[i];
          worklist.cancelWorkItem(taskId, parameters, instance.getProcessTransactionContext());
      }
  }
View Full Code Here

  }
 
  public String[] reserveWorkItem(ProcessInstance instance) throws Exception{
    if(!getStatus(instance).equals(Activity.STATUS_READY)) return null;
   
    WorkList worklist = instance.getWorkList();
   
    Map kpv = createParameter(instance);
    KeyedParameter[] parameters = KeyedParameter.fromMap(kpv);   

    RoleMapping roleMapping = getRole().getMapping(instance, getTracingTag());   
    String[] taskIds = new String[roleMapping.size()];
    int i=0;
    do{
      taskIds[i++] = worklist.reserveWorkItem(roleMapping.getEndpoint(), parameters, instance.getProcessTransactionContext());       
    }while(roleMapping.next());
   
    setTaskIds(instance, taskIds);

    return taskIds;
View Full Code Here

      instance.putRoleMapping(roleMapping);
    }
   
    String[] taskIds = getTaskIds(instance);
   
    WorkList wl = (new WorkListServiceLocator()).getWorkList();

    ResultPayload rp = new ResultPayload();
    rp.setExtendedValue(new KeyedParameter(KeyedParameter.DEFAULT_STATUS, DefaultWorkList.WORKITEM_STATUS_DELEGATED));
    rp.setExtendedValue(new KeyedParameter("endDate", DAOFactory.getInstance(instance.getProcessTransactionContext()).getNow().getTime()));
    rp.setExtendedValue(new KeyedParameter(KeyedParameter.DISPATCHINGOPTION, "" + Role.DISPATCHINGOPTION_ALL));
    rp.setExtendedValue(new KeyedParameter("dispatchParam1", ""));
   
    wl.updateWorkItem(taskIds[0], null, rp.getExtendedValues(), instance.getProcessTransactionContext());

    setTaskIds(instance, null);
    executeActivity(instance);

    firePropertyChangeEventToActivityFilters(instance, "roleMapping", roleMapping);
View Full Code Here

   
    String[] taskIds = getTaskIds(instance);
    if(taskIds == null || taskIds.length == 0){
      addWorkitem(instance, DefaultWorkList.WORKITEM_STATUS_DRAFT);
    }else{ //wl update : flag 'DRAFT'
      WorkList wl = (new WorkListServiceLocator()).getWorkList();

      ResultPayload rp = new ResultPayload();
      rp.setExtendedValue(new KeyedParameter(KeyedParameter.DEFAULT_STATUS, DefaultWorkList.WORKITEM_STATUS_DRAFT));
     
      rp.setExtendedValue(new KeyedParameter("saveDate", now));
     
      wl.updateWorkItem(taskIds[0], null, rp.getExtendedValues(), instance.getProcessTransactionContext());
    }
   
    firePropertyChangeEventToActivityFilters(instance, "saveDate", now);
    fireEventToActivityFilters(instance, "saveWorkitem", payload);
    fireEventToActivityFilters(instance, "saveAnyway", payload);
View Full Code Here

       
        RoleMapping  rm = ha.getRole().getMapping(instance);
       
        if (rm != null) {
          // 아래는 HumanActivity의 reserveWorkItem() 메소드를 옮겨온 것이다.
          WorkList worklist = instance.getWorkList();
         
          Map kpv = ha.createParameter(instance);
          KeyedParameter[] parameters = KeyedParameter.fromMap(kpv);   

          RoleMapping roleMapping = ha.getRole().getMapping(instance, ha.getTracingTag());   
          String[] taskIds = new String[roleMapping.size()];
         
          int idx = 0;
          do{
            taskIds[idx++] = worklist.reserveWorkItem(roleMapping.getEndpoint(), parameters, instance.getProcessTransactionContext());       
          }while(roleMapping.next());
         
          StringBuffer taskId = new StringBuffer();
          if (taskIds != null) {
            for (int j = 0; j < taskIds.length; j++) {
View Full Code Here

        Activity  a = (Activity)activities.get(i);
        if (a instanceof HumanActivity) {
          HumanActivity  ha = (HumanActivity)a;
          if (ha.getRole().getName().equals(roleName)) {
            // 변경된 Role 추가
            WorkList  workList = instance.getWorkList();
            String  userId = rm.getEndpoint();
           
            workList.reserveWorkItem(userId, KeyedParameter.fromMap(ha.createParameter(instance)), instance.getProcessTransactionContext());
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.uengine.webservices.worklist.WorkList

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.