0005003: Bloqueio de Trecho - Adicionar agência
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@34146 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
5628b12df7
commit
a44b13cfba
|
@ -0,0 +1,6 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta;
|
||||
|
||||
public interface ConfRestricaoPtovtaDAO extends GenericDAO<ConfRestricaoPtovta, 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.ConfRestricaoPtovtaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta;
|
||||
|
||||
@Repository("confRestricaoPtovtaDAO")
|
||||
public class ConfRestricaoPtovtaHibernateDAO extends GenericHibernateDAO<ConfRestricaoPtovta, Integer>
|
||||
implements ConfRestricaoPtovtaDAO {
|
||||
|
||||
@Autowired
|
||||
public ConfRestricaoPtovtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
}
|
|
@ -73,9 +73,10 @@ public class ConfRestricaoCanalVenta implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "RUTA_ID")
|
||||
private Ruta ruta;
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID")
|
||||
@OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<ConfRestricaoExcecao> lsConfRestricaoExcecao;
|
||||
@OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<ConfRestricaoPtovta> lsConfRestricaoPtovta;
|
||||
|
||||
public Integer getConfRestricaoCanalVentaId() {
|
||||
return confRestricaoCanalVentaId;
|
||||
|
@ -250,6 +251,27 @@ public class ConfRestricaoCanalVenta implements Serializable {
|
|||
this.lsConfRestricaoExcecao = lsConfRestricaoExcecao;
|
||||
}
|
||||
|
||||
public List<ConfRestricaoPtovta> getLsConfRestricaoPtovta() {
|
||||
if (this.lsConfRestricaoPtovta != null) {
|
||||
List<ConfRestricaoPtovta> lsTemp = new ArrayList<ConfRestricaoPtovta>();
|
||||
|
||||
for (ConfRestricaoPtovta cre : this.lsConfRestricaoPtovta) {
|
||||
if (cre.getActivo() == Boolean.TRUE) {
|
||||
lsTemp.add(cre);
|
||||
}
|
||||
}
|
||||
|
||||
lsConfRestricaoPtovta = lsTemp;
|
||||
return lsConfRestricaoPtovta;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setLsConfRestricaoPtovta(List<ConfRestricaoPtovta> lsConfRestricaoPtovta) {
|
||||
this.lsConfRestricaoPtovta = lsConfRestricaoPtovta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
|
|
@ -10,7 +10,7 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
|
@ -27,8 +27,8 @@ public class ConfRestricaoExcecao implements Serializable {
|
|||
@Column(name = "CONFRESTRICAOEXCECAO_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_EXCECAO_SEQ")
|
||||
private Integer confRestricaoExcecaoId;
|
||||
@OneToOne
|
||||
@JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID")
|
||||
@JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID")
|
||||
@ManyToOne
|
||||
private ConfRestricaoCanalVenta confRestricaoCanalVenta;
|
||||
@Column(name = "FECEXCECAO")
|
||||
private Date fecExcecao;
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
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 = "CONF_RESTRICAO_PTOVTA_SEQ", sequenceName = "CONF_RESTRICAO_PTOVTA_SEQ", allocationSize = 1)
|
||||
@Table(name = "CONF_RESTRICAO_PTOVTA")
|
||||
public class ConfRestricaoPtovta implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_PTOVTA_SEQ")
|
||||
@Column(name = "CONFRESTRICAOPTOVTA_ID")
|
||||
private Integer confRestricaoPtovtaId;
|
||||
@JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID")
|
||||
@ManyToOne
|
||||
private ConfRestricaoCanalVenta confRestricaoCanalVenta;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
||||
private PuntoVenta puntoVenta;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
public Integer getConfRestricaoPtovtaId() {
|
||||
return confRestricaoPtovtaId;
|
||||
}
|
||||
|
||||
public void setConfRestricaoPtovtaId(Integer confRestricaoPtovtaId) {
|
||||
this.confRestricaoPtovtaId = confRestricaoPtovtaId;
|
||||
}
|
||||
|
||||
public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() {
|
||||
return confRestricaoCanalVenta;
|
||||
}
|
||||
|
||||
public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) {
|
||||
this.confRestricaoCanalVenta = confRestricaoCanalVenta;
|
||||
}
|
||||
|
||||
public PuntoVenta getPuntoVenta() {
|
||||
return puntoVenta;
|
||||
}
|
||||
|
||||
public void setPuntoVenta(PuntoVenta puntoVenta) {
|
||||
this.puntoVenta = puntoVenta;
|
||||
}
|
||||
|
||||
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 + ((confRestricaoPtovtaId == null) ? 0 : confRestricaoPtovtaId.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;
|
||||
ConfRestricaoPtovta other = (ConfRestricaoPtovta) obj;
|
||||
if (confRestricaoPtovtaId == null) {
|
||||
if (other.confRestricaoPtovtaId != null)
|
||||
return false;
|
||||
} else if (!confRestricaoPtovtaId.equals(other.confRestricaoPtovtaId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ConfRestricaoPtovta [confRestricaoPtovtaId=" + confRestricaoPtovtaId + ", confRestricaoCanalVenta=" + confRestricaoCanalVenta + ", puntoVenta=" + puntoVenta + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta;
|
||||
|
||||
public interface ConfRestricaoPtovtaService extends GenericService<ConfRestricaoPtovta, Integer> {
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
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.ConfRestricaoPtovtaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta;
|
||||
import com.rjconsultores.ventaboletos.service.ConfRestricaoPtovtaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("confRestricaoPtovtaService")
|
||||
public class ConfRestricaoPtovtaServiceImpl implements ConfRestricaoPtovtaService {
|
||||
|
||||
@Autowired
|
||||
ConfRestricaoPtovtaDAO confRestricaoPtovtaDAO;
|
||||
|
||||
@Override
|
||||
public List<ConfRestricaoPtovta> obtenerTodos() {
|
||||
return confRestricaoPtovtaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfRestricaoPtovta obtenerID(Integer id) {
|
||||
return confRestricaoPtovtaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ConfRestricaoPtovta suscribir(ConfRestricaoPtovta entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return confRestricaoPtovtaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ConfRestricaoPtovta actualizacion(ConfRestricaoPtovta entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return confRestricaoPtovtaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void borrar(ConfRestricaoPtovta entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
confRestricaoPtovtaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue