fixes bug #9296
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@71455 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
67f8967d7e
commit
c18b2bc2d2
|
@ -0,0 +1,6 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta;
|
||||
|
||||
public interface TipoEventoExtraPtovtaDAO extends GenericDAO<TipoEventoExtraPtoVta, Integer> {
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
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.TipoEventoExtraPtovtaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta;
|
||||
|
||||
@Repository("tipoEventoExtraPtovtaDAO")
|
||||
public class TipoEventoExtraPtovtaHibernateDAO extends GenericHibernateDAO<TipoEventoExtraPtoVta, Integer> implements
|
||||
TipoEventoExtraPtovtaDAO {
|
||||
|
||||
@Autowired
|
||||
public TipoEventoExtraPtovtaHibernateDAO (
|
||||
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TipoEventoExtraPtoVta> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
}
|
|
@ -109,6 +109,10 @@ public class TipoEventoExtra implements Serializable {
|
|||
|
||||
@Column(name="CVESISTEMA")
|
||||
private String cveSistema;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoeventoextra")
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
private List<TipoEventoExtraPtoVta> pontosventa = new ArrayList<TipoEventoExtraPtoVta>();
|
||||
|
||||
public TipoEventoExtraEmpresa addEmpresa(Empresa e) {
|
||||
TipoEventoExtraEmpresa t = new TipoEventoExtraEmpresa();
|
||||
|
@ -125,6 +129,29 @@ public class TipoEventoExtra implements Serializable {
|
|||
this.empresas.remove(t);
|
||||
}
|
||||
|
||||
public TipoEventoExtraPtoVta addPuntoVenta(PuntoVenta p) {
|
||||
TipoEventoExtraPtoVta t = new TipoEventoExtraPtoVta();
|
||||
t.setPuntoventa(p);
|
||||
t.setTipoeventoextra(this);
|
||||
t.setActivo(Boolean.TRUE);
|
||||
t.setFecmodif(Calendar.getInstance().getTime());
|
||||
t.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
this.pontosventa.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
public void removePuntoVenta(PuntoVenta p) {
|
||||
for (TipoEventoExtraPtoVta t : this.pontosventa){
|
||||
if (t.getPuntoventa().equals(p)){
|
||||
this.pontosventa.remove(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removePuntoVenta(TipoEventoExtraPtoVta t){
|
||||
this.pontosventa.remove(t);
|
||||
}
|
||||
|
||||
public String getDescTipoEvento() {
|
||||
return descTipoEvento;
|
||||
}
|
||||
|
@ -402,5 +429,13 @@ public class TipoEventoExtra implements Serializable {
|
|||
public void setCveSistema(String cveSistema) {
|
||||
this.cveSistema = cveSistema;
|
||||
}
|
||||
|
||||
public List<TipoEventoExtraPtoVta> getPontosventa() {
|
||||
return pontosventa;
|
||||
}
|
||||
|
||||
public void setPontosventa(List<TipoEventoExtraPtoVta> pontosventa) {
|
||||
this.pontosventa = pontosventa;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
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
|
||||
@Table(name = "TIPO_EVENTO_EXTRA_PTOVTA")
|
||||
@SequenceGenerator(name = "TIPOEVENTOEXTRAPTOVTA_SEQ", sequenceName = "TIPOEVENTOEXTRAPTOVTA_SEQ", allocationSize = 1)
|
||||
public class TipoEventoExtraPtoVta {
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPOEVENTOEXTRAPTOVTA_SEQ")
|
||||
@Column(name = "TIPOEVENTOEXTRAPTOVTA_ID")
|
||||
private Integer tipoeventoextraptovtaId;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "TIPOEVENTOEXTRA_ID")
|
||||
private TipoEventoExtra tipoeventoextra;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "PUNTOVENTA_ID")
|
||||
private PuntoVenta puntoventa;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
public Integer getTipoeventoextraptovtaId() {
|
||||
return tipoeventoextraptovtaId;
|
||||
}
|
||||
public void setTipoeventoextraptovtaId(Integer tipoeventoextraptovtaId) {
|
||||
this.tipoeventoextraptovtaId = tipoeventoextraptovtaId;
|
||||
}
|
||||
public TipoEventoExtra getTipoeventoextra() {
|
||||
return tipoeventoextra;
|
||||
}
|
||||
public void setTipoeventoextra(TipoEventoExtra tipoeventoextra) {
|
||||
this.tipoeventoextra = tipoeventoextra;
|
||||
}
|
||||
public PuntoVenta getPuntoventa() {
|
||||
return puntoventa;
|
||||
}
|
||||
public void setPuntoventa(PuntoVenta puntoventa) {
|
||||
this.puntoventa = puntoventa;
|
||||
}
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return this.puntoventa.getNombpuntoventa();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (tipoeventoextraptovtaId != null ? tipoeventoextraptovtaId.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 TipoEventoExtraPtoVta)) {
|
||||
return false;
|
||||
}
|
||||
TipoEventoExtraPtoVta other = (TipoEventoExtraPtoVta) object;
|
||||
if ((this.tipoeventoextraptovtaId == null && other.tipoeventoextraptovtaId != null) || (this.tipoeventoextraptovtaId != null && !this.tipoeventoextraptovtaId.equals(other.tipoeventoextraptovtaId))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta;
|
||||
|
||||
public interface TipoEventoExtraPtovtaService extends GenericService<TipoEventoExtraPtoVta, Integer> {
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
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.TipoEventoExtraPtovtaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta;
|
||||
import com.rjconsultores.ventaboletos.service.TipoEventoExtraPtovtaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("tipoEventoExtraPtovtaService")
|
||||
public class TipoEventoExtraPtovtaServiceImpl implements TipoEventoExtraPtovtaService {
|
||||
@Autowired
|
||||
private TipoEventoExtraPtovtaDAO TipoEventoExtraPtovtaDAO;
|
||||
|
||||
|
||||
@Transactional
|
||||
public TipoEventoExtraPtoVta suscribir(TipoEventoExtraPtoVta entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return TipoEventoExtraPtovtaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TipoEventoExtraPtoVta> obtenerTodos() {
|
||||
return TipoEventoExtraPtovtaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TipoEventoExtraPtoVta obtenerID(Integer id) {
|
||||
return TipoEventoExtraPtovtaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public TipoEventoExtraPtoVta actualizacion(TipoEventoExtraPtoVta entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return TipoEventoExtraPtovtaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(TipoEventoExtraPtoVta entidad) {
|
||||
TipoEventoExtraPtovtaDAO.borrar(entidad);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue