Example #1
0
 public void createGroup(String name, String description, boolean publicGroup) {
   if (log.isDebugEnabled()) {
     log.debug("Creating group : " + name);
   }
   User currentUser = authenticationService.getCurrentUser();
   String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
   String groupId = groupRepository.createGroup(domain);
   groupDetailsRepository.createGroupDetails(groupId, name, description, publicGroup);
   groupMembersRepository.addAdmin(groupId, currentUser.getLogin());
   groupCounterRepository.incrementGroupCounter(domain, groupId);
   userGroupRepository.addGroupAsAdmin(currentUser.getLogin(), groupId);
 }
Example #2
0
 private Collection<Group> getGroupDetails(User currentUser, Collection<String> groupIds) {
   String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin());
   Collection<Group> groups = new TreeSet<Group>();
   for (String groupId : groupIds) {
     Group group = groupRepository.getGroupById(domain, groupId);
     Group groupDetails = groupDetailsRepository.getGroupDetails(groupId);
     group.setName(groupDetails.getName());
     group.setPublicGroup(groupDetails.isPublicGroup());
     group.setDescription(groupDetails.getDescription());
     long counter = groupCounterRepository.getGroupCounter(domain, groupId);
     group.setCounter(counter);
     groups.add(group);
   }
   return groups;
 }