git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@23887 d1611594-4594-4d17-8e1d-87c2c4800839
parent
fcbd6fc97c
commit
84d2a620bb
|
@ -5,9 +5,14 @@
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.collections.Transformer;
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.FetchMode;
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.criterion.Order;
|
import org.hibernate.criterion.Order;
|
||||||
|
@ -81,20 +86,23 @@ public class MarcaHibernateDAO extends GenericHibernateDAO<Marca, Short>
|
||||||
|
|
||||||
|
|
||||||
public List<Marca> buscarMarcaPorEmpresa(List<Empresa> empresa) {
|
public List<Marca> buscarMarcaPorEmpresa(List<Empresa> empresa) {
|
||||||
String hql = " select new com.rjconsultores.ventaboletos.entidad.Marca(marca.marcaId, marca.descmarca) from Marca marca " +
|
if ( (empresa == null) || (empresa.isEmpty())){
|
||||||
" where ";
|
return Collections.emptyList();
|
||||||
for(Empresa e: empresa){
|
|
||||||
|
|
||||||
hql = hql + " marca.empresa.empresaId = "+ e.getEmpresaId() + " or";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Collection idsEmpresa = CollectionUtils.transformedCollection(empresa, new Transformer() {
|
||||||
|
|
||||||
hql = hql.substring(0,hql.length()-3);
|
@Override
|
||||||
|
public Object transform(Object input) {
|
||||||
|
return ((Empresa)input).getEmpresaId();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Query sq = getSession().createQuery(hql);
|
Criteria c = makeCriteria();
|
||||||
|
c.add(Restrictions.eq("activo", true));
|
||||||
|
c.add(Restrictions.in("empresa", idsEmpresa));
|
||||||
|
c.setFetchMode("logotipomarca", FetchMode.DEFAULT);
|
||||||
|
|
||||||
List<Marca> lsMarca = sq.list();
|
return c.list();
|
||||||
return lsMarca;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Administrador
|
* @author Administrador
|
||||||
|
@ -57,16 +60,20 @@ public class Marca implements Serializable {
|
||||||
@Column(name = "USUARIO_ID")
|
@Column(name = "USUARIO_ID")
|
||||||
private Integer usuarioId;
|
private Integer usuarioId;
|
||||||
@OneToMany(mappedBy = "marca")
|
@OneToMany(mappedBy = "marca")
|
||||||
|
@Fetch(FetchMode.SELECT)
|
||||||
private List<CategoriaMarca> categoriaMarcaList;
|
private List<CategoriaMarca> categoriaMarcaList;
|
||||||
@OneToMany(mappedBy = "marca")
|
@OneToMany(mappedBy = "marca")
|
||||||
|
@Fetch(FetchMode.SELECT)
|
||||||
private List<ReservacionMarca> reservacionMarcaList;
|
private List<ReservacionMarca> reservacionMarcaList;
|
||||||
@OneToMany(mappedBy = "marca")
|
@OneToMany(mappedBy = "marca")
|
||||||
private List<CancelacionCtrl> cancelacionCtrlList;
|
private List<CancelacionCtrl> cancelacionCtrlList;
|
||||||
@Column(name = "EQUIVALENCIA_ID")
|
@Column(name = "EQUIVALENCIA_ID")
|
||||||
private String equivalenciaId;
|
private String equivalenciaId;
|
||||||
@OneToMany(mappedBy = "marca")
|
@OneToMany(mappedBy = "marca")
|
||||||
|
@Fetch(FetchMode.SELECT)
|
||||||
private List<TarifaHist> tarifaHistList;
|
private List<TarifaHist> tarifaHistList;
|
||||||
@OneToMany(mappedBy = "marca")
|
@OneToMany(mappedBy = "marca")
|
||||||
|
@Fetch(FetchMode.SELECT)
|
||||||
private List<Corrida> corridaList;
|
private List<Corrida> corridaList;
|
||||||
|
|
||||||
public Marca() {
|
public Marca() {
|
||||||
|
|
|
@ -26,6 +26,8 @@ import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
@ -39,264 +41,267 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||||
@Table(name = "USUARIO")
|
@Table(name = "USUARIO")
|
||||||
public class Usuario implements Serializable, Authentication, UserDetails {
|
public class Usuario implements Serializable, Authentication, UserDetails {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SEQ")
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SEQ")
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@Column(name = "USUARIO_ID")
|
@Column(name = "USUARIO_ID")
|
||||||
private Integer usuarioId;
|
private Integer usuarioId;
|
||||||
@Column(name = "NOMBUSUARIO")
|
@Column(name = "NOMBUSUARIO")
|
||||||
private String nombusuario;
|
private String nombusuario;
|
||||||
@Column(name = "NOMBPATERNO")
|
@Column(name = "NOMBPATERNO")
|
||||||
private String nombpaterno;
|
private String nombpaterno;
|
||||||
@Column(name = "NOMBMATERNO")
|
@Column(name = "NOMBMATERNO")
|
||||||
private String nombmaterno;
|
private String nombmaterno;
|
||||||
@Column(name = "ACTIVO")
|
@Column(name = "ACTIVO")
|
||||||
private Boolean activo;
|
private Boolean activo;
|
||||||
@Column(name = "FECMODIF")
|
@Column(name = "FECMODIF")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date fecmodif;
|
private Date fecmodif;
|
||||||
@Column(name = "USUARIOMODIF_ID")
|
@Column(name = "USUARIOMODIF_ID")
|
||||||
private Integer usuariomodifId;
|
private Integer usuariomodifId;
|
||||||
@Column(name = "DESCCONTRASENA")
|
@Column(name = "DESCCONTRASENA")
|
||||||
private String senha;
|
private String senha;
|
||||||
@Column(name = "CVEUSUARIO")
|
@Column(name = "CVEUSUARIO")
|
||||||
private String claveUsuario;
|
private String claveUsuario;
|
||||||
@Column(name = "DESCCORREO")
|
@Column(name = "DESCCORREO")
|
||||||
private String descCorreo;
|
private String descCorreo;
|
||||||
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL)
|
||||||
private List<UsuarioPerfil> usuarioPerfilList;
|
@Fetch(FetchMode.SELECT)
|
||||||
|
private List<UsuarioPerfil> usuarioPerfilList;
|
||||||
@Column(name = "INDCORTEAUTOMATICO")
|
@Column(name = "INDCORTEAUTOMATICO")
|
||||||
private Boolean indCorteAutomatico;
|
private Boolean indCorteAutomatico;
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "EMPLEADO_ID")
|
@JoinColumn(name = "EMPLEADO_ID")
|
||||||
private Empleado empleado;
|
private Empleado empleado;
|
||||||
|
@OneToMany(mappedBy = "usuarioLog", cascade = CascadeType.ALL,fetch=FetchType.EAGER)
|
||||||
|
@Fetch(FetchMode.SELECT)
|
||||||
|
private List<UsuarioEmpresa> usuarioEmpresaList;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "usuarioLog", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
public String getClaveUsuario() {
|
||||||
private List<UsuarioEmpresa> usuarioEmpresaList;
|
return claveUsuario;
|
||||||
|
}
|
||||||
|
|
||||||
public String getClaveUsuario() {
|
public void setClaveUsuario(String claveUsuario) {
|
||||||
return claveUsuario;
|
this.claveUsuario = claveUsuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClaveUsuario(String claveUsuario) {
|
public Usuario() {
|
||||||
this.claveUsuario = claveUsuario;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public Usuario() {
|
public Usuario(Integer usuarioId) {
|
||||||
}
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
public Usuario(Integer usuarioId) {
|
public Integer getUsuarioId() {
|
||||||
this.usuarioId = usuarioId;
|
return usuarioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUsuarioId() {
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
return usuarioId;
|
this.usuarioId = usuarioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsuarioId(Integer usuarioId) {
|
public String getNombusuario() {
|
||||||
this.usuarioId = usuarioId;
|
return nombusuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNombusuario() {
|
public void setNombusuario(String nombusuario) {
|
||||||
return nombusuario;
|
this.nombusuario = nombusuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNombusuario(String nombusuario) {
|
public String getNombpaterno() {
|
||||||
this.nombusuario = nombusuario;
|
return nombpaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNombpaterno() {
|
public void setNombpaterno(String nombpaterno) {
|
||||||
return nombpaterno;
|
this.nombpaterno = nombpaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNombpaterno(String nombpaterno) {
|
public String getNombmaterno() {
|
||||||
this.nombpaterno = nombpaterno;
|
return nombmaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNombmaterno() {
|
public void setNombmaterno(String nombmaterno) {
|
||||||
return nombmaterno;
|
this.nombmaterno = nombmaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNombmaterno(String nombmaterno) {
|
public Boolean getActivo() {
|
||||||
this.nombmaterno = nombmaterno;
|
return activo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getActivo() {
|
public void setActivo(Boolean activo) {
|
||||||
return activo;
|
this.activo = activo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivo(Boolean activo) {
|
public Date getFecmodif() {
|
||||||
this.activo = activo;
|
return fecmodif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getFecmodif() {
|
public void setFecmodif(Date fecmodif) {
|
||||||
return fecmodif;
|
this.fecmodif = fecmodif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFecmodif(Date fecmodif) {
|
public Integer getUsuariomodifId() {
|
||||||
this.fecmodif = fecmodif;
|
return usuariomodifId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUsuariomodifId() {
|
public void setUsuariomodifId(Integer usuariomodifId) {
|
||||||
return usuariomodifId;
|
this.usuariomodifId = usuariomodifId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsuariomodifId(Integer usuariomodifId) {
|
public String getSenha() {
|
||||||
this.usuariomodifId = usuariomodifId;
|
return senha;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSenha() {
|
public void setSenha(String senha) {
|
||||||
return senha;
|
this.senha = senha;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSenha(String senha) {
|
|
||||||
this.senha = senha;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<UsuarioEmpresa> getUsuarioEmpresaList() {
|
public List<UsuarioEmpresa> getUsuarioEmpresaList() {
|
||||||
List<UsuarioEmpresa> tmp = new ArrayList<UsuarioEmpresa>();
|
List<UsuarioEmpresa> tmp = new ArrayList<UsuarioEmpresa>();
|
||||||
if (usuarioEmpresaList != null) {
|
if (usuarioEmpresaList != null) {
|
||||||
for (UsuarioEmpresa ce : this.usuarioEmpresaList) {
|
for (UsuarioEmpresa ce : this.usuarioEmpresaList) {
|
||||||
if (ce.getActivo()) {
|
if (ce.getActivo()) {
|
||||||
tmp.add(ce);
|
tmp.add(ce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsuarioEmpresaList(List<UsuarioEmpresa> usuarioEmpresaList) {
|
public void setUsuarioEmpresaList(List<UsuarioEmpresa> usuarioEmpresaList) {
|
||||||
this.usuarioEmpresaList = usuarioEmpresaList;
|
this.usuarioEmpresaList = usuarioEmpresaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UsuarioPerfil> getUsuarioPerfilList() {
|
public List<UsuarioPerfil> getUsuarioPerfilList() {
|
||||||
List<UsuarioPerfil> tmp = new ArrayList<UsuarioPerfil>();
|
List<UsuarioPerfil> tmp = new ArrayList<UsuarioPerfil>();
|
||||||
if (usuarioPerfilList != null) {
|
if (usuarioPerfilList != null) {
|
||||||
for (UsuarioPerfil cp : this.usuarioPerfilList) {
|
for (UsuarioPerfil cp : this.usuarioPerfilList) {
|
||||||
if (cp.getActivo()) {
|
if (cp.getActivo()) {
|
||||||
tmp.add(cp);
|
tmp.add(cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Empresa> getEmpresa() {
|
|
||||||
List<Empresa> tmp = new ArrayList<Empresa>();
|
|
||||||
if (usuarioEmpresaList != null) {
|
|
||||||
for (UsuarioEmpresa cp : this.usuarioEmpresaList) {
|
|
||||||
if ((cp.getActivo())) {
|
|
||||||
tmp.add(cp.getEmpresa());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
public List<Empresa> getEmpresa() {
|
||||||
}
|
List<Empresa> tmp = new ArrayList<Empresa>();
|
||||||
|
if (usuarioEmpresaList != null) {
|
||||||
|
for (UsuarioEmpresa cp : this.usuarioEmpresaList) {
|
||||||
|
if ((cp.getActivo())) {
|
||||||
|
tmp.add(cp.getEmpresa());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setUsuarioPerfilList(List<UsuarioPerfil> usuarioPerfilList) {
|
return tmp;
|
||||||
this.usuarioPerfilList = usuarioPerfilList;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public Empleado getEmpleado() {
|
public void setUsuarioPerfilList(List<UsuarioPerfil> usuarioPerfilList) {
|
||||||
return empleado;
|
this.usuarioPerfilList = usuarioPerfilList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmpleado(Empleado empleado) {
|
public Empleado getEmpleado() {
|
||||||
this.empleado = empleado;
|
return empleado;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<GrantedAuthority> getAuthorities() {
|
public void setEmpleado(Empleado empleado) {
|
||||||
return new ArrayList<GrantedAuthority>();
|
this.empleado = empleado;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
@Override
|
||||||
return this.senha;
|
public int hashCode() {
|
||||||
}
|
int hash = 0;
|
||||||
|
hash += (usuarioId != null ? usuarioId.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
@Override
|
||||||
return this.nombusuario;
|
public boolean equals(Object object) {
|
||||||
}
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||||
|
if (!(object instanceof Usuario)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Usuario other = (Usuario) object;
|
||||||
|
if ((this.usuarioId == null && other.usuarioId != null) || (this.usuarioId != null && !this.usuarioId.equals(other.usuarioId))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isAccountNonExpired() {
|
@Override
|
||||||
return true;
|
public String toString() {
|
||||||
}
|
return "com.rjconsultores.ventaboletos.entidad.Usuario[usuarioId=" + usuarioId + "]";
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isAccountNonLocked() {
|
public Collection<GrantedAuthority> getAuthorities() {
|
||||||
return true;
|
return new ArrayList<GrantedAuthority>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCredentialsNonExpired() {
|
public String getPassword() {
|
||||||
return true;
|
return this.senha;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public String getUsername() {
|
||||||
return true;
|
return this.nombusuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getCredentials() {
|
public boolean isAccountNonExpired() {
|
||||||
return new Object();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getDetails() {
|
public boolean isAccountNonLocked() {
|
||||||
return new Object();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getPrincipal() {
|
public boolean isCredentialsNonExpired() {
|
||||||
return this;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuthenticated() {
|
public boolean isEnabled() {
|
||||||
return Boolean.TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthenticated(boolean bln) throws IllegalArgumentException {
|
public Object getCredentials() {
|
||||||
}
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public Object getDetails() {
|
||||||
return this.getNombusuario();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescCorreo() {
|
public Object getPrincipal() {
|
||||||
return descCorreo;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescCorreo(String descCorreo) {
|
public boolean isAuthenticated() {
|
||||||
this.descCorreo = descCorreo;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getIndCorteAutomatico() {
|
public void setAuthenticated(boolean bln) throws IllegalArgumentException {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.getNombusuario();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescCorreo() {
|
||||||
|
return descCorreo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescCorreo(String descCorreo) {
|
||||||
|
this.descCorreo = descCorreo;
|
||||||
|
}
|
||||||
|
public Boolean getIndCorteAutomatico() {
|
||||||
return indCorteAutomatico;
|
return indCorteAutomatico;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIndCorteAutomatico(Boolean indCorteAutomatico) {
|
public void setIndCorteAutomatico(Boolean indCorteAutomatico) {
|
||||||
this.indCorteAutomatico = indCorteAutomatico;
|
this.indCorteAutomatico = indCorteAutomatico;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 0;
|
|
||||||
hash += (usuarioId != null ? usuarioId.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object object) {
|
|
||||||
if (!(object instanceof Usuario)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Usuario other = (Usuario) object;
|
|
||||||
if ((this.usuarioId == null && other.usuarioId != null) || (this.usuarioId != null && !this.usuarioId.equals(other.usuarioId))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "com.rjconsultores.ventaboletos.entidad.Usuario[usuarioId=" + usuarioId + "]";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue