Package org.activiti.engine.identity

Examples of org.activiti.engine.identity.Group


  }

  @Test
  public void testFindGroupsByUserAndType() {
    IdentityService identityService = activitiRule.getIdentityService();
    Group sales = identityService.newGroup("sales");
    sales.setType("hierarchy");
    identityService.saveGroup(sales);

    Group development = identityService.newGroup("development");
    development.setType("hierarchy");
    identityService.saveGroup(development);

    Group admin = identityService.newGroup("admin");
    admin.setType("security-role");
    identityService.saveGroup(admin);

    Group user = identityService.newGroup("user");
    user.setType("security-role");
    identityService.saveGroup(user);

    User johndoe = identityService.newUser("johndoe");
    identityService.saveUser(johndoe);
View Full Code Here


  }

  @Test
  public void testGroup() {
    IdentityService identityService = activitiRule.getIdentityService();
    Group group = identityService.newGroup("sales");
    group.setName("Sales division");
    identityService.saveGroup(group);

    group = identityService.createGroupQuery().groupId("sales").singleResult();
    assertEquals("sales", group.getId());
    assertEquals("Sales division", group.getName());

    identityService.deleteGroup("sales");
  }
View Full Code Here

  }

  @Test
  public void testMembership() {
    IdentityService identityService = activitiRule.getIdentityService();
    Group sales = identityService.newGroup("sales");
    identityService.saveGroup(sales);

    Group development = identityService.newGroup("development");
    identityService.saveGroup(development);

    User johndoe = identityService.newUser("johndoe");
    identityService.saveUser(johndoe);
View Full Code Here

  @Before
  public void setUp() throws Exception {
   
    IdentityService identityService = activitiRule.getIdentityService();
    Group accountants = identityService.newGroup("accountancy");
    identityService.saveGroup(accountants);
    Group managers = identityService.newGroup("management");
    identityService.saveGroup(managers);
    Group sales = identityService.newGroup("sales");
    identityService.saveGroup(sales);

    User kermit = identityService.newUser(KERMIT);
    identityService.saveUser(kermit);
    identityService.createMembership(KERMIT, "accountancy");
View Full Code Here

    // create a new user to create a new request
    User requester = identityService.newUser("Micha Kops");
    identityService.saveUser(requester);

    // create group service and assign the user to it
    Group serviceGroup = identityService.newGroup("service");
    identityService.saveGroup(serviceGroup);
    identityService.createMembership(requester.getId(),
        serviceGroup.getId());

    // create a new user for an it-support employee
    User itguy = identityService.newUser("itguy");
    identityService.saveUser(itguy);

    // create a group it-support for critical issues
    Group itSupportGroup = identityService.newGroup("itsupport-critical");
    itSupportGroup.setName("IT Support for Critical Issues");
    identityService.saveGroup(itSupportGroup);

    // assign the user itguy to the group itsupport-critical
    identityService.createMembership(itguy.getId(), itSupportGroup.getId());

    // set requester as current user
    identityService.setAuthenticatedUserId(requester.getId());

    // assert that the process definition does exist in the current
    // environment
    ProcessDefinition definition = activitiRule.getRepositoryService()
        .createProcessDefinitionQuery()
        .processDefinitionKey("issueRequestProcess").singleResult();
    assertThat(definition, notNullValue());

    // get a handle on the form-service
    FormService formService = activitiRule.getFormService();

    // assert that our start form has four form fields
    List<FormProperty> formProps = formService.getStartFormData(
        definition.getId()).getFormProperties();
    assertThat(formProps.size(), equalTo(4));

    // fill out the first form's fields
    Map<String, String> requestFormProps = new HashMap<String, String>();
    requestFormProps.put(SUMMARY_KEY, SUMMARY_VALUE);
    requestFormProps.put(DESCRIPTION_KEY, DESCRIPTION_VALUE);
    requestFormProps.put("email", "someguy@hascode.com");
    requestFormProps.put("priority", "critical");

    Date startDate = new Date();

    // create a new process instance with given form params
    ProcessInstance processInstance = formService.submitStartFormData(
        definition.getId(), requestFormProps);
    assertThat(processInstance, notNullValue());

    // test the audit process, fetch historic data
    List<HistoricDetail> historicFormProps = activitiRule
        .getHistoryService().createHistoricDetailQuery()
        .formProperties().orderByVariableName().asc().list();

    // assert that the historic data corresponds to the form data that we've
    // entered
    assertThat(historicFormProps.size(), equalTo(4));
    HistoricFormProperty historicSummary = (HistoricFormProperty) historicFormProps
        .get(0);
    assertThat(historicSummary.getPropertyId(), equalTo(DESCRIPTION_KEY));
    assertThat(historicSummary.getPropertyValue(),
        equalTo(DESCRIPTION_VALUE));
    assertThat(historicSummary.getTime(), greaterThan(startDate));

    // assert that the bad-words filter has filtered one bad word and
    // replaced it with 'xxx'
    assertThat(
        (String) activitiRule.getRuntimeService()
            .getVariable(processInstance.getProcessInstanceId(),
                DESCRIPTION_KEY),
        endsWith("I hate your xxxing shop!"));

    // get a handle on the task service
    TaskService taskService = activitiRule.getTaskService();

    // seach for a task for candidate-group 'itsupport-critical'
    Task approveCriticalIssueTask = taskService.createTaskQuery()
        .processInstanceId(processInstance.getProcessInstanceId())
        .taskCandidateGroup(itSupportGroup.getId()).singleResult();
    assertThat(approveCriticalIssueTask.getName(),
        equalTo("Approve Critical Issue"));

    // claim the task for the user 'itguy'
    taskService.claim(approveCriticalIssueTask.getId(), itguy.getId());
View Full Code Here

    @Override
    protected Object doExecute() throws Exception {
        IdentityService identityService = getProcessEngine().getIdentityService();

        Group group = identityService.newGroup(id);
        group.setName(name);
        group.setType(type);
        identityService.saveGroup(group);

        return null;
    }
View Full Code Here

  private static final String GONZO = "gonzo";

  public void setUp() throws Exception {
    super.setUp();
   
    Group accountants = identityService.newGroup("accountancy");
    identityService.saveGroup(accountants);
    Group managers = identityService.newGroup("management");
    identityService.saveGroup(managers);
    Group sales = identityService.newGroup("sales");
    identityService.saveGroup(sales);

    User kermit = identityService.newUser(KERMIT);
    identityService.saveUser(kermit);
    identityService.createMembership(KERMIT, "accountancy");
View Full Code Here

        User user1 = identityService.newUser("user1");
        identityService.saveUser(user1);
        User user2 = identityService.newUser("user2");
        identityService.saveUser(user2);

        Group group1 = identityService.newGroup("group1");
        identityService.saveGroup(group1);
        identityService.createMembership("user1", "group1");

        // 启动流程
        RuntimeService runtimeService = activitiRule.getRuntimeService();
View Full Code Here

    }
  }
 
  protected void createGroup(String groupId, String type) {
    if (identityService.createGroupQuery().groupId(groupId).count() == 0) {
      Group newGroup = identityService.newGroup(groupId);
      newGroup.setName(groupId.substring(0, 1).toUpperCase() + groupId.substring(1));
      newGroup.setType(type);
      identityService.saveGroup(newGroup);
    }
  }
View Full Code Here

    }
  }
 
  protected void createGroup(String groupId, String type) {
    if (identityService.createGroupQuery().groupId(groupId).count() == 0) {
      Group newGroup = identityService.newGroup(groupId);
      newGroup.setName(groupId.substring(0, 1).toUpperCase() + groupId.substring(1));
      newGroup.setType(type);
      identityService.saveGroup(newGroup);
    }
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.identity.Group

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.