diff --git a/pom.xml b/pom.xml index dc9661a53..26084324a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores ModelWeb - 1.96.1 + 1.96.2 diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaConfigLayoutDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaConfigLayoutDAO.java new file mode 100644 index 000000000..8668ca373 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaConfigLayoutDAO.java @@ -0,0 +1,11 @@ + +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout; + +public interface EmpresaConfigLayoutDAO extends GenericDAO { + + public List buscarByEmpresa(Integer empresaId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaConfigLayoutHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaConfigLayoutHibernateDAO.java new file mode 100644 index 000000000..c039095ac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaConfigLayoutHibernateDAO.java @@ -0,0 +1,40 @@ + +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.EmpresaConfigLayoutDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout; + +@Repository("empresaConfigLayoutDAO") +public class EmpresaConfigLayoutHibernateDAO extends GenericHibernateDAO + implements EmpresaConfigLayoutDAO { + + @Autowired + public EmpresaConfigLayoutHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq(ACTIVO, Boolean.TRUE)); + + return c.list(); + } + + public List buscarByEmpresa(Integer empresaId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq(ACTIVO, Boolean.TRUE)); + c.add(Restrictions.eq("empresa.empresaId", empresaId)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaConfigLayout.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaConfigLayout.java new file mode 100644 index 000000000..a221305e9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaConfigLayout.java @@ -0,0 +1,195 @@ +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 = "EMPRESA_CONFIG_LAYOUT_SEQ", sequenceName = "EMPRESA_CONFIG_LAYOUT_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_CONFIG_LAYOUT") +public class EmpresaConfigLayout implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_CONFIG_LAYOUT_SEQ") + @Column(name = "EMPRESACONFIGLAYOUT_ID") + private Integer empresaconfiglayoutId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @JoinColumn(name = "IMPRESIONLAYOUTCONFIG_ID", referencedColumnName = "IMPRESIONLAYOUTCONFIG_ID") + @ManyToOne + private ImpresionLayoutConfig impresionlayoutconfigId; + + @JoinColumn(name = "TIPOVENTA_ID", referencedColumnName = "TIPOVENTA_ID") + @ManyToOne + private TipoVenta tipoVenta; + + @Column(name = "INDEMAIL") + private Boolean indEmail; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getEmpresaconfiglayoutId() { + return empresaconfiglayoutId; + } + + public void setEmpresaconfiglayoutId(Integer empresaconfiglayoutId) { + this.empresaconfiglayoutId = empresaconfiglayoutId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public ImpresionLayoutConfig getImpresionlayoutconfigId() { + return impresionlayoutconfigId; + } + + public void setImpresionlayoutconfigId(ImpresionLayoutConfig impresionlayoutconfigId) { + this.impresionlayoutconfigId = impresionlayoutconfigId; + } + + public TipoVenta getTipoVenta() { + return tipoVenta; + } + + public void setTipoVenta(TipoVenta tipoVenta) { + this.tipoVenta = tipoVenta; + } + + public Boolean getIndEmail() { + return indEmail; + } + + public void setIndEmail(Boolean indEmail) { + this.indEmail = indEmail; + } + + 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 String toString() { + return "EmpresaConfigLayout [empresaconfiglayoutId=" + empresaconfiglayoutId + ", empresa=" + empresa + + ", impresionlayoutconfigId=" + impresionlayoutconfigId + ", tipoVenta=" + tipoVenta + ", indEmail=" + + indEmail + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((empresaconfiglayoutId == null) ? 0 : empresaconfiglayoutId.hashCode()); + result = prime * result + ((impresionlayoutconfigId == null) ? 0 : impresionlayoutconfigId.hashCode()); + result = prime * result + ((indEmail == null) ? 0 : indEmail.hashCode()); + result = prime * result + ((tipoVenta == null) ? 0 : tipoVenta.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof EmpresaConfigLayout)) { + return false; + } + EmpresaConfigLayout other = (EmpresaConfigLayout) obj; + if (activo == null) { + if (other.activo != null) { + return false; + } + } else if (!activo.equals(other.activo)) { + return false; + } + if (empresa == null) { + if (other.empresa != null) { + return false; + } + } else if (!empresa.equals(other.empresa)) { + return false; + } + if (empresaconfiglayoutId == null) { + if (other.empresaconfiglayoutId != null) { + return false; + } + } else if (!empresaconfiglayoutId.equals(other.empresaconfiglayoutId)) { + return false; + } + if (impresionlayoutconfigId == null) { + if (other.impresionlayoutconfigId != null) { + return false; + } + } else if (!impresionlayoutconfigId.equals(other.impresionlayoutconfigId)) { + return false; + } + if (indEmail == null) { + if (other.indEmail != null) { + return false; + } + } else if (!indEmail.equals(other.indEmail)) { + return false; + } + if (tipoVenta == null) { + if (other.tipoVenta != null) { + return false; + } + } else if (!tipoVenta.equals(other.tipoVenta)) { + return false; + } + return true; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaConfigLayoutService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaConfigLayoutService.java new file mode 100644 index 000000000..9c5c0fd0f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaConfigLayoutService.java @@ -0,0 +1,11 @@ + +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout; + +public interface EmpresaConfigLayoutService extends GenericService { + + public List buscarByEmpresa(Integer empresaId); +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaConfigLayoutServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaConfigLayoutServiceImpl.java new file mode 100644 index 000000000..99f954f70 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaConfigLayoutServiceImpl.java @@ -0,0 +1,60 @@ + +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.EmpresaConfigLayoutDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout; +import com.rjconsultores.ventaboletos.service.EmpresaConfigLayoutService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaConfigLayoutService") +public class EmpresaConfigLayoutServiceImpl implements EmpresaConfigLayoutService { + + @Autowired + private EmpresaConfigLayoutDAO empresaConfigLayoutDAO; + + public List obtenerTodos() { + return empresaConfigLayoutDAO.obtenerTodos(); + } + + public EmpresaConfigLayout obtenerID(Integer id) { + return empresaConfigLayoutDAO.obtenerID(id); + } + + @Transactional + public EmpresaConfigLayout suscribir(EmpresaConfigLayout entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaConfigLayoutDAO.suscribir(entidad); + } + + @Transactional + public EmpresaConfigLayout actualizacion(EmpresaConfigLayout entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaConfigLayoutDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EmpresaConfigLayout entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaConfigLayoutDAO.actualizacion(entidad); + } + + public List buscarByEmpresa(Integer empresaId) { + return empresaConfigLayoutDAO.buscarByEmpresa(empresaId); + } +}