diff --git a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java index 46bb8e7eb..f07b83d38 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java @@ -80,6 +80,9 @@ public class Categoria implements Serializable { @Column(name = "INDNAOUSAASSENTO") private Boolean indnaousaassento; + @Column(name = "CVESISTEMA") + private String cvesistema; + public Categoria() { } @@ -239,4 +242,11 @@ public class Categoria implements Serializable { this.orgaosConcedentes = orgaosConcedentes; } + public String getCvesistema() { + return cvesistema; + } + + public void setCvesistema(String cvesistema) { + this.cvesistema = cvesistema; + } } diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java index 5703bca1c..dab713398 100644 --- a/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.service; +import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; /** @@ -21,4 +22,6 @@ public interface CategoriaCtrlService { public CategoriaCtrl actualizacion(CategoriaCtrl entidad); public void borrar(CategoriaCtrl entidad); + + public boolean validaCategoriaProgramaFidelidade(Categoria categoria); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java index 287cab7ab..64fcb95c6 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java @@ -15,6 +15,8 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.CategoriaCtrlDAO; import com.rjconsultores.ventaboletos.dao.CategoriaDAO; +import com.rjconsultores.ventaboletos.dao.ConstanteDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.CategoriaClase; import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; @@ -22,6 +24,7 @@ import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import com.rjconsultores.ventaboletos.entidad.Constante; import com.rjconsultores.ventaboletos.service.CategoriaCtrlService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -33,11 +36,18 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { public static final int CATEGORIA_ADULTO = 1; + private static final String CVE_SISTEMA_CATEGORIA_FIDELIDADE = "FIDELIDADE"; + private static final String CONSTANTE_URL_WS_FIDELIDADE = "URL_WS_FIDELIDADE"; + private static final String CONSTANTE_SENHA_WS_FIDELIDADE = "SENHA_WS_FIDELIDADE"; + private static final String CONSTANTE_USUARIO_WS_FIDELIDADE = "USUARIO_WS_FIDELIDADE"; private static final int CANT_MAX_CATEGORIA_ADULTO = 200; @Autowired private CategoriaCtrlDAO categoriaCtrlDAO; @Autowired private CategoriaDAO categoriaDAO; + + @Autowired + private ConstanteDAO constanteDAO; @Override public CategoriaCtrl obtenerID(Integer id) { @@ -165,4 +175,23 @@ public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { return cd; } + + @Override + public boolean validaCategoriaProgramaFidelidade(Categoria categoria){ + + if(categoria.getCvesistema().equals(CVE_SISTEMA_CATEGORIA_FIDELIDADE)){ + Constante url = constanteDAO.buscarPorNomeConstante(CONSTANTE_URL_WS_FIDELIDADE); + Constante usuario = constanteDAO.buscarPorNomeConstante(CONSTANTE_USUARIO_WS_FIDELIDADE); + Constante senha = constanteDAO.buscarPorNomeConstante(CONSTANTE_SENHA_WS_FIDELIDADE); + + if(url == null || url.getValorconstante() == null || url.getValorconstante().isEmpty() || + usuario == null || usuario.getValorconstante() == null || usuario.getValorconstante().isEmpty() || + senha == null || senha.getValorconstante() == null || senha.getValorconstante().isEmpty()){ + + return Boolean.FALSE; + } + } + + return Boolean.TRUE; + } }