diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaBloqueioImpPosteriorDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaBloqueioImpPosteriorDAO.java new file mode 100644 index 000000000..e9b814bdb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaBloqueioImpPosteriorDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior; + +public interface CategoriaBloqueioImpPosteriorDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaBloqueioImpPosteriorHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaBloqueioImpPosteriorHibernateDAO.java new file mode 100644 index 000000000..3177f7847 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaBloqueioImpPosteriorHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.CategoriaBloqueioImpPosteriorDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior; + +@Repository("categoriaBloqueioImpPosteriorDAO") +public class CategoriaBloqueioImpPosteriorHibernateDAO extends GenericHibernateDAO + implements CategoriaBloqueioImpPosteriorDAO { + + @Autowired + public CategoriaBloqueioImpPosteriorHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java new file mode 100644 index 000000000..fa34d8b23 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.entidad; + +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; + +@Entity +@SequenceGenerator(name = "CAT_BLOQ_IMPPOSTERIOR_SEQ", sequenceName = "CAT_BLOQ_IMPPOSTERIOR_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_BLOQ_IMPPOSTERIOR") +public class CategoriaBloqueioImpPosterior { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CAT_BLOQ_IMPPOSTERIOR_SEQ") + @Column(name = "CATBLOQUEIOIMPPOSTERIOR_ID") + private Integer categoriaBloqueioImpPosteriorId; + @ManyToOne() + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoventa; + @ManyToOne() + @JoinColumn(name = "CATEGORIA_ID") + private Categoria categoria; + public Integer getCategoriaBloqueioImpPosteriorId() { + return categoriaBloqueioImpPosteriorId; + } + public void setCategoriaBloqueioImpPosteriorId(Integer categoriaBloqueioImpPosteriorId) { + this.categoriaBloqueioImpPosteriorId = categoriaBloqueioImpPosteriorId; + } + public PuntoVenta getPuntoventa() { + return puntoventa; + } + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + public Categoria getCategoria() { + return categoria; + } + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (categoriaBloqueioImpPosteriorId != null ? categoriaBloqueioImpPosteriorId.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 CategoriaBloqueioImpPosterior)) { + return false; + } + CategoriaBloqueioImpPosterior other = (CategoriaBloqueioImpPosterior) object; + if ((this.categoriaBloqueioImpPosteriorId == null && other.categoriaBloqueioImpPosteriorId != null) || (this.categoriaBloqueioImpPosteriorId != null && !this.categoriaBloqueioImpPosteriorId.equals(other.categoriaBloqueioImpPosteriorId))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java index 705955de8..762f268ad 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -216,6 +216,10 @@ public class PuntoVenta implements Serializable { @LazyCollection(LazyCollectionOption.FALSE) private List historicoPuntoVentaList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventa") + @LazyCollection(LazyCollectionOption.FALSE) + private List categoriaBloqImpPosteriorList; + public PtovtaEmpresaBloqueada addEmpresaBloqueada(Empresa e) { PtovtaEmpresaBloqueada eb = new PtovtaEmpresaBloqueada(); eb.setEmpresa(e); @@ -960,4 +964,20 @@ public class PuntoVenta implements Serializable { public void setHistoricoPuntoVentaList(List historicoPuntoVentaList) { this.historicoPuntoVentaList = historicoPuntoVentaList; } + + public List getCategoriaBloqImpPosteriorList() { + return categoriaBloqImpPosteriorList; + } + + public void setCategoriaBloqImpPosteriorList(List categoriaBloqImpPosteriorList) { + this.categoriaBloqImpPosteriorList = categoriaBloqImpPosteriorList; + } + + public void addCategoriaBloqImpPosterior(CategoriaBloqueioImpPosterior cat){ + this.categoriaBloqImpPosteriorList.add(cat); + } + + public void removeCategoriaBloqImpPosterior(CategoriaBloqueioImpPosterior cat){ + this.categoriaBloqImpPosteriorList.remove(cat); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaBloqueioImpPosteriorService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaBloqueioImpPosteriorService.java new file mode 100644 index 000000000..5598d53b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaBloqueioImpPosteriorService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior; + +public interface CategoriaBloqueioImpPosteriorService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaBloqueioImpPosteriorServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaBloqueioImpPosteriorServiceImpl.java new file mode 100644 index 000000000..f6a142ee1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaBloqueioImpPosteriorServiceImpl.java @@ -0,0 +1,44 @@ +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.CategoriaBloqueioImpPosteriorDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior; +import com.rjconsultores.ventaboletos.service.CategoriaBloqueioImpPosteriorService; + +@Service("categoriaBloqueioImpPosteriorService") +public class CategoriaBloqueioImpPosteriorServiceImpl implements CategoriaBloqueioImpPosteriorService { + + @Autowired + private CategoriaBloqueioImpPosteriorDAO categoriaDAO; + + public List obtenerTodos() { + return categoriaDAO.obtenerTodos(); + } + + public CategoriaBloqueioImpPosterior obtenerID(Integer id) { + return categoriaDAO.obtenerID(id); + } + + @Transactional + public CategoriaBloqueioImpPosterior suscribir(CategoriaBloqueioImpPosterior entidad) { + + return categoriaDAO.suscribir(entidad); + } + + @Transactional + public CategoriaBloqueioImpPosterior actualizacion(CategoriaBloqueioImpPosterior entidad) { + + return categoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaBloqueioImpPosterior entidad) { + + categoriaDAO.borrar(entidad); + } +}