Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(method = RequestMethod.POST, path = "/cotacao/{chave}", produces = MediaType.APPLICATION_XML_VALUE)
- public ResponseEntity<String> addUpdateCotacao(@PathVariable("chave") String chave, @RequestBody String cotacaoJSon,
- HttpServletRequest request) {
- try {
- logService.log(
- String.format("%s: %s(%s)(%s)", request.getRemoteAddr(), "addUpdateCotacao", chave, cotacaoJSon));
- Usuario usuario = usuarioService.getByChaveDeAcesso(chave);
- validarUsuario(usuario, chave);
- Map<String, LigacaoSuperus> ligacaoSuperus = new HashMap<>();
- CotacaoParser cotacaoJsonParser = new CotacaoJsonParser(cotacaoJSon, ligacaoSuperus);
- Cotacao cotacao = cotacaoService.buildCotacaoFromParser(cotacaoJsonParser, usuario);
- return new CotacaoResponseEntityXmlBuilder(cotacao, ligacaoSuperus).build();
- } catch (ExceptionValidacao e) {
- logger.warn(e.getMessage(), e);
- logService.log(MessageFormat.format("{0}\n\n{1}", e.getMessage(), ExceptionUtils.getStackTrace(e)));
- return ResponseEntity.badRequest().body(e.getMessage());
- } catch (Exception e) {
- logger.warn(e.getMessage(), e);
- logService.log(MessageFormat.format("{0}\n\n{1}", e.getMessage(), ExceptionUtils.getStackTrace(e)));
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement