Example #1
0
 public void triggers(TaskDTO taskDto) {
   this.taskDto = taskDto;
   this.eventNumber = taskDto.getEventType();
   if (null != this.eventNumber && !this.eventNumber.isEmpty()) {
     try {
       this.taskId = taskDto.getId().toString();
       this.input = Utils.parasToMap(taskDto.getInputParas());
       this.client.sendTaskStartLog(
           this.taskId, "ID:" + this.taskId + "的任务-开始执行" + this.input.toString());
       destinationName = this.input.get("SAP_SYSTEM") + "_" + this.taskDto.getUserId();
       ThreadLocalUtil.setTaskDTO(
           this.eventNumber,
           String.valueOf(taskDto.getUserId()),
           taskDto.getInputParas(),
           String.valueOf(taskDto.getId()),
           String.valueOf(taskDto.getRunId()));
       if ("A0001".equals(this.eventNumber)) {
         this.switchConnJCo();
       } else if ("E0000".equals(this.eventNumber)) {
         if (this.switchUsi()) {
           this.switchEvent();
         }
       } else if ("E0015".equals(this.eventNumber)) {
         if (this.switchUsi()) {
           this.switchTable();
         }
       } else {
         if (this.switchUsi()) {
           this.switchOther();
         }
       }
     } catch (JCoException
         | NotFoundException
         | InstantiationException
         | IllegalAccessException
         | ClassNotFoundException
         | IOException
         | DocumentException
         | SAXException ex) {
       Logger.getLogger(EventMdl.class.getName()).log(Level.SEVERE, null, ex);
       String errorMessage = ex.getMessage();
       this.client.sendTaskErrorLog(
           this.taskId,
           "ID:"
               + this.taskId
               + ","
               + (errorMessage.length() > 200 ? errorMessage.substring(0, 200) : errorMessage));
     }
   } else {
     this.client.sendTaskErrorLog(this.taskId, "Event Number is null.");
   }
 }