// ROOT and XPath are the same for this one. // @RequestMapping( value = Routes.RETAIL_CUSTOMER_COLLECTION, method = RequestMethod.GET, produces = "application/atom+xml") @ResponseBody public void index(HttpServletResponse response, @RequestParam Map<String, String> params) throws IOException, FeedException { response.setContentType(MediaType.APPLICATION_ATOM_XML_VALUE); try { exportService.exportRetailCustomers(response.getOutputStream(), new ExportFilter(params)); } catch (Exception e) { System.out.printf( "***** Error Caused by RetailCustomer.x.IndentifiedObject need: %s", e.toString()); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } }
@RequestMapping( value = Routes.RETAIL_CUSTOMER_COLLECTION, method = RequestMethod.POST, consumes = "application/atom+xml", produces = "application/atom+xml") @ResponseBody public void create( HttpServletResponse response, @RequestParam Map<String, String> params, InputStream stream) throws IOException { response.setContentType(MediaType.APPLICATION_ATOM_XML_VALUE); try { RetailCustomer retailCustomer = this.retailCustomerService.importResource(stream); exportService.exportTimeConfiguration( retailCustomer.getId(), response.getOutputStream(), new ExportFilter(new HashMap<String, String>())); } catch (Exception e) { System.out.printf( "***** Error Caused by RetailCustomer.x.IndentifiedObject need: %s", e.toString()); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } }