git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@25873 d1611594-4594-4d17-8e1d-87c2c4800839
parent
a83fe7ee0b
commit
91147f78cf
|
@ -0,0 +1,7 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao;
|
||||||
|
|
||||||
|
public interface ConfRestricaoExcecaoDAO extends GenericDAO<ConfRestricaoExcecao, Integer> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ConfRestricaoExcecaoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao;
|
||||||
|
|
||||||
|
@Repository("confRestricaoExcecaoDAO")
|
||||||
|
public class ConfRestricaoExcecaoHibernateDAO extends GenericHibernateDAO<ConfRestricaoExcecao, Integer>
|
||||||
|
implements ConfRestricaoExcecaoDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ConfRestricaoExcecaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,20 @@
|
||||||
package com.rjconsultores.ventaboletos.entidad;
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
@ -68,6 +73,9 @@ public class ConfRestricaoCanalVenta implements Serializable {
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "RUTA_ID")
|
@JoinColumn(name = "RUTA_ID")
|
||||||
private Ruta ruta;
|
private Ruta ruta;
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
|
@JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID")
|
||||||
|
private List<ConfRestricaoExcecao> lsConfRestricaoExcecao;
|
||||||
|
|
||||||
public Integer getConfRestricaoCanalVentaId() {
|
public Integer getConfRestricaoCanalVentaId() {
|
||||||
return confRestricaoCanalVentaId;
|
return confRestricaoCanalVentaId;
|
||||||
|
@ -221,6 +229,27 @@ public class ConfRestricaoCanalVenta implements Serializable {
|
||||||
this.ruta = ruta;
|
this.ruta = ruta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ConfRestricaoExcecao> getLsConfRestricaoExcecao() {
|
||||||
|
if (this.lsConfRestricaoExcecao != null) {
|
||||||
|
List<ConfRestricaoExcecao> lsTemp = new ArrayList<ConfRestricaoExcecao>();
|
||||||
|
|
||||||
|
for (ConfRestricaoExcecao cre : this.lsConfRestricaoExcecao) {
|
||||||
|
if (cre.getActivo() == Boolean.TRUE) {
|
||||||
|
lsTemp.add(cre);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lsConfRestricaoExcecao = lsTemp;
|
||||||
|
return lsConfRestricaoExcecao;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsConfRestricaoExcecao(List<ConfRestricaoExcecao> lsConfRestricaoExcecao) {
|
||||||
|
this.lsConfRestricaoExcecao = lsConfRestricaoExcecao;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
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.OneToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "CONF_RESTRICAO_EXCECAO_SEQ", sequenceName = "CONF_RESTRICAO_EXCECAO_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "CONF_RESTRICAO_EXCECAO")
|
||||||
|
public class ConfRestricaoExcecao implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "CONFRESTRICAOEXCECAO_ID")
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_EXCECAO_SEQ")
|
||||||
|
private Integer confRestricaoExcecaoId;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID")
|
||||||
|
private ConfRestricaoCanalVenta confRestricaoCanalVenta;
|
||||||
|
@Column(name = "FECEXCECAO")
|
||||||
|
private Date fecExcecao;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public Integer getConfRestricaoExcecaoId() {
|
||||||
|
return confRestricaoExcecaoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfRestricaoExcecaoId(Integer confRestricaoExcecaoId) {
|
||||||
|
this.confRestricaoExcecaoId = confRestricaoExcecaoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() {
|
||||||
|
return confRestricaoCanalVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) {
|
||||||
|
this.confRestricaoCanalVenta = confRestricaoCanalVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecExcecao() {
|
||||||
|
return fecExcecao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecExcecao(Date fecExcecao) {
|
||||||
|
this.fecExcecao = fecExcecao;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 + ((confRestricaoExcecaoId == null) ? 0 : confRestricaoExcecaoId.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;
|
||||||
|
ConfRestricaoExcecao other = (ConfRestricaoExcecao) obj;
|
||||||
|
if (confRestricaoExcecaoId == null) {
|
||||||
|
if (other.confRestricaoExcecaoId != null)
|
||||||
|
return false;
|
||||||
|
} else if (!confRestricaoExcecaoId.equals(other.confRestricaoExcecaoId))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao;
|
||||||
|
|
||||||
|
public interface ConfRestricaoExcecaoService extends GenericService<ConfRestricaoExcecao, Integer> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
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.ConfRestricaoExcecaoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConfRestricaoExcecaoService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("confRestricaoExcecaoService")
|
||||||
|
public class ConfRestricaoExcecaoServiceImpl implements ConfRestricaoExcecaoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfRestricaoExcecaoDAO confRestricaoExcecaoDAO;
|
||||||
|
|
||||||
|
public List<ConfRestricaoExcecao> obtenerTodos() {
|
||||||
|
return confRestricaoExcecaoDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfRestricaoExcecao obtenerID(Integer id) {
|
||||||
|
return confRestricaoExcecaoDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ConfRestricaoExcecao suscribir(ConfRestricaoExcecao entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return confRestricaoExcecaoDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ConfRestricaoExcecao actualizacion(ConfRestricaoExcecao entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return confRestricaoExcecaoDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(ConfRestricaoExcecao entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
confRestricaoExcecaoDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue