leonardo 2017-01-31 13:15:31 +00:00
parent d1ed528cd4
commit 35b7d2efaa
1 changed files with 181 additions and 182 deletions

View File

@ -151,22 +151,22 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
} }
entidad = puntoVentaDAO.suscribir(entidad); entidad = puntoVentaDAO.suscribir(entidad);
if (ApplicationProperties.getInstance().integracionAGWS()) {
log.debug("iniciando integração com AG"); log.debug("iniciando integração com AG");
integrarClienteAG(entidad); integrarClienteAG(entidad);
if (!entidad.getIndIntegradoAG()){ if (!entidad.getIndIntegradoAG()){
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG()); throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
} }
integrarFornecedorAG(entidad); integrarFornecedorAG(entidad);
log.debug("fim da integração com AG");
if (!entidad.getIndIntegradoAG()){ if (!entidad.getIndIntegradoAG()){
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG()); throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
} }
log.debug("fim da integração com AG");
}
return entidad; return entidad;
} }
private void integrarFornecedorAG(PuntoVenta entidad) { private void integrarFornecedorAG(PuntoVenta entidad) {
if (ApplicationProperties.getInstance().integracionAGWS()) {
try{ try{
IAGservice service = new IAGserviceLocator(); IAGservice service = new IAGserviceLocator();
DaoAG.getInstance().setDBConnection(dataSource.getConnection()); DaoAG.getInstance().setDBConnection(dataSource.getConnection());
@ -239,10 +239,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
wslog.error(me.toString()); wslog.error(me.toString());
} }
} }
}
private void integrarClienteAG(PuntoVenta entidad) { private void integrarClienteAG(PuntoVenta entidad) {
if (ApplicationProperties.getInstance().integracionAGWS()) {
try{ try{
IAGservice service = new IAGserviceLocator(); IAGservice service = new IAGserviceLocator();
DaoAG.getInstance().setDBConnection(dataSource.getConnection()); DaoAG.getInstance().setDBConnection(dataSource.getConnection());
@ -337,7 +335,6 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
wslog.error(me.toString()); wslog.error(me.toString());
} }
} }
}
@Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class})
public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException {
@ -392,6 +389,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
} }
entidad = puntoVentaDAO.actualizacion(entidad); entidad = puntoVentaDAO.actualizacion(entidad);
if (ApplicationProperties.getInstance().integracionAGWS()) {
log.debug("iniciando integração com AG"); log.debug("iniciando integração com AG");
integrarClienteAG(entidad); integrarClienteAG(entidad);
if (!entidad.getIndIntegradoAG()){ if (!entidad.getIndIntegradoAG()){
@ -402,6 +400,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG()); throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
} }
log.debug("fim da integração com AG"); log.debug("fim da integração com AG");
}
if (respEx != null) { if (respEx != null) {
if (respEx instanceof IntegracionException) { if (respEx instanceof IntegracionException) {