Search in sources :

Example 26 with AuditTask

use of org.kie.internal.task.api.AuditTask in project jbpm by kiegroup.

the class GetAllAuditTasksByStatusCommand method execute.

@Override
public List<AuditTask> execute(Context context) {
    TaskPersistenceContext persistenceContext = ((TaskContext) context).getPersistenceContext();
    List<AuditTask> groupTasks = persistenceContext.queryWithParametersInTransaction("getAllAuditTasksByStatus", persistenceContext.addParametersToMap("owner", userId, "statuses", filter.getParams().get("statuses"), "firstResult", filter.getOffset(), "maxResults", filter.getCount()), ClassUtil.<List<AuditTask>>castClass(List.class));
    return groupTasks;
}
Also used : TaskContext(org.kie.internal.task.api.TaskContext) List(java.util.List) TaskPersistenceContext(org.kie.internal.task.api.TaskPersistenceContext) AuditTask(org.kie.internal.task.api.AuditTask)

Example 27 with AuditTask

use of org.kie.internal.task.api.AuditTask in project jbpm by kiegroup.

the class GetAllGroupAuditTasksByUserCommand method execute.

@Override
public List<AuditTask> execute(Context context) {
    TaskPersistenceContext persistenceContext = ((TaskContext) context).getPersistenceContext();
    boolean userExists = doCallbackUserOperation(userId, (TaskContext) context);
    List<String> groupIds = doUserGroupCallbackOperation(userId, null, (TaskContext) context);
    groupIds.add(userId);
    List<AuditTask> groupTasks = persistenceContext.queryWithParametersInTransaction("getAllGroupAuditTasksByUser", persistenceContext.addParametersToMap("potentialOwners", groupIds, "firstResult", filter.getOffset(), "maxResults", filter.getCount()), ClassUtil.<List<AuditTask>>castClass(List.class));
    return groupTasks;
}
Also used : TaskContext(org.kie.internal.task.api.TaskContext) List(java.util.List) TaskPersistenceContext(org.kie.internal.task.api.TaskPersistenceContext) AuditTask(org.kie.internal.task.api.AuditTask)

Example 28 with AuditTask

use of org.kie.internal.task.api.AuditTask in project jbpm by kiegroup.

the class RuntimeDataServiceEJBIntegrationTest method testGetTaskAudit.

@Test
public void testGetTaskAudit() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    ProcessInstance instance = processService.getProcessInstance(processInstanceId);
    assertNotNull(instance);
    Collection<NodeInstance> activeNodes = ((WorkflowProcessInstanceImpl) instance).getNodeInstances();
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    NodeInstance node = activeNodes.iterator().next();
    assertNotNull(node);
    assertTrue(node instanceof WorkItemNodeInstance);
    Long workItemId = ((WorkItemNodeInstance) node).getWorkItemId();
    assertNotNull(workItemId);
    List<AuditTask> auditTasks = runtimeDataService.getAllAuditTask("salaboy", new QueryFilter(0, 10));
    assertNotNull(auditTasks);
    assertEquals(1, auditTasks.size());
    assertEquals("Write a Document", auditTasks.get(0).getName());
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) WorkflowProcessInstanceImpl(org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkItemNodeInstance(org.jbpm.workflow.instance.node.WorkItemNodeInstance) NodeInstance(org.kie.api.runtime.process.NodeInstance) WorkItemNodeInstance(org.jbpm.workflow.instance.node.WorkItemNodeInstance) AuditTask(org.kie.internal.task.api.AuditTask) Test(org.junit.Test)

Aggregations

AuditTask (org.kie.internal.task.api.AuditTask)28 QueryFilter (org.kie.internal.query.QueryFilter)23 Test (org.junit.Test)19 Task (org.kie.api.task.model.Task)16 TaskFluent (org.jbpm.services.task.utils.TaskFluent)15 HumanTaskServicesBaseTest (org.jbpm.services.task.HumanTaskServicesBaseTest)12 TaskSummary (org.kie.api.task.model.TaskSummary)7 TaskEvent (org.kie.internal.task.api.model.TaskEvent)6 ArrayList (java.util.ArrayList)5 List (java.util.List)4 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)4 HashMap (java.util.HashMap)3 WorkflowProcessInstanceImpl (org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl)3 WorkItemNodeInstance (org.jbpm.workflow.instance.node.WorkItemNodeInstance)3 NodeInstance (org.kie.api.runtime.process.NodeInstance)3 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)3 TaskContext (org.kie.internal.task.api.TaskContext)3 TaskPersistenceContext (org.kie.internal.task.api.TaskPersistenceContext)3 Date (java.util.Date)2 I18NTextImpl (org.jbpm.services.task.impl.model.I18NTextImpl)2