desenvolvimento (bug #5284)
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@35335 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d6f2829502
commit
b903b25aba
|
@ -0,0 +1,8 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
||||||
|
|
||||||
|
public interface PtoVtaSeguroDAO extends GenericDAO<PtoVtaSeguro, Integer> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
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.PtoVtaSeguroDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
||||||
|
|
||||||
|
@Repository("ptoVtaSeguroDAO")
|
||||||
|
public class PtoVtaSeguroHibernateDAO extends GenericHibernateDAO<PtoVtaSeguro, Integer>
|
||||||
|
implements PtoVtaSeguroDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public PtoVtaSeguroHibernateDAO(
|
||||||
|
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PtoVtaSeguro> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.addOrder(Order.asc("ptoVtaSeguroId"));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PtoVtaSeguro> buscar(int id) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.eq("ptoVtaSeguroId", id));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,160 @@
|
||||||
|
/*
|
||||||
|
* 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.OneToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author RJ
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "PTOVTA_SEGURO_SEQ", sequenceName = "PTOVTA_SEGURO_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "PTOVTA_SEGURO")
|
||||||
|
public class PtoVtaSeguro implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_SEGURO_SEQ")
|
||||||
|
@Column(name = "PTOVTASEGURO_ID")
|
||||||
|
private Integer ptoVtaSeguroId;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "EMPRESA_ID")
|
||||||
|
private Empresa empresa;
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "INDVENDSEGOPCIONAL")
|
||||||
|
private Boolean indVendeSegOpcional;
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "INDESTANSEGOPCIONAL")
|
||||||
|
private Boolean indEstanSegOpcional;
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private int usuarioId;
|
||||||
|
|
||||||
|
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
||||||
|
@OneToOne
|
||||||
|
private PuntoVenta puntoventaId;
|
||||||
|
|
||||||
|
public PtoVtaSeguro() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public PtoVtaSeguro(Integer ptoVtaSeguroId) {
|
||||||
|
this.ptoVtaSeguroId = ptoVtaSeguroId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPtoVtaSeguroId() {
|
||||||
|
return ptoVtaSeguroId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPtoVtaSeguroId(Integer ptoVtaSeguroId) {
|
||||||
|
this.ptoVtaSeguroId = ptoVtaSeguroId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Empresa getEmpresa() {
|
||||||
|
return empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresa(Empresa empresa) {
|
||||||
|
this.empresa = empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndVendeSegOpcional() {
|
||||||
|
return indVendeSegOpcional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndVendeSegOpcional(Boolean indVendeSegOpcional) {
|
||||||
|
this.indVendeSegOpcional = indVendeSegOpcional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndEstanSegOpcional() {
|
||||||
|
return indEstanSegOpcional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndEstanSegOpcional(Boolean indEstanSegOpcional) {
|
||||||
|
this.indEstanSegOpcional = indEstanSegOpcional;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 int getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioId(int usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PuntoVenta getPuntoventaId() {
|
||||||
|
return puntoventaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoventaId(PuntoVenta puntoventaId) {
|
||||||
|
this.puntoventaId = puntoventaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 0;
|
||||||
|
hash += (ptoVtaSeguroId != null ? ptoVtaSeguroId.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
if (!(object instanceof PtoVtaSeguro)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
PtoVtaSeguro other = (PtoVtaSeguro) object;
|
||||||
|
if ((this.ptoVtaSeguroId == null && other.ptoVtaSeguroId != null) || (this.ptoVtaSeguroId != null && !this.ptoVtaSeguroId.equals(other.ptoVtaSeguroId))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro[ ptoVtaSeguroId=" + ptoVtaSeguroId + " ]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -166,6 +166,10 @@ public class PuntoVenta implements Serializable {
|
||||||
@LazyCollection(LazyCollectionOption.FALSE)
|
@LazyCollection(LazyCollectionOption.FALSE)
|
||||||
private List<PtoVtaCheckin> ptovtaCheckinList;
|
private List<PtoVtaCheckin> ptovtaCheckinList;
|
||||||
|
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId")
|
||||||
|
@LazyCollection(LazyCollectionOption.FALSE)
|
||||||
|
private List<PtoVtaSeguro> ptovtaSeguroList;
|
||||||
|
|
||||||
public PtovtaEmpresaBloqueada addEmpresaBloqueada(Empresa e){
|
public PtovtaEmpresaBloqueada addEmpresaBloqueada(Empresa e){
|
||||||
PtovtaEmpresaBloqueada eb = new PtovtaEmpresaBloqueada();
|
PtovtaEmpresaBloqueada eb = new PtovtaEmpresaBloqueada();
|
||||||
eb.setEmpresa(e);
|
eb.setEmpresa(e);
|
||||||
|
@ -701,5 +705,36 @@ public class PuntoVenta implements Serializable {
|
||||||
public void removePtovtaCheckin(PtoVtaCheckin pto){
|
public void removePtovtaCheckin(PtoVtaCheckin pto){
|
||||||
this.ptovtaCheckinList.remove(pto);
|
this.ptovtaCheckinList.remove(pto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PtoVtaSeguro> getPtovtaSeguroList() {
|
||||||
|
List<PtoVtaSeguro> lista = new ArrayList<PtoVtaSeguro>();
|
||||||
|
for (PtoVtaSeguro ck : ptovtaSeguroList ){
|
||||||
|
if (ck.getActivo()){
|
||||||
|
lista.add(ck);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lista;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPtovtaSeguroList(List<PtoVtaSeguro> ptovtaSeguroList) {
|
||||||
|
this.ptovtaSeguroList = ptovtaSeguroList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PtoVtaSeguro addPtovtaSeguro(PtoVtaSeguro pto){
|
||||||
|
PtoVtaSeguro pt = new PtoVtaSeguro();
|
||||||
|
pt.setPuntoventaId(pto.getPuntoventaId());
|
||||||
|
pt.setEmpresa(pto.getEmpresa());
|
||||||
|
pt.setIndVendeSegOpcional(pto.getIndVendeSegOpcional());
|
||||||
|
pt.setIndEstanSegOpcional(pto.getIndEstanSegOpcional());
|
||||||
|
pt.setActivo(Boolean.TRUE);
|
||||||
|
pt.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
pt.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
this.ptovtaSeguroList.add(pt);
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removePtovtaSeguro(PtoVtaSeguro pto){
|
||||||
|
this.ptovtaSeguroList.remove(pto);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
||||||
|
|
||||||
|
public interface PtoVtaSeguroService extends GenericService<PtoVtaSeguro, Integer> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
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.PtoVtaSeguroDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PtoVtaSeguroService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("ptoVtaSeguroService")
|
||||||
|
public class PtoVtaSeguroServiceImpl implements PtoVtaSeguroService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PtoVtaSeguroDAO ptoVtaSeguroServiceDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PtoVtaSeguro> obtenerTodos() {
|
||||||
|
return ptoVtaSeguroServiceDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PtoVtaSeguro obtenerID(Integer id) {
|
||||||
|
return ptoVtaSeguroServiceDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = false)
|
||||||
|
public PtoVtaSeguro suscribir(PtoVtaSeguro entidad) {
|
||||||
|
return ptoVtaSeguroServiceDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = false)
|
||||||
|
public PtoVtaSeguro actualizacion(PtoVtaSeguro entidad) {
|
||||||
|
return ptoVtaSeguroServiceDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = false)
|
||||||
|
public void borrar(PtoVtaSeguro entidad) {
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
ptoVtaSeguroServiceDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue