Search in sources :

Example 51 with QueryFilter

use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.

the class RuntimeDataServiceImplTaskLookupTest method testGetTasksAssignedAsPotentialOwner.

@Test
public void testGetTasksAssignedAsPotentialOwner() {
    asssertProcessInstance();
    List<TaskSummary> taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("maciej", new QueryFilter());
    assertNotNull(taskSummaries);
    assertEquals(1, taskSummaries.size());
    taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("kris", new QueryFilter());
    assertNotNull(taskSummaries);
    assertEquals(2, taskSummaries.size());
    taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("tihomir", new QueryFilter());
    assertNotNull(taskSummaries);
    assertEquals(0, taskSummaries.size());
    processService.abortProcessInstance(processInstanceId);
    processInstanceId = null;
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) TaskSummary(org.kie.api.task.model.TaskSummary) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 52 with QueryFilter

use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.

the class CommandBasedTaskService method getTasksOwnedByExpirationDateOptional.

@Override
public List<TaskSummary> getTasksOwnedByExpirationDateOptional(String userId, List<Status> statuses, Date expirationDate) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("expirationDate", expirationDate);
    return getTasksOwned(userId, statuses, new QueryFilter("(t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null)", params, "t.id", false));
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) HashMap(java.util.HashMap)

Example 53 with QueryFilter

use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.

the class CommandBasedTaskService method getTasksOwnedByExpirationDate.

@Override
public List<TaskSummary> getTasksOwnedByExpirationDate(String userId, List<Status> statuses, Date expirationDate) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("expirationDate", expirationDate);
    return getTasksOwned(userId, statuses, new QueryFilter("t.taskData.expirationTime = :expirationDate", params, "t.id", false));
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) HashMap(java.util.HashMap)

Example 54 with QueryFilter

use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.

the class ProcessInstanceAdminServiceImplTest method testTrigerLastActionNode.

@Test
public void testTrigerLastActionNode() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    Collection<NodeInstanceDesc> activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    NodeInstanceDesc active = activeNodes.iterator().next();
    assertEquals("Write a Document", active.getName());
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    assertEquals(1, tasks.size());
    Collection<ProcessNode> processNodes = processAdminService.getProcessNodes(processInstanceId);
    ProcessNode writeDocNode = processNodes.stream().filter(pn -> pn.getNodeName().equals("Report")).findFirst().orElse(null);
    processAdminService.triggerNode(processInstanceId, writeDocNode.getNodeId());
    activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
    assertNotNull(activeNodes);
    assertEquals(0, activeNodes.size());
    tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    assertEquals(0, tasks.size());
    ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(processInstanceId);
    assertEquals(ProcessInstance.STATE_COMPLETED, pi.getState().intValue());
    processInstanceId = null;
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) TaskSummary(org.kie.api.task.model.TaskSummary) ProcessNode(org.jbpm.services.api.admin.ProcessNode) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc) NodeInstanceDesc(org.jbpm.services.api.model.NodeInstanceDesc) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 55 with QueryFilter

use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.

the class ProcessInstanceAdminServiceImplTest method testRetriggerNodeInstance.

@Test
public void testRetriggerNodeInstance() {
    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    Collection<NodeInstanceDesc> activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    NodeInstanceDesc active = activeNodes.iterator().next();
    assertEquals("Write a Document", active.getName());
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    assertEquals(1, tasks.size());
    TaskSummary task = tasks.get(0);
    processAdminService.retriggerNodeInstance(processInstanceId, active.getId());
    activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    NodeInstanceDesc activeRetriggered = activeNodes.iterator().next();
    assertFalse(active.getId().longValue() == activeRetriggered.getId().longValue());
    tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    assertEquals(1, tasks.size());
    TaskSummary taskRetriggered = tasks.get(0);
    assertFalse(task.getId().longValue() == taskRetriggered.getId().longValue());
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) TaskSummary(org.kie.api.task.model.TaskSummary) NodeInstanceDesc(org.jbpm.services.api.model.NodeInstanceDesc) KModuleDeploymentServiceTest(org.jbpm.kie.services.test.KModuleDeploymentServiceTest) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Aggregations

QueryFilter (org.kie.internal.query.QueryFilter)149 Test (org.junit.Test)127 TaskSummary (org.kie.api.task.model.TaskSummary)122 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)52 HashMap (java.util.HashMap)47 AbstractCaseServicesBaseTest (org.jbpm.casemgmt.impl.util.AbstractCaseServicesBaseTest)31 KModuleDeploymentServiceTest (org.jbpm.kie.services.test.KModuleDeploymentServiceTest)26 AuditTask (org.kie.internal.task.api.AuditTask)25 ArrayList (java.util.ArrayList)24 QueryContext (org.kie.api.runtime.query.QueryContext)24 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)23 CaseInstance (org.jbpm.casemgmt.api.model.instance.CaseInstance)21 Task (org.kie.api.task.model.Task)19 CaseFileInstance (org.jbpm.casemgmt.api.model.instance.CaseFileInstance)18 TaskFluent (org.jbpm.services.task.utils.TaskFluent)17 TaskEvent (org.kie.internal.task.api.model.TaskEvent)17 HumanTaskServicesBaseTest (org.jbpm.services.task.HumanTaskServicesBaseTest)14 Status (org.kie.api.task.model.Status)13 OrganizationalEntity (org.kie.api.task.model.OrganizationalEntity)11 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)10