Ejemplo n.º 1
0
 @DELETE
 @Produces(MediaType.APPLICATION_JSON)
 public Map<String, String> delete() {
   Map<String, String> map = new HashMap<String, String>();
   String msg = "Foram removido(s) %d registro(s)";
   int delete = malhaService.delete();
   String.format(msg, delete);
   map.put("message", msg);
   return map;
 }
Ejemplo n.º 2
0
 @POST
 public Response salvar(
     @FormParam("origem") String origem,
     @FormParam("destino") String destino,
     @FormParam("distancia") int distancia) {
   if (StringUtils.isEmpty(origem) || StringUtils.isEmpty(destino)) {
     return Response.serverError()
         .entity("Os parametros origem e destino são obrigatórios")
         .build();
   }
   Malha malha = new Malha(origem, destino, distancia);
   malhaService.salvar(malha);
   return Response.status(Status.OK).build();
 }
Ejemplo n.º 3
0
 @GET
 @Produces(MediaType.APPLICATION_JSON)
 public List<Malha> list() {
   return malhaService.findAll();
 }