Package org.activiti.engine.identity

Examples of org.activiti.engine.identity.Group


 
  @Autowired
  protected IdentityService identityService;

  protected Group getGroupFromRequest(String groupId) {
    Group group = identityService.createGroupQuery().groupId(groupId).singleResult();

    if (group == null) {
      throw new ActivitiObjectNotFoundException("Could not find a group with id '" + groupId + "'.", User.class);
    }
    return group;
View Full Code Here


  @RequestMapping(value="/identity/groups/{groupId}/members/{userId}", method = RequestMethod.DELETE)
  public void deleteMembership(@PathVariable("groupId") String groupId, @PathVariable("userId") String userId,
      HttpServletRequest request, HttpServletResponse response) {
   
    Group group = getGroupFromRequest(groupId);
  
    // Check if user is not a member of group since API doesn't return typed exception
    if (identityService.createUserQuery()
        .memberOfGroup(group.getId())
        .userId(userId)
        .count() != 1) {
     
      throw new ActivitiObjectNotFoundException("User '" + userId + "' is not part of group '" + group.getId() + "'.", null);
    }
  
    identityService.deleteMembership(userId, group.getId());
    response.setStatus(HttpStatus.NO_CONTENT.value());
  }
View Full Code Here

    // Check if a user with the given ID already exists so we return a CONFLICT
    if (identityService.createGroupQuery().groupId(groupRequest.getId()).count() > 0) {
      throw new ActivitiConflictException("A group with id '" + groupRequest.getId() + "' already exists.");
    }
   
    Group created = identityService.newGroup(groupRequest.getId());
    created.setId(groupRequest.getId());
    created.setName(groupRequest.getName());
    created.setType(groupRequest.getType());
    identityService.saveGroup(created);
   
    response.setStatus(HttpStatus.CREATED.value());
   
    return restResponseFactory.createGroupResponse(created, httpRequest.getRequestURL().toString().replace("/identity/groups", ""));
View Full Code Here

    identityService.createMembership("kermit", "admin");

  }
 
  private Group createGroup(String id, String name, String type) {
    Group group = identityService.newGroup(id);
    group.setName(name);
    group.setType(type);
    identityService.saveGroup(group);
    return group;
  }
View Full Code Here

          + "' does not exist.");
      return new StateResponse().setSuccess(false);
    }

    // Add only if not already member
    Group group = identityService.createGroupQuery().groupMember(userId)
        .groupId(groupId).singleResult();
    if (group != null)
      identityService.deleteMembership(userId, groupId);
    return new StateResponse().setSuccess(true);
  }
View Full Code Here

    user.setFirstName("Kermit");
    user.setLastName("the Frog");
    user.setPassword("kermit");
    identityService.saveUser(user);
   
    Group group = identityService.newGroup("admin");
    group.setName("Administrators");
    identityService.saveGroup(group);
   
    identityService.createMembership(user.getId(), group.getId());
  }
View Full Code Here

    String groupId = (String) getRequest().getAttributes().get("groupId");
    if (groupId == null) {
      throw new ActivitiException("No groupId provided");
    }
    Group group = ActivitiUtil.getIdentityService().createGroupQuery()
        .groupId(groupId).singleResult();
    return group;
  }
View Full Code Here

    if (groupId == null) {
      setStatus(Status.CLIENT_ERROR_NOT_FOUND, "The group '" + groupId
          + "' does not exist.");
      return new StateResponse().setSuccess(false);
    }
    Group group = ActivitiUtil.getIdentityService().createGroupQuery()
        .groupId(groupId).singleResult();
    if (group != null) {
      ActivitiUtil.getIdentityService().deleteGroup(groupId);
      return new StateResponse().setSuccess(true);
    }
View Full Code Here

    }
    if (groupInfo.getName() == null || groupInfo.getName().equals(""))
      groupInfo.setName(groupInfo.getId());

    if (identityService.createGroupQuery().groupId(groupInfo.getId()).count() == 0) {
      Group group = identityService.newGroup(groupInfo.getId());
      group.setName(groupInfo.getName());
      if (groupInfo.getType() != null) {
        group.setType(groupInfo.getType());
      } else {
        group.setType("assignment");
      }
      identityService.saveGroup(group);
    } else {
      throw new ActivitiException("group id must be unique");
    }
View Full Code Here

 
  protected void handleFormSubmit() {
    try {
      // create user
      form.commit(); // will throw exception in case validation is false
      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);
    }
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.