Exemplo n.º 1
0
 @GET
 @Path("/all")
 @Produces(MediaType.APPLICATION_JSON)
 public Response getAllUsers(@CookieParam("name") String uid) {
   int userid = Sessions.uid(uid);
   if (Factory.getInstance().getUserDAO().getById(userid).getAccess() == 2) {
     UserDAO userDAO = Factory.getInstance().getUserDAO();
     try {
       ArrayList<UserDTO> users = (ArrayList<UserDTO>) GetListDTO.getListUserDTO(userDAO.getAll());
       log.info("GetUser ALL: success");
       return Response.ok(new GenericEntity<ArrayList<UserDTO>>(users) {}).build();
     } catch (Exception e) {
       log.info("GetUser ALL: exception");
       return null;
     }
   }
   return Response.status(400).entity("not access").build();
 }