08-19-2011 09:48 AM
08-22-2011 02:50 AM
08-22-2011 05:11 AM
activiti:candidateUsers="accountancyUser" does not lead to List<Task> myTasks =
                processEngine.getTaskService().createTaskQuery().processDefinitionId(processInstance.getId())
                        .taskCandidateUser("accountancyUser").list(); beeing a list with more than zero elements.08-23-2011 06:07 AM
08-23-2011 07:16 AM
08-23-2011 07:54 AM
08-23-2011 08:41 AM
08-24-2011 03:53 AM
<definitions id="definitions"
             targetNamespace="http://activiti.org/bpmn20"
             xmlns:activiti="http://activiti.org/bpmn"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
  <process id="assigningRoles">
    <startEvent id="begin"/>
    <sequenceFlow id="flow1" sourceRef="begin" targetRef="createReport"/>
    <userTask id="createReport" name="create the report" activiti:candidateUsers="accountancyUser"/>
    <sequenceFlow id="flow2" sourceRef="createReport" targetRef="verifyReport"/>
    <userTask id="verifyReport" name="verify the report" activiti:candidateUsers="accountancyUser"/>
    <sequenceFlow id="flow3" sourceRef="verifyReport" targetRef="end"/>
    <endEvent id="end"/>
  </process>
</definitions>
  // create a test user in group ROLE_EDIT
  User accountancyUser = identityService.newUser("accountancyUser");
  Group accountancyGroup = identityService.newGroup("ROLE_EDIT");
  identityService.saveGroup(accountancyGroup);
  identityService.saveUser(accountancyUser);
  identityService.createMembership(accountancyUser.getId(),
    accountancyGroup.getId());
  List<Group> groups = identityService.createGroupQuery()
    .groupId("ROLE_EDIT").list();
  assertEquals(1, groups.size());
  List<User> users = identityService.createUserQuery()
    .memberOfGroup("ROLE_EDIT").list();
  assertEquals(1, users.size());
  accountancyUser = users.get(0);
  assertEquals("accountancyUser", accountancyUser.getId());
  // start the process
  ProcessInstance processInstance = runtimeService
    .startProcessInstanceByKey("assigningRoles");
  // "accountancyUser" should have one task after the process instance was
  // created
  List<Task> myTasks = processEngine.getTaskService().createTaskQuery()
    .processDefinitionId(processInstance.getId())
    .taskCandidateUser("accountancyUser").list();
  Assert.assertNotNull(myTasks);
// here the test fails:
  Assert.assertEquals(1, myTasks.size());
  // now see if he's involved user on any task of the the process instance
  Assert.assertTrue(processEngine.getTaskService().createTaskQuery()
    .processDefinitionId(processInstance.getId())
    .taskInvolvedUser("accountancyUser").list().size() == 0);
  // now add myself to the task as candidate user
  processEngine.getTaskService().addCandidateUser(myTasks.get(0).getId(),
    "accountancyUser");
  // and now all of a sudden i'm involved user on the task
  Assert.assertTrue(processEngine.getTaskService().createTaskQuery()
    .processDefinitionId(processInstance.getId())
    .taskInvolvedUser("accountancyUser").list().size() == 1);
 }
08-24-2011 03:59 AM
processDefinitionId(processInstance.getId()) // "accountancyUser" should have one task after the process instance was
      // created
      List<Task> myTasks = processEngine.getTaskService().createTaskQuery()
            .processDefinitionId(processInstance.getId())
            .taskCandidateUser("accountancyUser").list();
					
				
			
			
				
			
			
			
			
			
			
			
		08-24-2011 04:10 AM
processInstance.getProcessDefinitionId()So I have understood the roles concept  Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.