Ely
7 months ago
16 changed files with 1453 additions and 632 deletions
@ -0,0 +1,130 @@ |
|||
/* |
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/J2EE/EJB30/StatelessEjbClass.java to edit this template
|
|||
*/ |
|||
package mx.edu.tjs.chapala.sistemas.bl; |
|||
|
|||
import java.util.List; |
|||
import java.util.Optional; |
|||
import javax.ejb.Stateless; |
|||
import javax.faces.application.FacesMessage; |
|||
import javax.faces.context.FacesContext; |
|||
import mx.edu.tjs.chapala.sistemas.dao.RolDAO; |
|||
import mx.edu.tjs.chapala.sistemas.modelo.Rol; |
|||
import mx.edu.tjs.chapala.sistemas.msg.Mensaje; |
|||
|
|||
/** |
|||
* |
|||
* @author Ely |
|||
*/ |
|||
@Stateless |
|||
public class RolBL implements RolBLLocal { |
|||
|
|||
// Add business logic below. (Right-click in editor and choose
|
|||
// "Insert Code > Add Business Method")
|
|||
public void addMessage(FacesMessage.Severity severity, String summary, String detail) { |
|||
FacesContext.getCurrentInstance(). |
|||
addMessage(null, new FacesMessage(severity, summary, detail)); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public Mensaje agregar(Rol rol) { |
|||
System.out.println("Llegaste al metodo de agregar rol"); |
|||
RolDAO rolDAO = new RolDAO(); |
|||
Mensaje m = null; |
|||
|
|||
//Toda la logica
|
|||
Optional<Rol> rolEncontradoOptional =rolDAO.buscarRol(rol); |
|||
|
|||
if (rolEncontradoOptional.isPresent()) { |
|||
rolEncontradoOptional.get(); |
|||
m = Mensaje.ELEMENTO_DUPLICADO; |
|||
System.out.println("NO SE PUEDE AGREGAR, EL ROL YA EXISTE"); |
|||
addMessage(FacesMessage.SEVERITY_ERROR, "", "¡Error! El elemento ya existe"); |
|||
|
|||
} else { |
|||
rolDAO.agregar(rol); |
|||
m = Mensaje.SIN_ERROR; |
|||
System.out.println("AGREGADO CON EXITO"); |
|||
addMessage(FacesMessage.SEVERITY_INFO, "", "¡Elemento agregado con éxito!"); |
|||
} |
|||
return m; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public Rol buscarId(Rol rol) { |
|||
System.out.println("Llegaste al metodo de buscar por id"); |
|||
RolDAO r = new RolDAO(); |
|||
Mensaje m = null; |
|||
|
|||
Rol rolEncontrado = r.buscarPorId(rol); |
|||
|
|||
if (rolEncontrado == null) { |
|||
m = Mensaje.ELEMENTO_NO_ENCONTRADO; |
|||
System.out.println("NO EXISTE EL rol"); |
|||
return rolEncontrado; |
|||
} else { |
|||
m = Mensaje.SIN_ERROR; |
|||
System.out.println("ROL ENCONTRADO CON EXITO: " + rolEncontrado.getId()); |
|||
return rolEncontrado; |
|||
} |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public Rol buscarNombre(Rol rol) { |
|||
System.out.println("Llegaste al metodo de buscar por nombre"); |
|||
RolDAO r = new RolDAO(); |
|||
Mensaje m = null; |
|||
|
|||
Rol rolEncontrado = r.buscarPorRol(rol); |
|||
|
|||
if (rolEncontrado == null) { |
|||
m = Mensaje.ELEMENTO_NO_ENCONTRADO; |
|||
System.out.println("NO EXISTE EL Usuarios"); |
|||
return rolEncontrado; |
|||
} else { |
|||
m = Mensaje.SIN_ERROR; |
|||
System.out.println("Usuarios ENCONTRADO CON EXITO: " + rolEncontrado.getRol()); |
|||
return rolEncontrado; |
|||
} |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public List<Rol> buscarStatus(boolean b) { |
|||
RolDAO r = new RolDAO(); |
|||
List l = r.buscarStatus(b); |
|||
System.out.println(l); |
|||
return l; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public void eliminarId(Rol r) { |
|||
RolDAO rl = new RolDAO(); |
|||
Mensaje m = null; |
|||
|
|||
if (rl.eliminar(r)) { |
|||
m = Mensaje.SIN_ERROR; |
|||
System.out.println("ELIMINADO CON EXITO"); |
|||
addMessage(FacesMessage.SEVERITY_INFO, "", "¡rol eliminado correctamente!"); |
|||
|
|||
} else { |
|||
m = Mensaje.ELEMENTO_NO_ENCONTRADO; |
|||
System.out.println("NO SE PUDO ELIMINAR"); |
|||
addMessage(FacesMessage.SEVERITY_WARN, "", "¡Error! No se pudo eliminar el rol"); |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public void editar(Rol rol) { |
|||
RolDAO r = new RolDAO(); |
|||
Mensaje m = null; |
|||
r.editar(rol); |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
/* |
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/J2EE/EJB30/SessionLocal.java to edit this template
|
|||
*/ |
|||
package mx.edu.tjs.chapala.sistemas.bl; |
|||
|
|||
import java.util.List; |
|||
import javax.ejb.Local; |
|||
import mx.edu.tjs.chapala.sistemas.modelo.Rol; |
|||
import mx.edu.tjs.chapala.sistemas.msg.Mensaje; |
|||
|
|||
/** |
|||
* |
|||
* @author Ely |
|||
*/ |
|||
@Local |
|||
public interface RolBLLocal { |
|||
public void editar(Rol rol); |
|||
|
|||
public void eliminarId(Rol r); |
|||
|
|||
public List<Rol> buscarStatus(boolean b); |
|||
|
|||
public Rol buscarNombre(Rol rol); |
|||
|
|||
public Rol buscarId(Rol rol); |
|||
|
|||
public Mensaje agregar(Rol rol); |
|||
|
|||
} |
@ -0,0 +1,128 @@ |
|||
/* |
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|||
*/ |
|||
package mx.edu.tjs.chapala.sistemas.dao; |
|||
|
|||
import java.util.List; |
|||
import java.util.Optional; |
|||
import javax.persistence.EntityManager; |
|||
import javax.persistence.EntityManagerFactory; |
|||
import javax.persistence.Persistence; |
|||
import javax.persistence.Query; |
|||
import mx.edu.tjs.chapala.sistemas.modelo.Rol; |
|||
|
|||
/** |
|||
* |
|||
* @author Ely |
|||
*/ |
|||
public class RolDAO { |
|||
private EntityManager em; //Manejador de entidades (entidad=bean del modelo)
|
|||
|
|||
public RolDAO() { |
|||
//conexion
|
|||
EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); |
|||
em = emf.createEntityManager(); |
|||
|
|||
} |
|||
|
|||
public void agregar(Rol r) { |
|||
em.getTransaction().begin(); |
|||
r.setStatus(1); |
|||
em.persist(r); //Almacenar en la BD
|
|||
em.getTransaction().commit(); |
|||
} |
|||
|
|||
public void editar(Rol r) { |
|||
buscarPorId(r); |
|||
em.getTransaction().begin(); |
|||
em.merge(r); //Editar en la BD
|
|||
em.getTransaction().commit(); |
|||
|
|||
} |
|||
public boolean eliminar(Rol r) { |
|||
if (buscarPorId(r) == null) { |
|||
return false; |
|||
} else { |
|||
em.getTransaction().begin(); |
|||
|
|||
// Obtener usuarios actualizado desde la base de datos
|
|||
Rol ro = em.find(Rol.class, r.getId()); |
|||
|
|||
r.setRol(ro.getRol()); |
|||
|
|||
|
|||
// Modificar solo el estado
|
|||
r.setStatus(0); |
|||
|
|||
em.merge(r); |
|||
em.getTransaction().commit(); |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
public Optional<Rol> buscarRol(Rol r) { |
|||
Query q1 = em.createNamedQuery("Rol.findByRol"); |
|||
q1.setParameter("rol",r.getRol()); |
|||
|
|||
|
|||
|
|||
List<Rol> resultadoRol = q1.getResultList(); |
|||
|
|||
|
|||
// Verifica si hay resultados para todos los campos
|
|||
if (!resultadoRol.isEmpty()) { |
|||
// Compara si el mismo autor está en los tres resultados
|
|||
Rol rolEncontrado = resultadoRol.stream() |
|||
.findFirst() |
|||
.orElse(null); |
|||
|
|||
return Optional.ofNullable(rolEncontrado); |
|||
} else { |
|||
// Devuelve Optional vacío para indicar ausencia de resultados
|
|||
return Optional.empty(); |
|||
} |
|||
} |
|||
|
|||
public Rol buscarPorId(Rol r) { |
|||
Query q = em.createNamedQuery("Rol.findById"); |
|||
q.setParameter("id", r.getId()); |
|||
if (q.getResultList().isEmpty()) { |
|||
return null; |
|||
} else { |
|||
return (Rol) q.getResultList().get(0); |
|||
} |
|||
} |
|||
|
|||
|
|||
public Rol buscarPorRol(Rol r) { |
|||
Query q = em.createNamedQuery("Rol.findByRol"); |
|||
q.setParameter("rol", r.getRol()); |
|||
if (q.getResultList().isEmpty()) { |
|||
return null; |
|||
} else { |
|||
return (Rol) q.getResultList().get(0); |
|||
} |
|||
} |
|||
|
|||
public List<Rol> buscarStatus(boolean status) { |
|||
Query q = em.createNamedQuery("Rol.findByStatus"); |
|||
int s = status ? 1 : 0; |
|||
|
|||
if(s==1){ |
|||
System.out.println("Rol activos"); |
|||
} else { |
|||
System.out.println("Rol inactivos"); |
|||
} |
|||
|
|||
q.setParameter("status", s); |
|||
return q.getResultList(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -1,204 +0,0 @@ |
|||
/* |
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|||
*/ |
|||
package mx.edu.tjs.chapala.sistemas.modelo; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
import javax.persistence.Basic; |
|||
import javax.persistence.CascadeType; |
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.GeneratedValue; |
|||
import javax.persistence.GenerationType; |
|||
import javax.persistence.Id; |
|||
import javax.persistence.NamedQueries; |
|||
import javax.persistence.NamedQuery; |
|||
import javax.persistence.OneToMany; |
|||
import javax.persistence.Table; |
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.Size; |
|||
import javax.xml.bind.annotation.XmlRootElement; |
|||
import javax.xml.bind.annotation.XmlTransient; |
|||
|
|||
/** |
|||
* |
|||
* @author nickdalyrendon |
|||
*/ |
|||
@Entity |
|||
@Table(name = "domicilio") |
|||
@XmlRootElement |
|||
@NamedQueries({ |
|||
@NamedQuery(name = "Domicilio.findAll", query = "SELECT d FROM Domicilio d"), |
|||
@NamedQuery(name = "Domicilio.findById", query = "SELECT d FROM Domicilio d WHERE d.id = :id"), |
|||
@NamedQuery(name = "Domicilio.findByPais", query = "SELECT d FROM Domicilio d WHERE d.pais = :pais"), |
|||
@NamedQuery(name = "Domicilio.findByEstado", query = "SELECT d FROM Domicilio d WHERE d.estado = :estado"), |
|||
@NamedQuery(name = "Domicilio.findByMunicipio", query = "SELECT d FROM Domicilio d WHERE d.municipio = :municipio"), |
|||
@NamedQuery(name = "Domicilio.findByLocalidad", query = "SELECT d FROM Domicilio d WHERE d.localidad = :localidad"), |
|||
@NamedQuery(name = "Domicilio.findByCp", query = "SELECT d FROM Domicilio d WHERE d.cp = :cp"), |
|||
@NamedQuery(name = "Domicilio.findByCalle", query = "SELECT d FROM Domicilio d WHERE d.calle = :calle"), |
|||
@NamedQuery(name = "Domicilio.findByNumero", query = "SELECT d FROM Domicilio d WHERE d.numero = :numero")}) |
|||
public class Domicilio implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
@Id |
|||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
|||
@Basic(optional = false) |
|||
@Column(name = "id") |
|||
private Integer id; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "pais") |
|||
private String pais; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "estado") |
|||
private String estado; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "municipio") |
|||
private String municipio; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "localidad") |
|||
private String localidad; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "cp") |
|||
private String cp; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "calle") |
|||
private String calle; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "numero") |
|||
private String numero; |
|||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "domicilioId") |
|||
private List<Usuarios> usuariosList; |
|||
|
|||
public Domicilio() { |
|||
} |
|||
|
|||
public Domicilio(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public Domicilio(Integer id, String pais, String estado, String municipio, String localidad, String cp, String calle, String numero) { |
|||
this.id = id; |
|||
this.pais = pais; |
|||
this.estado = estado; |
|||
this.municipio = municipio; |
|||
this.localidad = localidad; |
|||
this.cp = cp; |
|||
this.calle = calle; |
|||
this.numero = numero; |
|||
} |
|||
|
|||
public Integer getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getPais() { |
|||
return pais; |
|||
} |
|||
|
|||
public void setPais(String pais) { |
|||
this.pais = pais; |
|||
} |
|||
|
|||
public String getEstado() { |
|||
return estado; |
|||
} |
|||
|
|||
public void setEstado(String estado) { |
|||
this.estado = estado; |
|||
} |
|||
|
|||
public String getMunicipio() { |
|||
return municipio; |
|||
} |
|||
|
|||
public void setMunicipio(String municipio) { |
|||
this.municipio = municipio; |
|||
} |
|||
|
|||
public String getLocalidad() { |
|||
return localidad; |
|||
} |
|||
|
|||
public void setLocalidad(String localidad) { |
|||
this.localidad = localidad; |
|||
} |
|||
|
|||
public String getCp() { |
|||
return cp; |
|||
} |
|||
|
|||
public void setCp(String cp) { |
|||
this.cp = cp; |
|||
} |
|||
|
|||
public String getCalle() { |
|||
return calle; |
|||
} |
|||
|
|||
public void setCalle(String calle) { |
|||
this.calle = calle; |
|||
} |
|||
|
|||
public String getNumero() { |
|||
return numero; |
|||
} |
|||
|
|||
public void setNumero(String numero) { |
|||
this.numero = numero; |
|||
} |
|||
|
|||
@XmlTransient |
|||
public List<Usuarios> getUsuariosList() { |
|||
return usuariosList; |
|||
} |
|||
|
|||
public void setUsuariosList(List<Usuarios> usuariosList) { |
|||
this.usuariosList = usuariosList; |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int hash = 0; |
|||
hash += (id != null ? id.hashCode() : 0); |
|||
return hash; |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object object) { |
|||
// TODO: Warning - this method won't work in the case the id fields are not set
|
|||
if (!(object instanceof Domicilio)) { |
|||
return false; |
|||
} |
|||
Domicilio other = (Domicilio) object; |
|||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "mx.edu.tjs.chapala.sistemas.modelo.Domicilio[ id=" + id + " ]"; |
|||
} |
|||
|
|||
} |
@ -1,114 +1,128 @@ |
|||
/* |
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|||
*/ |
|||
package mx.edu.tjs.chapala.sistemas.modelo; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
import javax.persistence.Basic; |
|||
import javax.persistence.CascadeType; |
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.GeneratedValue; |
|||
import javax.persistence.GenerationType; |
|||
import javax.persistence.Id; |
|||
import javax.persistence.NamedQueries; |
|||
import javax.persistence.NamedQuery; |
|||
import javax.persistence.OneToMany; |
|||
import javax.persistence.Table; |
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.Size; |
|||
import javax.xml.bind.annotation.XmlRootElement; |
|||
import javax.xml.bind.annotation.XmlTransient; |
|||
|
|||
/** |
|||
* |
|||
* @author nickdalyrendon |
|||
*/ |
|||
@Entity |
|||
@Table(name = "rol") |
|||
@XmlRootElement |
|||
@NamedQueries({ |
|||
@NamedQuery(name = "Rol.findAll", query = "SELECT r FROM Rol r"), |
|||
@NamedQuery(name = "Rol.findById", query = "SELECT r FROM Rol r WHERE r.id = :id"), |
|||
@NamedQuery(name = "Rol.findByRol", query = "SELECT r FROM Rol r WHERE r.rol = :rol")}) |
|||
public class Rol implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
@Id |
|||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
|||
@Basic(optional = false) |
|||
@Column(name = "id") |
|||
private Integer id; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "rol") |
|||
private String rol; |
|||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "rolId") |
|||
private List<Usuarios> usuariosList; |
|||
|
|||
public Rol() { |
|||
} |
|||
|
|||
public Rol(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public Rol(Integer id, String rol) { |
|||
this.id = id; |
|||
this.rol = rol; |
|||
} |
|||
|
|||
public Integer getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getRol() { |
|||
return rol; |
|||
} |
|||
|
|||
public void setRol(String rol) { |
|||
this.rol = rol; |
|||
} |
|||
|
|||
@XmlTransient |
|||
public List<Usuarios> getUsuariosList() { |
|||
return usuariosList; |
|||
} |
|||
|
|||
public void setUsuariosList(List<Usuarios> usuariosList) { |
|||
this.usuariosList = usuariosList; |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int hash = 0; |
|||
hash += (id != null ? id.hashCode() : 0); |
|||
return hash; |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object object) { |
|||
// TODO: Warning - this method won't work in the case the id fields are not set
|
|||
if (!(object instanceof Rol)) { |
|||
return false; |
|||
} |
|||
Rol other = (Rol) object; |
|||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "mx.edu.tjs.chapala.sistemas.modelo.Rol[ id=" + id + " ]"; |
|||
} |
|||
|
|||
} |
|||
/* |
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|||
*/ |
|||
package mx.edu.tjs.chapala.sistemas.modelo; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
import javax.persistence.Basic; |
|||
import javax.persistence.CascadeType; |
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.GeneratedValue; |
|||
import javax.persistence.GenerationType; |
|||
import javax.persistence.Id; |
|||
import javax.persistence.NamedQueries; |
|||
import javax.persistence.NamedQuery; |
|||
import javax.persistence.OneToMany; |
|||
import javax.persistence.Table; |
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.Size; |
|||
import javax.xml.bind.annotation.XmlRootElement; |
|||
import javax.xml.bind.annotation.XmlTransient; |
|||
|
|||
/** |
|||
* |
|||
* @author Ely |
|||
*/ |
|||
@Entity |
|||
@Table(name = "rol") |
|||
@XmlRootElement |
|||
@NamedQueries({ |
|||
@NamedQuery(name = "Rol.findAll", query = "SELECT r FROM Rol r"), |
|||
@NamedQuery(name = "Rol.findById", query = "SELECT r FROM Rol r WHERE r.id = :id"), |
|||
@NamedQuery(name = "Rol.findByRol", query = "SELECT r FROM Rol r WHERE r.rol = :rol"), |
|||
@NamedQuery(name = "Rol.findByStatus", query = "SELECT r FROM Rol r WHERE r.status = :status")}) |
|||
public class Rol implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
@Id |
|||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
|||
@Basic(optional = false) |
|||
@Column(name = "id") |
|||
private Integer id; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "rol") |
|||
private String rol; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Column(name = "status") |
|||
private int status; |
|||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "rolId") |
|||
private List<Usuarios> usuariosList; |
|||
|
|||
public Rol() { |
|||
} |
|||
|
|||
public Rol(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public Rol(Integer id, String rol, int status) { |
|||
this.id = id; |
|||
this.rol = rol; |
|||
this.status = status; |
|||
} |
|||
|
|||
public Integer getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getRol() { |
|||
return rol; |
|||
} |
|||
|
|||
public void setRol(String rol) { |
|||
this.rol = rol; |
|||
} |
|||
|
|||
public int getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(int status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
@XmlTransient |
|||
public List<Usuarios> getUsuariosList() { |
|||
return usuariosList; |
|||
} |
|||
|
|||
public void setUsuariosList(List<Usuarios> usuariosList) { |
|||
this.usuariosList = usuariosList; |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int hash = 0; |
|||
hash += (id != null ? id.hashCode() : 0); |
|||
return hash; |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object object) { |
|||
// TODO: Warning - this method won't work in the case the id fields are not set
|
|||
if (!(object instanceof Rol)) { |
|||
return false; |
|||
} |
|||
Rol other = (Rol) object; |
|||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "mx.edu.tjs.chapala.sistemas.modelo.Rol[ id=" + id + " ]"; |
|||
} |
|||
|
|||
} |
|||
|
@ -1,259 +1,353 @@ |
|||
/* |
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|||
*/ |
|||
package mx.edu.tjs.chapala.sistemas.modelo; |
|||
|
|||
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.NamedQueries; |
|||
import javax.persistence.NamedQuery; |
|||
import javax.persistence.Table; |
|||
import javax.persistence.Temporal; |
|||
import javax.persistence.TemporalType; |
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.Size; |
|||
import javax.xml.bind.annotation.XmlRootElement; |
|||
|
|||
/** |
|||
* |
|||
* @author nickdalyrendon |
|||
*/ |
|||
@Entity |
|||
@Table(name = "usuarios") |
|||
@XmlRootElement |
|||
@NamedQueries({ |
|||
@NamedQuery(name = "Usuarios.findAll", query = "SELECT u FROM Usuarios u"), |
|||
@NamedQuery(name = "Usuarios.findById", query = "SELECT u FROM Usuarios u WHERE u.id = :id"), |
|||
@NamedQuery(name = "Usuarios.findByUsuario", query = "SELECT u FROM Usuarios u WHERE u.usuario = :usuario"), |
|||
@NamedQuery(name = "Usuarios.findByContrasenia", query = "SELECT u FROM Usuarios u WHERE u.contrasenia = :contrasenia"), |
|||
@NamedQuery(name = "Usuarios.findByStatus", query = "SELECT u FROM Usuarios u WHERE u.status = :status"), |
|||
@NamedQuery(name = "Usuarios.findByNombre", query = "SELECT u FROM Usuarios u WHERE u.nombre = :nombre"), |
|||
@NamedQuery(name = "Usuarios.findByApellidom", query = "SELECT u FROM Usuarios u WHERE u.apellidom = :apellidom"), |
|||
@NamedQuery(name = "Usuarios.findByApellidop", query = "SELECT u FROM Usuarios u WHERE u.apellidop = :apellidop"), |
|||
@NamedQuery(name = "Usuarios.findByFechanacimiento", query = "SELECT u FROM Usuarios u WHERE u.fechanacimiento = :fechanacimiento"), |
|||
@NamedQuery(name = "Usuarios.findByCorreo", query = "SELECT u FROM Usuarios u WHERE u.correo = :correo"), |
|||
@NamedQuery(name = "Usuarios.findByGenero", query = "SELECT u FROM Usuarios u WHERE u.genero = :genero"), |
|||
@NamedQuery(name = "Usuarios.findByTelefono", query = "SELECT u FROM Usuarios u WHERE u.telefono = :telefono")}) |
|||
public class Usuarios implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
@Id |
|||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
|||
@Basic(optional = false) |
|||
@Column(name = "id") |
|||
private Integer id; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "usuario") |
|||
private String usuario; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "contrasenia") |
|||
private String contrasenia; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Column(name = "status") |
|||
private int status; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "nombre") |
|||
private String nombre; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "apellidom") |
|||
private String apellidom; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "apellidop") |
|||
private String apellidop; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Column(name = "fechanacimiento") |
|||
@Temporal(TemporalType.DATE) |
|||
private Date fechanacimiento; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "correo") |
|||
private String correo; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Column(name = "genero") |
|||
private Character genero; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 20) |
|||
@Column(name = "telefono") |
|||
private String telefono; |
|||
@JoinColumn(name = "domicilio_id", referencedColumnName = "id") |
|||
@ManyToOne(optional = false) |
|||
private Domicilio domicilioId; |
|||
@JoinColumn(name = "rol_id", referencedColumnName = "id") |
|||
@ManyToOne(optional = false) |
|||
private Rol rolId; |
|||
|
|||
public Usuarios() { |
|||
} |
|||
|
|||
public Usuarios(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public Usuarios(Integer id, String usuario, String contrasenia, int status, String nombre, String apellidom, String apellidop, Date fechanacimiento, String correo, Character genero, String telefono) { |
|||
this.id = id; |
|||
this.usuario = usuario; |
|||
this.contrasenia = contrasenia; |
|||
this.status = status; |
|||
this.nombre = nombre; |
|||
this.apellidom = apellidom; |
|||
this.apellidop = apellidop; |
|||
this.fechanacimiento = fechanacimiento; |
|||
this.correo = correo; |
|||
this.genero = genero; |
|||
this.telefono = telefono; |
|||
} |
|||
|
|||
public Integer getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getUsuario() { |
|||
return usuario; |
|||
} |
|||
|
|||
public void setUsuario(String usuario) { |
|||
this.usuario = usuario; |
|||
} |
|||
|
|||
public String getContrasenia() { |
|||
return contrasenia; |
|||
} |
|||
|
|||
public void setContrasenia(String contrasenia) { |
|||
this.contrasenia = contrasenia; |
|||
} |
|||
|
|||
public int getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(int status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public String getNombre() { |
|||
return nombre; |
|||
} |
|||
|
|||
public void setNombre(String nombre) { |
|||
this.nombre = nombre; |
|||
} |
|||
|
|||
public String getApellidom() { |
|||
return apellidom; |
|||
} |
|||
|
|||
public void setApellidom(String apellidom) { |
|||
this.apellidom = apellidom; |
|||
} |
|||
|
|||
public String getApellidop() { |
|||
return apellidop; |
|||
} |
|||
|
|||
public void setApellidop(String apellidop) { |
|||
this.apellidop = apellidop; |
|||
} |
|||
|
|||
public Date getFechanacimiento() { |
|||
return fechanacimiento; |
|||
} |
|||
|
|||
public void setFechanacimiento(Date fechanacimiento) { |
|||
this.fechanacimiento = fechanacimiento; |
|||
} |
|||
|
|||
public String getCorreo() { |
|||
return correo; |
|||
} |
|||
|
|||
public void setCorreo(String correo) { |
|||
this.correo = correo; |
|||
} |
|||
|
|||
public Character getGenero() { |
|||
return genero; |
|||
} |
|||
|
|||
public void setGenero(Character genero) { |
|||
this.genero = genero; |
|||
} |
|||
|
|||
public String getTelefono() { |
|||
return telefono; |
|||
} |
|||
|
|||
public void setTelefono(String telefono) { |
|||
this.telefono = telefono; |
|||
} |
|||
|
|||
public Domicilio getDomicilioId() { |
|||
return domicilioId; |
|||
} |
|||
|
|||
public void setDomicilioId(Domicilio domicilioId) { |
|||
this.domicilioId = domicilioId; |
|||
} |
|||
|
|||
public Rol getRolId() { |
|||
return rolId; |
|||
} |
|||
|
|||
public void setRolId(Rol rolId) { |
|||
this.rolId = rolId; |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int hash = 0; |
|||
hash += (id != null ? id.hashCode() : 0); |
|||
return hash; |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object object) { |
|||
// TODO: Warning - this method won't work in the case the id fields are not set
|
|||
if (!(object instanceof Usuarios)) { |
|||
return false; |
|||
} |
|||
Usuarios other = (Usuarios) object; |
|||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "mx.edu.tjs.chapala.sistemas.modelo.Usuarios[ id=" + id + " ]"; |
|||
} |
|||
|
|||
} |
|||
/* |
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|||
*/ |
|||
package mx.edu.tjs.chapala.sistemas.modelo; |
|||
|
|||
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.NamedQueries; |
|||
import javax.persistence.NamedQuery; |
|||
import javax.persistence.Table; |
|||
import javax.persistence.Temporal; |
|||
import javax.persistence.TemporalType; |
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.Size; |
|||
import javax.xml.bind.annotation.XmlRootElement; |
|||
|
|||
/** |
|||
* |
|||
* @author Ely |
|||
*/ |
|||
@Entity |
|||
@Table(name = "usuarios") |
|||
@XmlRootElement |
|||
@NamedQueries({ |
|||
@NamedQuery(name = "Usuarios.findAll", query = "SELECT u FROM Usuarios u"), |
|||
@NamedQuery(name = "Usuarios.findById", query = "SELECT u FROM Usuarios u WHERE u.id = :id"), |
|||
@NamedQuery(name = "Usuarios.findByNombre", query = "SELECT u FROM Usuarios u WHERE u.nombre = :nombre"), |
|||
@NamedQuery(name = "Usuarios.findByApellidop", query = "SELECT u FROM Usuarios u WHERE u.apellidop = :apellidop"), |
|||
@NamedQuery(name = "Usuarios.findByApellidom", query = "SELECT u FROM Usuarios u WHERE u.apellidom = :apellidom"), |
|||
@NamedQuery(name = "Usuarios.findByGenero", query = "SELECT u FROM Usuarios u WHERE u.genero = :genero"), |
|||
@NamedQuery(name = "Usuarios.findByFechanacimiento", query = "SELECT u FROM Usuarios u WHERE u.fechanacimiento = :fechanacimiento"), |
|||
@NamedQuery(name = "Usuarios.findByUsuario", query = "SELECT u FROM Usuarios u WHERE u.usuario = :usuario"), |
|||
@NamedQuery(name = "Usuarios.findByContrasenia", query = "SELECT u FROM Usuarios u WHERE u.contrasenia = :contrasenia"), |
|||
@NamedQuery(name = "Usuarios.findByCorreo", query = "SELECT u FROM Usuarios u WHERE u.correo = :correo"), |
|||
@NamedQuery(name = "Usuarios.findByTelefono", query = "SELECT u FROM Usuarios u WHERE u.telefono = :telefono"), |
|||
@NamedQuery(name = "Usuarios.findByPais", query = "SELECT u FROM Usuarios u WHERE u.pais = :pais"), |
|||
@NamedQuery(name = "Usuarios.findByEstado", query = "SELECT u FROM Usuarios u WHERE u.estado = :estado"), |
|||
@NamedQuery(name = "Usuarios.findByMunicipio", query = "SELECT u FROM Usuarios u WHERE u.municipio = :municipio"), |
|||
@NamedQuery(name = "Usuarios.findByLocalidad", query = "SELECT u FROM Usuarios u WHERE u.localidad = :localidad"), |
|||
@NamedQuery(name = "Usuarios.findByCalle", query = "SELECT u FROM Usuarios u WHERE u.calle = :calle"), |
|||
@NamedQuery(name = "Usuarios.findByNumero", query = "SELECT u FROM Usuarios u WHERE u.numero = :numero"), |
|||
@NamedQuery(name = "Usuarios.findByCp", query = "SELECT u FROM Usuarios u WHERE u.cp = :cp"), |
|||
@NamedQuery(name = "Usuarios.findByStatus", query = "SELECT u FROM Usuarios u WHERE u.status = :status")}) |
|||
public class Usuarios implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
@Id |
|||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
|||
@Basic(optional = false) |
|||
@Column(name = "id") |
|||
private Integer id; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "nombre") |
|||
private String nombre; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "apellidop") |
|||
private String apellidop; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "apellidom") |
|||
private String apellidom; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Column(name = "genero") |
|||
private Character genero; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Column(name = "fechanacimiento") |
|||
@Temporal(TemporalType.DATE) |
|||
private Date fechanacimiento; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "usuario") |
|||
private String usuario; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "contrasenia") |
|||
private String contrasenia; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "correo") |
|||
private String correo; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 20) |
|||
@Column(name = "telefono") |
|||
private String telefono; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "pais") |
|||
private String pais; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "estado") |
|||
private String estado; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "municipio") |
|||
private String municipio; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "localidad") |
|||
private String localidad; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "calle") |
|||
private String calle; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "numero") |
|||
private String numero; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Size(min = 1, max = 45) |
|||
@Column(name = "cp") |
|||
private String cp; |
|||
@Basic(optional = false) |
|||
@NotNull |
|||
@Column(name = "status") |
|||
private int status; |
|||
@JoinColumn(name = "rol_id", referencedColumnName = "id") |
|||
@ManyToOne(optional = false) |
|||
private Rol rolId; |
|||
|
|||
public Usuarios() { |
|||
} |
|||
|
|||
public Usuarios(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public Usuarios(Integer id, String nombre, String apellidop, String apellidom, Character genero, Date fechanacimiento, String usuario, String contrasenia, String correo, String telefono, String pais, String estado, String municipio, String localidad, String calle, String numero, String cp, int status) { |
|||
this.id = id; |
|||
this.nombre = nombre; |
|||
this.apellidop = apellidop; |
|||
this.apellidom = apellidom; |
|||
this.genero = genero; |
|||
this.fechanacimiento = fechanacimiento; |
|||
this.usuario = usuario; |
|||
this.contrasenia = contrasenia; |
|||
this.correo = correo; |
|||
this.telefono = telefono; |
|||
this.pais = pais; |
|||
this.estado = estado; |
|||
this.municipio = municipio; |
|||
this.localidad = localidad; |
|||
this.calle = calle; |
|||
this.numero = numero; |
|||
this.cp = cp; |
|||
this.status = status; |
|||
} |
|||
|
|||
public Integer getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getNombre() { |
|||
return nombre; |
|||
} |
|||
|
|||
public void setNombre(String nombre) { |
|||
this.nombre = nombre; |
|||
} |
|||
|
|||
public String getApellidop() { |
|||
return apellidop; |
|||
} |
|||
|
|||
public void setApellidop(String apellidop) { |
|||
this.apellidop = apellidop; |
|||
} |
|||
|
|||
public String getApellidom() { |
|||
return apellidom; |
|||
} |
|||
|
|||
public void setApellidom(String apellidom) { |
|||
this.apellidom = apellidom; |
|||
} |
|||
|
|||
public Character getGenero() { |
|||
return genero; |
|||
} |
|||
|
|||
public void setGenero(Character genero) { |
|||
this.genero = genero; |
|||
} |
|||
|
|||
public Date getFechanacimiento() { |
|||
return fechanacimiento; |
|||
} |
|||
|
|||
public void setFechanacimiento(Date fechanacimiento) { |
|||
this.fechanacimiento = fechanacimiento; |
|||
} |
|||
|
|||
public String getUsuario() { |
|||
return usuario; |
|||
} |
|||
|
|||
public void setUsuario(String usuario) { |
|||
this.usuario = usuario; |
|||
} |
|||
|
|||
public String getContrasenia() { |
|||
return contrasenia; |
|||
} |
|||
|
|||
public void setContrasenia(String contrasenia) { |
|||
this.contrasenia = contrasenia; |
|||
} |
|||
|
|||
public String getCorreo() { |
|||
return correo; |
|||
} |
|||
|
|||
public void setCorreo(String correo) { |
|||
this.correo = correo; |
|||
} |
|||
|
|||
public String getTelefono() { |
|||
return telefono; |
|||
} |
|||
|
|||
public void setTelefono(String telefono) { |
|||
this.telefono = telefono; |
|||
} |
|||
|
|||
public String getPais() { |
|||
return pais; |
|||
} |
|||
|
|||
public void setPais(String pais) { |
|||
this.pais = pais; |
|||
} |
|||
|
|||
public String getEstado() { |
|||
return estado; |
|||
} |
|||
|
|||
public void setEstado(String estado) { |
|||
this.estado = estado; |
|||
} |
|||
|
|||
public String getMunicipio() { |
|||
return municipio; |
|||
} |
|||
|
|||
public void setMunicipio(String municipio) { |
|||
this.municipio = municipio; |
|||
} |
|||
|
|||
public String getLocalidad() { |
|||
return localidad; |
|||
} |
|||
|
|||
public void setLocalidad(String localidad) { |
|||
this.localidad = localidad; |
|||
} |
|||
|
|||
public String getCalle() { |
|||
return calle; |
|||
} |
|||
|
|||
public void setCalle(String calle) { |
|||
this.calle = calle; |
|||
} |
|||
|
|||
public String getNumero() { |
|||
return numero; |
|||
} |
|||
|
|||
public void setNumero(String numero) { |
|||
this.numero = numero; |
|||
} |
|||
|
|||
public String getCp() { |
|||
return cp; |
|||
} |
|||
|
|||
public void setCp(String cp) { |
|||
this.cp = cp; |
|||
} |
|||
|
|||
public int getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(int status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public Rol getRolId() { |
|||
return rolId; |
|||
} |
|||
|
|||
public void setRolId(Rol rolId) { |
|||
this.rolId = rolId; |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
int hash = 0; |
|||
hash += (id != null ? id.hashCode() : 0); |
|||
return hash; |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object object) { |
|||
// TODO: Warning - this method won't work in the case the id fields are not set
|
|||
if (!(object instanceof Usuarios)) { |
|||
return false; |
|||
} |
|||
Usuarios other = (Usuarios) object; |
|||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "mx.edu.tjs.chapala.sistemas.modelo.Usuarios[ id=" + id + " ]"; |
|||
} |
|||
|
|||
} |
|||
|
@ -1,23 +1,38 @@ |
|||
<?xml version='1.0' encoding='UTF-8' ?> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml" |
|||
xmlns:h="http://xmlns.jcp.org/jsf/html"> |
|||
xmlns:h="http://xmlns.jcp.org/jsf/html" |
|||
xmlns:p="http://primefaces.org/ui"> |
|||
<h:head> |
|||
<title>Inventario</title> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
|||
</h:head> |
|||
<h:body> |
|||
|
|||
<h2>login</h2> |
|||
<h:form> |
|||
<h:commandButton value="Login" action="#{login.login()}"/> |
|||
|
|||
<body style="background-color: #036FAB;" > |
|||
<div > |
|||
<center> |
|||
<h:form> |
|||
<div style=" height: 500px; width: 500px; background-color: #ffffff; align-content:center; margin-top: 100px; border-radius: 15px;"> |
|||
<p:graphicImage value="/resources/imagen/usuario.png" style="height: 200px; width: 300px; "/> |
|||
<p:growl id="growl" showDetail="true" /> |
|||
<center> |
|||
<h:panelGrid columns="2" > |
|||
|
|||
<p:inputText id="usuario" required="true" style="margin-top:20px" placeholder="usuario" requiredMessage="campo obligatorio" /> |
|||
<p:messages for="usuario"/> |
|||
|
|||
|
|||
<p:password id="contrasenia" required="true" style="margin-top:20px" placeholder= "contraseña" requiredMessage="campo obligatorio" /> |
|||
<p:messages for="contrasenia"/> |
|||
|
|||
</h:panelGrid> |
|||
|
|||
<p:commandButton ajax="false" value="Login" update="growl" action="#{login.login()}" style=" background-color:#036FAB; margin-top: 20px" /> |
|||
|
|||
</center> |
|||
</div> |
|||
</h:form> |
|||
|
|||
</center> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</h:body> |
|||
</body> |
|||
</html> |
|||
|
After Width: | Height: | Size: 696 KiB |
@ -0,0 +1,149 @@ |
|||
<?xml version='1.0' encoding='UTF-8' ?> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml" |
|||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" |
|||
xmlns:h="http://xmlns.jcp.org/jsf/html" |
|||
xmlns:f="http://xmlns.jcp.org/jsf/core" |
|||
xmlns:p="http://primefaces.org/ui"> |
|||
|
|||
<body> |
|||
|
|||
<ui:composition template="./template/principal.xhtml"> |
|||
|
|||
<ui:define name="top"> |
|||
<center><H2> R O L </H2></center> |
|||
</ui:define> |
|||
|
|||
<ui:define name="left"> |
|||
<h:form> |
|||
<p:menu style="border-color: gray; margin: 1px; width: 163px; height: 600px; " > |
|||
|
|||
<p:menuitem action="ProductoLista.xhtml" value="Productos" ajax="false" icon="pi pi-shopping-bag" iconPos="left" style="background-color: lightgray" styleClass="botonMenu" /> |
|||
<p:menuitem action="proveedorLista.xhtml" value="Proveedores" ajax="false" icon="pi pi-id-card" iconPos="left" style="background-color: white " styleClass="botonMenu"/> |
|||
<p:menuitem action="marcaLista.xhtml" value="Marcas" ajax="false" icon="pi pi-tag" iconPos="left" style="background-color: lightgray" styleClass="botonMenu" /> |
|||
<p:menuitem action="categoriaLista.xhtml" value="Categorias" ajax="false" icon="pi pi-star" iconPos="left" style="background-color: white" styleClass="botonMenu" /> |
|||
<p:menuitem action="UbicacionAlmacenLista.xhtml" value="Almacen" ajax="false" icon="pi pi-map-marker" iconPos="left" style="background-color: lightgray" styleClass="botonMenu"/> |
|||
<p:menuitem action="usuariosLista.xhtml" value="Usuarios" ajax="false" icon="pi pi-users" iconPos="left" style="background-color: white" styleClass="botonMenu" /> |
|||
<p:menuitem action="rolLista.xhtml" value="Rol" ajax="false" icon="pi pi-sitemap" iconPos="left" style="background-color: lightgray" styleClass="botonMenu" /> |
|||
</p:menu> |
|||
</h:form> |
|||
|
|||
</ui:define> |
|||
|
|||
<ui:define name="content"> |
|||
<f:view> |
|||
<h:form id="formtabla"> |
|||
<p:growl id="grsowl" showDetail="true" /> |
|||
|
|||
<p:dataTable id="tabla" value="#{demoBeanRol.all}" var="item" |
|||
widgetVar="Rol" emptyMessage="No se han encontrado el usuario" |
|||
filteredValue="#{demoBeanRol.filteredCustomers3}" |
|||
globalFilterFunction="#{demoBeanRol.globalFilterFunction}" |
|||
scrollable="true" scrollHeight="480" > |
|||
|
|||
<f:facet name="header"> |
|||
<div class="flex justify-content-end" style="height: 30px;" > |
|||
<div> |
|||
<p:commandButton ajax="true" oncomplete="PF('dlg').show();" actionListener="#{demoBeanRol.prepararNuevo()}" |
|||
update=":dialog" value="Nuevo" icon="pi pi-plus" /> |
|||
|
|||
<i class="pi pi-search" style="margin-left: 765px; margin-top: 10px;"></i> |
|||
<p:inputText id="globalFilter" onkeyup="PF('rol').filter()" placeholder="Buscar rol" |
|||
style="width:300px; margin-left: 10px; float: right; margin-top: -40px;"/> |
|||
|
|||
</div> |
|||
</div> |
|||
</f:facet> |
|||
|
|||
<p:column styleClass="columnaId2"> |
|||
<f:facet name="header"> |
|||
<h:outputText value="Id" style=" font-weight:bolder; float: left" /> |
|||
</f:facet> |
|||
<h:outputText value="#{item.id}"/> |
|||
</p:column> |
|||
<p:column> |
|||
<f:facet name="header"> |
|||
<h:outputText value="Rol" style=" font-weight:bolder; float: left" /> |
|||
</f:facet> |
|||
<h:outputText value="#{item.rol}"/> |
|||
</p:column> |
|||
<p:column styleClass="columnaOpc"> |
|||
<f:facet name="header"> |
|||
<h:outputText value="Opciones" style=" font-weight:bolder;"/> |
|||
</f:facet> |
|||
|
|||
<p:commandButton ajax="true" oncomplete="PF('dlg').show();" actionListener="#{demoBeanRol.prepararEditar(item)}" |
|||
icon="pi pi-file-edit" update=":dialog" style="margin-right: 10px "/> |
|||
|
|||
<p:commandButton ajax="true" oncomplete="PF('dlg2').show();" actionListener="#{demoBeanRol.prepararEliminar(item)}" |
|||
update=":dialog2" style="background-color: red; color:white; border-color: red; " icon="pi pi-trash" /> |
|||
|
|||
</p:column> |
|||
|
|||
</p:dataTable> |
|||
</h:form> |
|||
|
|||
|
|||
<!-- crear/editar''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' --> |
|||
|
|||
<p:dialog id="dialog" widgetVar="dlg" width="600" height="150" modal="true" appendTo="@(body)" > |
|||
|
|||
<h:form style="height: 600px;" class="form-container" > |
|||
<p:growl id="growl" for="proveedorMsj" showDetail="true" /> |
|||
|
|||
<h1 style="text-align: center; background-color: #ADD8E6; padding: 20px; color: #000; font-size: 2em; margin-bottom: 10px;"> |
|||
<h:outputText value="#{demoBeanRol.titulo}"/></h1> |
|||
|
|||
<h:panelGrid id="grid" columns="3" style="width: 100%"> |
|||
|
|||
<p:outputLabel value="Rol:" for="rol" style=" font-weight:bolder"/> |
|||
<p:inputText id="rol" value="#{demoBeanRol.rol.rol}" title="Rol" required="true" requiredMessage="este campo es obligatorio" styleClass="formulario-elemento"/> |
|||
<p:message for="rol"/> |
|||
</h:panelGrid> |
|||
|
|||
|
|||
<p:commandButton action="#{demoBeanRol.agregar()}" update="grid, formtabla:tabla, growl" rendered="#{demoBeanRol.nuevo}" ajax="false" icon="pi pi-check" |
|||
style="margin-right: 10px; margin-top: 10px; background-color: green; color:white; border-color:green;" /> |
|||
|
|||
<p:commandButton action="#{demoBeanRol.editar()}" update="grid, formtabla:tabla, growl" ajax="true" rendered="#{!demoBeanRol.nuevo}" icon="pi pi-check" |
|||
style="margin-right: 10px; margin-top: 10px; background-color: green; color:white; border-color:green;" /> |
|||
|
|||
<p:commandButton action="rolLista.xhtml" immediate="true" ajax="false" icon="pi pi-times" style="background-color: red; color:white; border-color: red; margin-right: 15px;"/> |
|||
|
|||
</h:form> |
|||
</p:dialog> |
|||
|
|||
<!-- elimininar --> |
|||
|
|||
<p:dialog id="dialog2" widgetVar="dlg2" width="600" height="150" modal="true" > |
|||
<h:form> |
|||
<h1 style="text-align: center; background-color: #ADD8E6; padding: 30px; color: #000; font-size: 2em; margin-bottom: 20px;"> |
|||
<h:outputText value="Eliminar"/></h1> |
|||
<div> |
|||
<h:panelGrid id="grid" columns="4" style="width: 100%;" cellpadding="20" > |
|||
<h:outputText value="Id:"/> |
|||
<h:outputText value="#{demoBeanRol.rol.id}" title="Id"/> |
|||
<h:outputText value="Rol:"/> |
|||
<h:outputText value="#{demoBeanRol.rol.rol}" title="Rol"/> |
|||
</h:panelGrid> |
|||
</div> |
|||
<div style="margin-top: 20px;"> |
|||
<p:commandButton action="rolLista.xhtml" icon="pi pi-times" ajax="false" immediate="true" |
|||
style="margin-left: 10px; background-color:red; border-color:red; float: right;" /> |
|||
|
|||
<p:commandButton action="rolLista.xhtml" actionListener="#{demoBeanRol.eliminar()}" |
|||
ajax="false" icon="pi pi-check" |
|||
style=" background-color:green; border-color:green; float: right;"/> |
|||
</div> |
|||
</h:form> |
|||
|
|||
|
|||
</p:dialog> |
|||
</f:view> |
|||
|
|||
</ui:define> |
|||
|
|||
</ui:composition> |
|||
|
|||
</body> |
|||
</html> |
Loading…
Reference in new issue