bug #9347 - adm
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@72689 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
592b3d4656
commit
7f75c22140
|
@ -0,0 +1,7 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MensagemRecusa;
|
||||||
|
|
||||||
|
public interface MensagemRecusaDAO extends GenericDAO<MensagemRecusa, Integer> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
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.MensagemRecusaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MensagemRecusa;
|
||||||
|
|
||||||
|
@Repository("MensagemRecusaDAO")
|
||||||
|
public class MensagemRecusaHibernateDAO extends GenericHibernateDAO<MensagemRecusa, Integer> implements MensagemRecusaDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SQLBuilder sqlBuilder;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public MensagemRecusaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<MensagemRecusa> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
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.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "MENSAGEM_RECUSA_SEQ", sequenceName = "MENSAGEM_RECUSA_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "MENSAGEM_RECUSA")
|
||||||
|
public class MensagemRecusa implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAGEM_RECUSA_SEQ")
|
||||||
|
@Column(name = "MENSAGEMRECUSA_ID")
|
||||||
|
private Integer mensagemRecusaId;
|
||||||
|
|
||||||
|
@Column(name = "TIPO_MENSAGEM")
|
||||||
|
private String tipoMensagem;
|
||||||
|
|
||||||
|
@Column(name = "DESCRICAO")
|
||||||
|
private String descricao;
|
||||||
|
|
||||||
|
@JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private Categoria categoria;
|
||||||
|
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
@Column(name= "TIPO_RELATORIO")
|
||||||
|
private Short tipoRelatorio;
|
||||||
|
|
||||||
|
public MensagemRecusa() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMensagemRecusaId() {
|
||||||
|
return mensagemRecusaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMensagemRecusaId(Integer mensagemRecusaId) {
|
||||||
|
this.mensagemRecusaId = mensagemRecusaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoMensagem() {
|
||||||
|
return tipoMensagem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoMensagem(String tipoMensagem) {
|
||||||
|
this.tipoMensagem = tipoMensagem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescricao() {
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescricao(String descricao) {
|
||||||
|
this.descricao = descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Categoria getCategoria() {
|
||||||
|
return categoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoria(Categoria categoria) {
|
||||||
|
this.categoria = categoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getTipoRelatorio() {
|
||||||
|
return tipoRelatorio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoRelatorio(Short tipoRelatorio) {
|
||||||
|
this.tipoRelatorio = tipoRelatorio;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MensagemRecusa;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
|
||||||
|
public interface MensagemRecusaService {
|
||||||
|
|
||||||
|
public List<MensagemRecusa> obtenerTodos();
|
||||||
|
|
||||||
|
public MensagemRecusa obtenerID(Integer id);
|
||||||
|
|
||||||
|
public void borrar(MensagemRecusa entidad);
|
||||||
|
|
||||||
|
public MensagemRecusa suscribirActualizar(MensagemRecusa entidad) throws BusinessException;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
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.MensagemRecusaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MensagemRecusa;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MensagemRecusaService;
|
||||||
|
|
||||||
|
@Service("mensagemRecusaService")
|
||||||
|
public class MensagemRecusaServiceImpl implements MensagemRecusaService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MensagemRecusaDAO mensagemRecusaDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MensagemRecusa> obtenerTodos() {
|
||||||
|
return mensagemRecusaDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MensagemRecusa obtenerID(Integer id) {
|
||||||
|
return mensagemRecusaDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
|
public void borrar(MensagemRecusa entidad) {
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
mensagemRecusaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
|
public MensagemRecusa suscribirActualizar(MensagemRecusa entidad) throws BusinessException {
|
||||||
|
if (entidad.getMensagemRecusaId() == null) {
|
||||||
|
return mensagemRecusaDAO.suscribir(entidad);
|
||||||
|
} else {
|
||||||
|
return mensagemRecusaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue