fixes bug #7276
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@54351 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
347ba8d80b
commit
f82d348e00
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta;
|
||||||
|
|
||||||
|
public interface ConexionExcepcionRutaDAO extends GenericDAO<ConexionExcepcionRuta, Long> {
|
||||||
|
|
||||||
|
public List<ConexionExcepcionRuta> obtenerConexionExcepcionsActivo(Long conexionctrlId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
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.ConexionExcepcionRutaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta;
|
||||||
|
|
||||||
|
@Repository("conexionExcepcionRutaDAO")
|
||||||
|
public class ConexionExcepcionRutaHibernateDAO extends GenericHibernateDAO<ConexionExcepcionRuta, Long>
|
||||||
|
implements ConexionExcepcionRutaDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ConexionExcepcionRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionExcepcionRuta> obtenerConexionExcepcionsActivo(Long conexionctrlId) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("conexionctrlId", conexionctrlId));
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
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.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "CONEXION_EXCEPCION_RUTA_SEQ", sequenceName = "CONEXION_EXCEPCION_RUTA_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "CONEXION_EXCEPCION_RUTA")
|
||||||
|
public class ConexionExcepcionRuta implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_EXCEPCION_RUTA_SEQ")
|
||||||
|
@Column(name = "CONEXIONEXCEPCIONRUTA_ID")
|
||||||
|
private Long conexionExcepcionRutaId;
|
||||||
|
@JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private Ruta ruta;
|
||||||
|
@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 Long getConexionExcepcionRutaId() {
|
||||||
|
return conexionExcepcionRutaId;
|
||||||
|
}
|
||||||
|
public void setConexionExcepcionRutaId(Long conexionExcepcionRutaId) {
|
||||||
|
this.conexionExcepcionRutaId = conexionExcepcionRutaId;
|
||||||
|
}
|
||||||
|
public Ruta getRuta() {
|
||||||
|
return ruta;
|
||||||
|
}
|
||||||
|
public void setRuta(Ruta ruta) {
|
||||||
|
this.ruta = ruta;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta;
|
||||||
|
|
||||||
|
public interface ConexionExcepcionRutaService extends GenericService<ConexionExcepcionRuta, Long> {
|
||||||
|
|
||||||
|
public List<ConexionExcepcionRuta> obtenerConexionExcepcionsActivo(Long conexionctrlId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
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.ConexionExcepcionRutaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConexionExcepcionRutaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("conexionExcepcionRutaService")
|
||||||
|
public class ConexionExcepcionRutaServiceImpl implements ConexionExcepcionRutaService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConexionExcepcionRutaDAO conexionExcepcionRutaDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionExcepcionRuta> obtenerTodos() {
|
||||||
|
return conexionExcepcionRutaDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionExcepcionRuta> obtenerConexionExcepcionsActivo(Long conexionctrlId) {
|
||||||
|
return conexionExcepcionRutaDAO.obtenerConexionExcepcionsActivo(conexionctrlId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConexionExcepcionRuta obtenerID(Long id) {
|
||||||
|
return conexionExcepcionRutaDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public ConexionExcepcionRuta suscribir(ConexionExcepcionRuta entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return conexionExcepcionRutaDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public ConexionExcepcionRuta actualizacion(ConexionExcepcionRuta entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return conexionExcepcionRutaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void borrar(ConexionExcepcionRuta entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
conexionExcepcionRutaDAO.actualizacion(entidad);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue