Search in sources :

Example 26 with Group

use of org.activiti.engine.identity.Group in project Activiti by Activiti.

the class TaskQueryImpl method getGroupsForCandidateUser.

protected List<String> getGroupsForCandidateUser(String candidateUser) {
    // TODO: Discuss about removing this feature? Or document it properly and maybe recommend to not use it
    // and explain alternatives
    List<Group> groups = Context.getCommandContext().getGroupIdentityManager().findGroupsByUser(candidateUser);
    List<String> groupIds = new ArrayList<String>();
    for (Group group : groups) {
        groupIds.add(group.getId());
    }
    return groupIds;
}
Also used : Group(org.activiti.engine.identity.Group) ArrayList(java.util.ArrayList)

Example 27 with Group

use of org.activiti.engine.identity.Group in project Activiti by Activiti.

the class TaskServiceTest method testAddCandidateGroupUnexistingTask.

public void testAddCandidateGroupUnexistingTask() {
    Group group = identityService.newGroup("group");
    identityService.saveGroup(group);
    try {
        taskService.addCandidateGroup("unexistingTaskId", group.getId());
        fail("ActivitiException expected");
    } catch (ActivitiObjectNotFoundException ae) {
        assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
        assertEquals(Task.class, ae.getObjectClass());
    }
    identityService.deleteGroup(group.getId());
}
Also used : Group(org.activiti.engine.identity.Group) Task(org.activiti.engine.task.Task) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 28 with Group

use of org.activiti.engine.identity.Group in project Activiti by Activiti.

the class GroupSelectionQuery method getCurrentGroups.

protected Set<String> getCurrentGroups() {
    Set<String> groupIds = new HashSet<String>();
    List<Group> currentGroups = identityService.createGroupQuery().groupMember(userId).list();
    for (Group group : currentGroups) {
        groupIds.add(group.getId());
    }
    return groupIds;
}
Also used : Group(org.activiti.engine.identity.Group) HashSet(java.util.HashSet)

Example 29 with Group

use of org.activiti.engine.identity.Group in project Activiti by Activiti.

the class GroupsForUserQuery method loadItems.

public List<Item> loadItems(int start, int count) {
    List<Group> groups = identityService.createGroupQuery().groupMember(userId).orderByGroupType().asc().orderByGroupId().asc().orderByGroupName().asc().list();
    List<Item> groupItems = new ArrayList<Item>();
    for (Group group : groups) {
        groupItems.add(new GroupItem(group));
    }
    return groupItems;
}
Also used : Group(org.activiti.engine.identity.Group) PropertysetItem(com.vaadin.data.util.PropertysetItem) Item(com.vaadin.data.Item) ArrayList(java.util.ArrayList)

Example 30 with Group

use of org.activiti.engine.identity.Group in project Activiti by Activiti.

the class NewGroupPopupWindow method handleFormSubmit.

protected void handleFormSubmit() {
    try {
        // create user
        // will throw exception in case validation is false
        form.commit();
        Group group = createGroup();
        // close popup and navigate to new group
        close();
        ExplorerApp.get().getViewManager().showGroupPage(group.getId());
    } catch (InvalidValueException e) {
        // Do nothing: the Form component will render the errormsgs automatically
        setHeight(270, UNITS_PIXELS);
    }
}
Also used : InvalidValueException(com.vaadin.data.Validator.InvalidValueException) Group(org.activiti.engine.identity.Group)

Aggregations

Group (org.activiti.engine.identity.Group)61 User (org.activiti.engine.identity.User)22 ArrayList (java.util.ArrayList)12 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)5 StringEntity (org.apache.http.entity.StringEntity)5 Item (com.vaadin.data.Item)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 PropertysetItem (com.vaadin.data.util.PropertysetItem)3 Deployment (org.activiti.engine.test.Deployment)3 HttpDelete (org.apache.http.client.methods.HttpDelete)3 HttpPut (org.apache.http.client.methods.HttpPut)3 HashSet (java.util.HashSet)2 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)2 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)2 IdentityService (org.activiti.engine.IdentityService)2 GroupQuery (org.activiti.engine.identity.GroupQuery)2 LoggedInUser (org.activiti.explorer.identity.LoggedInUser)2 ActivitiConflictException (org.activiti.rest.exception.ActivitiConflictException)2