Search in sources :

Example 31 with Status

use of org.kie.api.task.model.Status in project jbpm by kiegroup.

the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerByStatusWithUserStatusLangOneTaskReserved.

@Test
public void testGetTasksAssignedAsPotentialOwnerByStatusWithUserStatusLangOneTaskReserved() {
    // One potential owner, should go straight to state Reserved
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet') ],businessAdministrators = [ new User('Administrator') ], }),";
    str += "name =  'This is my task name' })";
    Task task = TaskFactory.evalTask(new StringReader(str));
    taskService.addTask(task, new HashMap<String, Object>());
    List<Status> statuses = new ArrayList<Status>();
    statuses.add(Status.Reserved);
    List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwnerByStatus("Bobba Fet", statuses, "en-UK");
    assertEquals(1, tasks.size());
    assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
}
Also used : Status(org.kie.api.task.model.Status) Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) TaskSummary(org.kie.api.task.model.TaskSummary) Test(org.junit.Test)

Example 32 with Status

use of org.kie.api.task.model.Status in project jbpm by kiegroup.

the class TaskQueryServiceBaseTest method testGetTasksOwnedWithUserStatusLangOneTask.

@Test
public void testGetTasksOwnedWithUserStatusLangOneTask() {
    // One potential owner, should go straight to state Reserved
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet')  ],businessAdministrators = [ new User('Administrator') ], }),";
    str += "name = 'This is my task name' })";
    Task task = TaskFactory.evalTask(new StringReader(str));
    taskService.addTask(task, new HashMap<String, Object>());
    List<Status> statuses = new ArrayList<Status>();
    statuses.add(Status.Reserved);
    List<TaskSummary> tasks = taskService.getTasksOwnedByStatus("Bobba Fet", statuses, "en-UK");
    assertEquals(1, tasks.size());
    assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
}
Also used : Status(org.kie.api.task.model.Status) Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) TaskSummary(org.kie.api.task.model.TaskSummary) Test(org.junit.Test)

Example 33 with Status

use of org.kie.api.task.model.Status in project jbpm by kiegroup.

the class TaskQueryServiceBaseTest method testGetTasksOwnedByExpirationDateWithUserStatusDateOneTaskReserved.

@Test
public void testGetTasksOwnedByExpirationDateWithUserStatusDateOneTaskReserved() {
    // One potential owner, should go straight to state Reserved
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { expirationTime = new Date( 10000000 ), } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet')  ],businessAdministrators = [ new User('Administrator') ], }),";
    str += "name =  'This is my task name' })";
    Task task = TaskFactory.evalTask(new StringReader(str));
    taskService.addTask(task, new HashMap<String, Object>());
    List<Status> statuses = new ArrayList<Status>();
    statuses.add(Status.Reserved);
    Date date = new Date(10000000);
    List<TaskSummary> tasks = taskService.getTasksOwnedByExpirationDate("Bobba Fet", statuses, date);
    assertEquals(1, tasks.size());
    assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
}
Also used : Status(org.kie.api.task.model.Status) Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) TaskSummary(org.kie.api.task.model.TaskSummary) Date(java.util.Date) Test(org.junit.Test)

Example 34 with Status

use of org.kie.api.task.model.Status in project jbpm by kiegroup.

the class TaskQueryServiceBaseTest method testGetTasksAssignedByExpirationDateOptional.

@Test
public void testGetTasksAssignedByExpirationDateOptional() {
    // One potential owner, should go straight to state Reserved
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet')],businessAdministrators = [ new User('Administrator') ], }),";
    str += "name =  'This is my task name' })";
    Task task = TaskFactory.evalTask(new StringReader(str));
    taskService.addTask(task, new HashMap<String, Object>());
    List<Status> statuses = new ArrayList<Status>();
    statuses.add(Status.InProgress);
    statuses.add(Status.Reserved);
    statuses.add(Status.Created);
    List<TaskSummary> tasks = taskService.getTasksOwnedByExpirationDateOptional("Bobba Fet", statuses, new Date());
    assertEquals(1, tasks.size());
}
Also used : Status(org.kie.api.task.model.Status) Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) TaskSummary(org.kie.api.task.model.TaskSummary) Date(java.util.Date) Test(org.junit.Test)

Example 35 with Status

use of org.kie.api.task.model.Status in project jbpm by kiegroup.

the class TaskQueryServiceBaseTest method testGetTasksByStatusByProcessId.

@Test
public void testGetTasksByStatusByProcessId() {
    // One potential owner, should go straight to state Reserved
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) {processInstanceId = 99 } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet')],businessAdministrators = [ new User('Administrator') ], }),";
    str += "name =  'This is my task name' })";
    Task task = TaskFactory.evalTask(new StringReader(str));
    taskService.addTask(task, new HashMap<String, Object>());
    str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) {processInstanceId = 100 } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Bobba Fet')],businessAdministrators = [ new User('Administrator') ], }),";
    str += "name =  'Another name' })";
    task = TaskFactory.evalTask(new StringReader(str));
    taskService.addTask(task, new HashMap<String, Object>());
    List<Status> statuses = new ArrayList<Status>();
    statuses.add(Status.Reserved);
    List<TaskSummary> tasks = taskService.getTasksByStatusByProcessInstanceId(99L, statuses, "en-UK");
    assertEquals(1, tasks.size());
}
Also used : Status(org.kie.api.task.model.Status) Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) TaskSummary(org.kie.api.task.model.TaskSummary) Test(org.junit.Test)

Aggregations

Status (org.kie.api.task.model.Status)60 ArrayList (java.util.ArrayList)50 TaskSummary (org.kie.api.task.model.TaskSummary)49 Test (org.junit.Test)44 Task (org.kie.api.task.model.Task)19 HashMap (java.util.HashMap)16 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)16 InternalTask (org.kie.internal.task.api.model.InternalTask)16 StringReader (java.io.StringReader)15 KieSession (org.kie.api.runtime.KieSession)14 QueryFilter (org.kie.internal.query.QueryFilter)14 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)10 QueryContext (org.kie.api.runtime.query.QueryContext)10 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)9 Date (java.util.Date)8 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)8 TaskService (org.kie.api.task.TaskService)7 List (java.util.List)5 Properties (java.util.Properties)4 JBossUserGroupCallbackImpl (org.jbpm.services.task.identity.JBossUserGroupCallbackImpl)4