fixes bug#15119
qua: dev: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@97358 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
11b7fa8533
commit
7447b6d563
|
@ -0,0 +1,12 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfTotem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Wallace
|
||||||
|
*/
|
||||||
|
public interface ConfTotemDAO extends GenericDAO<ConfTotem, Integer> {
|
||||||
|
|
||||||
|
public ConfTotem buscar(String chave);
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
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.CustomDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Custom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Wallace
|
||||||
|
*/
|
||||||
|
@Repository("confTotemDAO")
|
||||||
|
public class ConfTotemHibernateDAO extends GenericHibernateDAO<Custom, Integer>
|
||||||
|
implements CustomDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ConfTotemHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Custom> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Custom buscar(String chave) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
c.add(Restrictions.ilike("chave", chave));
|
||||||
|
|
||||||
|
return c.list().isEmpty() ? null : (Custom) c.list().get(0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
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
|
||||||
|
@SequenceGenerator(name = "CONF_TOTEM_SEQ", sequenceName = "CONF_TOTEM_SEQ",allocationSize=1)
|
||||||
|
@Table(name = "CONF_TOTEM")
|
||||||
|
public class ConfTotem implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_TOTEM_SEQ")
|
||||||
|
@Column(name = "CONFTOTEM_ID")
|
||||||
|
private Integer confTotemId;
|
||||||
|
@Column(name = "VALOR")
|
||||||
|
private Boolean valor;
|
||||||
|
@Column(name = "CHAVE")
|
||||||
|
private String chave;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public Integer getConfTotemId() {
|
||||||
|
return confTotemId;
|
||||||
|
}
|
||||||
|
public void setConfTotemId(Integer confTotemId) {
|
||||||
|
this.confTotemId = confTotemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfTotem() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((confTotemId == null) ? 0 : confTotemId.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
ConfTotem other = (ConfTotem) obj;
|
||||||
|
if (confTotemId == null) {
|
||||||
|
if (other.confTotemId != null)
|
||||||
|
return false;
|
||||||
|
} else if (!confTotemId.equals(other.confTotemId))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getValor() {
|
||||||
|
return valor;
|
||||||
|
}
|
||||||
|
public void setValor(Boolean valor) {
|
||||||
|
this.valor = valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 String getChave() {
|
||||||
|
return chave;
|
||||||
|
}
|
||||||
|
public void setChave(String chave) {
|
||||||
|
this.chave = chave;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfTotem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Wallace
|
||||||
|
*/
|
||||||
|
public interface ConfTotemService extends GenericService<ConfTotem, Integer> {
|
||||||
|
|
||||||
|
public ConfTotem buscar(String chave);
|
||||||
|
}
|
|
@ -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.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ConfTotemDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfTotem;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConfTotemService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
public class ConfTotemServiceImpl implements ConfTotemService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfTotemDAO confTotemDAO;
|
||||||
|
|
||||||
|
public List<ConfTotem> obtenerTodos() {
|
||||||
|
return confTotemDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfTotem obtenerID(Integer id) {
|
||||||
|
return confTotemDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public ConfTotem suscribir(ConfTotem entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado() != null ? UsuarioLogado.getUsuarioLogado().getUsuarioId() : null);
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return confTotemDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ConfTotem actualizacion(ConfTotem entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return confTotemDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(ConfTotem entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
confTotemDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
|
||||||
|
public ConfTotem buscar(String chave) {
|
||||||
|
return confTotemDAO.buscar(chave);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue