コード例 #1
0
 @SuppressWarnings({"rawtypes", "unchecked"})
 @RequestMapping(
     method = RequestMethod.GET,
     value = "/data/tipos",
     produces = MediaType.APPLICATION_JSON_VALUE)
 public ReturnAdapter getTipos() {
   ReturnAdapter result = new ReturnAdapter();
   try {
     List l = tipoService.getTipos();
     if (l != null) {
       result.setNumResult(l.size());
       result.setData(l);
     } else {
       result.setCode(StandardResponse.SIN_CONTENIDO);
       result.setMessage(StandardResponse.MESSAGE_SIN_CONTENIDO);
       result.setNumResult(0);
     }
   } catch (Exception e) {
     result = StandardResponse.getResponseInExceptionInt(e, log);
   }
   return result;
 }
コード例 #2
0
 @SuppressWarnings({"rawtypes", "unchecked"})
 @RequestMapping(
     method = RequestMethod.GET,
     value = "/data/tipos/{id}",
     produces = MediaType.APPLICATION_JSON_VALUE)
 public ReturnAdapter getTipoById(@PathVariable("id") Integer id) {
   ReturnAdapter result = new ReturnAdapter();
   try {
     Tipo l = tipoService.getTipoById(id);
     if (l != null) {
       List lista = new ArrayList();
       lista.add(l);
       result.setData(lista);
     } else {
       result.setCode(StandardResponse.SIN_CONTENIDO);
       result.setMessage(StandardResponse.MESSAGE_SIN_CONTENIDO);
       result.setNumResult(0);
     }
   } catch (Exception e) {
     result = StandardResponse.getResponseInExceptionInt(e, log);
   }
   return result;
 }