Package pl.net.bluesoft.rnd.processtool.model

Examples of pl.net.bluesoft.rnd.processtool.model.BpmTask


                    withErrorHandling(getApplication(), new Runnable() {
                        public void run() {
                             if (event.isDoubleClick()) {
                                 ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
                                 BeanItem<ProcessQueue> beanItem = bic.getItem(event.getItemId());
                                 BpmTask task = session.assignTaskFromQueue(beanItem.getBean(), ctx);
                                 if (task != null) {
                                     getWindow().executeJavaScript("Liferay.trigger('processtool.bpm.assignProcess', '"
                                             + task.getProcessInstance().getInternalId() + "');");
                                     getWindow().executeJavaScript("vaadin.forceSync();");
                                     Window w = new Window(task.getProcessInstance().getInternalId());
                                     w.setContent(new ProcessDataPane(getApplication(), session, i18NSource, task, new WindowProcessDataDisplayContext(w)));
                                     w.center();
                                     getWindow().addWindow(w);
                                   w.focus();
View Full Code Here


                        getWindow().executeJavaScript("Liferay.trigger('processtool.bpm.newProcess', '" + instance.getInternalId() + "');");
                        getWindow().executeJavaScript("vaadin.forceSync();");

                        List<BpmTask> tasks = session.findUserTasks(instance, ctx);
                        if (!tasks.isEmpty()) {
                            BpmTask task = tasks.get(0);
                            if (activityMainPane != null) {
                                activityMainPane.displayProcessData(task, session);
                            }
                            else {
                                Window w = new Window(instance.getInternalId());
View Full Code Here

        getWindow().executeJavaScript("Liferay.trigger('processtool.bpm.newProcess', '" + instance.getInternalId() + "');");
        getWindow().executeJavaScript("vaadin.forceSync();");

        List<BpmTask> tasks = session.findUserTasks(instance, ctx);
        if (!tasks.isEmpty()) {
          BpmTask task = tasks.get(0);
          if (activityMainPane != null) {
            activityMainPane.displayProcessData(task, session);
          }
          else {
            Window w = new Window(instance.getInternalId());
View Full Code Here

    }

  @Override
    @WebMethod
    public void assignTaskToUser(@WebParam(name="taskId")final String taskId, @WebParam(name="userLogin")final String userLogin) throws AperteWsWrongArgumentException {
    final BpmTask taskData = getTaskData(taskId);
    final UserData user = findUser(userLogin);   
        withContext(new ReturningProcessToolContextCallback<ProcessInstance>() {
            @Override
            public ProcessInstance processWithContext(ProcessToolContext ctx) {           
                getSession(ctx, user).assignTaskToUser(ctx, taskData.getInternalTaskId(), userLogin);
                return null;
            }
        });
    }
View Full Code Here

  @WebMethod (exclude=true)
    public BpmTask getTaskData(@WebParam(name="taskId")final String taskId) throws AperteWsWrongArgumentException, AperteWsIllegalArgumentException {
   
    AperteErrorCheckUtil.checkCorrectnessOfArgument(taskId, AperteIllegalArgumentCodes.TASK_ID);
   
    BpmTask taskData =  withContext(new ReturningProcessToolContextCallback<BpmTask>() {
            @Override
            public BpmTask processWithContext(ProcessToolContext ctx) {
                return fetchHibernateData(getSession(ctx).getTaskData(taskId, ctx));
            }
        });
View Full Code Here

    public void performAction(@WebParam(name="procesInstanceInternalId")final String internalId,
                    @WebParam(name="actionName")final String actionName,
                                 @WebParam(name="bpmTaskName")final String bpmTaskName,
                                 @WebParam(name="userLogin")final String userLogin) throws  AperteWsWrongArgumentException {
   
    final BpmTask bpmTask = findProcessTask(internalId, userLogin, bpmTaskName);
    final UserData user = findUser(userLogin);  
    final ProcessInstance processData = getProcessData(internalId);
    final ProcessStateAction action= getActionIfExists(processData, actionName);
   
    if(userLogin==null){
      adminCompleteTask(processData, action, bpmTask);
    }
    BpmTask[] bpmnTable = {bpmTask};
    processData.setActiveTasks(bpmnTable);
      BpmTask withContextBpmnTask = withContext(new ReturningProcessToolContextCallback<BpmTask>() {
              @Override
              public BpmTask processWithContext(ProcessToolContext ctx) {
                             
                  getSession(ctx, user).performAction(action, bpmTask, ctx);
                  return null;
View Full Code Here

       ResultsPageWrapper<ProcessInstance> recentInstances = ctx.getProcessInstanceDAO().getRecentProcesses(user, minDate, offset, limit);
       Collection<ProcessInstance> instances = recentInstances.getResults();
       for (ProcessInstance pi : instances) {
         List<BpmTask> tasks = findProcessTasks(pi, user.getLogin(), ctx);
         if (tasks.isEmpty()) {
           BpmTask task = getMostRecentProcessHistoryTask(pi, user, minDate, ctx);
           if (task != null) {
             recentTasks.add(task);
           }
         }
         else {
View Full Code Here

        
         TaskImpl taskInstance = (TaskImpl)resultRow[0];
         ProcessInstance processInstance = (ProcessInstance)resultRow[1];
        
         /* Map process and jbpm task to system's bpm task */
         BpmTask task = taskFactory.create(taskInstance, processInstance);
        
         result.add(task);
       }
      
       return result;
View Full Code Here

    
    
  @Override
    public BpmTask performAction(ProcessStateAction action, BpmTask task, ProcessToolContext ctx)
     {
           BpmTask bpmTask = getTaskData(task.getInternalTaskId(), ctx);

          
           if (bpmTask == null || bpmTask.isFinished())

               return bpmTask;
          
           ProcessInstance processInstance = bpmTask.getProcessInstance();
           ProcessInstanceLog log = addActionLogEntry(action, task, ctx);
           Map<String, Object> vars = new HashMap<String, Object>();
           vars.put("ACTION", action.getBpmName());
           processInstance.setSimpleAttribute("ACTION", action.getBpmName());
           List<String> outgoingTransitionNames = getOutgoingTransitionNames(task.getInternalTaskId(), ctx);

           ProcessEngine processEngine = getProcessEngine(ctx);

           Task bpmTaskInstance = processEngine.getTaskService().getTask(task.getInternalTaskId());
           String executionId = bpmTaskInstance.getExecutionId();


           Set<String> taskIdsBeforeCompletion = new HashSet<String>();

           pl.net.bluesoft.util.lang.Collections.collect(findProcessTasksWithUser(processInstance, ctx), new Transformer<BpmTask, String>() {

               @Override
               public String transform(BpmTask obj) {
                   return obj.getInternalTaskId()
               }
           }, taskIdsBeforeCompletion);

          
          
          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;

View Full Code Here

     @Override
     public void assignTaskToUser(ProcessToolContext ctx, String taskId, String userLogin) {
      long start = System.currentTimeMillis();
       ProcessEngine processEngine = getProcessEngine(ctx);
       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));
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.processtool.model.BpmTask

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.