@GET public Response getClients( @QueryParam("page") final Integer page, @QueryParam("size") final Integer size, @QueryParam("sort_dir") final SortDirection sortDirection, @QueryParam("sorted_by") final String sortedBy, @QueryParam("client_id") final String idFilter, @QueryParam("name") final String nameFilter, @QueryParam("updated_by") final String updatedByFilter, @QueryParam("created_by") final String createdByFilter, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { return respondWith( page == null && size == null ? clientService.getAllClients() : clientService.getClients( page, size, sortDirection, sortedBy, new Client(idFilter, nameFilter, updatedByFilter, createdByFilter)), uriInfo, headers) .build(); }
@GET @Path("/{client_id}/") public Response getClient( @PathParam("client_id") final String clientID, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { return respondWith(clientService.getClient(clientID), uriInfo, headers).build(); }
@PUT @Consumes(MediaType.APPLICATION_JSON) public Response updateClient( final Client client, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { clientService.updateClient(client); return Response.ok( new StatusEntity("200", uriInfo.getAbsolutePath() + "/" + client.getClientID())) .build(); }
@DELETE @Path("/{client_id}/") public Response deleteClient( @PathParam("client_id") final String clientID, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { clientService.deleteClient(clientID); return Response.ok( new StatusEntity( "200", "Client with ID='" + clientID + "' has been successfully removed")) .build(); }