correcao (fixes bug 6109)
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@42153 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
0f95b29633
commit
7283c21b3a
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioSesion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author RJ Consultores
|
||||||
|
*/
|
||||||
|
public interface UsuarioSesionDAO extends GenericDAO<UsuarioSesion, Integer> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Order;
|
||||||
|
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.UsuarioSesionDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioSesion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author RJ Consultores
|
||||||
|
*/
|
||||||
|
@Repository("usuarioSesionDAO")
|
||||||
|
public class UsuarioSesionHibernateDAO extends GenericHibernateDAO<UsuarioSesion, Integer>
|
||||||
|
implements UsuarioSesionDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public UsuarioSesionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UsuarioSesion> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
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.OneToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author RJ Consultores
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "USUARIO_SESION_SEQ", sequenceName = "USUARIO_SESION_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "USUARIO_SESION")
|
||||||
|
public class UsuarioSesion implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SESION_SEQ")
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "USUARIOSESION_ID")
|
||||||
|
private Integer usuarioSesionId;
|
||||||
|
|
||||||
|
@JoinColumn(name = "SISTEMA_ID", referencedColumnName = "SISTEMA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private Sistema sistema;
|
||||||
|
|
||||||
|
@Column(name = "INDFIRMADO")
|
||||||
|
private Boolean indFirmado;
|
||||||
|
|
||||||
|
@Column(name = "FECHORINICIO")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecHorInicio;
|
||||||
|
|
||||||
|
@Column(name = "FECHORACTIVIDAD")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecHorActividad;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID")
|
||||||
|
private Usuario usuario;
|
||||||
|
|
||||||
|
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private Empresa empresa;
|
||||||
|
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
|
||||||
|
public Integer getUsuarioSesionId() {
|
||||||
|
return usuarioSesionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioSesionId(Integer usuarioSesionId) {
|
||||||
|
this.usuarioSesionId = usuarioSesionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Sistema getSistema() {
|
||||||
|
return sistema;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSistema(Sistema sistema) {
|
||||||
|
this.sistema = sistema;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndFirmado() {
|
||||||
|
return indFirmado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndFirmado(Boolean indFirmado) {
|
||||||
|
this.indFirmado = indFirmado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecHorInicio() {
|
||||||
|
return fecHorInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecHorInicio(Date fecHorInicio) {
|
||||||
|
this.fecHorInicio = fecHorInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecHorActividad() {
|
||||||
|
return fecHorActividad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecHorActividad(Date fecHorActividad) {
|
||||||
|
this.fecHorActividad = fecHorActividad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Usuario getUsuario() {
|
||||||
|
return usuario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuario(Usuario usuario) {
|
||||||
|
this.usuario = usuario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Empresa getEmpresa() {
|
||||||
|
return empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresa(Empresa empresa) {
|
||||||
|
this.empresa = empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 0;
|
||||||
|
hash += (usuarioSesionId != null ? usuarioSesionId.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||||
|
if (!(object instanceof UsuarioSesion)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
UsuarioSesion other = (UsuarioSesion) object;
|
||||||
|
if ((this.usuarioSesionId == null && other.usuarioSesionId != null) || (this.usuarioSesionId != null && !this.usuarioSesionId.equals(other.usuarioSesionId))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "com.rjconsultores.ventaboletos.entidad.UsuarioSesion[usuarioSesionId=" + usuarioSesionId + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioSesion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author RJ Consultores
|
||||||
|
*/
|
||||||
|
public interface UsuarioSesionService extends GenericService<UsuarioSesion, Integer> {
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
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.UsuarioSesionDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.UsuarioSesion;
|
||||||
|
import com.rjconsultores.ventaboletos.service.UsuarioSesionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author RJ Consultores
|
||||||
|
*/
|
||||||
|
@Service("usuarioSesionService")
|
||||||
|
public class UsuarioSesionImpl implements UsuarioSesionService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UsuarioSesionDAO usuarioSesionDAO;
|
||||||
|
|
||||||
|
public List<UsuarioSesion> obtenerTodos() {
|
||||||
|
return usuarioSesionDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UsuarioSesion obtenerID(Integer id) {
|
||||||
|
return usuarioSesionDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public UsuarioSesion suscribir(UsuarioSesion entidad) {
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return usuarioSesionDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public UsuarioSesion actualizacion(UsuarioSesion entidad) {
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return usuarioSesionDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(UsuarioSesion entidad) {
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
usuarioSesionDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue