0004755: Conexão - Conf. Exceção por Serviço
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@32578 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
fe8ec8e627
commit
a6575b507b
|
@ -17,4 +17,6 @@ public interface ConexionDAO extends GenericDAO<Conexion, Integer> {
|
||||||
public List<ConexionVO> buscarConexiones(Integer origenId, Integer destinoId);
|
public List<ConexionVO> buscarConexiones(Integer origenId, Integer destinoId);
|
||||||
|
|
||||||
public List<Conexion> buscarPorConexionCtrl(Long conexcionCtrlId);
|
public List<Conexion> buscarPorConexionCtrl(Long conexcionCtrlId);
|
||||||
|
|
||||||
|
public List<ConexionVO> buscarConexionesValidas();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion;
|
||||||
|
|
||||||
|
public interface ConexionExcepcionDAO extends GenericDAO<ConexionExcepcion, Long> {
|
||||||
|
|
||||||
|
public List<ConexionExcepcion> obtenerConexionExcepcionsActivo();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ConexionExcepcionDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion;
|
||||||
|
|
||||||
|
@Repository("conexionExcepcionDAO")
|
||||||
|
public class ConexionExcepcionHibernateDAO extends GenericHibernateDAO<ConexionExcepcion, Long>
|
||||||
|
implements ConexionExcepcionDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ConexionExcepcionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionExcepcion> obtenerConexionExcepcionsActivo() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -29,6 +31,55 @@ public class ConexionHibernateDAO extends GenericHibernateDAO<Conexion, Integer>
|
||||||
setSessionFactory(factory);
|
setSessionFactory(factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionVO> buscarConexionesValidas() {
|
||||||
|
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append(" select ");
|
||||||
|
sb.append(" cct.conexionctrl_id as conexionCtrlId, ");
|
||||||
|
sb.append(" po1.descparada as conOrigen, ");
|
||||||
|
sb.append(" pd1.descparada as conDestino, ");
|
||||||
|
sb.append(" c.numgrupo as grupo, ");
|
||||||
|
sb.append(" po2.descparada as tramoOrigen, ");
|
||||||
|
sb.append(" pd2.descparada as tramoDestino ");
|
||||||
|
sb.append(" from conexion c ");
|
||||||
|
sb.append(" inner join conexion_conf cf on ( cf.conexionctrl_id = c.conexionctrl_id ), ");
|
||||||
|
sb.append(" conexion_ctrl cct, ");
|
||||||
|
sb.append(" parada po1, ");
|
||||||
|
sb.append(" parada pd1, ");
|
||||||
|
sb.append(" parada po2, ");
|
||||||
|
sb.append(" parada pd2 ");
|
||||||
|
sb.append(" where c.activo = 1 ");
|
||||||
|
sb.append(" and cct.conexionctrl_id = c.conexionctrl_id ");
|
||||||
|
sb.append(" and po1.parada_id = cct.origen_id ");
|
||||||
|
sb.append(" and pd1.parada_id = cct.destino_id ");
|
||||||
|
sb.append(" and po2.parada_id = c.origen_id ");
|
||||||
|
sb.append(" and pd2.parada_id = c.destino_id ");
|
||||||
|
sb.append(" order by po1.descparada, ");
|
||||||
|
sb.append(" pd1.descparada, ");
|
||||||
|
sb.append(" c.numgrupo, ");
|
||||||
|
sb.append(" po2.descparada, ");
|
||||||
|
sb.append(" pd2.descparada ");
|
||||||
|
|
||||||
|
Query query = getSession().createSQLQuery(sb.toString());
|
||||||
|
List<ConexionVO> conexionVOs = new ArrayList<ConexionVO>();
|
||||||
|
|
||||||
|
for (Object o : query.list()) {
|
||||||
|
Object[] oc = (Object[]) o;
|
||||||
|
|
||||||
|
ConexionVO conexionVO = new ConexionVO();
|
||||||
|
conexionVO.setConexionCtrlId(((BigDecimal) oc[0]).longValue());
|
||||||
|
conexionVO.setConOrigen((String) oc[1]);
|
||||||
|
conexionVO.setConDestino((String) oc[2]);
|
||||||
|
conexionVO.setGrupo(((BigDecimal) oc[3]).intValue());
|
||||||
|
conexionVO.setTramoOrigen((String) oc[4]);
|
||||||
|
conexionVO.setTramoDestino((String) oc[5]);
|
||||||
|
conexionVOs.add(conexionVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return conexionVOs;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ConexionVO> buscarConexiones(Integer origenId, Integer destinoId) {
|
public List<ConexionVO> buscarConexiones(Integer origenId, Integer destinoId) {
|
||||||
StringBuilder sb = new StringBuilder("");
|
StringBuilder sb = new StringBuilder("");
|
||||||
|
|
|
@ -126,7 +126,6 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
public List<Corrida> buscarPorId(final Integer idCorrida) {
|
public List<Corrida> buscarPorId(final Integer idCorrida) {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
c.add(Restrictions.eq("id.corridaId", idCorrida));
|
c.add(Restrictions.eq("id.corridaId", idCorrida));
|
||||||
|
|
||||||
return c.list();
|
return c.list();
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "CONEXION_EXCEPCION_SEQ", sequenceName = "CONEXION_EXCEPCION_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "CONEXION_EXCEPCION")
|
||||||
|
public class ConexionExcepcion implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_EXCEPCION_SEQ")
|
||||||
|
@Column(name = "CONEXIONEXCEPCION_ID")
|
||||||
|
private Long conexionExcepcionId;
|
||||||
|
@Column(name = "NUMCORRIDA")
|
||||||
|
private Integer numcorrida;
|
||||||
|
@Column(name = "CONEXIONCTRL_ID")
|
||||||
|
private Long conexionctrlId;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public ConexionExcepcion() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConexionExcepcion(Long conexionExcepcionId) {
|
||||||
|
this.conexionExcepcionId = conexionExcepcionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConexionExcepcion(Long conexionExcepcionId, Integer numcorrida, Long conexionctrlId, Boolean activo, Date fecmodif, Integer usuarioId) {
|
||||||
|
this.conexionExcepcionId = conexionExcepcionId;
|
||||||
|
this.numcorrida = numcorrida;
|
||||||
|
this.conexionctrlId = conexionctrlId;
|
||||||
|
this.activo = activo;
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getConexionExcepcionId() {
|
||||||
|
return conexionExcepcionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConexionExcepcionId(Long conexionExcepcionId) {
|
||||||
|
this.conexionExcepcionId = conexionExcepcionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumcorrida() {
|
||||||
|
return numcorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumcorrida(Integer numcorrida) {
|
||||||
|
this.numcorrida = numcorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getConexionctrlId() {
|
||||||
|
return conexionctrlId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConexionctrlId(Long conexionctrlId) {
|
||||||
|
this.conexionctrlId = conexionctrlId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((conexionExcepcionId == null) ? 0 : conexionExcepcionId.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
ConexionExcepcion other = (ConexionExcepcion) obj;
|
||||||
|
if (conexionExcepcionId == null) {
|
||||||
|
if (other.conexionExcepcionId != null)
|
||||||
|
return false;
|
||||||
|
} else if (!conexionExcepcionId.equals(other.conexionExcepcionId))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ConexionExcepcion [conexionExcepcionId=" + conexionExcepcionId + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion;
|
||||||
|
|
||||||
|
public interface ConexionExcepcionService extends GenericService<ConexionExcepcion, Long> {
|
||||||
|
|
||||||
|
public List<ConexionExcepcion> obtenerConexionExcepcionsActivo();
|
||||||
|
|
||||||
|
}
|
|
@ -22,4 +22,7 @@ public interface ConexionService {
|
||||||
public void borrar(Conexion conexion);
|
public void borrar(Conexion conexion);
|
||||||
|
|
||||||
public List<Conexion> buscarPorConexionCtrl(Long conexcionCtrlId);
|
public List<Conexion> buscarPorConexionCtrl(Long conexcionCtrlId);
|
||||||
|
|
||||||
|
public List<ConexionVO> buscarConexionesValidas();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ConexionExcepcionDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConexionExcepcionService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("conexionExcepcionService")
|
||||||
|
public class ConexionExcepcionServiceImpl implements ConexionExcepcionService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConexionExcepcionDAO conexionExcepcionDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionExcepcion> obtenerTodos() {
|
||||||
|
return conexionExcepcionDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionExcepcion> obtenerConexionExcepcionsActivo() {
|
||||||
|
return conexionExcepcionDAO.obtenerConexionExcepcionsActivo();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConexionExcepcion obtenerID(Long id) {
|
||||||
|
return conexionExcepcionDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public ConexionExcepcion suscribir(ConexionExcepcion entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return conexionExcepcionDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public ConexionExcepcion actualizacion(ConexionExcepcion entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return conexionExcepcionDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void borrar(ConexionExcepcion entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
conexionExcepcionDAO.actualizacion(entidad);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -25,6 +25,11 @@ public class ConexionServiceImpl implements ConexionService {
|
||||||
conexionDAO.generarConexiones(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
conexionDAO.generarConexiones(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionVO> buscarConexionesValidas() {
|
||||||
|
return conexionDAO.buscarConexionesValidas();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ConexionVO> buscarConexiones(Integer origenId, Integer destinoId) {
|
public List<ConexionVO> buscarConexiones(Integer origenId, Integer destinoId) {
|
||||||
return conexionDAO.buscarConexiones(origenId, destinoId);
|
return conexionDAO.buscarConexiones(origenId, destinoId);
|
||||||
|
|
|
@ -55,4 +55,9 @@ public class ConexionVO {
|
||||||
public void setConexionCtrlId(Long conexionCtrlId) {
|
public void setConexionCtrlId(Long conexionCtrlId) {
|
||||||
this.conexionCtrlId = conexionCtrlId;
|
this.conexionCtrlId = conexionCtrlId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ConexionVO [conOrigen=" + conOrigen + ", conDestino=" + conDestino + ", grupo=" + grupo + ", tramoOrigen=" + tramoOrigen + ", tramoDestino=" + tramoDestino + ", conexionCtrlId=" + conexionCtrlId + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue