Esempio n. 1
0
  public void updateGroup(GroupDTO groupDto) throws DataIntegrityViolationException {

    Group group = groupRepo.findOne(groupDto.getId());

    // remove all existing permission (orphanRemoval=true in OneToMany relationship)
    group.getPermissionList().clear();

    group.setName(groupDto.getName());

    if (groupDto.getPermissionArray() != null) {
      for (String permission : groupDto.getPermissionArray()) {
        group.addPermission(new GroupPermission(permission));
      }
    }

    groupRepo.save(group);
  }
Esempio n. 2
0
  public Group addGroup(GroupDTO groupDto) {
    Group group = new Group();
    group.setName(groupDto.getName());

    if (groupDto.getPermissionArray() != null) {
      for (String permission : groupDto.getPermissionArray()) {
        group.addPermission(new GroupPermission(permission));
      }
    }

    return groupRepo.save(group);
  }
Esempio n. 3
0
 public Group addGroup(Group group) {
   return groupRepo.save(group);
 }
Esempio n. 4
0
 public Group getGroupByName(String name) {
   return groupRepo.findOneByName(name);
 }
Esempio n. 5
0
 public Long countGroupByName(String name) {
   return groupRepo.countByName(name);
 }
Esempio n. 6
0
 public Group getGroupById(String id) {
   return groupRepo.findOne(id);
 }
Esempio n. 7
0
 public List<Group> getAllGroup() {
   Sort sort = new Sort("name");
   return groupRepo.findAll(sort);
 }
Esempio n. 8
0
 public void deleteGroupById(String id) {
   groupRepo.delete(id);
 }
Esempio n. 9
0
 public Page<Group> getGroupByName(String name, Pageable page) {
   String wildCardName = CommonUtil.addWildCard(name);
   return groupRepo.findByLikeName(wildCardName, page);
 }