leonardo 2016-12-14 16:23:43 +00:00
parent 911803c7f7
commit d7c2f3599e
1 changed files with 14 additions and 0 deletions

View File

@ -7,10 +7,12 @@ package com.rjconsultores.ventaboletos.service.impl;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.SQLException;
import java.text.Normalizer; import java.text.Normalizer;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import javax.sql.DataSource;
import javax.xml.rpc.ServiceException; import javax.xml.rpc.ServiceException;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -77,6 +79,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
private EstacionService estacionService; private EstacionService estacionService;
@Autowired @Autowired
private UsuarioUbicacionDAO usuarioUbicacionDAO; private UsuarioUbicacionDAO usuarioUbicacionDAO;
@Autowired
private DataSource dataSource;
// FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados // FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados
@Deprecated @Deprecated
@ -146,8 +150,10 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
} }
entidad = puntoVentaDAO.suscribir(entidad); entidad = puntoVentaDAO.suscribir(entidad);
log.debug("iniciando integração com AG");
integrarClienteAG(entidad); integrarClienteAG(entidad);
integrarFornecedorAG(entidad); integrarFornecedorAG(entidad);
log.debug("fim da integração com AG");
return entidad; return entidad;
} }
@ -156,6 +162,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
if (ApplicationProperties.getInstance().integracionAGWS()) { if (ApplicationProperties.getInstance().integracionAGWS()) {
try{ try{
IAGservice service = new IAGserviceLocator(); IAGservice service = new IAGserviceLocator();
DaoAG.getInstance().setDBConnection(dataSource.getConnection());
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG))); IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
TFornecedor fornecedor = null; TFornecedor fornecedor = null;
try{ try{
@ -215,6 +222,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
log.error("", se.toString()); log.error("", se.toString());
} catch (MalformedURLException me){ } catch (MalformedURLException me){
log.error("", me.toString()); log.error("", me.toString());
} catch (SQLException me){
log.error("", me.toString());
} }
} }
} }
@ -223,6 +232,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
if (ApplicationProperties.getInstance().integracionAGWS()) { if (ApplicationProperties.getInstance().integracionAGWS()) {
try{ try{
IAGservice service = new IAGserviceLocator(); IAGservice service = new IAGserviceLocator();
DaoAG.getInstance().setDBConnection(dataSource.getConnection());
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG))); IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
TCliente cli = null; TCliente cli = null;
try{ try{
@ -304,6 +314,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
log.error("", se.toString()); log.error("", se.toString());
} catch (MalformedURLException me){ } catch (MalformedURLException me){
log.error("", me.toString()); log.error("", me.toString());
} catch (SQLException me){
log.error("", me.toString());
} }
} }
} }
@ -359,8 +371,10 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
entidad = puntoVentaDAO.actualizacion(entidad); entidad = puntoVentaDAO.actualizacion(entidad);
log.debug("iniciando integração com AG");
integrarClienteAG(entidad); integrarClienteAG(entidad);
integrarFornecedorAG(entidad); integrarFornecedorAG(entidad);
log.debug("fim da integração com AG");
if (respEx != null) { if (respEx != null) {
if (respEx instanceof IntegracionException) { if (respEx instanceof IntegracionException) {