diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingAnticipacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingAnticipacionDAO.java deleted file mode 100644 index 494f6eff8..000000000 --- a/src/com/rjconsultores/ventaboletos/dao/PricingAnticipacionDAO.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.dao; - -import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingAnticipacion; -import java.util.List; - -/** - * - * @author Desenvolvimento - */ -public interface PricingAnticipacionDAO extends GenericDAO { - - public List obtenerPorPricing(Pricing pricing); -} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java new file mode 100644 index 000000000..a202bb71b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; + +/** + * + * @author Rafius + */ +public interface PricingOcupaAntecipaDAO extends GenericDAO { + + public Boolean podeSalvar(Pricing pricing, PricingOcupaAntecipa pricingOcupaAntecipa); + + public List podeSalvar(Pricing pricing); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingOcupacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingOcupacionDAO.java deleted file mode 100644 index cc541a3b6..000000000 --- a/src/com/rjconsultores/ventaboletos/dao/PricingOcupacionDAO.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.dao; - -import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingOcupacion; -import java.math.BigDecimal; -import java.util.List; - -/** - * - * @author Rafius - */ -public interface PricingOcupacionDAO extends GenericDAO { - - public Boolean podeSalvar(Pricing pricing, BigDecimal min, BigDecimal max); - - public List podeSalvar(Pricing pricing); -} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAnticipacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAnticipacionHibernateDAO.java deleted file mode 100644 index 165a9dd39..000000000 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAnticipacionHibernateDAO.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.dao.hibernate; - -import com.rjconsultores.ventaboletos.dao.PricingAnticipacionDAO; -import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingAnticipacion; -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; - -/** - * - * @author Desenvolvimento - */ -@Repository("pricingAnticipacionDAO") -public class PricingAnticipacionHibernateDAO extends GenericHibernateDAO - implements PricingAnticipacionDAO { - - @Autowired - public PricingAnticipacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { - setSessionFactory(factory); - } - - @Override - public List obtenerTodos() { - Criteria c = getSession().createCriteria(getPersistentClass()); - c.add(Restrictions.eq("activo", Pricing.ATIVO)); - - return c.list(); - } - - public List obtenerPorPricing(Pricing pricing) { - Criteria c = getSession().createCriteria(getPersistentClass()); - c.add(Restrictions.eq("activo", Pricing.ATIVO)); - c.add(Restrictions.eq("pricing", pricing)); - - return c.list(); - } -} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java new file mode 100644 index 000000000..30aa57cdd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +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.PricingOcupaAntecipaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; + +/** + * + * @author Rafius + */ +@Repository("pricingOcupacionDAO") +public class PricingOcupaAntecipaHibernateDAO extends GenericHibernateDAO + implements PricingOcupaAntecipaDAO { + + @Autowired + public PricingOcupaAntecipaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + return c.list(); + } + + @Override + public Boolean podeSalvar(Pricing pricing, PricingOcupaAntecipa poa) { + + StringBuilder hql = new StringBuilder(); + hql.append(" SELECT pv FROM PricingOcupaAntecipa pv "); + hql.append(" WHERE pv.activo = :activo "); + hql.append(" AND pv.pricing.pricingId = :pricingId "); + + if (poa.getCantasientosmin() != null && poa.getCantasientosmax() != null) { + hql.append(" AND (( :cantasientosmin BETWEEN cantasientosmin AND cantasientosmax) "); + hql.append(" OR (:cantasientosmax BETWEEN cantasientosmin AND cantasientosmax) "); + hql.append(" OR ((cantasientosmin BETWEEN :cantasientosmin AND :cantasientosmax) "); + hql.append(" OR (cantasientosmax BETWEEN :cantasientosmin AND :cantasientosmax )))"); + } + + Query sq = getSession().createQuery(hql.toString()); + sq.setInteger("activo", Pricing.ATIVO); + sq.setInteger("pricingId", pricing.getPricingId()); + + if (poa.getCantasientosmin() != null && poa.getCantasientosmax() != null) { + sq.setInteger("cantasientosmin", poa.getCantasientosmin()); + sq.setInteger("cantasientosmax", poa.getCantasientosmax()); + } + + List ls = sq.list(); + if (!ls.isEmpty()) { + return Boolean.FALSE; + } + return Boolean.TRUE; + } + + @Override + public List podeSalvar(Pricing pricing) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupacionHibernateDAO.java deleted file mode 100644 index a0b826e7f..000000000 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupacionHibernateDAO.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.dao.hibernate; - -import com.rjconsultores.ventaboletos.dao.PricingOcupacionDAO; -import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingOcupacion; -import java.math.BigDecimal; -import java.util.List; -import org.hibernate.Criteria; -import org.hibernate.Query; -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; - -/** - * - * @author Rafius - */ -@Repository("pricingOcupacionDAO") -public class PricingOcupacionHibernateDAO extends GenericHibernateDAO - implements PricingOcupacionDAO { - - @Autowired - public PricingOcupacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { - setSessionFactory(factory); - } - - @Override - public List obtenerTodos() { - Criteria c = getSession().createCriteria(getPersistentClass()); - c.add(Restrictions.eq("activo", Pricing.ATIVO)); - - return c.list(); - } - - public Boolean podeSalvar(Pricing pricing, BigDecimal min, BigDecimal max) { - Boolean retorno = Boolean.TRUE; - - StringBuilder hql = new StringBuilder("SELECT pv FROM PricingOcupacion pv "); - hql.append(" WHERE pv.activo = 1 "); - hql.append(" AND pv.pricing.pricingId = ").append(pricing.getPricingId()); - hql.append(" AND ( "); - hql.append(" ( ").append(min).append(" BETWEEN ocupacioninicial AND ocupacionfinal ) "); - hql.append(" OR ( ").append(max).append(" BETWEEN ocupacioninicial AND ocupacionfinal) "); - hql.append(" OR ((ocupacioninicial BETWEEN ").append(min).append(" AND ").append(max).append(" ) OR (ocupacionfinal BETWEEN ").append(min).append(" AND ").append(max).append(" )))"); - - Query sq = getSession().createQuery(hql.toString()); - - List ls = sq.list(); - if (!ls.isEmpty()) { - retorno = Boolean.FALSE; - } - - return retorno; - } - - public List podeSalvar(Pricing pricing) { - Criteria c = getSession().createCriteria(getPersistentClass()); - c.add(Restrictions.eq("activo", Pricing.ATIVO)); - c.add(Restrictions.eq("pricing", pricing)); - - return c.list(); - } -} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Pricing.java b/src/com/rjconsultores/ventaboletos/entidad/Pricing.java index 940aa0277..332fd67e3 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Pricing.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Pricing.java @@ -9,6 +9,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; + import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -69,8 +70,6 @@ public class Pricing implements Serializable { @Column(name = "CANTDIASANTICIPACION") private Integer cantdiasanticipacion; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) - private List pricingOcupacionList; - @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingAsientoList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingMercadoList; @@ -98,9 +97,9 @@ public class Pricing implements Serializable { @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingPuntoventaList; @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) - private List pricingAnticipacionList; - @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) private List pricingTipoServicioList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingOcupaAntecipaList; @Column(name = "INDGENERAFERIADOVIAJE") private String indGeneraFeriadoViaje; @Column(name = "INDGENERAFERIADOVENTA") @@ -227,19 +226,18 @@ public class Pricing implements Serializable { this.usuarioId = usuarioId; } - public List getPricingOcupacionList(Integer activo) { - List poList = new ArrayList(); - for (PricingOcupacion po : this.pricingOcupacionList) { - if (po.getActivo().equals(activo)) { - poList.add(po); + public List getPricingOcupaAntecipaList(Integer activo) { + List poaList = new ArrayList(); + for (PricingOcupaAntecipa poa : this.pricingOcupaAntecipaList) { + if (poa.getActivo().equals(activo)) { + poaList.add(poa); } } - - return poList; + return poaList; } - public void setPricingOcupacionList(List pricingOcupacionList) { - this.pricingOcupacionList = pricingOcupacionList; + public void setPricingOcupaAntecipaList(List pricingOcupaAntecipaList) { + this.pricingOcupaAntecipaList = pricingOcupaAntecipaList; } public List getPricingAsientoList(Integer activo) { @@ -436,21 +434,6 @@ public class Pricing implements Serializable { this.pricingPuntoventaList = pricingPuntoventaList; } - public List getPricingAnticipacionList(Integer activo) { - List ppList = new ArrayList(); - for (PricingAnticipacion pp : this.pricingAnticipacionList) { - if (pp.getActivo().equals(activo)) { - ppList.add(pp); - } - } - - return ppList; - } - - public void setPricingAnticipacionList(List pricingAnticipacionList) { - this.pricingAnticipacionList = pricingAnticipacionList; - } - public List getPricingTipoServicioList(Integer status) { List ppList = new ArrayList(); for (PricingTipoServicio pp : this.pricingTipoServicioList) { @@ -482,6 +465,14 @@ public class Pricing implements Serializable { this.indGeneraFeriadoVenta = indGeneraFeriadoVenta; } + public String getNombPricing() { + return nombPricing; + } + + public void setNombPricing(String nombPricing) { + this.nombPricing = nombPricing; + } + @Override public int hashCode() { int hash = 0; @@ -506,18 +497,4 @@ public class Pricing implements Serializable { return "entidad.test.Pricing[pricingId=" + pricingId + "]"; } - /** - * @return the nombPricing - */ - public String getNombPricing() { - return nombPricing; - } - - /** - * @param nombPricing - * the nombPricing to set - */ - public void setNombPricing(String nombPricing) { - this.nombPricing = nombPricing; - } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingAnticipacion.java b/src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java similarity index 50% rename from src/com/rjconsultores/ventaboletos/entidad/PricingAnticipacion.java rename to src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java index 25c15123b..4f2ab38fb 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PricingAnticipacion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java @@ -1,155 +1,170 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.entidad; - -import java.io.Serializable; -import java.math.BigDecimal; -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; - -/** - * - * @author Desenvolvimento - */ -@Entity -@SequenceGenerator(name = "PRICING_ANTICIPACION_SEQ", sequenceName = "PRICING_ANTICIPACION_SEQ", allocationSize = 1) -@Table(name = "PRICING_ANTICIPACION") -public class PricingAnticipacion implements Serializable { - - private static final long serialVersionUID = 1L; - @Id - @Basic(optional = false) - @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ANTICIPACION_SEQ") - @Column(name = "PRICINGANTICIPACION_ID") - private Integer pricinganticipacionId; - @Basic(optional = false) - @Column(name = "CANTDIASMIN") - private Integer cantdiasmin; - @Basic(optional = false) - @Column(name = "CANTDIASMAX") - private Integer cantdiasmax; - @Basic(optional = false) - @Column(name = "PORCPRICING") - private BigDecimal porcpricing; - @Basic(optional = false) - @Column(name = "ACTIVO") - private Integer activo; - @Basic(optional = false) - @Column(name = "FECMODIF") - @Temporal(TemporalType.TIMESTAMP) - private Date fecmodif; - @Basic(optional = false) - @Column(name = "USUARIO_ID") - private int usuarioId; - @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") - @ManyToOne - private Pricing pricing; - - public PricingAnticipacion() { - } - - public Pricing getPricing() { - return pricing; - } - - public void setPricing(Pricing pricing) { - this.pricing = pricing; - } - - public PricingAnticipacion(Integer pricinganticipacionId) { - this.pricinganticipacionId = pricinganticipacionId; - } - - public Integer getPricinganticipacionId() { - return pricinganticipacionId; - } - - public void setPricinganticipacionId(Integer pricinganticipacionId) { - this.pricinganticipacionId = pricinganticipacionId; - } - - public Integer getCantdiasmax() { - return cantdiasmax; - } - - public void setCantdiasmax(Integer cantdiasmax) { - this.cantdiasmax = cantdiasmax; - } - - public Integer getCantdiasmin() { - return cantdiasmin; - } - - public void setCantdiasmin(Integer cantdiasmin) { - this.cantdiasmin = cantdiasmin; - } - - public BigDecimal getPorcpricing() { - return porcpricing; - } - - public void setPorcpricing(BigDecimal porcpricing) { - this.porcpricing = porcpricing; - } - - public Integer getActivo() { - return activo; - } - - public void setActivo(Integer activo) { - this.activo = activo; - } - - public Date getFecmodif() { - return fecmodif; - } - - public void setFecmodif(Date fecmodif) { - this.fecmodif = fecmodif; - } - - public int getUsuarioId() { - return usuarioId; - } - - public void setUsuarioId(int usuarioId) { - this.usuarioId = usuarioId; - } - - @Override - public int hashCode() { - int hash = 0; - hash += (pricinganticipacionId != null ? pricinganticipacionId.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object object) { - if (!(object instanceof PricingAnticipacion)) { - return false; - } - PricingAnticipacion other = (PricingAnticipacion) object; - if ((this.pricinganticipacionId == null && other.pricinganticipacionId != null) || (this.pricinganticipacionId != null && !this.pricinganticipacionId.equals(other.pricinganticipacionId))) { - return false; - } - return true; - } - - @Override - public String toString() { - return "com.rjconsultores.ventaboletos.entidad.PricingAnticipacion[pricinganticipacionId=" + pricinganticipacionId + "]"; - } -} +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +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 = "PRICING_OCUPA_ANTECIPA_SEQ", sequenceName = "PRICING_OCUPA_ANTECIPA_SEQ", allocationSize = 1) +@Table(name = "PRICING_OCUPA_ANTECIPA") +public class PricingOcupaAntecipa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_OCUPA_ANTECIPA_SEQ") + @Column(name = "PRICINGOCUPAANTECIPA_ID") + private Integer pricingocupaantecipaId; + @Basic(optional = false) + @Column(name = "CANTDIASMIN") + private Integer cantdiasmin; + @Basic(optional = false) + @Column(name = "CANTDIASMAX") + private Integer cantdiasmax; + @Column(name = "CANTASIENTOSMIN") + private Integer cantasientosmin; + @Column(name = "CANTASIENTOSMAX") + private Integer cantasientosmax; + @Column(name = "PORCENTAJE") + private BigDecimal porcentaje; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Integer activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public Integer getPricingocupaantecipaId() { + return pricingocupaantecipaId; + } + + public void setPricingocupaantecipaId(Integer pricingocupaantecipaId) { + this.pricingocupaantecipaId = pricingocupaantecipaId; + } + + public Integer getCantdiasmin() { + return cantdiasmin; + } + + public void setCantdiasmin(Integer cantdiasmin) { + this.cantdiasmin = cantdiasmin; + } + + public Integer getCantdiasmax() { + return cantdiasmax; + } + + public void setCantdiasmax(Integer cantdiasmax) { + this.cantdiasmax = cantdiasmax; + } + + public Integer getCantasientosmin() { + return cantasientosmin; + } + + public void setCantasientosmin(Integer cantasientosmin) { + this.cantasientosmin = cantasientosmin; + } + + public Integer getCantasientosmax() { + return cantasientosmax; + } + + public void setCantasientosmax(Integer cantasientosmax) { + this.cantasientosmax = cantasientosmax; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer 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; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingocupaantecipaId != null ? pricingocupaantecipaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingOcupaAntecipa)) { + return false; + } + PricingOcupaAntecipa other = (PricingOcupaAntecipa) object; + if ((this.pricingocupaantecipaId == null && other.pricingocupaantecipaId != null) || (this.pricingocupaantecipaId != null && !this.pricingocupaantecipaId.equals(other.pricingocupaantecipaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa[ pricingocupaantecipaId=" + pricingocupaantecipaId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingOcupacion.java b/src/com/rjconsultores/ventaboletos/entidad/PricingOcupacion.java deleted file mode 100644 index e616bf423..000000000 --- a/src/com/rjconsultores/ventaboletos/entidad/PricingOcupacion.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.entidad; - -import java.io.Serializable; -import java.math.BigDecimal; -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; - -/** - * - * @author Rafius - */ -@Entity -@SequenceGenerator(name = "PRICING_OCUPACION_SEQ", sequenceName = "PRICING_OCUPACION_SEQ", allocationSize = 1) -@Table(name = "PRICING_OCUPACION") -public class PricingOcupacion implements Serializable { - - private static final long serialVersionUID = 1L; - @Id - @Basic(optional = false) - @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_OCUPACION_SEQ") - @Column(name = "PRICINGOCUPACION_ID") - private Integer pricingocupacionId; - @Column(name = "OCUPACIONINICIAL") - private BigDecimal ocupacioninicial; - @Column(name = "OCUPACIONFINAL") - private BigDecimal ocupacionfinal; - @Column(name = "PORCENTAJE") - private BigDecimal porcentaje; - @Column(name = "ACTIVO") - private Integer activo; - @Column(name = "FECMODIF") - @Temporal(TemporalType.TIMESTAMP) - private Date fecmodif; - @Column(name = "USUARIO_ID") - private Integer usuarioId; - @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") - @ManyToOne - private Pricing pricing; - - public PricingOcupacion() { - } - - public PricingOcupacion(Integer pricingocupacionId) { - this.pricingocupacionId = pricingocupacionId; - } - - public Integer getPricingocupacionId() { - return pricingocupacionId; - } - - public void setPricingocupacionId(Integer pricingocupacionId) { - this.pricingocupacionId = pricingocupacionId; - } - - public BigDecimal getOcupacioninicial() { - return ocupacioninicial; - } - - public void setOcupacioninicial(BigDecimal ocupacioninicial) { - this.ocupacioninicial = ocupacioninicial; - } - - public BigDecimal getOcupacionfinal() { - return ocupacionfinal; - } - - public void setOcupacionfinal(BigDecimal ocupacionfinal) { - this.ocupacionfinal = ocupacionfinal; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } - - public Integer getActivo() { - return activo; - } - - public void setActivo(Integer 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; - } - - public Pricing getPricing() { - return pricing; - } - - public void setPricing(Pricing pricing) { - this.pricing = pricing; - } - - @Override - public int hashCode() { - int hash = 0; - hash += (pricingocupacionId != null ? pricingocupacionId.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object object) { - if (!(object instanceof PricingOcupacion)) { - return false; - } - PricingOcupacion other = (PricingOcupacion) object; - if ((this.pricingocupacionId == null && other.pricingocupacionId != null) || (this.pricingocupacionId != null && !this.pricingocupacionId.equals(other.pricingocupacionId))) { - return false; - } - return true; - } - - @Override - public String toString() { - return "entidad.test.PricingOcupacion[pricingocupacionId=" + pricingocupacionId + "]"; - } -} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingAnticipacionService.java b/src/com/rjconsultores/ventaboletos/service/PricingAnticipacionService.java deleted file mode 100644 index dafd39b19..000000000 --- a/src/com/rjconsultores/ventaboletos/service/PricingAnticipacionService.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.service; - -import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingAnticipacion; -import java.util.List; - -/** - * - * @author Desenvolvimento - */ -public interface PricingAnticipacionService extends GenericService { - - public List obtenerPorPricing(Pricing pricing); -} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java b/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java new file mode 100644 index 000000000..8b9179192 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; + +public interface PricingOcupaAntecipaService extends GenericService { + + public Boolean podeSalvar(Pricing pricing, PricingOcupaAntecipa pricingOcupaAntecipa); + + public List obtenerPorPricing(Pricing pricing); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingOcupacionService.java b/src/com/rjconsultores/ventaboletos/service/PricingOcupacionService.java deleted file mode 100644 index 33a8b38e0..000000000 --- a/src/com/rjconsultores/ventaboletos/service/PricingOcupacionService.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.service; - -import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingOcupacion; -import java.math.BigDecimal; -import java.util.List; - -/** - * - * @author Rafius - */ -public interface PricingOcupacionService extends GenericService { - - public Boolean podeSalvar(Pricing pricing, BigDecimal min, BigDecimal max); - - public List obtenerPorPricing(Pricing pricing); -} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingAnticipacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingAnticipacionServiceImpl.java deleted file mode 100644 index dd042d808..000000000 --- a/src/com/rjconsultores/ventaboletos/service/impl/PricingAnticipacionServiceImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.rjconsultores.ventaboletos.service.impl; - -import com.rjconsultores.ventaboletos.dao.PricingAnticipacionDAO; -import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingAnticipacion; -import com.rjconsultores.ventaboletos.service.PricingAnticipacionService; -import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; -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; - -/** - * - * @author Desenvolvimento - */ -@Service("pricingAnticipacionService") -public class PricingAnticipacionServiceImpl implements PricingAnticipacionService { - - @Autowired - private PricingAnticipacionDAO pricingAnticipacionDAO; - - public List obtenerTodos() { - return pricingAnticipacionDAO.obtenerTodos(); - } - - public PricingAnticipacion obtenerID(Integer id) { - return pricingAnticipacionDAO.obtenerID(id); - } - - @Transactional - public PricingAnticipacion suscribir(PricingAnticipacion entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Pricing.ATIVO); - - return pricingAnticipacionDAO.suscribir(entidad); - } - - @Transactional - public PricingAnticipacion actualizacion(PricingAnticipacion entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Pricing.ATIVO); - - return pricingAnticipacionDAO.actualizacion(entidad); - } - - @Transactional - public void borrar(PricingAnticipacion entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Pricing.EXCLUIDO); - - pricingAnticipacionDAO.actualizacion(entidad); - } - - public List obtenerPorPricing(Pricing pricing) { - return pricingAnticipacionDAO.obtenerPorPricing(pricing); - } -} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java similarity index 57% rename from src/com/rjconsultores/ventaboletos/service/impl/PricingOcupacionServiceImpl.java rename to src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java index 54373524c..7b0b9d7cc 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupacionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java @@ -1,41 +1,34 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package com.rjconsultores.ventaboletos.service.impl; -import com.rjconsultores.ventaboletos.dao.PricingOcupacionDAO; -import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingOcupacion; -import com.rjconsultores.ventaboletos.service.PricingOcupacionService; -import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; -import java.math.BigDecimal; 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; -/** - * - * @author Rafius - */ +import com.rjconsultores.ventaboletos.dao.PricingOcupaAntecipaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.service.PricingOcupaAntecipaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + @Service("pricingOcupacionService") -public class PricingOcupacionServiceImpl implements PricingOcupacionService { +public class PricingOcupaAntecipaServiceImpl implements PricingOcupaAntecipaService { @Autowired - private PricingOcupacionDAO pricingOcupacionDAO; + private PricingOcupaAntecipaDAO pricingOcupacionDAO; - public List obtenerTodos() { + public List obtenerTodos() { return pricingOcupacionDAO.obtenerTodos(); } - public PricingOcupacion obtenerID(Integer id) { + public PricingOcupaAntecipa obtenerID(Integer id) { return pricingOcupacionDAO.obtenerID(id); } @Transactional - public PricingOcupacion suscribir(PricingOcupacion entidad) { + public PricingOcupaAntecipa suscribir(PricingOcupaAntecipa entidad) { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Pricing.ATIVO); @@ -44,7 +37,7 @@ public class PricingOcupacionServiceImpl implements PricingOcupacionService { } @Transactional - public PricingOcupacion actualizacion(PricingOcupacion entidad) { + public PricingOcupaAntecipa actualizacion(PricingOcupaAntecipa entidad) { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Pricing.ATIVO); @@ -53,7 +46,7 @@ public class PricingOcupacionServiceImpl implements PricingOcupacionService { } @Transactional - public void borrar(PricingOcupacion entidad) { + public void borrar(PricingOcupaAntecipa entidad) { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Pricing.EXCLUIDO); @@ -61,11 +54,13 @@ public class PricingOcupacionServiceImpl implements PricingOcupacionService { pricingOcupacionDAO.actualizacion(entidad); } - public Boolean podeSalvar(Pricing pricing, BigDecimal min, BigDecimal max) { - return pricingOcupacionDAO.podeSalvar(pricing, min, max); + @Override + public Boolean podeSalvar(Pricing pricing, PricingOcupaAntecipa pricingOcupaAntecipa) { + return pricingOcupacionDAO.podeSalvar(pricing, pricingOcupaAntecipa); } - public List obtenerPorPricing(Pricing pricing) { + @Override + public List obtenerPorPricing(Pricing pricing) { return pricingOcupacionDAO.podeSalvar(pricing); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java index d179de972..da9d0d2d1 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java @@ -16,7 +16,6 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.PricingDAO; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Pricing; -import com.rjconsultores.ventaboletos.entidad.PricingAnticipacion; import com.rjconsultores.ventaboletos.entidad.PricingAsiento; import com.rjconsultores.ventaboletos.entidad.PricingCategoria; import com.rjconsultores.ventaboletos.entidad.PricingClase; @@ -25,7 +24,7 @@ import com.rjconsultores.ventaboletos.entidad.PricingDia; import com.rjconsultores.ventaboletos.entidad.PricingImporte; import com.rjconsultores.ventaboletos.entidad.PricingMarca; import com.rjconsultores.ventaboletos.entidad.PricingMercado; -import com.rjconsultores.ventaboletos.entidad.PricingOcupacion; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; import com.rjconsultores.ventaboletos.entidad.PricingRuta; import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; @@ -121,10 +120,10 @@ public class PricingServiceImpl implements PricingService { pricingMercado.setActivo(ativarInativarExcluir); } - for (PricingOcupacion pricingOcupacion : entidad.getPricingOcupacionList(statusPricing)) { - pricingOcupacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - pricingOcupacion.setFecmodif(Calendar.getInstance().getTime()); - pricingOcupacion.setActivo(ativarInativarExcluir); + for (PricingOcupaAntecipa pricingOcupaAntecipa : entidad.getPricingOcupaAntecipaList(statusPricing)) { + pricingOcupaAntecipa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingOcupaAntecipa.setFecmodif(Calendar.getInstance().getTime()); + pricingOcupaAntecipa.setActivo(ativarInativarExcluir); } for (PricingPuntoVenta pricingPuntoVenta : entidad.getPricingPuntoventaList(statusPricing)) { @@ -151,12 +150,6 @@ public class PricingServiceImpl implements PricingService { pricingVigencia.setActivo(ativarInativarExcluir); } - for (PricingAnticipacion pricingAnticipacion : entidad.getPricingAnticipacionList(statusPricing)) { - pricingAnticipacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - pricingAnticipacion.setFecmodif(Calendar.getInstance().getTime()); - pricingAnticipacion.setActivo(ativarInativarExcluir); - } - for (PricingTipoServicio pricingTipoServicio : entidad.getPricingTipoServicioList(statusPricing)) { pricingTipoServicio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); pricingTipoServicio.setFecmodif(Calendar.getInstance().getTime()); @@ -217,7 +210,6 @@ public class PricingServiceImpl implements PricingService { clonePricing.setIndGeneraFeriadoViaje(pricing.getIndGeneraFeriadoViaje()); clonePricing.setIndtransferible(pricing.getIndtransferible()); - clonePricing.setPricingAnticipacionList(new ArrayList()); clonePricing.setPricingAsientoList(new ArrayList()); clonePricing.setPricingCategoriaList(new ArrayList()); clonePricing.setPricingClaseList(new ArrayList()); @@ -226,7 +218,7 @@ public class PricingServiceImpl implements PricingService { clonePricing.setPricingImporteList(new ArrayList()); clonePricing.setPricingMarcaList(new ArrayList()); clonePricing.setPricingMercadoList(new ArrayList()); - clonePricing.setPricingOcupacionList(new ArrayList()); + clonePricing.setPricingOcupaAntecipaList(new ArrayList()); clonePricing.setPricingPuntoventaList(new ArrayList()); clonePricing.setPricingRutaList(new ArrayList()); clonePricing.setPricingTipoptovtaList(new ArrayList()); @@ -383,22 +375,25 @@ public class PricingServiceImpl implements PricingService { } clonePricing.setPricingMercadoList(pricingMercadoList); - List pricingOcupacionList = new ArrayList(); - for (PricingOcupacion pricingOcupacion : pricing.getPricingOcupacionList(statusAtivo)) { + List pricingOcupaAntecipaList = new ArrayList(); + for (PricingOcupaAntecipa pricingOcupaAntecipa : pricing.getPricingOcupaAntecipaList(statusAtivo)) { - PricingOcupacion clonePricingOcupacion = new PricingOcupacion(); + PricingOcupaAntecipa clonePricingOcupaAntecipa = new PricingOcupaAntecipa(); - clonePricingOcupacion.setOcupacionfinal(pricingOcupacion.getOcupacionfinal()); - clonePricingOcupacion.setOcupacioninicial(pricingOcupacion.getOcupacioninicial()); - clonePricingOcupacion.setPorcentaje(pricingOcupacion.getPorcentaje()); + clonePricingOcupaAntecipa.setCantasientosmin(pricingOcupaAntecipa.getCantasientosmin()); + clonePricingOcupaAntecipa.setCantasientosmax(pricingOcupaAntecipa.getCantasientosmax()); + clonePricingOcupaAntecipa.setCantdiasmin(pricingOcupaAntecipa.getCantdiasmin()); + clonePricingOcupaAntecipa.setCantdiasmax(pricingOcupaAntecipa.getCantdiasmax()); + clonePricingOcupaAntecipa.setImporte(pricingOcupaAntecipa.getImporte()); + clonePricingOcupaAntecipa.setPorcentaje(pricingOcupaAntecipa.getPorcentaje()); - clonePricingOcupacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - clonePricingOcupacion.setFecmodif(Calendar.getInstance().getTime()); - clonePricingOcupacion.setActivo(ativar); - clonePricingOcupacion.setPricing(clonePricing); - pricingOcupacionList.add(clonePricingOcupacion); + clonePricingOcupaAntecipa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingOcupaAntecipa.setFecmodif(Calendar.getInstance().getTime()); + clonePricingOcupaAntecipa.setActivo(ativar); + clonePricingOcupaAntecipa.setPricing(clonePricing); + pricingOcupaAntecipaList.add(clonePricingOcupaAntecipa); } - clonePricing.setPricingOcupacionList(pricingOcupacionList); + clonePricing.setPricingOcupaAntecipaList(pricingOcupaAntecipaList); List pricingPuntoVentaList = new ArrayList(); for (PricingPuntoVenta pricingPuntoVenta : pricing.getPricingPuntoventaList(statusAtivo)) { @@ -463,22 +458,6 @@ public class PricingServiceImpl implements PricingService { } clonePricing.setPricingVigenciaList(pricingVigenciaList); - List pricingAnticipacionList = new ArrayList(); - for (PricingAnticipacion pricingAnticipacion : pricing.getPricingAnticipacionList(statusAtivo)) { - - PricingAnticipacion clonePricingAnticipacion = new PricingAnticipacion(); - clonePricingAnticipacion.setCantdiasmax(pricingAnticipacion.getCantdiasmax()); - clonePricingAnticipacion.setCantdiasmin(pricingAnticipacion.getCantdiasmin()); - clonePricingAnticipacion.setPorcpricing(pricingAnticipacion.getPorcpricing()); - - clonePricingAnticipacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - clonePricingAnticipacion.setFecmodif(Calendar.getInstance().getTime()); - clonePricingAnticipacion.setActivo(ativar); - clonePricingAnticipacion.setPricing(clonePricing); - pricingAnticipacionList.add(clonePricingAnticipacion); - } - clonePricing.setPricingAnticipacionList(pricingAnticipacionList); - List pricingTipoServicioList = new ArrayList(); for (PricingTipoServicio pricingTipoServicio : pricing.getPricingTipoServicioList(statusAtivo)) { diff --git a/src/hibernate.cfg.xml b/src/hibernate.cfg.xml index 1cc356edd..1650e9404 100644 --- a/src/hibernate.cfg.xml +++ b/src/hibernate.cfg.xml @@ -2,192 +2,198 @@ - - oracle.jdbc.OracleDriver - jdbc:oracle:thin:@sistema.grupoguanabara.net.br:1521:ORCL - vtabol - vtax05 - - org.hibernate.dialect.Oracle10gDialect - true - true 1, false 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + org.hibernate.dialect.Oracle10gDialect + true + true 1, false 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +