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());
}
use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class TaskIdentityLinksTest method testCustomTypeUserLink.
@Deployment(resources = "org/activiti/engine/test/api/task/IdentityLinksProcess.bpmn20.xml")
public void testCustomTypeUserLink() {
runtimeService.startProcessInstanceByKey("IdentityLinksProcess");
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.addUserIdentityLink(taskId, "kermit", "interestee");
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
IdentityLink identityLink = identityLinks.get(0);
assertNull(identityLink.getGroupId());
assertEquals("kermit", identityLink.getUserId());
assertEquals("interestee", identityLink.getType());
assertEquals(taskId, identityLink.getTaskId());
assertEquals(1, identityLinks.size());
taskService.deleteUserIdentityLink(taskId, "kermit", "interestee");
assertEquals(0, taskService.getIdentityLinksForTask(taskId).size());
}
use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class TaskIdentityLinksTest method testCustomIdentityLink.
// Test custom identity links
@Deployment
public void testCustomIdentityLink() {
runtimeService.startProcessInstanceByKey("customIdentityLink");
List<Task> tasks = taskService.createTaskQuery().taskInvolvedUser("kermit").list();
assertEquals(1, tasks.size());
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(tasks.get(0).getId());
assertEquals(2, identityLinks.size());
for (IdentityLink idLink : identityLinks) {
assertEquals("businessAdministrator", idLink.getType());
String userId = idLink.getUserId();
if (userId == null) {
assertEquals("management", idLink.getGroupId());
} else {
assertEquals("kermit", userId);
}
}
}
use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class TaskServiceTest method testGetIdentityLinksWithAssignee.
public void testGetIdentityLinksWithAssignee() {
Task task = taskService.newTask();
taskService.saveTask(task);
String taskId = task.getId();
identityService.saveUser(identityService.newUser("kermit"));
taskService.claim(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.ASSIGNEE, identityLinks.get(0).getType());
//cleanup
taskService.deleteTask(taskId, true);
identityService.deleteUser("kermit");
}
use of org.activiti.engine.task.IdentityLink in project Activiti by Activiti.
the class GetIdentityLinksForProcessDefinitionCmd method execute.
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<IdentityLink> execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = commandContext.getProcessDefinitionEntityManager().findProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiObjectNotFoundException("Cannot find process definition with id " + processDefinitionId, ProcessDefinition.class);
}
List<IdentityLink> identityLinks = (List) processDefinition.getIdentityLinks();
return identityLinks;
}
Aggregations