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;
}
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));
}
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));
}
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;
}
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());
}
Aggregations