예제 #1
0
 @ResponseBody
 @RequestMapping(value = "/v1/referential/invoiceCategory", method = RequestMethod.PUT)
 public InvoiceCategoryDTO addInvoiceCategory(@RequestBody InvoiceCategoryDTO invoiceCategoryDTO) {
   // FIXME ymartel 20160219 : check if name does not already exist
   InvoiceCategory categoryToStore = getInvoiceCategoryDao().create();
   categoryToStore.setName(invoiceCategoryDTO.getName());
   InvoiceCategoryDTO dto = new InvoiceCategoryDTO(categoryToStore);
   return dto;
 }
예제 #2
0
  @ResponseBody
  @RequestMapping(value = "/v1/referential/invoiceCategory", method = RequestMethod.POST)
  public InvoiceCategoryDTO editInvoiceCategory(
      @RequestParam(value = "id") String id, @RequestParam(value = "name") String name) {

    InvoiceCategory category = getInvoiceCategoryDao().forTopiaIdEquals(id).findAny();
    // FIXME JC151211 - Deal with TopiaNoResultException
    category.setName(name);
    InvoiceCategoryDTO dto = new InvoiceCategoryDTO(category);
    return dto;
  }