diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java new file mode 100644 index 000000000..62cc2c65a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; + +public interface ConfRestricaoVendaWebDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java new file mode 100644 index 000000000..7e5ef1b9f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java @@ -0,0 +1,33 @@ +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.ConfRestricaoVendaWebDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; +import com.rjconsultores.ventaboletos.entidad.Constante; + +@Repository("confRestricaoVendaWebDAO") +public class ConfRestricaoVendaWebHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoVendaWebDAO { + + @Autowired + public ConfRestricaoVendaWebHibernateDAO(@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(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java new file mode 100644 index 000000000..0f3f78e7e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java @@ -0,0 +1,80 @@ +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 = "CONF_RESTRICAO_VENDAWEB_SEQ", sequenceName = "CONF_RESTRICAO_VENDAWEB_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_VENDAWEB") +public class ConfRestricaoVendaWeb implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_VENDAWEB_SEQ") + @Column(name = "CONFRESTRICAOVENDAWEB_ID") + private Integer confRestricaoVendaWebId; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "valor") + private Double valor; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getConfRestricaoVendaWebId() { + return confRestricaoVendaWebId; + } + public void setConfRestricaoVendaWebId(Integer confRestricaoVendaWebId) { + this.confRestricaoVendaWebId = confRestricaoVendaWebId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Double getValor() { + return valor; + } + public void setValor(Double valor) { + this.valor = valor; + } + 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; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java new file mode 100644 index 000000000..63cd1054b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; + +public interface ConfRestricaoVendaWebService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java new file mode 100644 index 000000000..969f2bf2b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java @@ -0,0 +1,61 @@ +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.ConfRestricaoVendaWebDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; +import com.rjconsultores.ventaboletos.service.ConfRestricaoVendaWebService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + + +@Service("confRestricaoVendaWebService") +public class ConfRestricaoVendaWebServiceImpl implements ConfRestricaoVendaWebService{ + + @Autowired + ConfRestricaoVendaWebDAO confRestricaoVendaWebDAO; + + @Override + @Transactional + public ConfRestricaoVendaWeb suscribir(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoVendaWebDAO.suscribir(entidad); + } + + @Override + public ConfRestricaoVendaWeb obtenerID(Integer id) { + return confRestricaoVendaWebDAO.obtenerID(id); + } + + @Override + public List obtenerTodos() { + return confRestricaoVendaWebDAO.obtenerTodos(); + } + + @Override + @Transactional + public void borrar(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoVendaWebDAO.actualizacion(entidad); + } + + @Override + @Transactional + public ConfRestricaoVendaWeb actualizacion(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoVendaWebDAO.actualizacion(entidad); + } +}