Search in sources :

Example 16 with IdentityLink

use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.

the class TaskServiceTest method testGetIdentityLinksWithCandidateUser.

public void testGetIdentityLinksWithCandidateUser() {
    Task task = taskService.newTask();
    taskService.saveTask(task);
    String taskId = task.getId();
    identityService.saveUser(identityService.newUser("kermit"));
    taskService.addCandidateUser(taskId, "kermit");
    List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
    assertEquals(1, identityLinks.size());
    assertEquals("kermit", identityLinks.get(0).getUserId());
    assertNull(identityLinks.get(0).getGroupId());
    assertEquals(IdentityLinkType.CANDIDATE, identityLinks.get(0).getType());
    //cleanup
    taskService.deleteTask(taskId, true);
    identityService.deleteUser("kermit");
}
Also used : Task(org.activiti.engine.task.Task) IdentityLink(org.activiti.engine.task.IdentityLink)

Example 17 with IdentityLink

use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.

the class TaskServiceTest method testGetIdentityLinksWithCandidateGroup.

public void testGetIdentityLinksWithCandidateGroup() {
    Task task = taskService.newTask();
    taskService.saveTask(task);
    String taskId = task.getId();
    identityService.saveGroup(identityService.newGroup("muppets"));
    taskService.addCandidateGroup(taskId, "muppets");
    List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
    assertEquals(1, identityLinks.size());
    assertEquals("muppets", identityLinks.get(0).getGroupId());
    assertNull(identityLinks.get(0).getUserId());
    assertEquals(IdentityLinkType.CANDIDATE, identityLinks.get(0).getType());
    //cleanup
    taskService.deleteTask(taskId, true);
    identityService.deleteGroup("muppets");
}
Also used : Task(org.activiti.engine.task.Task) IdentityLink(org.activiti.engine.task.IdentityLink)

Example 18 with IdentityLink

use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.

the class TaskServiceTest method testGetIdentityLinksWithNonExistingAssignee.

public void testGetIdentityLinksWithNonExistingAssignee() {
    Task task = taskService.newTask();
    taskService.saveTask(task);
    String taskId = task.getId();
    taskService.claim(taskId, "nonExistingAssignee");
    List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
    assertEquals(1, identityLinks.size());
    assertEquals("nonExistingAssignee", identityLinks.get(0).getUserId());
    assertNull(identityLinks.get(0).getGroupId());
    assertEquals(IdentityLinkType.ASSIGNEE, identityLinks.get(0).getType());
    //cleanup
    taskService.deleteTask(taskId, true);
}
Also used : Task(org.activiti.engine.task.Task) IdentityLink(org.activiti.engine.task.IdentityLink)

Example 19 with IdentityLink

use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.

the class TaskServiceTest method testGetIdentityLinksWithNonExistingOwner.

public void testGetIdentityLinksWithNonExistingOwner() {
    Task task = taskService.newTask();
    taskService.saveTask(task);
    String taskId = task.getId();
    taskService.claim(taskId, "nonExistingOwner");
    taskService.delegateTask(taskId, "nonExistingAssignee");
    List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
    assertEquals(2, identityLinks.size());
    IdentityLink assignee = identityLinks.get(0);
    assertEquals("nonExistingAssignee", assignee.getUserId());
    assertNull(assignee.getGroupId());
    assertEquals(IdentityLinkType.ASSIGNEE, assignee.getType());
    IdentityLink owner = identityLinks.get(1);
    assertEquals("nonExistingOwner", owner.getUserId());
    assertNull(owner.getGroupId());
    assertEquals(IdentityLinkType.OWNER, owner.getType());
    //cleanup
    taskService.deleteTask(taskId, true);
}
Also used : Task(org.activiti.engine.task.Task) IdentityLink(org.activiti.engine.task.IdentityLink)

Example 20 with IdentityLink

use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.

the class TaskIdentityLinksTest method testDeleteCandidateUser.

@Deployment(resources = "org/activiti/engine/test/api/task/TaskIdentityLinksTest.testDeleteCandidateUser.bpmn20.xml")
public void testDeleteCandidateUser() {
    runtimeService.startProcessInstanceByKey("TaskIdentityLinks");
    String taskId = taskService.createTaskQuery().singleResult().getId();
    List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
    assertEquals(1, identityLinks.size());
    IdentityLink identityLink = identityLinks.get(0);
    assertEquals("user", identityLink.getUserId());
}
Also used : IdentityLink(org.activiti.engine.task.IdentityLink) Deployment(org.activiti.engine.test.Deployment)

Aggregations

IdentityLink (org.activiti.engine.task.IdentityLink)45 Deployment (org.activiti.engine.test.Deployment)21 Task (org.activiti.engine.task.Task)15 RestIdentityLink (org.activiti.rest.service.api.engine.RestIdentityLink)8 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)7 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)3 TaskService (org.activiti.engine.TaskService)3 ActivitiEntityEvent (org.activiti.engine.delegate.event.ActivitiEntityEvent)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)2 SystemException (com.evolveum.midpoint.util.exception.SystemException)2 Event (org.activiti.engine.task.Event)2 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ObjectTypeUtil.toShortString (com.evolveum.midpoint.schema.util.ObjectTypeUtil.toShortString)1