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());
}
}
entidad = puntoVentaDAO.suscribir(entidad);
if (respEx != null) {
if (respEx instanceof IntegracionException) {
throw (IntegracionException) respEx;
} else if (respEx instanceof ValidacionCampoException) {
if (respEx instanceof ValidacionCampoException) {
throw (ValidacionCampoException) respEx;
} else if (respEx instanceof IntegracionException) {
entidad = puntoVentaDAO.suscribir(entidad);
throw (IntegracionException) respEx;
}
}
entidad = puntoVentaDAO.suscribir(entidad);
return entidad;
}
@ -197,16 +197,16 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
private boolean tienesEstacionEnPuntoVta(PuntoVenta entidad) {
List<Estacion> lsEstaciones = estacionService.buscarEstaciones(entidad);
if(lsEstaciones != null && lsEstaciones.size() > 0 ){
if (lsEstaciones != null && lsEstaciones.size() > 0) {
return true;
}
return false;
}
@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");
}
@ -289,7 +289,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String cpfOrCnpj = puntoVenta.getNumDoCPuntoVenta().replaceAll("[^0-9.]", "");
if (!CpfCnpj.isValid(cpfOrCnpj)){
if (!CpfCnpj.isValid(cpfOrCnpj)) {
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 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 ddd = null;
@ -486,27 +486,29 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
}
/**
* From xml spec valid chars:<br>
* #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]<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
*
* @param text The String to clean
* @param replacement The string to be substituted for each match
* @return The resulting String
*/
private String removerCaracteresInvalidosXml(String s){
if (s == null){
* From xml spec valid chars:<br>
* #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]<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
*
* @param text
* The String to clean
* @param replacement
* The string to be substituted for each match
* @return The resulting String
*/
private String removerCaracteresInvalidosXml(String s) {
if (s == null) {
return s;
}
String re = "[^\\x09\\x0A\\x0D\\x20-\\xD7FF\\xE000-\\xFFFD\\x10000-x10FFFF]";
return s.replaceAll(re, "");
return s.replaceAll(re, "");
}
private String removerAcentosCaracteresEspeciaisTotvs(String s){
if (StringUtils.isBlank(s)){
private String removerAcentosCaracteresEspeciaisTotvs(String s) {
if (StringUtils.isBlank(s)) {
return s;
}
s = StringUtils.trim(s);