Ejemplo n.º 1
0
 @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();
 }
Ejemplo n.º 2
0
 @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();
 }
Ejemplo n.º 3
0
 @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();
 }
Ejemplo n.º 4
0
 @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();
 }