valdevir 2016-09-29 19:49:31 +00:00
parent 5a42085280
commit 60c232f973
1 changed files with 56 additions and 54 deletions

View File

@ -120,15 +120,15 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage());
} }
} }
entidad = puntoVentaDAO.suscribir(entidad);
if (respEx != null) { if (respEx != null) {
if (respEx instanceof IntegracionException) { if (respEx instanceof ValidacionCampoException) {
throw (IntegracionException) respEx;
} else if (respEx instanceof ValidacionCampoException) {
throw (ValidacionCampoException) respEx; throw (ValidacionCampoException) respEx;
} else if (respEx instanceof IntegracionException) {
entidad = puntoVentaDAO.suscribir(entidad);
throw (IntegracionException) respEx;
} }
} }
entidad = puntoVentaDAO.suscribir(entidad);
return entidad; return entidad;
} }
@ -197,16 +197,16 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
private boolean tienesEstacionEnPuntoVta(PuntoVenta entidad) { private boolean tienesEstacionEnPuntoVta(PuntoVenta entidad) {
List<Estacion> lsEstaciones = estacionService.buscarEstaciones(entidad); List<Estacion> lsEstaciones = estacionService.buscarEstaciones(entidad);
if(lsEstaciones != null && lsEstaciones.size() > 0 ){ if (lsEstaciones != null && lsEstaciones.size() > 0) {
return true; return true;
} }
return false; return false;
} }
@Transactional @Transactional
public void borrar(PuntoVenta entidad) throws BusinessException{ public void borrar(PuntoVenta entidad) throws BusinessException {
if(tienesEstacionEnPuntoVta(entidad)){ if (tienesEstacionEnPuntoVta(entidad)) {
throw new BusinessException("editarPuntoVentaController.MSG.estacionVinculadaAgenciaOnDelete"); throw new BusinessException("editarPuntoVentaController.MSG.estacionVinculadaAgenciaOnDelete");
} }
@ -289,7 +289,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String cpfOrCnpj = puntoVenta.getNumDoCPuntoVenta().replaceAll("[^0-9.]", ""); String cpfOrCnpj = puntoVenta.getNumDoCPuntoVenta().replaceAll("[^0-9.]", "");
if (!CpfCnpj.isValid(cpfOrCnpj)){ if (!CpfCnpj.isValid(cpfOrCnpj)) {
throw new ValidacionCampoException("editarPuntoVentaController.erro.cpfCnpj"); throw new ValidacionCampoException("editarPuntoVentaController.erro.cpfCnpj");
} }
@ -365,7 +365,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String est = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getEstado().getCveestado(); String est = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getEstado().getCveestado();
String codpais = CodPaisBanco.BRASIL.getValor(); String codpais = CodPaisBanco.BRASIL.getValor();
String cep = puntoVenta.getCodpostal() != null?puntoVenta.getCodpostal().toString():null; String cep = puntoVenta.getCodpostal() != null ? puntoVenta.getCodpostal().toString() : null;
String tel = puntoVenta.getNumtelefonouno(); String tel = puntoVenta.getNumtelefonouno();
String ddd = null; String ddd = null;
@ -486,27 +486,29 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
} }
/** /**
* From xml spec valid chars:<br> * From xml spec valid chars:<br>
* #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]<br> * #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]<br>
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.<br> * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.<br>
* *
* link artigo:http://stackoverflow.com/questions/9710185/how-to-deal-with-invalid-characters-in-a-ws-output-when-using-cxf * link artigo:http://stackoverflow.com/questions/9710185/how-to-deal-with-invalid-characters-in-a-ws-output-when-using-cxf
* *
* @param text The String to clean * @param text
* @param replacement The string to be substituted for each match * The String to clean
* @return The resulting String * @param replacement
*/ * The string to be substituted for each match
private String removerCaracteresInvalidosXml(String s){ * @return The resulting String
if (s == null){ */
private String removerCaracteresInvalidosXml(String s) {
if (s == null) {
return s; return s;
} }
String re = "[^\\x09\\x0A\\x0D\\x20-\\xD7FF\\xE000-\\xFFFD\\x10000-x10FFFF]"; String re = "[^\\x09\\x0A\\x0D\\x20-\\xD7FF\\xE000-\\xFFFD\\x10000-x10FFFF]";
return s.replaceAll(re, ""); return s.replaceAll(re, "");
} }
private String removerAcentosCaracteresEspeciaisTotvs(String s){ private String removerAcentosCaracteresEspeciaisTotvs(String s) {
if (StringUtils.isBlank(s)){ if (StringUtils.isBlank(s)) {
return s; return s;
} }
s = StringUtils.trim(s); s = StringUtils.trim(s);