@GET public Response list( @HeaderParam("idUser") String idUser, @HeaderParam("passUser") String password) { helperService.validateUser(idUser, password); List<Student> students = studentService.list(); return Response.ok().entity(students).build(); }
@POST public Response add( Student student, @HeaderParam("idUser") String idUser, @HeaderParam("passUser") String password) { helperService.validateUser(idUser, password); student = studentService.add(student); return Response.ok().entity(student).build(); }
@DELETE @Path("{idStudent}") public Response remove( @HeaderParam("idUser") String idUser, @HeaderParam("passUser") String password, @PathParam("idStudent") Long idStudent) { helperService.validateUser(idUser, password); return Response.ok(studentService.remove(idStudent)).build(); }
@GET @Path("{idStudent}") public Response find( @HeaderParam("idUser") String idUser, @HeaderParam("passUser") String password, @PathParam("idStudent") Long idStudent) { helperService.validateUser(idUser, password); Student student = studentService.find(idStudent); return Response.ok().entity(student).build(); }
@PUT @Path("{idStudent}") public Response change( Student student, @HeaderParam("idUser") String idUser, @HeaderParam("passUser") String password, @PathParam("idStudent") Long idStudent) { helperService.validateUser(idUser, password); student.setIdStudent(idStudent); student = studentService.change(student); return Response.ok().entity(student).build(); }