Search in sources :

Example 71 with TaskSummary

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

the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerSkipable.

@Test
public void testGetTasksAssignedAsPotentialOwnerSkipable() {
    // One potential owner, should go straight to state Reserved
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) {skipable=true } ), ";
    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<String> groupIds = new ArrayList<String>();
    groupIds.add("Crusaders");
    List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Bobba Fet", groupIds);
    assertEquals(1, tasks.size());
    assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
    assertEquals(true, tasks.get(0).isSkipable());
}
Also used : 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 72 with TaskSummary

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

the class TaskQueryServiceBaseTest method testGetTasksAssignedAsBusinessAdministratorWithUserOfWrongGroupLangOneTask.

@Test
public void testGetTasksAssignedAsBusinessAdministratorWithUserOfWrongGroupLangOneTask() {
    // JBPM-4862
    String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
    str += "peopleAssignments = (with ( new PeopleAssignments() ) { businessAdministrators = [new Group('Crusaders')], }),";
    str += "name = 'This is my task name' })";
    Task task = TaskFactory.evalTask(new StringReader(str));
    taskService.addTask(task, new HashMap<String, Object>());
    List<TaskSummary> tasks = taskService.getTasksAssignedAsBusinessAdministrator("nocrusadaer", "en-UK");
    assertEquals(0, tasks.size());
}
Also used : Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) StringReader(java.io.StringReader) TaskSummary(org.kie.api.task.model.TaskSummary) Test(org.junit.Test)

Example 73 with TaskSummary

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

the class TaskQueryServiceBaseTest method testGetTasksAssignedAsRecipientWithUserLangOneTask.

@Test
public void testGetTasksAssignedAsRecipientWithUserLangOneTask() {
    // 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() ) { recipients = [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<TaskSummary> tasks = taskService.getTasksAssignedAsRecipient("Bobba Fet");
    assertEquals(1, tasks.size());
}
Also used : Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) StringReader(java.io.StringReader) TaskSummary(org.kie.api.task.model.TaskSummary) Test(org.junit.Test)

Example 74 with TaskSummary

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

the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerByStatusWithUserStatusLangOneTask.

@Test
public void testGetTasksAssignedAsPotentialOwnerByStatusWithUserStatusLangOneTask() {
    // 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.Created);
    statuses.add(Status.Ready);
    List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwnerByStatus("Bobba Fet", statuses, "en-UK");
    assertEquals(0, 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)

Example 75 with TaskSummary

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

the class TaskQueryServiceBaseTest method testGetTasksAssignedAsPotentialOwnerWithUserLangOneTask.

@Test
public void testGetTasksAssignedAsPotentialOwnerWithUserLangOneTask() {
    // 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<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Bobba Fet", "en-UK");
    assertEquals(1, tasks.size());
    assertEquals("Bobba Fet", tasks.get(0).getActualOwnerId());
}
Also used : Task(org.kie.api.task.model.Task) InternalTask(org.kie.internal.task.api.model.InternalTask) StringReader(java.io.StringReader) TaskSummary(org.kie.api.task.model.TaskSummary) Test(org.junit.Test)

Aggregations

TaskSummary (org.kie.api.task.model.TaskSummary)371 Test (org.junit.Test)327 HashMap (java.util.HashMap)132 QueryFilter (org.kie.internal.query.QueryFilter)126 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)100 Task (org.kie.api.task.model.Task)91 ArrayList (java.util.ArrayList)87 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)86 KieSession (org.kie.api.runtime.KieSession)84 TaskService (org.kie.api.task.TaskService)66 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)58 StringReader (java.io.StringReader)55 AbstractCaseServicesBaseTest (org.jbpm.casemgmt.impl.util.AbstractCaseServicesBaseTest)49 QueryContext (org.kie.api.runtime.query.QueryContext)49 Status (org.kie.api.task.model.Status)47 InternalTask (org.kie.internal.task.api.model.InternalTask)47 AbstractBaseTest (org.jbpm.test.util.AbstractBaseTest)41 CaseInstance (org.jbpm.casemgmt.api.model.instance.CaseInstance)38 CaseFileInstance (org.jbpm.casemgmt.api.model.instance.CaseFileInstance)36 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)28