Package pl.net.bluesoft.rnd.processtool.bpm

Examples of pl.net.bluesoft.rnd.processtool.bpm.BpmEvent


        }
       
    /* Inform queue manager about task assigne */
    ctx.getUserProcessQueueManager().onTaskAssigne(bpmTask);
   
        broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.ASSIGN_TASK, bpmTask, user));
        broadcastEvent(ctx, new ViewEvent(ViewEvent.Type.ACTION_COMPLETE));

        return bpmTask;
    }
View Full Code Here


          if (outgoingTransitionNames.size() == 1)
              processEngine.getTaskService().completeTask(task.getInternalTaskId(), outgoingTransitionNames.get(0), vars); //BPMN2.0 style, decision is taken on the XOR gateway
          else
              processEngine.getTaskService().completeTask(task.getInternalTaskId(), action.getBpmName(), vars);
         
          broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.TASK_FINISHED, task, user));
         
       /* Inform queue manager about task finish and process state change */
       ctx.getUserProcessQueueManager().onTaskFinished(task);        
  
          String processState = getProcessState(processInstance, ctx);
         
          /* Check if new subProcess is created */
          boolean startsSubprocess = updateSubprocess(processInstance, executionId, ctx);

          fillProcessAssignmentData(processEngine, processInstance, ctx);
          processInstance.setState(processState);
          if (startsSubprocess == false && processState == null && processInstance.getRunning() && !isProcessRunning(processInstance.getInternalId(), ctx)) {
              processInstance.setRunning(false);
          }
         
         
         
           if (log.getUserSubstitute() == null)
               broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.SIGNAL_PROCESS, bpmTask, user));
           else
               broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.SIGNAL_PROCESS, bpmTask, log.getUserSubstitute()));

           if (Strings.hasText(action.getAssignProcessStatus())) {
               String processStatus = action.getAssignProcessStatus();
               ProcessStatus ps = processStatus.length() == 1 ? ProcessStatus.fromChar(processStatus.charAt(0)) : ProcessStatus.fromString(processStatus);
               processInstance.setStatus(ps);
           }
           else
           {
             boolean isProcessRunning = processInstance.isProcessRunning();
             //boolean isProcessRunning = isProcessRunning(pi.getInternalId(), ctx);
            
             /* Process is not running and no new suprocesses are created, so process should
              * be finished by now
              */
             if(!isProcessRunning && !startsSubprocess)
             {
               broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.END_PROCESS, bpmTask, user));
              
               /* Inform queue manager about process ending. Only main process is stored */
               if(!processInstance.isSubprocess())
                 ctx.getUserProcessQueueManager().onProcessFinished(processInstance, bpmTask);
              
               processInstance.setStatus(ProcessStatus.FINISHED);
             }
            
             /* Process is running or is halted, but new subprocess are created */
             else if(!isProcessRunning && startsSubprocess
             {
               broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.PROCESS_HALTED, bpmTask, user));
              
               /* Inform queue manager about process halt */
               ctx.getUserProcessQueueManager().onProcessHalted(processInstance, bpmTask);
              
               processInstance.setStatus(ProcessStatus.RUNNING);
             }
             else
             {
               processInstance.setStatus(ProcessStatus.RUNNING);
             }
           }
          
           ctx.getProcessInstanceDAO().saveProcessInstance(processInstance);

           BpmTask userTask = null;

           BpmTask autoSkipTask = null;
          
           /* Is process finished */
           boolean isProcessFinished = processInstance.getStatus().equals(ProcessStatus.FINISHED);
           boolean isSubProcess = processInstance.getParent() != null;

           List<BpmTask> tasksAfterCompletion = null;
           if(startsSubprocess && processInstance.getChildren() != null) {
             for(ProcessInstance child : processInstance.getChildren()) {
               tasksAfterCompletion = findProcessTasks(child, ctx);
               if(tasksAfterCompletion != null && tasksAfterCompletion.size() > 0)
                 break;
             }
           }
           if(tasksAfterCompletion == null || tasksAfterCompletion.size() == 0) {
               tasksAfterCompletion = findProcessTasks(processInstance, ctx);
           }
           if(processInstance.getParent() != null && (tasksAfterCompletion == null || tasksAfterCompletion.size() == 0)) {
               tasksAfterCompletion = findProcessTasks(processInstance.getParent(), ctx);
           }
           if(tasksAfterCompletion != null) {
             for (BpmTask createdTask : tasksAfterCompletion) {
                 if (!taskIdsBeforeCompletion.contains(createdTask.getInternalTaskId()))
                 {
                     broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.ASSIGN_TASK, createdTask, user));
                    
                 /* Inform queue manager about task assigne */
                 ctx.getUserProcessQueueManager().onTaskAssigne(createdTask);
                 }
                 if (Lang.equals(user.getId(), createdTask.getOwner().getId())) {
View Full Code Here

       processEngine.getTaskService().assignTask(taskId, userLogin);
       BpmTask taskData = getTaskData(taskId, ctx);
       UserData newUser = new UserData()
       newUser.setLogin(userLogin);
       UserData loadOrCreateUser = loadOrCreateUser(ctx,newUser);
       broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.ASSIGN_TASK, taskData, loadOrCreateUser));
       broadcastEvent(ctx, new BpmEvent(BpmEvent.Type.ASSIGN_TASK, taskData, user));
    ctx.getUserProcessQueueManager().onTaskAssigne(taskData);
      long duration = System.currentTimeMillis() - start;
    log.severe("assignTaskToUser: " +  duration);
     }
View Full Code Here

        pi2.addProcessLog(log);

        fillProcessAssignmentData(pi2, ctx);
        ctx.getProcessInstanceDAO().saveProcessInstance(pi2);

        eventBusManager.publish(new BpmEvent(BpmEvent.Type.ASSIGN_TASK,
                pi2, user));

        ctx.getEventBusManager().publish(new BpmEvent(BpmEvent.Type.ASSIGN_TASK,
                pi2,
                user));

        return getTaskData(task.getId(), ctx);
    }
View Full Code Here

            ctx.getProcessInstanceDAO().saveProcessInstance(subPi);
          }
    }

    private void publishEvents(ProcessInstance processInstance, BpmEvent.Type signalProcess) {
        eventBusManager.publish(new BpmEvent(signalProcess,
                processInstance,
                user));
        ProcessToolContext.Util.getThreadProcessToolContext().getEventBusManager().publish(new BpmEvent(signalProcess,
                processInstance,
                user));
    }
View Full Code Here

     
      /* Map parent process owners to subprocess */
      newSubprocessInstance.getOwners().addAll(parentProcessInstance.getOwners());
     
      /* Inform about parent process halt */
        broadcastEvent(ctx, new BpmEvent(Type.PROCESS_HALTED, parentProcessInstance, parentProcessInstance.getCreator()));
     
      return newSubprocessInstance;
  }
View Full Code Here

            newProcessInstance.setState(taskName);
        ctx.getProcessInstanceDAO().saveProcessInstance(newProcessInstance);

        Collection<IEvent> events = new ArrayList<IEvent>();
        events.add(new BpmEvent(Type.NEW_PROCESS, newProcessInstance, creator));

    List<BpmTask> processTasks = findProcessTasks(newProcessInstance, ctx);

    if (!processTasks.isEmpty()) {
      for (BpmTask task : processTasks)
      {
        events.add(new BpmEvent(Type.ASSIGN_TASK, task, creator));

        /* Inform queue manager about task assigne */
        ctx.getUserProcessQueueManager().onTaskAssigne(task);
      }
    }
 
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.processtool.bpm.BpmEvent

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.