From 9da904a8e6072ad27daded20594a3ee3a49f2247 Mon Sep 17 00:00:00 2001 From: gleimar Date: Wed, 27 Feb 2013 19:59:19 +0000 Subject: [PATCH] =?UTF-8?q?-=20corre=C3=A7=C3=A3o=20da=20valida=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20duplicidade=20iata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@24740 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../service/impl/ParadaServiceImpl.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java index 95e7738e2..60d574671 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java @@ -16,9 +16,15 @@ import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import java.util.Calendar; import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.zkoss.util.resource.Labels; +import org.zkoss.zul.Messagebox; /** * @@ -63,6 +69,19 @@ public class ParadaServiceImpl implements ParadaService { } } + + lsParadas = buscarCVE(entidad.getCveparada()); + + if (!lsParadas.isEmpty()) { + if (entidad.getParadaId() == null) { + throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste"); + } else { + if (!lsParadas.contains(entidad)){ + throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste"); + } + } + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); @@ -116,7 +135,7 @@ public class ParadaServiceImpl implements ParadaService { } public List buscarCVE(String cveparada) { - return paradaDAO.buscarCVE(cveparada); + return paradaDAO.buscarCVE(StringUtils.trim(cveparada)); } public List buscaLike(String descparada) {