From e4d123cf56ef20ee46881a7c48a617096a9380cf Mon Sep 17 00:00:00 2001 From: julio Date: Fri, 10 Apr 2015 15:00:32 +0000 Subject: [PATCH] Totvs - WS Fornecedor / WS Cliente / WS Pedido Compra (bug #6127 ) git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@42985 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../service/impl/PuntoVentaServiceImpl.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index 2e8927fd1..4d96a2ae5 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -73,13 +73,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { return puntoVentaDAO.obtenerID(id); } - @Transactional(noRollbackFor = { IntegracionException.class }) + @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class }) public PuntoVenta suscribir(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - IntegracionException respEx = null; + Exception respEx = null; try { if (entidad.getIndIntegracion() != TipoRetorno.CONCLUIDA.getValor()) { String resp = integracionTotvs(entidad); @@ -108,7 +108,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); } } catch (ValidacionCampoException ev) { - throw ev; + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = ev; } catch (Exception e) { entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); @@ -119,19 +120,23 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { entidad = puntoVentaDAO.suscribir(entidad); if (respEx != null) { - throw respEx; + if (respEx instanceof IntegracionException) { + throw (IntegracionException) respEx; + } else if (respEx instanceof ValidacionCampoException) { + throw (ValidacionCampoException) respEx; + } } return entidad; } - @Transactional(noRollbackFor = { IntegracionException.class }) + @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class }) public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - IntegracionException respEx = null; + Exception respEx = null; try { if (entidad.getIndIntegracion() != TipoRetorno.CONCLUIDA.getValor()) { String resp = integracionTotvs(entidad); @@ -160,7 +165,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); } } catch (ValidacionCampoException e) { - throw e; + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = e; } catch (Exception e) { entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); @@ -171,7 +177,11 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { entidad = puntoVentaDAO.actualizacion(entidad); if (respEx != null) { - throw respEx; + if (respEx instanceof IntegracionException) { + throw (IntegracionException) respEx; + } else if (respEx instanceof ValidacionCampoException) { + throw (ValidacionCampoException) respEx; + } } return entidad;