From 4e69777fc93f69465c4f586cefcacde30e965f44 Mon Sep 17 00:00:00 2001 From: julio Date: Fri, 28 Mar 2014 14:55:19 +0000 Subject: [PATCH] Cotas - Poltronas ocupadas (fixed bug #5042) git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@34436 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/entidad/EsquemaAsiento.java | 215 +++++++++--------- .../service/EsquemaAsientoService.java | 2 +- .../impl/EsquemaAsientoServiceImpl.java | 7 +- 3 files changed, 111 insertions(+), 113 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java index c6ccd717c..8d36bfee7 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java @@ -21,118 +21,115 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; /** - * + * * @author Rafius */ @Entity -@SequenceGenerator(name = "ESQUEMA_ASIENTO_SEQ", sequenceName = "ESQUEMA_ASIENTO_SEQ",allocationSize=1) +@SequenceGenerator(name = "ESQUEMA_ASIENTO_SEQ", sequenceName = "ESQUEMA_ASIENTO_SEQ", allocationSize = 1) @Table(name = "ESQUEMA_ASIENTO") public class EsquemaAsiento implements Serializable { - private static final long serialVersionUID = 1L; - @Id - @Basic(optional = false) - @Column(name = "ESQUEMAASIENTO_ID") - @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_ASIENTO_SEQ") - private Integer esquemaasientoId; - @Column(name = "NUMASIENTO") - private String numasiento; - @Column(name = "INDVENDIBLE") - private Boolean indvendible; - @Column(name = "TIEMPOLIBERACION") - private Integer tiempoLiberacion; - @Column(name = "ACTIVO") - private Boolean activo; - @Column(name = "FECMODIF") - @Temporal(TemporalType.TIMESTAMP) - private Date fecmodif; - @Column(name = "USUARIO_ID") - private Integer usuarioId; - @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") - @ManyToOne - private Parada parada; - @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") - @ManyToOne - private EsquemaCorrida esquemaCorrida; - @Column(name = "MOTIVOBLOQUEO") - private String motivobloqueo; - @OneToOne - @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") - private Parada destino; - - + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMAASIENTO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_ASIENTO_SEQ") + private Integer esquemaasientoId; + @Column(name = "NUMASIENTO") + private String numasiento; + @Column(name = "INDVENDIBLE") + private Boolean indvendible; + @Column(name = "TIEMPOLIBERACION") + private Integer tiempoLiberacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @ManyToOne + private EsquemaCorrida esquemaCorrida; + @Column(name = "MOTIVOBLOQUEO") + private String motivobloqueo; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; - public EsquemaAsiento() { - } + public EsquemaAsiento() { + } - public EsquemaAsiento(Integer esquemaasientoId) { - this.esquemaasientoId = esquemaasientoId; - } + public EsquemaAsiento(Integer esquemaasientoId) { + this.esquemaasientoId = esquemaasientoId; + } - public Integer getEsquemaasientoId() { - return esquemaasientoId; - } + public Integer getEsquemaasientoId() { + return esquemaasientoId; + } - public void setEsquemaasientoId(Integer esquemaasientoId) { - this.esquemaasientoId = esquemaasientoId; - } + public void setEsquemaasientoId(Integer esquemaasientoId) { + this.esquemaasientoId = esquemaasientoId; + } - public String getNumasiento() { - return numasiento; - } + public String getNumasiento() { + return numasiento; + } - public void setNumasiento(String numasiento) { - this.numasiento = numasiento; - } + public void setNumasiento(String numasiento) { + this.numasiento = numasiento; + } - public Boolean getIndvendible() { - return indvendible; - } + public Boolean getIndvendible() { + return indvendible; + } - public void setIndvendible(Boolean indvendible) { - this.indvendible = indvendible; - } + public void setIndvendible(Boolean indvendible) { + this.indvendible = indvendible; + } - public Boolean getActivo() { - return activo; - } + public Boolean getActivo() { + return activo; + } - public void setActivo(Boolean activo) { - this.activo = activo; - } + public void setActivo(Boolean activo) { + this.activo = activo; + } - public Date getFecmodif() { - return fecmodif; - } + public Date getFecmodif() { + return fecmodif; + } - public void setFecmodif(Date fecmodif) { - this.fecmodif = fecmodif; - } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } - public Integer getUsuarioId() { - return usuarioId; - } + public Integer getUsuarioId() { + return usuarioId; + } - public void setUsuarioId(Integer usuarioId) { - this.usuarioId = usuarioId; - } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } - public Parada getParada() { - return parada; - } + public Parada getParada() { + return parada; + } - public void setParada(Parada parada) { - this.parada = parada; - } + public void setParada(Parada parada) { + this.parada = parada; + } - public EsquemaCorrida getEsquemaCorrida() { - return esquemaCorrida; - } + public EsquemaCorrida getEsquemaCorrida() { + return esquemaCorrida; + } - public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { - this.esquemaCorrida = esquemaCorrida; - } - + public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + this.esquemaCorrida = esquemaCorrida; + } public Parada getDestino() { return destino; @@ -159,27 +156,27 @@ public class EsquemaAsiento implements Serializable { } @Override - public int hashCode() { - int hash = 0; - hash += (esquemaasientoId != null ? esquemaasientoId.hashCode() : 0); - return hash; - } + public int hashCode() { + int hash = 0; + hash += (esquemaasientoId != null ? esquemaasientoId.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 EsquemaAsiento)) { - return false; - } - EsquemaAsiento other = (EsquemaAsiento) object; - if ((this.esquemaasientoId == null && other.esquemaasientoId != null) || (this.esquemaasientoId != null && !this.esquemaasientoId.equals(other.esquemaasientoId))) { - return false; - } - return true; - } + @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 EsquemaAsiento)) { + return false; + } + EsquemaAsiento other = (EsquemaAsiento) object; + if ((this.esquemaasientoId == null && other.esquemaasientoId != null) || (this.esquemaasientoId != null && !this.esquemaasientoId.equals(other.esquemaasientoId))) { + return false; + } + return true; + } - @Override - public String toString() { - return "com.rjconsultores.ventaboletos.entidad.test.EsquemaAsiento[esquemaasientoId=" + esquemaasientoId + "]"; - } + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.EsquemaAsiento[esquemaasientoId=" + esquemaasientoId + "]"; + } } diff --git a/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java b/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java index 3d3052cf3..5ebee36c8 100644 --- a/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java +++ b/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java @@ -45,5 +45,5 @@ public interface EsquemaAsientoService { * @param motivoOcupacion * @return */ - public void bloqueoAsientoOcupacion(EsquemaCorrida esquemaCorrida, String asiento, Parada origen, Parada destino, String motivoOcupacion) throws BusinessException; + public void bloqueoAsientoOcupacion(EsquemaCorrida esquemaCorrida, String asiento, Parada origen, Parada destino, Integer tiempoLiberacion, String motivoOcupacion) throws BusinessException; } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java index 70b0fba4c..5e3fb42b2 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java @@ -108,11 +108,11 @@ public class EsquemaAsientoServiceImpl implements EsquemaAsientoService { es.setFecmodif(Calendar.getInstance().getTime()); es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); es.setNumasiento(asiento.toString()); + es.setTiempoLiberacion(tiempoLiberacion); if (tipoBloqueo.equals(BLOQUEO_EXCLUSIVO)) { es.setIndvendible(Boolean.TRUE); es.setParada(origen); - es.setTiempoLiberacion(tiempoLiberacion); } else { es.setIndvendible(Boolean.FALSE); es.setParada(origen); @@ -130,6 +130,7 @@ public class EsquemaAsientoServiceImpl implements EsquemaAsientoService { if (tipoBloqueo.equals(BLOQUEO_EXCLUSIVO)) { if (!(es.getIndvendible() && (es.getParada() != null) && (es.getDestino() == null))) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.validacionGrabacion"); } @@ -153,7 +154,7 @@ public class EsquemaAsientoServiceImpl implements EsquemaAsientoService { @Transactional(rollbackFor = BusinessException.class) @Override - public void bloqueoAsientoOcupacion(EsquemaCorrida esquemaCorrida, String strAsiento, Parada origen, Parada destino, String motivoOcupacion) throws BusinessException { + public void bloqueoAsientoOcupacion(EsquemaCorrida esquemaCorrida, String strAsiento, Parada origen, Parada destino, Integer tiempoLiberacion, String motivoOcupacion) throws BusinessException { if (origen == null) { throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.origenObligatoria"); @@ -169,7 +170,7 @@ public class EsquemaAsientoServiceImpl implements EsquemaAsientoService { throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.tramo"); } - hacerBloqueo(BLOQUEO_OCUPACION, esquemaCorrida, strAsiento, origen, destino, motivoOcupacion, null); + hacerBloqueo(BLOQUEO_OCUPACION, esquemaCorrida, strAsiento, origen, destino, motivoOcupacion, tiempoLiberacion); } /**