AL-4466
parent
75f18f844f
commit
06b0d32fca
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>ModelWeb</artifactId>
|
||||
<version>1.96.1</version>
|
||||
<version>1.96.2</version>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout;
|
||||
|
||||
public interface EmpresaConfigLayoutDAO extends GenericDAO<EmpresaConfigLayout, Integer> {
|
||||
|
||||
public List<EmpresaConfigLayout> buscarByEmpresa(Integer empresaId);
|
||||
}
|
|
@ -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<EmpresaConfigLayout, Integer>
|
||||
implements EmpresaConfigLayoutDAO {
|
||||
|
||||
@Autowired
|
||||
public EmpresaConfigLayoutHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EmpresaConfigLayout> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq(ACTIVO, Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
public List<EmpresaConfigLayout> 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();
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout;
|
||||
|
||||
public interface EmpresaConfigLayoutService extends GenericService<EmpresaConfigLayout, Integer> {
|
||||
|
||||
public List<EmpresaConfigLayout> buscarByEmpresa(Integer empresaId);
|
||||
}
|
|
@ -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<EmpresaConfigLayout> 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<EmpresaConfigLayout> buscarByEmpresa(Integer empresaId) {
|
||||
return empresaConfigLayoutDAO.buscarByEmpresa(empresaId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue