Merge pull request 'fixes bug#AL-3308' (!120) from AL-3308 into master

Reviewed-on: adm/ModelWeb#120
Reviewed-by: Célio de Souza Ribeiro JR <celio@rjconsultores.com.br>
master
Gleison da Cruz 2023-11-27 20:37:16 +00:00
commit f679fdbeec
6 changed files with 198 additions and 1 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId>
<artifactId>ModelWeb</artifactId>
<version>1.25.0</version>
<version>1.25.1</version>
<distributionManagement>
<repository>

View File

@ -0,0 +1,6 @@
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraFormaPago;
public interface TipoEventoExtraFormaPagoDAO extends GenericDAO<TipoEventoExtraFormaPago, Integer> {
}

View File

@ -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<TipoEventoExtraFormaPago, Integer> implements TipoEventoExtraFormaPagoDAO {
@Autowired
public TipoEventoExtraFormaPagoHibernateDAO (
@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<TipoEventoExtraFormaPago> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
return c.list();
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,6 @@
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraFormaPago;
public interface TipoEventoExtraFormaPagoService extends GenericService<TipoEventoExtraFormaPago, Integer> {
}

View File

@ -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<TipoEventoExtraFormaPago> 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);
}
}