Examples of ProcessInstanceLog


Examples of org.jbpm.process.audit.ProcessInstanceLog

        ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");

        System.out.println("Process started");

        AuditLogService logService = (AuditLogService) context.getBean("logService");
        ProcessInstanceLog log = logService.findProcessInstance(processInstance.getId());
        assertNotNull(log);

        List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
        System.out.println("Found " + tasks.size() + " task(s) for user 'john'");
        assertEquals(1, tasks.size());
View Full Code Here

Examples of org.jbpm.process.audit.ProcessInstanceLog

    //@PersistenceUnit(unitName = "org.jbpm.domain")
  private EntityManagerFactory emf;

  public List<ActiveNodeInfo> getActiveNodeInfo(String instanceId) {
      AuditLogService auditLogService = new JPAAuditLogService(emf);
    ProcessInstanceLog processInstance = auditLogService.findProcessInstance(new Long(instanceId));
    if (processInstance == null) {
      throw new IllegalArgumentException("Could not find process instance " + instanceId);
    }
    Map<String, NodeInstanceLog> nodeInstances = new HashMap<String, NodeInstanceLog>();
    for (NodeInstanceLog nodeInstance: auditLogService.findNodeInstances(new Long(instanceId))) {
      if (nodeInstance.getType() == NodeInstanceLog.TYPE_ENTER) {
        nodeInstances.put(nodeInstance.getNodeInstanceId(), nodeInstance);
      } else {
        nodeInstances.remove(nodeInstance.getNodeInstanceId());
      }
    }
    if (!nodeInstances.isEmpty()) {
      List<ActiveNodeInfo> result = new ArrayList<ActiveNodeInfo>();
      for (NodeInstanceLog nodeInstance: nodeInstances.values()) {
        boolean found = false;
        DiagramInfo diagramInfo = getDiagramInfo(processInstance.getProcessId());
        if (diagramInfo != null) {
            for (DiagramNodeInfo nodeInfo: diagramInfo.getNodeList()) {
              if (nodeInfo.getName().equals("id=" + nodeInstance.getNodeId())) {
                result.add(new ActiveNodeInfo(diagramInfo.getWidth(), diagramInfo.getHeight(), nodeInfo));
                found = true;
                break;
              }
            }
        } else {
            throw new IllegalArgumentException("Could not find info for diagram for process " + processInstance.getProcessId());
        }
        if (!found) {
          throw new IllegalArgumentException("Could not find info for node "
            + nodeInstance.getNodeId() + " of process " + processInstance.getProcessId());
        }
      }
      return result;
    }
    return null;
View Full Code Here

Examples of org.jbpm.process.audit.ProcessInstanceLog

        System.out.println("Process started");

        AuditLogService logService = (AuditLogService) context.getBean("logService");
        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        TransactionStatus status = aptm.getTransaction(def);
        ProcessInstanceLog log = logService.findProcessInstance(processInstance.getId());
        aptm.commit(status);
        assertNotNull(log);

        List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
        System.out.println("Found " + tasks.size() + " task(s) for user 'john'");
View Full Code Here

Examples of org.jbpm.process.audit.ProcessInstanceLog

        System.out.println("Found " + tasks.size() + " task(s) for user 'john'");
        assertEquals(0, tasks.size());

        def = new DefaultTransactionDefinition();
        status = aptm.getTransaction(def);
        ProcessInstanceLog log = logService.findProcessInstance(processInstanceId);
        aptm.commit(status);
        assertNull(log);
    }
View Full Code Here

Examples of org.jbpm.process.audit.ProcessInstanceLog

        ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");

        System.out.println("Process started");

        AuditLogService logService = (AuditLogService) context.getBean("logService");
        ProcessInstanceLog log = logService.findProcessInstance(processInstance.getId());
        assertNotNull(log);

        List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
        System.out.println("Found " + tasks.size() + " task(s) for user 'john'");
        assertEquals(1, tasks.size());
View Full Code Here

Examples of org.kie.api.runtime.manager.audit.ProcessInstanceLog

        xmlLog.setCommandName("test-cmd");
        xmlLog.setIndex(2);
        JaxbProcessInstanceLog newXmlLog = testRoundTrip(xmlLog);
        ComparePair.compareObjectsViaFields(xmlLog, newXmlLog, "id");
       
        ProcessInstanceLog newLog = newXmlLog.getResult();
        ProcessInstanceLog origCmpLog = (ProcessInstanceLog) origLog;
        assertEquals( origLog.getExternalId(), newLog.getExternalId() );
        assertEquals( origCmpLog.getIdentity(), newLog.getIdentity());
        assertEquals( origCmpLog.getOutcome(), newLog.getOutcome());
        assertEquals( origCmpLog.getProcessId(), newLog.getProcessId() );
        assertEquals( origCmpLog.getProcessName(), newLog.getProcessName() );
        assertEquals( origCmpLog.getProcessVersion(), newLog.getProcessVersion() );
        assertEquals( origCmpLog.getDuration(), newLog.getDuration() );
        assertEquals( origCmpLog.getEnd(), newLog.getEnd() );
        assertEquals( origCmpLog.getParentProcessInstanceId(), newLog.getParentProcessInstanceId() );
        assertEquals( origCmpLog.getProcessInstanceId(), newLog.getProcessInstanceId() );
        assertEquals( origCmpLog.getStart(), newLog.getStart() );
        assertEquals( origCmpLog.getStatus(), newLog.getStatus() );
    }
View Full Code Here

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

        if (!user.getLogin().equals(task.getAssignee())) {
            loger.warning("Task: + " + bpmTask.getExecutionId() + " not assigned to requesting user: " + user.getLogin());
            return null;
        }

        ProcessInstanceLog log = new ProcessInstanceLog();
        log.setLogType(ProcessInstanceLog.LOG_TYPE_CLAIM_PROCESS);

        ctx.getProcessInstanceDAO().saveProcessInstance(pi);
        bpmTask = collectTask(task, pi, ctx);
        log.setState(ctx.getProcessDefinitionDAO().getProcessStateConfiguration(bpmTask));
        log.setEntryDate(snapshotDate);
        log.setEventI18NKey("process.log.process-assigned");
        log.setLogValue(pq.getName());
        log.setUser(findOrCreateUser(user, ctx));
        log.setAdditionalInfo(pq.getDescription());
        log.setExecutionId(task.getExecutionId());
        log.setOwnProcessInstance(pi);
        pi.getRootProcessInstance().addProcessLog(log);

        if (!ProcessStatus.RUNNING.equals(pi.getStatus())) {
            pi.setStatus(ProcessStatus.RUNNING);
        }
View Full Code Here

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

           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);
View Full Code Here

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

    }

    private ProcessInstanceLog addActionLogEntry(ProcessStateAction action, BpmTask task, ProcessToolContext ctx) {
        ProcessStateConfiguration state = ctx.getProcessDefinitionDAO().getProcessStateConfiguration(task);

        ProcessInstanceLog log = new ProcessInstanceLog();
        if(AUTO_SKIP_ACTION_NAME.toLowerCase().equals(action.getBpmName().toLowerCase()))
          return log;
       
        log.setLogType(ProcessInstanceLog.LOG_TYPE_PERFORM_ACTION);
        log.setState(state);
        log.setEntryDate(Calendar.getInstance());
        log.setEventI18NKey("process.log.action-performed");
        log.setLogValue(action.getBpmName());
        log.setAdditionalInfo(nvl(action.getLabel(), action.getDescription(), action.getBpmName()));
        log.setUser(findOrCreateUser(user, ctx));
        log.setUserSubstitute(getSubstitutingUser(ctx));
        log.setExecutionId(task.getExecutionId());
        log.setOwnProcessInstance(task.getProcessInstance());
        task.getProcessInstance().getRootProcessInstance().addProcessLog(log);
        return log;
    }
View Full Code Here

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

        else
          newProcessInstance.setInternalId(internalId);

        creator = findOrCreateUser(creator, ctx);

        ProcessInstanceLog log = new ProcessInstanceLog();
        log.setState(null);
        log.setEntryDate(Calendar.getInstance());
        log.setEventI18NKey("process.log.process-started");
        log.setUser(creator);
        log.setLogType(ProcessInstanceLog.LOG_TYPE_START_PROCESS);
        log.setOwnProcessInstance(newProcessInstance);
        newProcessInstance.getRootProcessInstance().addProcessLog(log);
        List<BpmTask> findProcessTasks = findProcessTasks(newProcessInstance, ctx);
        String taskName = findProcessTasks.get(0).getTaskName();

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.