Exemplo n.º 1
0
  public void settlement(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_SETTLEMENT);

    String account = (String) delegateTask.getVariable("operatorAcc");
    delegateTask.setAssignee(account);
  }
Exemplo n.º 2
0
  public void bidding(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_BIDDING);

    String account = (String) delegateTask.getVariable("operatorAcc");
    delegateTask.setAssignee(account);
  }
Exemplo n.º 3
0
  public void inspect(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_INSPECT);

    String account = (String) delegateTask.getVariable("qcAcc");
    delegateTask.setAssignee(account);
  }
Exemplo n.º 4
0
  public void professionalManagerAssess(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_PROFESSIONAL_MANAGER_ASSESS);

    String account = (String) delegateTask.getVariable("creatorAcc");
    delegateTask.setAssignee(account);
  }
Exemplo n.º 5
0
  public void contractHandle(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_CONTRACT_HANDLE);

    String account = (String) delegateTask.getVariable("operatorAcc");
    delegateTask.setAssignee(account);
  }
Exemplo n.º 6
0
  public void salesmanAudit(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_SALESMAN_AUDIT);

    String account = (String) delegateTask.getVariable("saleAcc");
    delegateTask.setAssignee(account);
  }
Exemplo n.º 7
0
  public void manufacture(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_MANUFACTURE);

    String account = (String) delegateTask.getVariable("operatorAcc");
    delegateTask.setAssignee(account);
  }
Exemplo n.º 8
0
  public void projectManagerApprove(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_PROJECT_MANAGER_APPROVE);

    SrProjectManager srProjectMgr = new SrProjectManager();
    String projNo = (String) delegateTask.getVariable("projNo");
    srProjectMgr.setProjNo(projNo);
    List<SrProjectManager> list = getSrProjectManagerService().list(srProjectMgr);
    if (list == null || list.size() == 0) {
      throw new Exception("未找到此工程的总管,请联系修船事业部相关人员,在“工程结算-基础数据-修船总管”中定义");
    }
    delegateTask.addCandidateUsers(getSrProjectManagers(list));
  }
Exemplo n.º 9
0
  @Override
  public void notify(DelegateTask delegateTask) {

    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace(
          "notify called; event name = {}, name = {}",
          delegateTask.getEventName(),
          delegateTask.getName());
    }

    ActivitiInterface activitiInterface = SpringApplicationContextHolder.getActivitiInterface();
    activitiInterface.notifyMidpointAboutTaskEvent(delegateTask);
  }
Exemplo n.º 10
0
 public void notify(DelegateTask delegateTask) {
   String processInstanceId = delegateTask.getProcessInstanceId();
   ProcessInstance processInstance =
       runtimeService
           .createProcessInstanceQuery()
           .processInstanceId(processInstanceId)
           .singleResult();
   Leave leave = new Leave(processInstance.getBusinessKey());
   leave.setLeaveType((String) delegateTask.getVariable("leaveType"));
   leave.setStartTime((Date) delegateTask.getVariable("startTime"));
   leave.setEndTime((Date) delegateTask.getVariable("endTime"));
   leave.setReason((String) delegateTask.getVariable("reason"));
   leave.preUpdate();
   leaveDao.update(leave);
 }
 /** {@inheritDoc} */
 @Override
 protected Object handleDelegateTaskProperty(
     DelegateTask task, TypeDefinition type, QName key, Serializable value) {
   checkType(key, value, String.class);
   task.setDescription((String) value);
   return DO_NOT_ADD;
 }
Exemplo n.º 12
0
 public String getDescription(DelegateTask delegateTask) throws Exception {
   String id = (String) delegateTask.getVariable("id");
   SrOutsource srOutsource = new SrOutsource();
   srOutsource.setId(id);
   srOutsource = (SrOutsource) getSrOutsourceService().list(srOutsource).get(0);
   return "[" + srOutsource.getProjName() + "] " + srOutsource.getName() + " ";
 }
  public void onCreate(DelegateTask delegateTask) throws Exception {
    String assignee = delegateTask.getAssignee();
    String processDefinitionId = delegateTask.getProcessDefinitionId();
    DelegateInfo delegateInfo = delegateService.getDelegateInfo(assignee, processDefinitionId);

    if (delegateInfo == null) {
      return;
    }

    String attorney = delegateInfo.getAttorney();
    Set<IdentityLink> ids = delegateTask.getCandidates();

    for (IdentityLink identityLink : ids) {
      if (this.containsUser(identityLink, assignee) || this.containsGroup(identityLink, assignee)) {
        this.addCandidateUser(delegateTask, assignee, attorney);
      }
    }
  }
Exemplo n.º 14
0
  public void inspectChiefHandle(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_INSPECT_CHIEF_HANDLE);

    UserInfoVo assignee = new UserInfoVo();
    assignee.setPorgName("修船事业部");
    assignee.setRoleName("修船技术质量科科长");
    List<UserInfoVo> list = listAssignees(assignee);
    delegateTask.addCandidateUsers(getCandidateUsers(list));
  }
Exemplo n.º 15
0
  public void outsourceChiefAudit(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_OUTSOURCE_CHIEF_AUDIT);

    UserInfoVo assignee = new UserInfoVo();
    assignee.setPorgName("修船事业部");
    assignee.setRoleName("修船外协科科长");
    List<UserInfoVo> list = listAssignees(assignee);
    delegateTask.addCandidateUsers(getCandidateUsers(list));
  }
Exemplo n.º 16
0
  public void settlementApprove(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_SETTLEMENT_APPROVE);

    UserInfoVo assignee = new UserInfoVo();
    assignee.setPorgName("修船事业部");
    assignee.setRoleName("修船外协科科长");
    List<UserInfoVo> list = listAssignees(assignee);
    delegateTask.addCandidateUsers(getCandidateUsers(list));
  }
Exemplo n.º 17
0
  public void businessDivisionDirectorApprove(DelegateTask delegateTask) throws Exception {

    setTaskInfo(delegateTask, SrOsStatus.STATUS_BUSINESS_DIVISION_DIRECTOR_APPROVE);

    // 通过CandidateUsers配置多个经营结算员
    UserInfoVo assignee = new UserInfoVo();
    assignee.setPorgName("修船事业部");
    assignee.setRoleName("修船事业部部长");
    List<UserInfoVo> list = listAssignees(assignee);
    delegateTask.addCandidateUsers(getCandidateUsers(list));
  }
Exemplo n.º 18
0
  public HumanTaskDTO createHumanTask(
      DelegateTask delegateTask, HistoricTaskInstanceEntity historicTaskInstanceEntity)
      throws Exception {
    HumanTaskConnector humanTaskConnector =
        ApplicationContextHelper.getBean(HumanTaskConnector.class);
    HumanTaskDTO humanTaskDto = new HumanTaskBuilder().setDelegateTask(delegateTask).build();

    if ("发起流程".equals(historicTaskInstanceEntity.getDeleteReason())) {
      humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_START);
    }

    HistoricProcessInstance historicProcessInstance =
        Context.getCommandContext()
            .getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(delegateTask.getProcessInstanceId());
    humanTaskDto.setProcessStarter(historicProcessInstance.getStartUserId());
    humanTaskDto = humanTaskConnector.saveHumanTask(humanTaskDto);

    return humanTaskDto;
  }
Exemplo n.º 19
0
 /** 通过实现TaskListener接口的notify方法,指定任务(个人任务和组任务)的办理人 */
 @Override
 public void notify(DelegateTask delegateTask) {
   // 指定任务的办理人
   delegateTask.setAssignee("黄老邪");
 }
 private void addCandidateUser(DelegateTask delegateTask, String assignee, String attorney) {
   logger.info("自动委托任务,设置候选人: {} to {}", delegateTask, attorney);
   delegateTask.addCandidateUser(attorney);
   delegateService.saveRecord(assignee, attorney, delegateTask.getId());
 }
Exemplo n.º 21
0
 @Override
 public void notify(DelegateTask delegateTask) {
   // get starter user name
   String initiator = (String) delegateTask.getVariable(Const.VAR_INITIATOR);
   delegateTask.addCandidateUser(initiator);
 }
Exemplo n.º 22
0
  /**
   * Adds Attachemnts based on formData to task.
   *
   * @param oFormData FormData from task where we search file fields.
   * @param oTask where we add Attachments.
   */
  public void addAttachmentsToTask(FormData oFormData, DelegateTask oTask) {
    DelegateExecution oExecution = oTask.getExecution();

    LOG.info("SCAN:file");
    List<String> asFieldID = getListFieldCastomTypeFile(oFormData);
    LOG.info("[addAttachmentsToTask]");
    LOG.info("(asFieldID={})", asFieldID.toString());
    List<String> asFieldValue = getVariableValues(oExecution, asFieldID);
    LOG.info("(asFieldValue={})", asFieldValue.toString());
    List<String> asFieldName = getListCastomFieldName(oFormData);
    LOG.info("(asFieldName={})", asFieldName.toString());
    if (!asFieldValue.isEmpty()) {
      int n = 0;
      for (String sKeyRedis : asFieldValue) {
        LOG.info("(sKeyRedis={})", sKeyRedis);
        if (sKeyRedis != null
            && !sKeyRedis.isEmpty()
            && !"".equals(sKeyRedis.trim())
            && !"null".equals(sKeyRedis.trim())
            && sKeyRedis.length() > 15) {
          if (!asFieldName.isEmpty() && n < asFieldName.size()) {
            // String sDescription = asFieldName.get((asFieldName.size() - 1) - n);
            String sDescription = asFieldName.get(n);
            LOG.info("(sDescription={})", sDescription);
            String sID_Field = asFieldID.get(n);
            LOG.info("(sID_Field={})", sID_Field);

            byte[] aByteFile;
            ByteArrayMultipartFile oByteArrayMultipartFile = null;
            try {
              aByteFile = oBytesDataInmemoryStorage.getBytes(sKeyRedis);
              oByteArrayMultipartFile = getByteArrayMultipartFileFromStorageInmemory(aByteFile);
            } catch (ClassNotFoundException | IOException | RecordInmemoryException e1) {
              throw new ActivitiException(e1.getMessage(), e1);
            }
            if (oByteArrayMultipartFile != null) {
              String sFileName = null;
              try {
                sFileName =
                    new String(oByteArrayMultipartFile.getOriginalFilename().getBytes(), "UTF-8");
              } catch (java.io.UnsupportedEncodingException oException) {
                LOG.error("error on getting sFileName: {}", oException.getMessage());
                throw new ActivitiException(oException.getMessage(), oException);
              }
              LOG.info("(sFileName={})", sFileName);

              // ===
              InputStream oInputStream = null;
              try {
                oInputStream = oByteArrayMultipartFile.getInputStream();
              } catch (Exception e) {
                throw new ActivitiException(e.getMessage(), e);
              }
              Attachment oAttachment =
                  oExecution
                      .getEngineServices()
                      .getTaskService()
                      .createAttachment(
                          oByteArrayMultipartFile.getContentType()
                              + ";"
                              + oByteArrayMultipartFile.getExp(),
                          oTask.getId(),
                          oExecution.getProcessInstanceId(),
                          sFileName,
                          sDescription,
                          oInputStream);

              if (oAttachment != null) {
                String nID_Attachment = oAttachment.getId();
                // LOG.info("(nID_Attachment={})", nID_Attachment);
                LOG.info(
                    "Try set variable(sID_Field={}) with the value(nID_Attachment={}), for new attachment...",
                    sID_Field,
                    nID_Attachment);
                oExecution
                    .getEngineServices()
                    .getRuntimeService()
                    .setVariable(oExecution.getProcessInstanceId(), sID_Field, nID_Attachment);
                LOG.info(
                    "Finished setting new value for variable with attachment (sID_Field={})",
                    sID_Field);
              } else {
                LOG.error("Can't add attachment to (oTask.getId()={})", oTask.getId());
              }
              // ===

            } else {
              LOG.error("oByteArrayMultipartFile==null!  (sKeyRedis={})", sKeyRedis);
            }
          } else {
            LOG.error("asFieldName has nothing! (asFieldName={})", asFieldName);
          }
        } else {
          LOG.error("Invalid Redis Key!!! (sKeyRedis={})", sKeyRedis);
        }
        n++;
      }
    }

    scanExecutionOnQueueTickets(oExecution, oFormData); // , oTask);//startformData

    /*LOG.info("SCAN:queueData");
    asFieldID = getListField_QueueDataFormType(formData);
    LOG.info("asFieldID="+asFieldID.toString());
    asFieldValue = getVariableValues(execution, asFieldID);
    LOG.info("asFieldValue="+asFieldValue.toString());
    //asFieldName = getListCastomFieldName(formData);
    //LOG.info("asFieldName="+asFieldName.toString());
    if (!asFieldValue.isEmpty()) {
    String sValue = asFieldValue.get(0);
    LOG.info("sValue=" + sValue);
    long nID_FlowSlotTicket=0;
    int nAt=sValue.indexOf(":");
    int nTo=sValue.indexOf(",");
    String s=sValue.substring(nAt+1,nTo);
    LOG.info("s=" + s);
    try{
    nID_FlowSlotTicket = Long.valueOf(s);
    LOG.info("Ok!");
    }catch(Exception oException){
    LOG.error(oException.getMessage());
    nID_FlowSlotTicket=1;
    }
    LOG.info("nID_FlowSlotTicket=" + nID_FlowSlotTicket);

    try{


    //                FlowSlotTicket oFlowSlotTicket = baseEntityDao.getById(FlowSlotTicket.class, nID_FlowSlotTicket);
    //                if (oFlowSlotTicket == null) {
    //                    LOG.error("FlowSlotTicket with id=" + nID_FlowSlotTicket + " is not found!");
    //                }else{
    //                    long nID_FlowSlot=oFlowSlotTicket.getoFlowSlot().getId();
    //                    LOG.error("nID_FlowSlot="+nID_FlowSlot);
    //                    long nID_Subject = oFlowSlotTicket.getnID_Subject();
    //                    LOG.error("nID_Subject="+nID_Subject);
    //                    long nID_Task_Activiti = 1; //TODO set real ID!!!
    //                    oFlowSlotTicket.setnID_Task_Activiti(nID_Task_Activiti);
    //                    baseEntityDao.saveOrUpdate(oFlowSlotTicket);
    //                    LOG.info("JSON:" + JsonRestUtils.toJsonResponse(new SaveFlowSlotTicketResponse(oFlowSlotTicket.getId())));
    //                }

    }catch(Exception oException){
    LOG.error(oException.getMessage());
    }

    }*/

  }
Exemplo n.º 23
0
 public void notify(DelegateTask delegateTask) {
   delegateTask.setVariable("calledThroughNotify", delegateTask.getName() + "-notify");
 }
Exemplo n.º 24
0
 public void calledInExpression(DelegateTask task, String eventName) {
   task.setVariable("calledInExpression", task.getName() + "-" + eventName);
 }
Exemplo n.º 25
0
 /**
  * @Description:这里用一句话描述这个方法的作用
  *
  * @param arg0
  * @author liuwu
  * @create_date 2015年10月28日 下午6:32:30
  */
 public void notify(DelegateTask delegateTask) {
   System.out.println("设置商务部经理*********************");
   delegateTask.setAssignee("zhouyp");
 }