use of org.jbpm.process.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class AuditTaskDeleteTest method buildCompletedProcessInstance.
private ProcessInstanceLog buildCompletedProcessInstance(long processInstanceId) {
ProcessInstanceLog pil = new ProcessInstanceLog(processInstanceId, "test");
pil.setDuration(0L);
pil.setExternalId("none");
pil.setIdentity("none");
pil.setOutcome("");
pil.setParentProcessInstanceId(-1L);
pil.setProcessId("test");
pil.setProcessName("test process");
pil.setProcessVersion("1");
pil.setStatus(2);
pil.setStart(null);
pil.setEnd(null);
return pil;
}
use of org.jbpm.process.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class ManagedAuditEventBuilderImpl method buildEvent.
@Override
public AuditEvent buildEvent(ProcessStartedEvent pse) {
ProcessInstanceLog log = (ProcessInstanceLog) super.buildEvent(pse);
log.setExternalId(ownerId);
return log;
}
use of org.jbpm.process.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class ManagedAuditEventBuilderImpl method buildEvent.
@Override
public AuditEvent buildEvent(ProcessCompletedEvent pce, Object log) {
ProcessInstanceLog instanceLog = (ProcessInstanceLog) super.buildEvent(pce, log);
instanceLog.setExternalId(ownerId);
return instanceLog;
}
use of org.jbpm.process.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class ActivityTest method testCallActivitySkipAbortParent.
@Test
@RequirePersistence
public void testCallActivitySkipAbortParent() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-CallActivitySkipAbortParent.bpmn2", "BPMN2-UserTask.bpmn2");
ksession = createKnowledgeSession(kbase);
TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "oldValue");
ProcessInstance processInstance = ksession.startProcess("ParentProcess", params);
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
WorkItem workItem = workItemHandler.getWorkItem();
assertNotNull(workItem);
assertEquals("john", workItem.getParameter("ActorId"));
long childPI = workItem.getProcessInstanceId();
assertNotEquals("Child process instance must be different", processInstance.getId(), childPI);
ksession.abortProcessInstance(childPI);
assertProcessInstanceFinished(processInstance, ksession);
ProcessInstanceLog log = logService.findProcessInstance(childPI);
assertNotNull(log);
assertEquals(ProcessInstance.STATE_ABORTED, log.getStatus().intValue());
// parent process instance should not be aborted
log = logService.findProcessInstance(processInstance.getId());
assertNotNull(log);
assertEquals("Parent process should be completed and not aborted", ProcessInstance.STATE_COMPLETED, log.getStatus().intValue());
}
use of org.jbpm.process.audit.ProcessInstanceLog in project jbpm by kiegroup.
the class ActivityTest method testScriptTaskWithHistoryLog.
@Test
@RequirePersistence
public void testScriptTaskWithHistoryLog() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-ScriptTask.bpmn2");
ksession = createKnowledgeSession(kbase);
ProcessInstance processInstance = ksession.startProcess("ScriptTask");
assertProcessInstanceCompleted(processInstance);
AuditLogService logService = new JPAAuditLogService(ksession.getEnvironment());
List<NodeInstanceLog> logs = logService.findNodeInstances(processInstance.getId());
assertNotNull(logs);
assertEquals(6, logs.size());
for (NodeInstanceLog log : logs) {
assertNotNull(log.getDate());
}
ProcessInstanceLog pilog = logService.findProcessInstance(processInstance.getId());
assertNotNull(pilog);
assertNotNull(pilog.getEnd());
List<ProcessInstanceLog> pilogs = logService.findActiveProcessInstances(processInstance.getProcessId());
assertNotNull(pilogs);
assertEquals(0, pilogs.size());
logService.dispose();
}
Aggregations