fixes bug#22760
qua:wally dev:valdir incluido o seguinte custom : dasabilitaUsuarioAdministradoresPerfil Para ser uma regra especifica do usuario administradores git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@108760 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
3ef51f81fa
commit
ceed4087e5
|
@ -28,10 +28,10 @@ import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.BooleanUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.hibernate.annotations.Fetch;
|
import org.hibernate.annotations.Fetch;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
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;
|
||||||
|
|
||||||
|
@ -41,18 +41,27 @@ import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
|
||||||
|
import br.com.rjconsultores.auditador.annotations.AuditarID;
|
||||||
|
import br.com.rjconsultores.auditador.annotations.AuditarLista;
|
||||||
|
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||||
|
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author rodrigo
|
* @author rodrigo
|
||||||
*/
|
*/
|
||||||
|
@AuditarClasse(nome = "USUARIO", tela = "Alteração de Usuário")
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(name = "USUARIO_SEQ", sequenceName = "USUARIO_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "USUARIO_SEQ", sequenceName = "USUARIO_SEQ", allocationSize = 1)
|
||||||
@Table(name = "USUARIO")
|
@Table(name = "USUARIO")
|
||||||
public class Usuario implements Serializable, UserDetails/*, Authentication*/ {
|
|
||||||
|
public class Usuario implements Serializable, UserDetails, Auditavel<Usuario> {
|
||||||
|
|
||||||
public final static int CANT_DIAS_CONTRASENA = 999;
|
public final static int CANT_DIAS_CONTRASENA = 999;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@AuditarID
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SEQ")
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SEQ")
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@ -79,6 +88,7 @@ public class Usuario implements Serializable, UserDetails/*, Authentication*/ {
|
||||||
private String descCorreo;
|
private String descCorreo;
|
||||||
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
@Fetch(FetchMode.SELECT)
|
@Fetch(FetchMode.SELECT)
|
||||||
|
@AuditarLista(auditarEntidades = true, nome = "Perfil")
|
||||||
private List<UsuarioPerfil> usuarioPerfilList;
|
private List<UsuarioPerfil> usuarioPerfilList;
|
||||||
@Column(name = "INDCORTEAUTOMATICO")
|
@Column(name = "INDCORTEAUTOMATICO")
|
||||||
private Boolean indCorteAutomatico;
|
private Boolean indCorteAutomatico;
|
||||||
|
@ -87,10 +97,12 @@ public class Usuario implements Serializable, UserDetails/*, Authentication*/ {
|
||||||
private Empleado empleado;
|
private Empleado empleado;
|
||||||
@OneToMany(mappedBy = "usuarioLog", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(mappedBy = "usuarioLog", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
@Fetch(FetchMode.SELECT)
|
@Fetch(FetchMode.SELECT)
|
||||||
|
@NaoAuditar
|
||||||
private List<UsuarioEmpresa> usuarioEmpresaList;
|
private List<UsuarioEmpresa> usuarioEmpresaList;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
@Fetch(FetchMode.SELECT)
|
@Fetch(FetchMode.SELECT)
|
||||||
|
@NaoAuditar
|
||||||
private List<UsuarioUbicacion> usuarioUbicacionList;
|
private List<UsuarioUbicacion> usuarioUbicacionList;
|
||||||
|
|
||||||
@Column(name = "FECCONTRASENA")
|
@Column(name = "FECCONTRASENA")
|
||||||
|
@ -118,6 +130,10 @@ public class Usuario implements Serializable, UserDetails/*, Authentication*/ {
|
||||||
|
|
||||||
@Column(name = "INDRETORNATODASLOCALIDADES")
|
@Column(name = "INDRETORNATODASLOCALIDADES")
|
||||||
private Boolean indRetornaTodasLocalidades;
|
private Boolean indRetornaTodasLocalidades;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
@NaoAuditar
|
||||||
|
private Usuario usuarioClone;
|
||||||
|
|
||||||
public String getClaveUsuario() {
|
public String getClaveUsuario() {
|
||||||
return claveUsuario;
|
return claveUsuario;
|
||||||
|
@ -491,5 +507,38 @@ public class Usuario implements Serializable, UserDetails/*, Authentication*/ {
|
||||||
public void setIndRetornaTodasLocalidades(Boolean indRetornaTodasLocalidades) {
|
public void setIndRetornaTodasLocalidades(Boolean indRetornaTodasLocalidades) {
|
||||||
this.indRetornaTodasLocalidades = indRetornaTodasLocalidades;
|
this.indRetornaTodasLocalidades = indRetornaTodasLocalidades;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clonar() throws CloneNotSupportedException {
|
||||||
|
|
||||||
|
usuarioClone = new Usuario();
|
||||||
|
usuarioClone = (Usuario) this.clone();
|
||||||
|
|
||||||
|
|
||||||
|
if(this.getUsuarioPerfilList() != null) {
|
||||||
|
List<UsuarioPerfil> lsClones = new ArrayList<UsuarioPerfil>();
|
||||||
|
for (UsuarioPerfil usuarioPerfil : this.getUsuarioPerfilList()) {
|
||||||
|
if(BooleanUtils.isTrue(usuarioPerfil.getActivo())) {
|
||||||
|
usuarioPerfil.clonar();
|
||||||
|
lsClones.add(usuarioPerfil.getCloneObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usuarioClone.setUsuarioPerfilList((lsClones));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Usuario getCloneObject() throws CloneNotSupportedException {
|
||||||
|
return usuarioClone;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextoInclusaoExclusao() {
|
||||||
|
return String.format("ID [%s]", getUsuarioId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,21 +18,30 @@ import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
|
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
|
||||||
|
import br.com.rjconsultores.auditador.annotations.AuditarEntidade;
|
||||||
|
import br.com.rjconsultores.auditador.annotations.AuditarID;
|
||||||
|
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
||||||
|
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Rafius
|
* @author Rafius
|
||||||
*/
|
*/
|
||||||
|
@AuditarClasse(nome = "USUARIO_PERFIL", tela = "Alteração de Usuário")
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(name = "USUARIO_PERFIL_SEQ", sequenceName = "USUARIO_PERFIL_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "USUARIO_PERFIL_SEQ", sequenceName = "USUARIO_PERFIL_SEQ", allocationSize = 1)
|
||||||
@Table(name = "USUARIO_PERFIL")
|
@Table(name = "USUARIO_PERFIL")
|
||||||
public class UsuarioPerfil implements Serializable {
|
public class UsuarioPerfil implements Serializable, Auditavel<UsuarioPerfil> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@Id
|
@Id
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_PERFIL_SEQ")
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_PERFIL_SEQ")
|
||||||
@Column(name = "USUARIOPERFIL_ID")
|
@Column(name = "USUARIOPERFIL_ID")
|
||||||
|
@AuditarID
|
||||||
private Integer usuarioperfilId;
|
private Integer usuarioperfilId;
|
||||||
@Column(name = "ACTIVO")
|
@Column(name = "ACTIVO")
|
||||||
private Boolean activo;
|
private Boolean activo;
|
||||||
|
@ -43,10 +52,14 @@ public class UsuarioPerfil implements Serializable {
|
||||||
private Integer usuariomodifId;
|
private Integer usuariomodifId;
|
||||||
@JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID")
|
@JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@AuditarEntidade
|
||||||
private Usuario usuario;
|
private Usuario usuario;
|
||||||
@JoinColumn(name = "PERFIL_ID", referencedColumnName = "PERFIL_ID")
|
@JoinColumn(name = "PERFIL_ID", referencedColumnName = "PERFIL_ID")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Perfil perfil;
|
private Perfil perfil;
|
||||||
|
@Transient
|
||||||
|
@NaoAuditar
|
||||||
|
private UsuarioPerfil usuarioPerfilClone;
|
||||||
|
|
||||||
public UsuarioPerfil() {
|
public UsuarioPerfil() {
|
||||||
|
|
||||||
|
@ -128,4 +141,21 @@ public class UsuarioPerfil implements Serializable {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "com.rjconsultores.ventaboletos.dao.hibernate.UsuarioPerfil[usuarioperfilId=" + usuarioperfilId + "]";
|
return "com.rjconsultores.ventaboletos.dao.hibernate.UsuarioPerfil[usuarioperfilId=" + usuarioperfilId + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clonar() throws CloneNotSupportedException {
|
||||||
|
usuarioPerfilClone = new UsuarioPerfil();
|
||||||
|
usuarioPerfilClone = (UsuarioPerfil) this.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UsuarioPerfil getCloneObject() throws CloneNotSupportedException {
|
||||||
|
return usuarioPerfilClone;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTextoInclusaoExclusao() {
|
||||||
|
return String.format("ID [%s]", getUsuarioperfilId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.security.authentication.CredentialsExpiredException;
|
import org.springframework.security.authentication.CredentialsExpiredException;
|
||||||
|
@ -24,6 +25,7 @@ import com.rjconsultores.ventaboletos.entidad.Perfil;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
|
||||||
import com.rjconsultores.ventaboletos.service.UsuarioService;
|
import com.rjconsultores.ventaboletos.service.UsuarioService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
|
@ -42,6 +44,10 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
|
||||||
private UsuarioDAO usuarioDAO;
|
private UsuarioDAO usuarioDAO;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UsuarioPerfilDAO usuarioPerfilDAO;
|
private UsuarioPerfilDAO usuarioPerfilDAO;
|
||||||
|
@Autowired
|
||||||
|
private LogAuditoriaService logAuditoriaService;
|
||||||
|
private static Logger log = Logger.getLogger(UsuarioServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
public List<Usuario> buscarPeloNome(String nome) {
|
public List<Usuario> buscarPeloNome(String nome) {
|
||||||
return usuarioDAO.buscarPeloNome(nome);
|
return usuarioDAO.buscarPeloNome(nome);
|
||||||
|
@ -52,68 +58,86 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Usuario obtenerID(Integer id) {
|
public Usuario obtenerID(Integer id) {
|
||||||
return usuarioDAO.obtenerID(id);
|
|
||||||
|
Usuario usuario = usuarioDAO.obtenerID(id);
|
||||||
|
try {
|
||||||
|
usuario.clonar();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
return usuario;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = BusinessException.class)
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
@Override
|
@Override
|
||||||
public Usuario suscribirActualizar(Usuario entidad, String senha, Perfil perfil) throws BusinessException {
|
public Usuario suscribirActualizar(Usuario entidad, String senha, Perfil perfil) throws BusinessException {
|
||||||
|
|
||||||
// validación duplicado
|
try{
|
||||||
List<Usuario> lsUsuario = this.buscarPelaCveUsuario(entidad.getClaveUsuario());
|
|
||||||
boolean podeSalvar = false;
|
Usuario originalClone = entidad.getCloneObject();
|
||||||
if (lsUsuario.isEmpty()) {
|
|
||||||
podeSalvar = true;
|
// validación duplicado
|
||||||
} else {
|
List<Usuario> lsUsuario = this.buscarPelaCveUsuario(entidad.getClaveUsuario());
|
||||||
if (entidad.getUsuarioId() != null) {
|
boolean podeSalvar = false;
|
||||||
for (Usuario u : lsUsuario) {
|
if (lsUsuario.isEmpty()) {
|
||||||
if (u.getUsuarioId().equals(entidad.getUsuarioId())) {
|
podeSalvar = true;
|
||||||
podeSalvar = true;
|
} else {
|
||||||
|
if (entidad.getUsuarioId() != null) {
|
||||||
|
for (Usuario u : lsUsuario) {
|
||||||
|
if (u.getUsuarioId().equals(entidad.getUsuarioId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (!podeSalvar) {
|
||||||
if (!podeSalvar) {
|
throw new BusinessException("MSG.Registro.Existe");
|
||||||
throw new BusinessException("MSG.Registro.Existe");
|
|
||||||
}
|
|
||||||
if (senha != null) {
|
|
||||||
// validación complejidad contrasena
|
|
||||||
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) {
|
|
||||||
ContrasenaUtileria contrasenaUtileria = new ContrasenaUtileria();
|
|
||||||
contrasenaUtileria.validarContrasenaCompleja(senha);
|
|
||||||
}
|
}
|
||||||
|
if (senha != null) {
|
||||||
// encriptación contrasena
|
// validación complejidad contrasena
|
||||||
entidad.setSenha(ContrasenaUtileria.encriptarContrasena(senha));
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) {
|
||||||
}
|
ContrasenaUtileria contrasenaUtileria = new ContrasenaUtileria();
|
||||||
|
contrasenaUtileria.validarContrasenaCompleja(senha);
|
||||||
// Perfil
|
}
|
||||||
UsuarioPerfil up = new UsuarioPerfil();
|
|
||||||
up.setUsuario(entidad);
|
// encriptación contrasena
|
||||||
up.setPerfil(perfil);
|
entidad.setSenha(ContrasenaUtileria.encriptarContrasena(senha));
|
||||||
up.setActivo(Boolean.TRUE);
|
|
||||||
up.setFecmodif(Calendar.getInstance().getTime());
|
|
||||||
up.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
||||||
|
|
||||||
if (entidad.getUsuarioId() != null) {
|
|
||||||
List<UsuarioPerfil> lsUsuarioPerfil = usuarioPerfilDAO.obtenerPorUsuario(entidad);
|
|
||||||
for (UsuarioPerfil up2 : lsUsuarioPerfil) {
|
|
||||||
usuarioPerfilDAO.borrar(up2);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
List<UsuarioPerfil> lsUp = new ArrayList<UsuarioPerfil>();
|
// Perfil
|
||||||
lsUp.add(up);
|
UsuarioPerfil up = new UsuarioPerfil();
|
||||||
entidad.setUsuarioPerfilList(lsUp);
|
up.setUsuario(entidad);
|
||||||
|
up.setPerfil(perfil);
|
||||||
entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
up.setActivo(Boolean.TRUE);
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
up.setFecmodif(Calendar.getInstance().getTime());
|
||||||
entidad.setActivo(Boolean.TRUE);
|
up.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
if (entidad.getUsuarioId() == null) {
|
if (entidad.getUsuarioId() != null) {
|
||||||
return usuarioDAO.suscribir(entidad);
|
List<UsuarioPerfil> lsUsuarioPerfil = usuarioPerfilDAO.obtenerPorUsuario(entidad);
|
||||||
} else {
|
for (UsuarioPerfil up2 : lsUsuarioPerfil) {
|
||||||
return usuarioDAO.actualizacion(entidad);
|
usuarioPerfilDAO.borrar(up2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<UsuarioPerfil> lsUp = new ArrayList<UsuarioPerfil>();
|
||||||
|
lsUp.add(up);
|
||||||
|
entidad.setUsuarioPerfilList(lsUp);
|
||||||
|
|
||||||
|
entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
if (entidad.getUsuarioId() == null) {
|
||||||
|
return usuarioDAO.suscribir(entidad);
|
||||||
|
} else {
|
||||||
|
entidad = usuarioDAO.actualizacion(entidad);
|
||||||
|
logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null && !entidad.getEmpresa().isEmpty()? entidad.getEmpresa().get(0).getEmpresaId(): null);
|
||||||
|
return entidad;
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,9 @@ public enum CustomEnum {
|
||||||
|
|
||||||
IS_HABILITA_IE_DESCENTRALIZADA("isHabilitaIEDescentralizada"),
|
IS_HABILITA_IE_DESCENTRALIZADA("isHabilitaIEDescentralizada"),
|
||||||
|
|
||||||
IS_VALIDAR_CONSTANTE_REMESSA("isValidarConstanteRemessa");
|
IS_VALIDAR_CONSTANTE_REMESSA("isValidarConstanteRemessa"),
|
||||||
|
|
||||||
|
IS_DESABILITA_USUARIO_ADMINISTRADORES_PERFIL("dasabilitaUsuarioAdministradoresPerfil");
|
||||||
|
|
||||||
private String descricao;
|
private String descricao;
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,25 @@ package com.rjconsultores.ventaboletos.vo.segurida;
|
||||||
|
|
||||||
public enum PerfilJerarquia {
|
public enum PerfilJerarquia {
|
||||||
|
|
||||||
NORMAL(0), ADMIN(1), JERARQUIA_2(2), JERARQUIA_3(3), JERARQUIA_4(4);
|
NORMAL(0), ADMIN(1), JERARQUIA_2(2), JERARQUIA_3(3), JERARQUIA_4(4), ADMINISTRADORES("ADMINISTRADORES");
|
||||||
|
|
||||||
private Integer valor;
|
private Integer valor;
|
||||||
|
private String valorCaracter;
|
||||||
|
|
||||||
private PerfilJerarquia(Integer valor) {
|
private PerfilJerarquia(Integer valor) {
|
||||||
this.valor = valor;
|
this.valor = valor;
|
||||||
}
|
}
|
||||||
|
private PerfilJerarquia(String valorCaracter) {
|
||||||
|
this.valorCaracter = valorCaracter;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getValor() {
|
public Integer getValor() {
|
||||||
return valor;
|
return valor;
|
||||||
}
|
}
|
||||||
|
public String getValorCaracter() {
|
||||||
|
return valorCaracter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static PerfilJerarquia buscar(Integer valor) {
|
public static PerfilJerarquia buscar(Integer valor) {
|
||||||
|
|
||||||
|
@ -26,4 +34,16 @@ public enum PerfilJerarquia {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public static PerfilJerarquia buscar(String valorCaracter) {
|
||||||
|
|
||||||
|
if (valorCaracter == null)
|
||||||
|
return NORMAL;
|
||||||
|
|
||||||
|
for (PerfilJerarquia jerarquia : PerfilJerarquia.values()) {
|
||||||
|
if (jerarquia.getValor().equals(valorCaracter)) {
|
||||||
|
return jerarquia;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue