From c8b5b5b3cb5823448b68863142d201ee92cb4e06 Mon Sep 17 00:00:00 2001 From: frederico Date: Fri, 29 Jul 2016 14:24:50 +0000 Subject: [PATCH] #7455 Mensagem adm git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@58531 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/dao/MensajeDAO.java | 7 + .../ventaboletos/dao/MensajeEmpresaDAO.java | 12 ++ .../dao/MensajePuntoVentaDAO.java | 12 ++ .../ventaboletos/dao/MensajeUsuarioDAO.java | 12 ++ .../hibernate/MensajeEmpresaHibernateDAO.java | 45 +++++ .../dao/hibernate/MensajeHibernateDAO.java | 35 ++++ .../MensajePuntoVentaHibernateDAO.java | 45 +++++ .../hibernate/MensajeUsuarioHibernateDAO.java | 45 +++++ .../ventaboletos/entidad/Mensaje.java | 180 ++++++++++++++++++ .../ventaboletos/entidad/MensajeEmpresa.java | 117 ++++++++++++ .../entidad/MensajePuntoVenta.java | 117 ++++++++++++ .../ventaboletos/entidad/MensajeUsuario.java | 125 ++++++++++++ .../service/MensajeEmpresaService.java | 21 ++ .../service/MensajePuntaVentaService.java | 21 ++ .../ventaboletos/service/MensajeService.java | 18 ++ .../service/MensajeUsuarioService.java | 21 ++ .../impl/MensajeEmpresaServiceImpl.java | 52 +++++ .../impl/MensajePuntoVentaServiceImpl.java | 52 +++++ .../service/impl/MensajeServiceImpl.java | 47 +++++ .../impl/MensajeUsuarioServiceImpl.java | 52 +++++ 20 files changed, 1036 insertions(+) create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensajeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensajeEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensajePuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensajeUsuarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensajePuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeUsuarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Mensaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MensajeEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MensajePuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MensajeUsuario.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensajeEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensajePuntaVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensajeUsuarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensajeEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensajePuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensajeUsuarioServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/dao/MensajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensajeDAO.java new file mode 100644 index 000000000..6a80ef6cf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensajeDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; + +public interface MensajeDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MensajeEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensajeEmpresaDAO.java new file mode 100644 index 000000000..55f600159 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensajeEmpresaDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa; + +public interface MensajeEmpresaDAO extends GenericDAO { + + public List obtenerPorMensaje(Mensaje mensaje); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MensajePuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensajePuntoVentaDAO.java new file mode 100644 index 000000000..bf6e86d92 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensajePuntoVentaDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta; + +public interface MensajePuntoVentaDAO extends GenericDAO { + + public List obtenerPorMensaje(Mensaje mensaje); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MensajeUsuarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensajeUsuarioDAO.java new file mode 100644 index 000000000..8803b2fe8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensajeUsuarioDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeUsuario; + +public interface MensajeUsuarioDAO extends GenericDAO { + + public List obtenerPorMensaje(Mensaje mensaje); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeEmpresaHibernateDAO.java new file mode 100644 index 000000000..b10d5df41 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeEmpresaHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +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.MensajeEmpresaDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa; + +@Repository("MensajeEmpresaDAO") +public class MensajeEmpresaHibernateDAO extends GenericHibernateDAO implements MensajeEmpresaDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensajeEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("mensaje", mensaje)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeHibernateDAO.java new file mode 100644 index 000000000..5ae462937 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeHibernateDAO.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +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.MensajeDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Mensaje; + +@Repository("MensajeDAO") +public class MensajeHibernateDAO extends GenericHibernateDAO implements MensajeDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajePuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajePuntoVentaHibernateDAO.java new file mode 100644 index 000000000..a4a1a39f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajePuntoVentaHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +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.MensajePuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta; + +@Repository("MensajePuntoVentaDAO") +public class MensajePuntoVentaHibernateDAO extends GenericHibernateDAO implements MensajePuntoVentaDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensajePuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("mensaje", mensaje)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeUsuarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeUsuarioHibernateDAO.java new file mode 100644 index 000000000..9d679cef6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeUsuarioHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +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.MensajeUsuarioDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeUsuario; + +@Repository("MensajeUsuarioDAO") +public class MensajeUsuarioHibernateDAO extends GenericHibernateDAO implements MensajeUsuarioDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensajeUsuarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("mensaje", mensaje)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Mensaje.java b/src/com/rjconsultores/ventaboletos/entidad/Mensaje.java new file mode 100644 index 000000000..936961619 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Mensaje.java @@ -0,0 +1,180 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MENSAJE_SEQ", sequenceName = "MENSAJE_SEQ", allocationSize = 1) +@Table(name = "MENSAJE") +public class Mensaje implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer mensajeId; + private Date fecIni; + private Date fecFin; + private String descripcion; + private Boolean indTipo; + private Boolean activo; + private Date fecModif; + private Integer usuarioId; + private List mensajesPuntoVenda; + private List mensajesEmpresa; + private List mensajesUsuario; + + public Mensaje() { + mensajesPuntoVenda = new ArrayList(); + mensajesEmpresa = new ArrayList(); + mensajesUsuario = new ArrayList(); + } + + @Id + @Column(name = "MENSAJE_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAJE_SEQ") + @Basic(optional = false) + public Integer getMensajeId() { + return mensajeId; + } + + public void setMensajeId(Integer mensajeId) { + this.mensajeId = mensajeId; + } + + @Column(name = "FECINI") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecIni() { + return fecIni; + } + + public void setFecIni(Date fecIni) { + this.fecIni = fecIni; + } + + @Column(name = "FECFIN") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecFin() { + return fecFin; + } + + public void setFecFin(Date fecFin) { + this.fecFin = fecFin; + } + + @Column(name = "DESCRIPCION") + public String getDescripcion() { + return descripcion; + } + + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + @Column(name = "INDTIPO") + public Boolean getIndTipo() { + return indTipo; + } + + public void setIndTipo(Boolean indTipo) { + this.indTipo = indTipo; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public List getMensajesPuntoVenda() { + return mensajesPuntoVenda; + } + + public void setMensajesPuntoVenda(List mensajesPuntoVenda) { + this.mensajesPuntoVenda = mensajesPuntoVenda; + } + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public List getMensajesEmpresa() { + return mensajesEmpresa; + } + + public void setMensajesEmpresa(List mensajesEmpresa) { + this.mensajesEmpresa = mensajesEmpresa; + } + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public List getMensajesUsuario() { + return mensajesUsuario; + } + + public void setMensajesUsuario(List mensajesUsuario) { + this.mensajesUsuario = mensajesUsuario; + } + + @Override + public String toString() { + return mensajeId == null ? "null" : this.mensajeId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mensajeId != null ? mensajeId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Mensaje)) { + return false; + } + Mensaje other = (Mensaje) object; + if ((this.mensajeId == null && other.mensajeId != null) || (this.mensajeId != null && !this.mensajeId.equals(other.mensajeId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MensajeEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/MensajeEmpresa.java new file mode 100644 index 000000000..c991f1ef3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MensajeEmpresa.java @@ -0,0 +1,117 @@ +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 = "MENSAJE_EMPRESA_SEQ", sequenceName = "MENSAJE_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "MENSAJE_EMPRESA") +public class MensajeEmpresa implements Serializable{ + + private static final long serialVersionUID = 1L; + + private Integer mensajeEmpresaId; + private Mensaje mensaje; + private Empresa empresa; + private Boolean activo; + private Date fecModif; + private Integer usuarioId; + + @Id + @Column(name = "MENSAJE_EMPRESA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAJE_EMPRESA_SEQ") + @Basic(optional = false) + public Integer getMensajeEmpresaId() { + return mensajeEmpresaId; + } + + public void setMensajeEmpresaId(Integer mensajeEmpresaId) { + this.mensajeEmpresaId = mensajeEmpresaId; + } + + @ManyToOne + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public Mensaje getMensaje() { + return mensaje; + } + + public void setMensaje(Mensaje mensaje) { + this.mensaje = mensaje; + } + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return mensajeEmpresaId == null ? "null" : this.mensajeEmpresaId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mensajeEmpresaId != null ? mensajeEmpresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof MensajeEmpresa)) { + return false; + } + MensajeEmpresa other = (MensajeEmpresa) object; + if ((this.mensajeEmpresaId == null && other.mensajeEmpresaId != null) || (this.mensajeEmpresaId != null && !this.mensajeEmpresaId.equals(other.mensajeEmpresaId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MensajePuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/MensajePuntoVenta.java new file mode 100644 index 000000000..1d6299b1c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MensajePuntoVenta.java @@ -0,0 +1,117 @@ +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 = "MENSAJE_PUNTO_VENTA_SEQ", sequenceName = "MENSAJE_PUNTO_VENTA_SEQ", allocationSize = 1) +@Table(name = "MENSAJE_PUNTO_VENTA") +public class MensajePuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer mensajePuntoVendaId; + private Mensaje mensaje; + private PuntoVenta puntoVenda; + private Boolean activo; + private Date fecModif; + private Integer usuarioId; + + @Id + @Column(name = "MENSAJE_PUNTO_VENTA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAJE_PUNTO_VENTA_SEQ") + @Basic(optional = false) + public Integer getMensajePuntoVendaId() { + return mensajePuntoVendaId; + } + + public void setMensajePuntoVendaId(Integer mensajePuntoVendaId) { + this.mensajePuntoVendaId = mensajePuntoVendaId; + } + + @ManyToOne + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public Mensaje getMensaje() { + return mensaje; + } + + public void setMensaje(Mensaje mensaje) { + this.mensaje = mensaje; + } + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + public PuntoVenta getPuntoVenda() { + return puntoVenda; + } + + public void setPuntoVenda(PuntoVenta puntoVenda) { + this.puntoVenda = puntoVenda; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return mensajePuntoVendaId == null ? "null" : this.mensajePuntoVendaId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mensajePuntoVendaId != null ? mensajePuntoVendaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof MensajePuntoVenta)) { + return false; + } + MensajePuntoVenta other = (MensajePuntoVenta) object; + if ((this.mensajePuntoVendaId == null && other.mensajePuntoVendaId != null) || (this.mensajePuntoVendaId != null && !this.mensajePuntoVendaId.equals(other.mensajePuntoVendaId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MensajeUsuario.java b/src/com/rjconsultores/ventaboletos/entidad/MensajeUsuario.java new file mode 100644 index 000000000..3faf6e181 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MensajeUsuario.java @@ -0,0 +1,125 @@ +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 +@SequenceGenerator(name = "MENSAJE_USUARIO_SEQ", sequenceName = "MENSAJE_USUARIO_SEQ", allocationSize = 1) +@Table(name = "MENSAJE_USUARIO") +public class MensajeUsuario { + + private Integer mensajeUsuarioId; + private Mensaje mensaje; + private Usuario usuario; + private Date fecLeido; + private Date fecModif; + private Boolean activo; + private Integer usuarioModifId; + + @Id + @Column(name = "MENSAJE_USUARIO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAJE_USUARIO_SEQ") + @Basic(optional = false) + public Integer getMensajeUsuarioId() { + return mensajeUsuarioId; + } + + public void setMensajeUsuarioId(Integer mensajeUsuarioId) { + this.mensajeUsuarioId = mensajeUsuarioId; + } + + @ManyToOne + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public Mensaje getMensaje() { + return mensaje; + } + + public void setMensaje(Mensaje mensaje) { + this.mensaje = mensaje; + } + + @ManyToOne + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + @Column(name = "FECLEIDO") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecLeido() { + return fecLeido; + } + + public void setFecLeido(Date fecLeido) { + this.fecLeido = fecLeido; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "USUARIOMODIF_ID ") + public Integer getUsuarioModifId() { + return usuarioModifId; + } + + public void setUsuarioModifId(Integer usuarioModifId) { + this.usuarioModifId = usuarioModifId; + } + + @Override + public String toString() { + return mensajeUsuarioId == null ? "null" : this.mensajeUsuarioId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mensajeUsuarioId != null ? mensajeUsuarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof MensajeUsuario)) { + return false; + } + MensajeUsuario other = (MensajeUsuario) object; + if ((this.mensajeUsuarioId == null && other.mensajeUsuarioId != null) || (this.mensajeUsuarioId != null && !this.mensajeUsuarioId.equals(other.mensajeUsuarioId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/MensajeEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/MensajeEmpresaService.java new file mode 100644 index 000000000..3e438772b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensajeEmpresaService.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensajeEmpresaService { + + public List obtenerTodos(); + + public List obtenerPorMensaje(Mensaje mensaje); + + public MensajeEmpresa obtenerID(Integer id); + + public void borrar(MensajeEmpresa entidad); + + public MensajeEmpresa suscribirActualizar(MensajeEmpresa entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MensajePuntaVentaService.java b/src/com/rjconsultores/ventaboletos/service/MensajePuntaVentaService.java new file mode 100644 index 000000000..aace4b375 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensajePuntaVentaService.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensajePuntaVentaService { + + public List obtenerTodos(); + + public List obtenerPorMensaje(Mensaje mensaje); + + public MensajePuntoVenta obtenerID(Integer id); + + public void borrar(MensajePuntoVenta entidad); + + public MensajePuntoVenta suscribirActualizar(MensajePuntoVenta entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MensajeService.java b/src/com/rjconsultores/ventaboletos/service/MensajeService.java new file mode 100644 index 000000000..cb40aad5a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensajeService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensajeService { + + public List obtenerTodos(); + + public Mensaje obtenerID(Integer id); + + public void borrar(Mensaje entidad); + + public Mensaje suscribirActualizar(Mensaje entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MensajeUsuarioService.java b/src/com/rjconsultores/ventaboletos/service/MensajeUsuarioService.java new file mode 100644 index 000000000..ce9372184 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensajeUsuarioService.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeUsuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensajeUsuarioService { + + public List obtenerTodos(); + + public List obtenerPorMensaje(Mensaje mensaje); + + public MensajeUsuario obtenerID(Integer id); + + public void borrar(MensajeUsuario entidad); + + public MensajeUsuario suscribirActualizar(MensajeUsuario entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensajeEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensajeEmpresaServiceImpl.java new file mode 100644 index 000000000..332ca438e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensajeEmpresaServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +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.MensajeEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensajeEmpresaService; + +@Service("mensajeEmpresaService") +public class MensajeEmpresaServiceImpl implements MensajeEmpresaService { + + @Autowired + private MensajeEmpresaDAO mensajeEmpresaDAO; + + @Override + public List obtenerTodos() { + return mensajeEmpresaDAO.obtenerTodos(); + } + + @Override + public MensajeEmpresa obtenerID(Integer id) { + return mensajeEmpresaDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(MensajeEmpresa entidad) { + mensajeEmpresaDAO.borrar(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public MensajeEmpresa suscribirActualizar(MensajeEmpresa entidad) throws BusinessException { + if (entidad.getMensajeEmpresaId() == null) { + return mensajeEmpresaDAO.suscribir(entidad); + } else { + return mensajeEmpresaDAO.actualizacion(entidad); + } + } + + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + return mensajeEmpresaDAO.obtenerPorMensaje(mensaje); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensajePuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensajePuntoVentaServiceImpl.java new file mode 100644 index 000000000..f2626d94f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensajePuntoVentaServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +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.MensajePuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensajePuntaVentaService; + +@Service("mensajePuntoVentaService") +public class MensajePuntoVentaServiceImpl implements MensajePuntaVentaService { + + @Autowired + private MensajePuntoVentaDAO mensajePuntoVentaDAO; + + @Override + public List obtenerTodos() { + return mensajePuntoVentaDAO.obtenerTodos(); + } + + @Override + public MensajePuntoVenta obtenerID(Integer id) { + return mensajePuntoVentaDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(MensajePuntoVenta entidad) { + mensajePuntoVentaDAO.borrar(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public MensajePuntoVenta suscribirActualizar(MensajePuntoVenta entidad) throws BusinessException { + if (entidad.getMensajePuntoVendaId() == null) { + return mensajePuntoVentaDAO.suscribir(entidad); + } else { + return mensajePuntoVentaDAO.actualizacion(entidad); + } + } + + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + return mensajePuntoVentaDAO.obtenerPorMensaje(mensaje); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java new file mode 100644 index 000000000..04a2f202c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.service.impl; + +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.MensajeDAO; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensajeService; + +@Service("mensajeService") +public class MensajeServiceImpl implements MensajeService { + + @Autowired + private MensajeDAO mensajeDAO; + + @Override + public List obtenerTodos() { + return mensajeDAO.obtenerTodos(); + } + + @Override + public Mensaje obtenerID(Integer id) { + return mensajeDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(Mensaje entidad) { + entidad.setActivo(Boolean.FALSE); + mensajeDAO.actualizacion(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public Mensaje suscribirActualizar(Mensaje entidad) throws BusinessException { + if (entidad.getMensajeId() == null) { + return mensajeDAO.suscribir(entidad); + } else { + return mensajeDAO.actualizacion(entidad); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensajeUsuarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensajeUsuarioServiceImpl.java new file mode 100644 index 000000000..6d50425f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensajeUsuarioServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +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.MensajeUsuarioDAO; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeUsuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensajeUsuarioService; + +@Service("mensajeUsuarioService") +public class MensajeUsuarioServiceImpl implements MensajeUsuarioService { + + @Autowired + private MensajeUsuarioDAO mensajeUsuarioDAO; + + @Override + public List obtenerTodos() { + return mensajeUsuarioDAO.obtenerTodos(); + } + + @Override + public MensajeUsuario obtenerID(Integer id) { + return mensajeUsuarioDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(MensajeUsuario entidad) { + mensajeUsuarioDAO.borrar(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public MensajeUsuario suscribirActualizar(MensajeUsuario entidad) throws BusinessException { + if (entidad.getMensajeUsuarioId() == null) { + return mensajeUsuarioDAO.suscribir(entidad); + } else { + return mensajeUsuarioDAO.actualizacion(entidad); + } + } + + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + return mensajeUsuarioDAO.obtenerPorMensaje(mensaje); + } + +}