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); }
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); }
public Group addGroup(Group group) { return groupRepo.save(group); }
public Group getGroupByName(String name) { return groupRepo.findOneByName(name); }
public Long countGroupByName(String name) { return groupRepo.countByName(name); }
public Group getGroupById(String id) { return groupRepo.findOne(id); }
public List<Group> getAllGroup() { Sort sort = new Sort("name"); return groupRepo.findAll(sort); }
public void deleteGroupById(String id) { groupRepo.delete(id); }
public Page<Group> getGroupByName(String name, Pageable page) { String wildCardName = CommonUtil.addWildCard(name); return groupRepo.findByLikeName(wildCardName, page); }