Exemplo n.º 1
0
 @PreAuthorize("hasRole('ROLE_ADMIN')")
 @Transactional(readOnly = true)
 public ResultClass<User> getAll() {
   ResultClass<User> result = new ResultClass<>();
   result.addAll(repositoryUser.getAllUsers());
   return result;
 }
Exemplo n.º 2
0
  @PreAuthorize("hasRole('ROLE_ADMIN')")
  @Transactional(readOnly = true)
  public void downloadCSV(HttpServletResponse response) throws IOException {

    Collection<User> users = new ArrayList<User>();
    users = repositoryUser.getAllUsers();

    if (!users.isEmpty()) {
      UserCSV userCSV = new UserCSV();
      userCSV.downloadCSV(response, users);
    }
  }