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