diff --git a/pom.xml b/pom.xml index b60845f90..fbaaacc8a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores ModelWeb - 1.25.0 + 1.25.1 diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraFormaPagoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraFormaPagoDAO.java new file mode 100644 index 000000000..7cdb3460a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraFormaPagoDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraFormaPago; + +public interface TipoEventoExtraFormaPagoDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraFormaPagoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraFormaPagoHibernateDAO.java new file mode 100644 index 000000000..b7de007f5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraFormaPagoHibernateDAO.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +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.TipoEventoExtraFormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraFormaPago; + +@Repository("tipoEventoExtraFormaPagoDAO") +public class TipoEventoExtraFormaPagoHibernateDAO extends GenericHibernateDAO implements TipoEventoExtraFormaPagoDAO { + + @Autowired + public TipoEventoExtraFormaPagoHibernateDAO ( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraFormaPago.java b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraFormaPago.java new file mode 100644 index 000000000..9c412e228 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraFormaPago.java @@ -0,0 +1,102 @@ +package com.rjconsultores.ventaboletos.entidad; + +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 +@Table(name = "TIPO_EVENTO_EXTRA_FORMAPAGO") +@SequenceGenerator(name = "TIPOEVENTOEXTRAFORMAPAGO_SEQ", sequenceName = "TIPOEVENTOEXTRAFORMAPAGO_SEQ", allocationSize = 1) +public class TipoEventoExtraFormaPago { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPOEVENTOEXTRAFORMAPAGO_SEQ") + @Column(name = "TIPOEVENTOEXTRAFORMAPAGO_ID") + private Integer tipoeventoextraformapagoId; + @ManyToOne + @JoinColumn(name = "TIPOEVENTOEXTRA_ID") + private TipoEventoExtra tipoeventoextra; + @ManyToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + + public Integer getTipoEventoExtraFormaPagoId() { + return tipoeventoextraformapagoId; + } + public void setTipoEventoExtraFormaPago(Integer tipoeventoextraformapagoId) { + this.tipoeventoextraformapagoId = tipoeventoextraformapagoId; + } + public TipoEventoExtra getTipoEventoExtra() { + return tipoeventoextra; + } + public void setTipoEventoExtra(TipoEventoExtra tipoeventoextra) { + this.tipoeventoextra = tipoeventoextra; + } + public FormaPago getFormapago() { + return formaPago; + } + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public String toString(){ + return this.formaPago.getDescpago(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoeventoextraformapagoId != null ? tipoeventoextraformapagoId.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 TipoEventoExtraFormaPago)) { + return false; + } + TipoEventoExtraFormaPago other = (TipoEventoExtraFormaPago) object; + if ((this.tipoeventoextraformapagoId == null && other.tipoeventoextraformapagoId != null) || (this.tipoeventoextraformapagoId != null && !this.tipoeventoextraformapagoId.equals(other.tipoeventoextraformapagoId))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraFormaPagoService.java b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraFormaPagoService.java new file mode 100644 index 000000000..397d3c80c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraFormaPagoService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraFormaPago; + +public interface TipoEventoExtraFormaPagoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraFormaPagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraFormaPagoServiceImpl.java new file mode 100644 index 000000000..e3ab5d07d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraFormaPagoServiceImpl.java @@ -0,0 +1,53 @@ +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.TipoEventoExtraFormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraFormaPago; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraFormaPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoEventoExtraFormaPagoService") +public class TipoEventoExtraFormaPagoServiceImpl implements TipoEventoExtraFormaPagoService { + @Autowired + private TipoEventoExtraFormaPagoDAO TipoEventoExtraFormaPagoDAO; + + + @Transactional + public TipoEventoExtraFormaPago suscribir(TipoEventoExtraFormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return TipoEventoExtraFormaPagoDAO.suscribir(entidad); + } + + @Override + public List obtenerTodos() { + return TipoEventoExtraFormaPagoDAO.obtenerTodos(); + } + + @Override + public TipoEventoExtraFormaPago obtenerID(Integer id) { + return TipoEventoExtraFormaPagoDAO.obtenerID(id); + } + + @Transactional + public TipoEventoExtraFormaPago actualizacion(TipoEventoExtraFormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return TipoEventoExtraFormaPagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoEventoExtraFormaPago entidad) { + TipoEventoExtraFormaPagoDAO.borrar(entidad); + } +}