fixes bug #6537
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@46545 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
4acc349811
commit
c5136b410a
|
@ -0,0 +1,10 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PacoteConvenio;
|
||||
|
||||
public interface PacoteConvenioDAO extends GenericDAO<PacoteConvenio, Long> {
|
||||
|
||||
public List<PacoteConvenio> buscar(String nomconvenio);
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
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;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.PacoteConvenioDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.PacoteConvenio;
|
||||
|
||||
@Repository("pacoteConvenioDAO")
|
||||
public class PacoteConvenioHibernateDAO extends GenericHibernateDAO<PacoteConvenio, Long> implements PacoteConvenioDAO {
|
||||
|
||||
@Autowired
|
||||
public PacoteConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<PacoteConvenio> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<PacoteConvenio> buscar(String nomconvenio) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
c.add(Restrictions.eq("nomconvenio", nomconvenio));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
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.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@Entity
|
||||
@Table(name = "PACOTE_CONVENIO")
|
||||
@SequenceGenerator(name = "PACOTE_CONVENIO_SEQ", sequenceName = "PACOTE_CONVENIO_SEQ", allocationSize = 1)
|
||||
public class PacoteConvenio implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_CONVENIO_SEQ")
|
||||
@Column(name = "PACOTECONVENIO_ID")
|
||||
private Long pacoteconvenioId;
|
||||
|
||||
@Column(name = "NOMCONVENIO")
|
||||
private String nomconvenio;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
public Long getPacoteconvenioId() {
|
||||
return pacoteconvenioId;
|
||||
}
|
||||
|
||||
public void setPacoteconvenioId(Long pacoteconvenioId) {
|
||||
this.pacoteconvenioId = pacoteconvenioId;
|
||||
}
|
||||
|
||||
public String getNomconvenio() {
|
||||
return nomconvenio;
|
||||
}
|
||||
|
||||
public void setNomconvenio(String nomconvenio) {
|
||||
this.nomconvenio = nomconvenio;
|
||||
}
|
||||
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getNomconvenio();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PacoteConvenio;
|
||||
|
||||
public interface PacoteConvenioService extends GenericService<PacoteConvenio, Long> {
|
||||
|
||||
public List<PacoteConvenio> buscar(String nomconvenio);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
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.PacoteConvenioDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.PacoteConvenio;
|
||||
import com.rjconsultores.ventaboletos.service.PacoteConvenioService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("pacoteConvenioService")
|
||||
public class PacoteConvenioServiceImpl implements PacoteConvenioService {
|
||||
|
||||
@Autowired
|
||||
private PacoteConvenioDAO pacoteConvenioDAO;
|
||||
|
||||
public List<PacoteConvenio> obtenerTodos() {
|
||||
return pacoteConvenioDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public PacoteConvenio obtenerID(Long id) {
|
||||
return pacoteConvenioDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public PacoteConvenio suscribir(PacoteConvenio entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return pacoteConvenioDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public PacoteConvenio actualizacion(PacoteConvenio entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return pacoteConvenioDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(PacoteConvenio entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
pacoteConvenioDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
public List<PacoteConvenio> buscar(String deschotel) {
|
||||
return pacoteConvenioDAO.buscar(deschotel);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue