commit 4492fe8453adb4093e0b053e4aefc046f95449e9 Author: nickdalyrendon Date: Fri May 10 07:56:32 2024 -0600 nuevo repositorio diff --git a/Inventario-ejb/build.xml b/Inventario-ejb/build.xml new file mode 100644 index 0000000..78b5d24 --- /dev/null +++ b/Inventario-ejb/build.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + Builds, tests, and runs the project Inventario-ejb. + + + diff --git a/Inventario-ejb/nbproject/ant-deploy.xml b/Inventario-ejb/nbproject/ant-deploy.xml new file mode 100644 index 0000000..fdc06d5 --- /dev/null +++ b/Inventario-ejb/nbproject/ant-deploy.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Inventario-ejb/nbproject/build-impl.xml b/Inventario-ejb/nbproject/build-impl.xml new file mode 100644 index 0000000..af64041 --- /dev/null +++ b/Inventario-ejb/nbproject/build-impl.xml @@ -0,0 +1,1207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set main.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Inventario-ejb/nbproject/genfiles.properties b/Inventario-ejb/nbproject/genfiles.properties new file mode 100644 index 0000000..86f20a6 --- /dev/null +++ b/Inventario-ejb/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=3dd259b3 +build.xml.script.CRC32=d98c699b +build.xml.stylesheet.CRC32=a737d6c5@1.75 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=3dd259b3 +nbproject/build-impl.xml.script.CRC32=17664588 +nbproject/build-impl.xml.stylesheet.CRC32=62693482@1.75 diff --git a/Inventario-ejb/nbproject/project.properties b/Inventario-ejb/nbproject/project.properties new file mode 100644 index 0000000..fad9f6e --- /dev/null +++ b/Inventario-ejb/nbproject/project.properties @@ -0,0 +1,76 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processor.options=-Aeclipselink.canonicalmodel.use_static_factory=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form,**/.nbattrs +build.dir=build +build.ear.classes.dir=${build.dir}/classes +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +debug.classpath=${javac.classpath}:${build.classes.dir} +debug.test.classpath=\ + ${run.test.classpath} +dist.dir=dist +dist.ear.jar=${dist.dir}/${jar.name} +dist.jar=${dist.dir}/${jar.name} +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath=\ + ${libs.javaee-endorsed-api-7.0.classpath} +excludes= +includes=** +j2ee.compile.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.7 +j2ee.platform.classpath=${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv4ee7 +jar.compress=false +jar.name=Inventario-ejb.jar +jars.in.ejbjar=false +javac.classpath= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath}:\ + ${libs.EclipseLink-GlassFish-v3.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +meta.inf=${source.root}/conf +meta.inf.excludes=sun-cmp-mappings.xml +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test diff --git a/Inventario-ejb/nbproject/project.xml b/Inventario-ejb/nbproject/project.xml new file mode 100644 index 0000000..2d99078 --- /dev/null +++ b/Inventario-ejb/nbproject/project.xml @@ -0,0 +1,19 @@ + + + org.netbeans.modules.j2ee.ejbjarproject + + + Inventario-ejb + 1.6.5 + + + + + + + + + .././lib/nblibraries.properties + + + diff --git a/Inventario-ejb/src/conf/MANIFEST.MF b/Inventario-ejb/src/conf/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/Inventario-ejb/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/Inventario-ejb/src/conf/META-INF/glassfish-resources.xml b/Inventario-ejb/src/conf/META-INF/glassfish-resources.xml new file mode 100644 index 0000000..d635baa --- /dev/null +++ b/Inventario-ejb/src/conf/META-INF/glassfish-resources.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Inventario-ejb/src/conf/glassfish-resources.xml b/Inventario-ejb/src/conf/glassfish-resources.xml new file mode 100644 index 0000000..0a45f8a --- /dev/null +++ b/Inventario-ejb/src/conf/glassfish-resources.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Inventario-ejb/src/conf/persistence.xml b/Inventario-ejb/src/conf/persistence.xml new file mode 100644 index 0000000..05e3888 --- /dev/null +++ b/Inventario-ejb/src/conf/persistence.xml @@ -0,0 +1,8 @@ + + + + jdbc/proyectoInventario + false + + + diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/CategoriaBL.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/CategoriaBL.java new file mode 100644 index 0000000..34d1895 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/CategoriaBL.java @@ -0,0 +1,156 @@ +/* + * 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.CategoriaDAO; +import mx.edu.tjs.chapala.sistemas.dao.MarcaDAO; +import mx.edu.tjs.chapala.sistemas.dao.ProveedorDAO; +import mx.edu.tjs.chapala.sistemas.modelo.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Proveedor; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Stateless +public class CategoriaBL implements CategoriaBLLocal { + + public void addMessage(FacesMessage.Severity severity, String summary, String detail) { + FacesContext.getCurrentInstance(). + addMessage(null, new FacesMessage(severity, summary, detail)); + } + + @Override + public Mensaje agregar(Categoria categoria) { + System.out.println("Llegaste al metodo de agregar categoria"); + CategoriaDAO categoriaDAO = new CategoriaDAO(); + Mensaje m = null; + + //Toda la logica + Optional categoriaEncontradoOptional = categoriaDAO.buscarCategoria(categoria); + Categoria e = categoriaDAO.buscarPorId(categoria); + + if(categoria.getNombre().isEmpty() || categoria.getStatus()==0){ + m = Mensaje.CAMPOS_INCOMPLETOS; + System.out.println("LOS CAMPOS SON INCOMPLETOS"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "Campos incompletos"); + } + + if(categoria.getNombre().length()>=45 ){ + m= Mensaje.DATOS_INCORRECTOS; + System.out.println("DATOS INCORRECTOS"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "Datos incorrectos"); + } + + if (categoriaEncontradoOptional.isPresent()) { + categoriaEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE AGREGAR, YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "La categoria ya existe"); + } else { + categoriaDAO.agregar(categoria); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "Se agrego la categoria"); + } + return m; + } + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + @Override + public Categoria buscarId(Categoria categoria) { + System.out.println("Llegaste al metodo de buscar por id"); + CategoriaDAO a = new CategoriaDAO(); + Mensaje m = null; + + Categoria c = a.buscarPorId(categoria); + + if (c == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE LA CATEGORIA"); + + return c; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("CATEGORIA ENCONTRADO CON EXITO: " + c.getId()); + return c; + } + } + + @Override + public Categoria buscarNombre(Categoria categoria) { + System.out.println("Llegaste al metodo de buscar por nombre"); + CategoriaDAO a = new CategoriaDAO(); + Mensaje m = null; + + Categoria ce = a.buscarPorNombre(categoria); + + if (ce == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE LA CATEGORIA"); + return ce; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("CATEGORIA ENCONTRADO CON EXITO: " + ce.getNombre()); + return ce; + } + } + + @Override + public List buscarStatus(boolean b) { + CategoriaDAO a = new CategoriaDAO(); + List l = a.buscarStatus(b); + System.out.println(l); + return l; + } + + @Override + public void eliminarId(Categoria categoria) { + CategoriaDAO a = new CategoriaDAO(); + Mensaje m = null; + + if (a.eliminar(categoria)) { + m = Mensaje.SIN_ERROR; + System.out.println("ELIMINADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "Se ha eliminado correctamente"); + } else { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO SE PUDO ELIMINAR"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "No se pudo eliminar"); + } + + } + + @Override + public void editar(Categoria categoria) { + CategoriaDAO ed = new CategoriaDAO(); + Mensaje m = null; + + + Optional categoriaEncontradoOptional = ed.buscarCategoria(categoria); + + if (categoriaEncontradoOptional.isPresent()) { + categoriaEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE AGREGAR, YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "La categoria ya existe"); + } else { + ed.editar(categoria); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "Categoria editada correctamente"); + } + } + + + } + diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/CategoriaBLLocal.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/CategoriaBLLocal.java new file mode 100644 index 0000000..ccb53df --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/CategoriaBLLocal.java @@ -0,0 +1,31 @@ +/* + * 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.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Proveedor; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Local +public interface CategoriaBLLocal { + Mensaje agregar(Categoria categoria); + + Categoria buscarId(Categoria categoria); + + Categoria buscarNombre(Categoria categoria); + + List buscarStatus(boolean b); + + + void eliminarId(Categoria categoria); + + public void editar(Categoria p); +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/MarcaBL.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/MarcaBL.java new file mode 100644 index 0000000..c783dac --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/MarcaBL.java @@ -0,0 +1,143 @@ +/* + * 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.CategoriaDAO; +import mx.edu.tjs.chapala.sistemas.dao.MarcaDAO; +import mx.edu.tjs.chapala.sistemas.modelo.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Marca; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Stateless +public class MarcaBL implements MarcaBLLocal { + + // 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(Marca marca) { + System.out.println("Llegaste al metodo de agregar marca"); + MarcaDAO marcaDAO = new MarcaDAO(); + Mensaje m = null; + + //Toda la logica + //Optional me = marcaDAO.buscarMarca(marca); + Optional marcaEncontradoOptional = marcaDAO.buscarMarca(marca); + Marca e = marcaDAO.buscarPorId(marca); + + if (marcaEncontradoOptional.isPresent()) { + marcaEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE AGREGAR, YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "La marca ya existe"); + } else { + marcaDAO.agregar(marca); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "Se agrego la marca"); + } + return m; + } + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + @Override + public Marca buscarId(Marca marca) { + System.out.println("Llegaste al metodo de buscar por id"); + MarcaDAO a = new MarcaDAO(); + Mensaje m = null; + + Marca c = a.buscarPorId(marca); + + if (c == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL PROVEEDOR"); + return c; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("CATEGORIA ENCONTRADO CON EXITO: " + c.getId()); + return c; + } + } + + @Override + public Marca buscarNombre(Marca marca) { + System.out.println("Llegaste al metodo de buscar por nombre"); + MarcaDAO a = new MarcaDAO(); + Mensaje m = null; + + Marca ce = a.buscarPorNombre(marca); + + if (ce == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL PROVEEDOR"); + return ce; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("PROVEEDOR ENCONTRADO CON EXITO: " + ce.getNombre()); + return ce; + } + } + + @Override + public List buscarStatus(boolean b) { + MarcaDAO a = new MarcaDAO(); + List l = a.buscarStatus(b); + System.out.println(l); + return l; + } + + @Override + public void eliminarId(Marca marca) { + MarcaDAO a = new MarcaDAO(); + Mensaje m = null; + + if (a.eliminar(marca)) { + m = Mensaje.SIN_ERROR; + System.out.println("ELIMINADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "Se ha eliminado correctamente"); + } else { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO SE PUDO ELIMINAR"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "No se pudo eliminar"); + } + } + + @Override + public void editar(Marca marca) { + MarcaDAO ed = new MarcaDAO(); + Mensaje m = null; + + Optional marcaEncontradoOptional = ed.buscarMarca(marca); + + if (marcaEncontradoOptional.isPresent()) { + marcaEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE AGREGAR, YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "La marca ya existe"); + } else { + ed.editar(marca); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "Marca editada correctamente"); + } + } +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/MarcaBLLocal.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/MarcaBLLocal.java new file mode 100644 index 0000000..5f7b770 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/MarcaBLLocal.java @@ -0,0 +1,31 @@ +/* + * 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.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Marca; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Local +public interface MarcaBLLocal { + Mensaje agregar(Marca marca); + + Marca buscarId(Marca marca); + + Marca buscarNombre(Marca marca); + + List buscarStatus(boolean b); + + + void eliminarId(Marca marca); + + public void editar(Marca p); +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProductoBL.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProductoBL.java new file mode 100644 index 0000000..f7f991a --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProductoBL.java @@ -0,0 +1,152 @@ +/* + * 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.ProductoDAO; +import mx.edu.tjs.chapala.sistemas.dao.ProveedorDAO; +import mx.edu.tjs.chapala.sistemas.modelo.Producto; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Stateless +public class ProductoBL implements ProductoBLLocal { + + // 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(Producto producto) { + System.out.println("Llegaste al metodo de agregar producto"); + ProductoDAO productoDAO = new ProductoDAO(); + Mensaje m = null; + + //Toda la logica + Optional productoEncontradoOptional = productoDAO.buscarProducto(producto); + + if (productoEncontradoOptional.isPresent()) { + productoEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE AGREGAR, EL PRODUCTO YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR","El producto ya existe"); + } else { + productoDAO.agregar(producto); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "CORRECTO","SE AGREGO CON EXITO"); + } + return m; + } + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + @Override + public Producto buscarId(Producto producto) { + System.out.println("Llegaste al metodo de buscar por id"); + ProductoDAO a = new ProductoDAO(); + Mensaje m = null; + + Producto productoEncontrado = a.buscarPorId(producto); + + if (productoEncontrado == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL PROVEEDOR"); + // addMessage(FacesMessage.SEVERITY_ERROR, "CORRECTO","NO SE ENCONTRO"); + return productoEncontrado; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("PROVEEDOR ENCONTRADO CON EXITO: " + productoEncontrado.getId()); + // addMessage(FacesMessage.SEVERITY_INFO, "CORRECTO","SE ENCONTRADO CON EXITO"); + return productoEncontrado; + } + } + + @Override + public Producto buscarNombre(Producto producto) { + System.out.println("Llegaste al metodo de buscar por nombre"); + ProductoDAO a = new ProductoDAO(); + Mensaje m = null; + + Producto productoEncontrado = a.buscarPorNombre(producto); + + if (productoEncontrado == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL PROVEEDOR"); + return productoEncontrado; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("PROVEEDOR ENCONTRADO CON EXITO: " + productoEncontrado.getNombre()); + return productoEncontrado; + } + } + + @Override + public List buscarStatus(boolean b) { + ProductoDAO a = new ProductoDAO(); + List l = a.buscarStatus(b); + System.out.println(l); + return l; + } + + @Override + public Mensaje eliminarId(Producto producto) { + ProductoDAO a = new ProductoDAO(); + Mensaje m = null; + + if (a.eliminar(producto)) { + m = Mensaje.SIN_ERROR; + System.out.println("ELIMINADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "ELIMINADO"," Se elimino correctamente"); + + } else { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO SE PUDO ELIMINAR"); + addMessage(FacesMessage.SEVERITY_ERROR, "NO SE ELIMINO","No se puede eliminar"); + } + return m; + } + + @Override + public Mensaje editar(Producto producto) { + ProductoDAO ed = new ProductoDAO(); + Mensaje m = null; + // ed.editar(producto); + + Optional proveedorEncontradoOptional = ed.buscarProducto(producto); + if (proveedorEncontradoOptional.isPresent()) { + proveedorEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE EDITAR, EL PRODUCTO YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "", "¡Error al editar! El elemento ya existe"); + } else { + ed.editar(producto); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "¡Elemento editado correctamente!"); + + + } + return m; + } + + public List getAll() { + ProductoDAO p = new ProductoDAO(); + return p.buscarStatus(true); + } +} + diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProductoBLLocal.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProductoBLLocal.java new file mode 100644 index 0000000..32f3dd1 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProductoBLLocal.java @@ -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.Producto; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Local +public interface ProductoBLLocal { + Mensaje agregar(Producto producto); + + Producto buscarId(Producto producto); + + Producto buscarNombre(Producto producto); + + List buscarStatus(boolean b); + + + Mensaje eliminarId(Producto producto); + + public Mensaje editar(Producto p); +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProveedorBL.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProveedorBL.java new file mode 100644 index 0000000..efced19 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProveedorBL.java @@ -0,0 +1,154 @@ +/* + * 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.ProveedorDAO; +import mx.edu.tjs.chapala.sistemas.modelo.Proveedor; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Stateless +public class ProveedorBL implements ProveedorBLLocal { + + // 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("proveedorMsj", new FacesMessage(severity, summary, detail)); + } + + @Override + public Mensaje agregar(Proveedor proveedor) { + System.out.println("Llegaste al metodo de agregar proveedor"); + ProveedorDAO proveedorDAO = new ProveedorDAO(); + Mensaje m = null; + + //Toda la logica + if (proveedor.getNombre().isEmpty() || proveedor.getCorreo().isEmpty() || proveedor.getTelefono().isEmpty()) { + m = Mensaje.CAMPOS_INCOMPLETOS; + System.out.println("CAMPOS INCOMPLETOS"); + return m; + } + + Optional proveedorEncontradoOptional = proveedorDAO.buscarProveedor(proveedor); + if (proveedorEncontradoOptional.isPresent()) { + proveedorEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE AGREGAR, EL PROVEEDOR YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "", "¡Error! El elemento ya existe"); + } else { + proveedorDAO.agregar(proveedor); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "¡Elemento agregado con éxito!"); + + } + + return m; + } + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + @Override + public Proveedor buscarId(Proveedor proveedor) { + System.out.println("Llegaste al metodo de buscar por id"); + ProveedorDAO a = new ProveedorDAO(); + Mensaje m = null; + + Proveedor proveedorEncontrado = a.buscarPorId(proveedor); + + if (proveedorEncontrado == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL PROVEEDOR"); + return proveedorEncontrado; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("PROVEEDOR ENCONTRADO CON EXITO: " + proveedorEncontrado.getId()); + return proveedorEncontrado; + } + } + + @Override + public Proveedor buscarNombre(Proveedor proveedor) { + System.out.println("Llegaste al metodo de buscar por nombre"); + ProveedorDAO a = new ProveedorDAO(); + Mensaje m = null; + + Proveedor proveedorEncontrado = a.buscarPorNombre(proveedor); + + if (proveedorEncontrado == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL PROVEEDOR"); + return proveedorEncontrado; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("PROVEEDOR ENCONTRADO CON EXITO: " + proveedorEncontrado.getNombre()); + return proveedorEncontrado; + } + } + + @Override + public List buscarStatus(boolean b) { + ProveedorDAO a = new ProveedorDAO(); + List l = a.buscarStatus(b); + System.out.println(l); + return l; + } + + @Override + public Mensaje eliminarId(Proveedor proveedor) { + ProveedorDAO a = new ProveedorDAO(); + Mensaje m = null; + + if (a.eliminar(proveedor)) { + m = Mensaje.SIN_ERROR; + System.out.println("ELIMINADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "¡Elemento 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 elemento"); + + } + return m; + } + + @Override + public Mensaje editar(Proveedor proveedor) { + ProveedorDAO ed = new ProveedorDAO(); + Mensaje m = null; + + Optional proveedorEncontradoOptional = ed.buscarProveedor(proveedor); + if (proveedorEncontradoOptional.isPresent()) { + proveedorEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE EDITAR, EL PROVEEDOR YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "", "¡Error al editar! El elemento ya existe"); + } else { + ed.editar(proveedor); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "¡Elemento editado correctamente!"); + + + } + return m; + } + + public List getAll() { + ProveedorDAO p = new ProveedorDAO(); + return p.buscarStatus(true); + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProveedorBLLocal.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProveedorBLLocal.java new file mode 100644 index 0000000..d3ac771 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/ProveedorBLLocal.java @@ -0,0 +1,32 @@ +/* + * 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.Proveedor; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Local +public interface ProveedorBLLocal { + + Mensaje agregar(Proveedor proveedor); + + Proveedor buscarId(Proveedor proveedor); + + Proveedor buscarNombre(Proveedor proveedor); + + List buscarStatus(boolean b); + + + Mensaje eliminarId(Proveedor proveedor); + + Mensaje editar(Proveedor p); + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UbicacionAlmacenBL.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UbicacionAlmacenBL.java new file mode 100644 index 0000000..fc5f7f4 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UbicacionAlmacenBL.java @@ -0,0 +1,145 @@ +/* + * 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.UbicacionAlmacenDAO; +import mx.edu.tjs.chapala.sistemas.modelo.Ubicacionalmacen; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author carlosAldrete + */ +@Stateless +public class UbicacionAlmacenBL implements UbicacionAlmacenBLLocal { + + // 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(Ubicacionalmacen ubicacionalmacen) { + System.out.println("Llegaste al metodo de agregar ubicacion de almacenamiento"); + UbicacionAlmacenDAO UbicacionAlmacenDAO = new UbicacionAlmacenDAO(); + Mensaje m = null; + + //Toda la logica + Optional me = UbicacionAlmacenDAO.buscarUbicacion(ubicacionalmacen); + + if (me.isPresent()) { + me.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE AGREGAR, YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR","La Ubicacion ya existe"); + } else { + UbicacionAlmacenDAO.agregar(ubicacionalmacen); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "CORRECTO","SE AGREGO CON EXITO"); + } + return m; + } + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + @Override + public Ubicacionalmacen buscarId(Ubicacionalmacen ubicacionalmacen) { + System.out.println("Llegaste al metodo de buscar por id"); + UbicacionAlmacenDAO a = new UbicacionAlmacenDAO(); + Mensaje m = null; + + Ubicacionalmacen c = a.buscarPorId(ubicacionalmacen); + + if (c == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL BODEGA"); + return c; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("BODEGA ENCONTRADO CON EXITO: " + c.getId()); + return c; + } + } + + @Override + public Ubicacionalmacen buscarBodega(Ubicacionalmacen ubicacionalmacen) { + System.out.println("Llegaste al metodo de buscar por nombre"); + UbicacionAlmacenDAO a = new UbicacionAlmacenDAO(); + Mensaje m = null; + + Ubicacionalmacen ce = a.buscarPorBodega(ubicacionalmacen); + + if (ce == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL ALMACEN"); + return ce; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("BODEGA ENCONTRADO CON EXITO: " + ce.getBodega()); + return ce; + } + } + + @Override + public List buscarStatus(boolean b) { + UbicacionAlmacenDAO a = new UbicacionAlmacenDAO(); + List l = a.buscarStatus(b); + System.out.println(l); + return l; + } + + @Override + public void eliminarId(Ubicacionalmacen ubicacionAlmacen) { + UbicacionAlmacenDAO a = new UbicacionAlmacenDAO(); + Mensaje m = null; + + if (a.eliminar(ubicacionAlmacen)) { + m = Mensaje.SIN_ERROR; + System.out.println("ELIMINADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "CORRECTO","SE ELIMINO CON EXITO"); + } else { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO SE PUDO ELIMINAR"); + addMessage(FacesMessage.SEVERITY_ERROR, "ERROR","NO SE PUEDE ELIMINAR"); + + + } + } + + @Override + public Mensaje editar(Ubicacionalmacen ubicacionAlmacen) { + UbicacionAlmacenDAO ed = new UbicacionAlmacenDAO(); + Mensaje m = null; + + Optional proveedorEncontradoOptional = ed.buscarUbicacion(ubicacionAlmacen); + if (proveedorEncontradoOptional.isPresent()) { + proveedorEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE EDITAR, LA UBICACION YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "", "¡Error al editar! El elemento ya existe"); + } else { + ed.editar(ubicacionAlmacen); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "¡Elemento editado correctamente!"); + + + } + return m; + } + public List getAll() { + UbicacionAlmacenDAO p = new UbicacionAlmacenDAO(); + return p.buscarStatus(true); + } +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UbicacionAlmacenBLLocal.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UbicacionAlmacenBLLocal.java new file mode 100644 index 0000000..2977fe3 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UbicacionAlmacenBLLocal.java @@ -0,0 +1,31 @@ +/* + * 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.Ubicacionalmacen; + +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Local +public interface UbicacionAlmacenBLLocal { + Mensaje agregar(Ubicacionalmacen ubicacionalmacen); + + Ubicacionalmacen buscarId(Ubicacionalmacen Ubicacionalmacen); + + Ubicacionalmacen buscarBodega(Ubicacionalmacen Ubicacionalmacen); + + List buscarStatus(boolean b); + + + void eliminarId(Ubicacionalmacen Ubicacionalmacen); + + Mensaje editar(Ubicacionalmacen p); +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UsuariosBL.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UsuariosBL.java new file mode 100644 index 0000000..c8e04ac --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UsuariosBL.java @@ -0,0 +1,134 @@ +/* + * 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.UsuariosDAO; +import mx.edu.tjs.chapala.sistemas.modelo.Usuarios; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Stateless +public class UsuariosBL implements UsuariosBLLocal { + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + + /** + * + * @param usuarios + * @return + */ + public void addMessage(FacesMessage.Severity severity, String summary, String detail) { + FacesContext.getCurrentInstance(). + addMessage(null, new FacesMessage(severity, summary, detail)); + } + + @Override + public Mensaje agregar(Usuarios usuarios) { + System.out.println("Llegaste al metodo de agregar usuario"); + UsuariosDAO usuariosDAO = new UsuariosDAO(); + Mensaje m = null; + + //Toda la logica + Optional usuariosEncontradoOptional =usuariosDAO.buscarUsuarios(usuarios); + + if (usuariosEncontradoOptional.isPresent()) { + usuariosEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println("NO SE PUEDE AGREGAR, EL PROVEEDOR YA EXISTE"); + addMessage(FacesMessage.SEVERITY_ERROR, "", "¡Error! El elemento ya existe"); + + } else { + usuariosDAO.agregar(usuarios); + m = Mensaje.SIN_ERROR; + System.out.println("AGREGADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "¡Elemento agregado con éxito!"); + } + return m; + } + + @Override + public Usuarios buscarId(Usuarios usuarios) { + System.out.println("Llegaste al metodo de buscar por id"); + UsuariosDAO u = new UsuariosDAO(); + Mensaje m = null; + + Usuarios usuariosEncontrado = u.buscarPorId(usuarios); + + if (usuariosEncontrado == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL Usuarios"); + return usuariosEncontrado; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("Usuarios ENCONTRADO CON EXITO: " + usuariosEncontrado.getId()); + return usuariosEncontrado; + } + } + + @Override + public Usuarios buscarNombre(Usuarios usuarios) { + System.out.println("Llegaste al metodo de buscar por nombre"); + UsuariosDAO u = new UsuariosDAO(); + Mensaje m = null; + + Usuarios usuariosEncontrado = u.buscarPorUsuarios(usuarios); + + if (usuariosEncontrado == null) { + m = Mensaje.ELEMENTO_NO_ENCONTRADO; + System.out.println("NO EXISTE EL Usuarios"); + return usuariosEncontrado; + } else { + m = Mensaje.SIN_ERROR; + System.out.println("Usuarios ENCONTRADO CON EXITO: " + usuariosEncontrado.getUsuario()); + return usuariosEncontrado; + } + } + + @Override + public List buscarStatus(boolean b) { + UsuariosDAO u = new UsuariosDAO(); + List l = u.buscarStatus(b); + System.out.println(l); + return l; + } + + + @Override + public void eliminarId(Usuarios usuarios) { + UsuariosDAO u = new UsuariosDAO(); + Mensaje m = null; + + if (u.eliminar(usuarios)) { + m = Mensaje.SIN_ERROR; + System.out.println("ELIMINADO CON EXITO"); + addMessage(FacesMessage.SEVERITY_INFO, "", "¡usuario 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 usuario"); + + } + } + + + @Override + public void editar(Usuarios usuarios) { + UsuariosDAO u = new UsuariosDAO(); + Mensaje m = null; + u.editar(usuarios); + } + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UsuariosBLLocal.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UsuariosBLLocal.java new file mode 100644 index 0000000..73e8d93 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/bl/UsuariosBLLocal.java @@ -0,0 +1,31 @@ +/* + * 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.Usuarios; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; + +/** + * + * @author nickdalyrendon + */ +@Local +public interface UsuariosBLLocal { + + public void editar(Usuarios usuarios); + + public void eliminarId(Usuarios usuarios); + + public List buscarStatus(boolean b); + + public Usuarios buscarNombre(Usuarios usuarios); + + public Usuarios buscarId(Usuarios usuarios); + + public Mensaje agregar(Usuarios usuarios); + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/CategoriaDAO.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/CategoriaDAO.java new file mode 100644 index 0000000..fb8d3fd --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/CategoriaDAO.java @@ -0,0 +1,122 @@ +/* + * 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.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Proveedor; + +/** + * + * @author nickdalyrendon + */ +public class CategoriaDAO { + private EntityManager em; //Manejador de entidades (entidad=bean del modelo) + + public CategoriaDAO() { + //conexion + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Categoria p) { + em.getTransaction().begin(); + em.persist(p); //Almacenar en la BD + em.getTransaction().commit(); + } + + public void editar(Categoria p) { + buscarPorId(p); + em.getTransaction().begin(); + em.merge(p); //Editar en la BD + em.getTransaction().commit(); + + } + + public boolean eliminar(Categoria p) { + if (buscarPorId(p) == null) { + return false; + } else { + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Categoria prov = em.find(Categoria.class, p.getId()); + + p.setNombre(prov.getNombre()); + + // Modificar solo el estado + p.setStatus(0); + + em.merge(p); + em.getTransaction().commit(); + + return true; + } + } + + public Optional buscarCategoria(Categoria p) { + Query q1 = em.createNamedQuery("Categoria.findByNombre"); + q1.setParameter("nombre", p.getNombre()); + + + List resultadoNombre = q1.getResultList(); + + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty()) { + // Compara si el mismo autor está en los tres resultados + Categoria a = resultadoNombre.stream() + .findFirst() + .orElse(null); + + return Optional.ofNullable(a); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + + public Categoria buscarPorId(Categoria a) { + Query q = em.createNamedQuery("Categoria.findById"); + q.setParameter("id", a.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Categoria) q.getResultList().get(0); + } + } + + public Categoria buscarPorNombre(Categoria a) { + Query q = em.createNamedQuery("Categoria.findByNombre"); + q.setParameter("nombre", a.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Categoria) q.getResultList().get(0); + } + } + + + public List buscarStatus(boolean status) { + Query q = em.createNamedQuery("Categoria.findByStatus"); + int s = status ? 1 : 0; + + if(s==1){ + System.out.println("Categoria activos"); + } else { + System.out.println("Categoria inactivos"); + } + + q.setParameter("status", s); + return q.getResultList(); + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/MarcaDAO.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/MarcaDAO.java new file mode 100644 index 0000000..cb74e3e --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/MarcaDAO.java @@ -0,0 +1,117 @@ +/* + * 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.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Marca; + +/** + * + * @author nickdalyrendon + */ +public class MarcaDAO { + +private EntityManager em; //Manejador de entidades (entidad=bean del modelo) + + public MarcaDAO() { + //conexion + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Marca p) { + em.getTransaction().begin(); + em.persist(p); //Almacenar en la BD + em.getTransaction().commit(); + } + + public void editar(Marca p) { + buscarPorId(p); + em.getTransaction().begin(); + em.merge(p); //Editar en la BD + em.getTransaction().commit(); + + } + + public boolean eliminar(Marca p) { + if (buscarPorId(p) == null) { + return false; + } else { + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Marca prov = em.find(Marca.class, p.getId()); + + p.setNombre(prov.getNombre()); + + // Modificar solo el estado + p.setStatus(0); + + em.merge(p); + em.getTransaction().commit(); + + return true; + } + } + + public Optional buscarMarca(Marca p) { + Query q1 = em.createNamedQuery("Marca.findByNombre"); + q1.setParameter("nombre", p.getNombre()); + + + List resultadoNombre = q1.getResultList(); + + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty()) { + // Compara si el mismo autor está en los tres resultados + Marca a = resultadoNombre.stream() + .findFirst() + .orElse(null); + + return Optional.ofNullable(a); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + + public Marca buscarPorId(Marca a) { + Query q = em.createNamedQuery("Marca.findById"); + q.setParameter("id", a.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Marca) q.getResultList().get(0); + } + } + + public Marca buscarPorNombre(Marca a) { + Query q = em.createNamedQuery("Marca.findByNombre"); + q.setParameter("nombre", a.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Marca) q.getResultList().get(0); + } + } + + + public List buscarStatus(boolean status) { + Query q = em.createNamedQuery("Marca.findByStatus"); + int s = status ? 1 : 0; + + q.setParameter("status", s); + return q.getResultList(); + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/ProductoDAO.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/ProductoDAO.java new file mode 100644 index 0000000..fe0cb8c --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/ProductoDAO.java @@ -0,0 +1,176 @@ +/* + * 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.Producto; + + + + +/** + * + * @author nickdalyrendon + */ +public class ProductoDAO { + //CONEXION + + private EntityManager em; //Manejador de entidades (entidad=bean del modelo) + + public ProductoDAO() { + //conexion + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Producto p) { + em.getTransaction().begin(); + p.setStatus(1); + em.persist(p); //Almacenar en la BD + em.getTransaction().commit(); + } + + public void editar(Producto p) { + buscarPorId(p); + em.getTransaction().begin(); + em.merge(p); //Editar en la BD + em.getTransaction().commit(); + + } + + public boolean eliminar(Producto p) { + if (buscarPorId(p) == null) { + return false; + } else { + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Producto prov = em.find(Producto.class, p.getId()); + // +// Categoria prov1 =em.find(Categoria.class, p.getId()); +// Ubicacionalmacen prov2 =em.find(Ubicacionalmacen.class, p.getId()); +// + + + p.setNombre(prov.getNombre()); + p.setCodigo(prov.getCodigo()); + p.setPrecio(prov.getPrecio()); + p.setDescripcion(prov.getDescripcion()); + p.setStock(prov.getStock()); + p.setEstadoproducto(prov.getEstadoproducto()); + p.setFechaadquisicion(prov.getFechaadquisicion()); + p.setStatus(prov.getStatus()); + p.setSubmarca(prov.getSubmarca()); + p.setMarcaId(prov.getMarcaId()); + p.setProveedorId(prov.getProveedorId()); + p.setUbicacionalmacenId(prov.getUbicacionalmacenId()); + p.setCategoriaId(prov.getCategoriaId()); + + + // Modificar solo el estado + p.setStatus(0); + + em.merge(p); + em.getTransaction().commit(); + + return true; + } + } + + public Optional buscarProducto(Producto p) { + Query q1 = em.createNamedQuery("Producto.findByNombre"); + q1.setParameter("nombre", p.getNombre()); + + Query q2 = em.createNamedQuery("Producto.findByCodigo"); + q2.setParameter("codigo", p.getCodigo()); + + Query q3 = em.createNamedQuery("Producto.findByEstadoproducto"); + q3.setParameter("estadoproducto", p.getEstadoproducto()); + + + Query q4 = em.createNamedQuery("Producto.findByFechaadquisicion"); + q4.setParameter("fechaadquisicion", p.getFechaadquisicion()); + + Query q5 = em.createNamedQuery("Producto.findByStock"); + q5.setParameter("stock", p.getStock()); + + Query q6 = em.createNamedQuery("Producto.findBySubmarca"); + q6.setParameter("submarca", p.getSubmarca()); + + + //lisotoootototootototot + + List resultadoNombre = q1.getResultList(); + List resultadoCodigo = q2.getResultList(); + List resultadoEstadoP = q3.getResultList(); + List resultadoFehaAd = q4.getResultList(); + List resultadoSatock = q5.getResultList(); + List resultadoSubmarca = q6.getResultList(); + + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty() && !resultadoCodigo.isEmpty() && !resultadoEstadoP.isEmpty() + && !resultadoFehaAd.isEmpty()&& !resultadoSatock.isEmpty()&& !resultadoSubmarca.isEmpty()) { + // Compara si el mismo autor está en los tres resultados + Producto productoEncontrado = resultadoNombre.stream() + .filter(resultadoCodigo::contains) + .filter(resultadoEstadoP::contains) + .filter(resultadoFehaAd::contains) + .filter(resultadoSatock::contains) + .filter(resultadoSubmarca::contains) + .findFirst() + .orElse(null); + + return Optional.ofNullable(productoEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + + public Producto buscarPorId(Producto a) { + Query q = em.createNamedQuery("Producto.findById"); + q.setParameter("id", a.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Producto) q.getResultList().get(0); + } + } + + public Producto buscarPorNombre(Producto a) { + Query q = em.createNamedQuery("Producto.findByNombre"); + q.setParameter("nombre", a.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Producto) q.getResultList().get(0); + } + } + + + public List buscarStatus(boolean status) { + Query q = em.createNamedQuery("Producto.findByStatus"); + int s = status ? 1 : 0; + + if(s==1){ + System.out.println("Producto activos"); + } else { + System.out.println("Producto inactivos"); + } + + q.setParameter("status", s); + return q.getResultList(); + } + +} + + diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/ProveedorDAO.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/ProveedorDAO.java new file mode 100644 index 0000000..a130530 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/ProveedorDAO.java @@ -0,0 +1,137 @@ +/* + * 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.Proveedor; + +/** + * + * @author nickdalyrendon + */ +public class ProveedorDAO { + //CONEXION + + private EntityManager em; //Manejador de entidades (entidad=bean del modelo) + + public ProveedorDAO() { + //conexion + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Proveedor p) { + em.getTransaction().begin(); + p.setStatus(1); + em.persist(p); //Almacenar en la BD + em.getTransaction().commit(); + + } + + public void editar(Proveedor p) { + buscarPorId(p); + em.getTransaction().begin(); + em.merge(p); //Editar en la BD + em.getTransaction().commit(); + + } + + public boolean eliminar(Proveedor p) { + if (buscarPorId(p) == null) { + return false; + } else { + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Proveedor prov = em.find(Proveedor.class, p.getId()); + + p.setNombre(prov.getNombre()); + p.setCorreo(prov.getCorreo()); + p.setTelefono(prov.getTelefono()); + + // Modificar solo el estado + p.setStatus(0); + + em.merge(p); + em.getTransaction().commit(); + + return true; + } + } + + public Optional buscarProveedor(Proveedor p) { + Query q1 = em.createNamedQuery("Proveedor.findByNombre"); + q1.setParameter("nombre", p.getNombre()); + + Query q2 = em.createNamedQuery("Proveedor.findByCorreo"); + q2.setParameter("correo", p.getCorreo()); + + Query q3 = em.createNamedQuery("Proveedor.findByTelefono"); + q3.setParameter("telefono", p.getTelefono()); + + List resultadoNombre = q1.getResultList(); + List resultadoCorreo = q2.getResultList(); + List resultadoTelefono = q3.getResultList(); + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty() && !resultadoCorreo.isEmpty() && !resultadoTelefono.isEmpty()) { + // Compara si el mismo autor está en los tres resultados + Proveedor autorEncontrado = resultadoNombre.stream() + .filter(resultadoCorreo::contains) + .filter(resultadoTelefono::contains) + .findFirst() + .orElse(null); + + return Optional.ofNullable(autorEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + + public Proveedor buscarPorId(Proveedor a) { + Query q = em.createNamedQuery("Proveedor.findById"); + q.setParameter("id", a.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Proveedor) q.getResultList().get(0); + } + } + + public Proveedor buscarPorNombre(Proveedor a) { + Query q = em.createNamedQuery("Proveedor.findByNombre"); + q.setParameter("nombre", a.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Proveedor) q.getResultList().get(0); + } + } + + + public List buscarStatus(boolean status) { + Query q = em.createNamedQuery("Proveedor.findByStatus"); + int s = status ? 1 : 0; + + if(s==1){ + System.out.println("Proveedores activos"); + } else { + System.out.println("Proveedores inactivos"); + } + + q.setParameter("status", s); + return q.getResultList(); + } + + + + } diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/UbicacionAlmacenDAO.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/UbicacionAlmacenDAO.java new file mode 100644 index 0000000..46b2024 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/UbicacionAlmacenDAO.java @@ -0,0 +1,123 @@ +/* + * 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.Ubicacionalmacen; + + +/** + * + * @author nickdalyrendon + */ +public class UbicacionAlmacenDAO { + private EntityManager em; //Manejador de entidades (entidad=bean del modelo) + + public UbicacionAlmacenDAO () { + //conexion + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Ubicacionalmacen u) { + em.getTransaction().begin(); + u.setStatus(1); + em.persist(u); //Almacenar en la BD + em.getTransaction().commit(); + } + + public void editar(Ubicacionalmacen u) { + buscarPorId(u); + em.getTransaction().begin(); + em.merge(u); //Editar en la BD + em.getTransaction().commit(); + + } + + public boolean eliminar(Ubicacionalmacen u) { + if (buscarPorId(u) == null) { + return false; + } else { + em.getTransaction().begin(); + + // Obtener usuarios actualizado desde la base de datos + Ubicacionalmacen ubi = em.find(Ubicacionalmacen.class, u.getId()); + u.setBodega(ubi.getBodega()); + u.setPasillo(ubi.getPasillo()); + u.setEstante(ubi.getEstante()); + u.setSeccion(ubi.getSeccion()); + u.setStatus(0); + + em.merge(u); + em.getTransaction().commit(); + + return true; + } + } + + public Optional buscarUbicacion(Ubicacionalmacen u) { + Query q1 = em.createNamedQuery("Ubicacionalmacen.findByBodega"); + q1.setParameter("bodega", u.getBodega()); + + + + List resultadoUsuarios = q1.getResultList(); + + + // Verifica si hay resultados para todos los campos + if (!resultadoUsuarios.isEmpty()) { + // Compara si el mismo autor está en los tres resultados + Ubicacionalmacen usuariosEncontrado = resultadoUsuarios.stream() + .findFirst() + .orElse(null); + + return Optional.ofNullable(usuariosEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + + public Ubicacionalmacen buscarPorId(Ubicacionalmacen u) { + Query q = em.createNamedQuery("Ubicacionalmacen.findById"); + q.setParameter("id", u.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Ubicacionalmacen) q.getResultList().get(0); + } + } + + public Ubicacionalmacen buscarPorBodega(Ubicacionalmacen u) { + Query q = em.createNamedQuery("Ubicacionalmacen.findByBodega"); + q.setParameter("bodega", u.getBodega()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Ubicacionalmacen) q.getResultList().get(0); + } + } + + + public List buscarStatus(boolean status) { + Query q = em.createNamedQuery("Ubicacionalmacen.findByStatus"); + int s = status ? 1 : 0; + + if(s==1){ + System.out.println("Usuarios activos"); + } else { + System.out.println("Usuarios inactivos"); + } + + q.setParameter("status", s); + return q.getResultList(); + } +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/UsuariosDAO.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/UsuariosDAO.java new file mode 100644 index 0000000..58dfe60 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/dao/UsuariosDAO.java @@ -0,0 +1,126 @@ +/* + * 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.Usuarios; + +/** + * + * @author nickdalyrendon + */ +public class UsuariosDAO { + private EntityManager em; //Manejador de entidades (entidad=bean del modelo) + + public UsuariosDAO() { + //conexion + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Usuarios u) { + em.getTransaction().begin(); + u.setStatus(1); + em.persist(u); //Almacenar en la BD + em.getTransaction().commit(); + } + + public void editar(Usuarios u) { + buscarPorId(u); + em.getTransaction().begin(); + em.merge(u); //Editar en la BD + em.getTransaction().commit(); + + } + + public boolean eliminar(Usuarios u) { + if (buscarPorId(u) == null) { + return false; + } else { + em.getTransaction().begin(); + + // Obtener usuarios actualizado desde la base de datos + Usuarios usua = em.find(Usuarios.class, u.getId()); + + u.setUsuario(usua.getUsuario()); + u.setContrasenia(usua.getContrasenia()); + + + // Modificar solo el estado + u.setStatus(0); + + em.merge(u); + em.getTransaction().commit(); + + return true; + } + } + + public Optional buscarUsuarios(Usuarios u) { + Query q1 = em.createNamedQuery("Usuarios.findByUsuario"); + q1.setParameter("usuario", u.getUsuario()); + + + + List resultadoUsuarios = q1.getResultList(); + + + // Verifica si hay resultados para todos los campos + if (!resultadoUsuarios.isEmpty()) { + // Compara si el mismo autor está en los tres resultados + Usuarios usuariosEncontrado = resultadoUsuarios.stream() + .findFirst() + .orElse(null); + + return Optional.ofNullable(usuariosEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + + public Usuarios buscarPorId(Usuarios u) { + Query q = em.createNamedQuery("Usuarios.findById"); + q.setParameter("id", u.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Usuarios) q.getResultList().get(0); + } + } + + + public Usuarios buscarPorUsuarios(Usuarios u) { + Query q = em.createNamedQuery("Usuarios.findByUsuario"); + q.setParameter("usuario", u.getUsuario()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Usuarios) q.getResultList().get(0); + } + } + + + public List buscarStatus(boolean status) { + Query q = em.createNamedQuery("Usuarios.findByStatus"); + int s = status ? 1 : 0; + + if(s==1){ + System.out.println("Usuarios activos"); + } else { + System.out.println("Usuarios inactivos"); + } + + q.setParameter("status", s); + return q.getResultList(); + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Categoria.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Categoria.java new file mode 100644 index 0000000..aa8161e --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Categoria.java @@ -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.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 = "categoria") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Categoria.findAll", query = "SELECT c FROM Categoria c"), + @NamedQuery(name = "Categoria.findById", query = "SELECT c FROM Categoria c WHERE c.id = :id"), + @NamedQuery(name = "Categoria.findByNombre", query = "SELECT c FROM Categoria c WHERE c.nombre = :nombre"), + @NamedQuery(name = "Categoria.findByStatus", query = "SELECT c FROM Categoria c WHERE c.status = :status")}) +public class Categoria 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 + @Column(name = "status") + private int status; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaId") + private List productoList; + + public Categoria() { + } + + public Categoria(Integer id) { + this.id = id; + } + + public Categoria(Integer id, String nombre, int status) { + this.id = id; + this.nombre = nombre; + 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 int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + @XmlTransient + public List getProductoList() { + return productoList; + } + + public void setProductoList(List productoList) { + this.productoList = productoList; + } + + @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 Categoria)) { + return false; + } + Categoria other = (Categoria) 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.Categoria[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Domicilio.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Domicilio.java new file mode 100644 index 0000000..14b5492 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Domicilio.java @@ -0,0 +1,204 @@ +/* + * 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 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 getUsuariosList() { + return usuariosList; + } + + public void setUsuariosList(List 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 + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Marca.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Marca.java new file mode 100644 index 0000000..3306495 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Marca.java @@ -0,0 +1,141 @@ +/* + * 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.JoinColumn; +import javax.persistence.ManyToOne; +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 = "marca") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Marca.findAll", query = "SELECT m FROM Marca m"), + @NamedQuery(name = "Marca.findById", query = "SELECT m FROM Marca m WHERE m.id = :id"), + @NamedQuery(name = "Marca.findByNombre", query = "SELECT m FROM Marca m WHERE m.nombre = :nombre"), + @NamedQuery(name = "Marca.findByStatus", query = "SELECT m FROM Marca m WHERE m.status = :status")}) +public class Marca 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 + @Column(name = "status") + private int status; + @JoinColumn(name = "proveedor_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Proveedor proveedorId; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "marcaId") + private List productoList; + + public Marca() { + } + + public Marca(Integer id) { + this.id = id; + } + + public Marca(Integer id, String nombre, int status) { + this.id = id; + this.nombre = nombre; + 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 int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Proveedor getProveedorId() { + return proveedorId; + } + + public void setProveedorId(Proveedor proveedorId) { + this.proveedorId = proveedorId; + } + + @XmlTransient + public List getProductoList() { + return productoList; + } + + public void setProductoList(List productoList) { + this.productoList = productoList; + } + + @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 Marca)) { + return false; + } + Marca other = (Marca) 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.Marca[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Producto.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Producto.java new file mode 100644 index 0000000..b60b815 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Producto.java @@ -0,0 +1,265 @@ +/* + * 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 = "producto") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Producto.findAll", query = "SELECT p FROM Producto p"), + @NamedQuery(name = "Producto.findById", query = "SELECT p FROM Producto p WHERE p.id = :id"), + @NamedQuery(name = "Producto.findByNombre", query = "SELECT p FROM Producto p WHERE p.nombre = :nombre"), + @NamedQuery(name = "Producto.findByCodigo", query = "SELECT p FROM Producto p WHERE p.codigo = :codigo"), + @NamedQuery(name = "Producto.findByPrecio", query = "SELECT p FROM Producto p WHERE p.precio = :precio"), + @NamedQuery(name = "Producto.findByDescripcion", query = "SELECT p FROM Producto p WHERE p.descripcion = :descripcion"), + @NamedQuery(name = "Producto.findByStock", query = "SELECT p FROM Producto p WHERE p.stock = :stock"), + @NamedQuery(name = "Producto.findByFechaadquisicion", query = "SELECT p FROM Producto p WHERE p.fechaadquisicion = :fechaadquisicion"), + @NamedQuery(name = "Producto.findByEstadoproducto", query = "SELECT p FROM Producto p WHERE p.estadoproducto = :estadoproducto"), + @NamedQuery(name = "Producto.findBySubmarca", query = "SELECT p FROM Producto p WHERE p.submarca = :submarca"), + @NamedQuery(name = "Producto.findByStatus", query = "SELECT p FROM Producto p WHERE p.status = :status")}) +public class Producto 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 = 15) + @Column(name = "codigo") + private String codigo; + @Basic(optional = false) + @NotNull + @Column(name = "precio") + private float precio; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 255) + @Column(name = "descripcion") + private String descripcion; + @Basic(optional = false) + @NotNull + @Column(name = "stock") + private int stock; + @Basic(optional = false) + @NotNull + @Column(name = "fechaadquisicion") + @Temporal(TemporalType.DATE) + private Date fechaadquisicion; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "estadoproducto") + private String estadoproducto; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "submarca") + private String submarca; + @Basic(optional = false) + @NotNull + @Column(name = "status") + private int status; + @JoinColumn(name = "categoria_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Categoria categoriaId; + @JoinColumn(name = "marca_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Marca marcaId; + @JoinColumn(name = "proveedor_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Proveedor proveedorId; + @JoinColumn(name = "ubicacionalmacen_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Ubicacionalmacen ubicacionalmacenId; + + public Producto() { + } + + public Producto(Integer id) { + this.id = id; + } + + public Producto(Integer id, String nombre, String codigo, float precio, String descripcion, int stock, Date fechaadquisicion, String estadoproducto, String submarca, int status) { + this.id = id; + this.nombre = nombre; + this.codigo = codigo; + this.precio = precio; + this.descripcion = descripcion; + this.stock = stock; + this.fechaadquisicion = fechaadquisicion; + this.estadoproducto = estadoproducto; + this.submarca = submarca; + 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 getCodigo() { + return codigo; + } + + public void setCodigo(String codigo) { + this.codigo = codigo; + } + + public float getPrecio() { + return precio; + } + + public void setPrecio(float precio) { + this.precio = precio; + } + + public String getDescripcion() { + return descripcion; + } + + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + public int getStock() { + return stock; + } + + public void setStock(int stock) { + this.stock = stock; + } + + public Date getFechaadquisicion() { + return fechaadquisicion; + } + + public void setFechaadquisicion(Date fechaadquisicion) { + this.fechaadquisicion = fechaadquisicion; + } + + public String getEstadoproducto() { + return estadoproducto; + } + + public void setEstadoproducto(String estadoproducto) { + this.estadoproducto = estadoproducto; + } + + public String getSubmarca() { + return submarca; + } + + public void setSubmarca(String submarca) { + this.submarca = submarca; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Categoria getCategoriaId() { + return categoriaId; + } + + public void setCategoriaId(Categoria categoriaId) { + this.categoriaId = categoriaId; + } + + public Marca getMarcaId() { + return marcaId; + } + + public void setMarcaId(Marca marcaId) { + this.marcaId = marcaId; + } + + public Proveedor getProveedorId() { + return proveedorId; + } + + public void setProveedorId(Proveedor proveedorId) { + this.proveedorId = proveedorId; + } + + public Ubicacionalmacen getUbicacionalmacenId() { + return ubicacionalmacenId; + } + + public void setUbicacionalmacenId(Ubicacionalmacen ubicacionalmacenId) { + this.ubicacionalmacenId = ubicacionalmacenId; + } + + @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 Producto)) { + return false; + } + Producto other = (Producto) 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.Producto[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Proveedor.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Proveedor.java new file mode 100644 index 0000000..972b75a --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Proveedor.java @@ -0,0 +1,259 @@ +/* + * 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 = "proveedor") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Proveedor.findAll", query = "SELECT p FROM Proveedor p"), + @NamedQuery(name = "Proveedor.findById", query = "SELECT p FROM Proveedor p WHERE p.id = :id"), + @NamedQuery(name = "Proveedor.findByNombre", query = "SELECT p FROM Proveedor p WHERE p.nombre = :nombre"), + @NamedQuery(name = "Proveedor.findByCorreo", query = "SELECT p FROM Proveedor p WHERE p.correo = :correo"), + @NamedQuery(name = "Proveedor.findByTelefono", query = "SELECT p FROM Proveedor p WHERE p.telefono = :telefono"), + @NamedQuery(name = "Proveedor.findByStatus", query = "SELECT p FROM Proveedor p WHERE p.status = :status"), + @NamedQuery(name = "Proveedor.findByMunicipio", query = "SELECT p FROM Proveedor p WHERE p.municipio = :municipio"), + @NamedQuery(name = "Proveedor.findByPais", query = "SELECT p FROM Proveedor p WHERE p.pais = :pais"), + @NamedQuery(name = "Proveedor.findByEstado", query = "SELECT p FROM Proveedor p WHERE p.estado = :estado"), + @NamedQuery(name = "Proveedor.findByCp", query = "SELECT p FROM Proveedor p WHERE p.cp = :cp"), + @NamedQuery(name = "Proveedor.findByCalle", query = "SELECT p FROM Proveedor p WHERE p.calle = :calle"), + @NamedQuery(name = "Proveedor.findByNumero", query = "SELECT p FROM Proveedor p WHERE p.numero = :numero")}) +public class Proveedor 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 = "correo") + private String correo; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "telefono") + private String telefono; + @Basic(optional = false) + @NotNull + @Column(name = "status") + private int status; + @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 = "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 = "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 = "proveedorId") + private List marcaList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "proveedorId") + private List productoList; + + public Proveedor() { + } + + public Proveedor(Integer id) { + this.id = id; + } + + public Proveedor(Integer id, String nombre, String correo, String telefono, int status, String municipio, String pais, String estado, String cp, String calle, String numero) { + this.id = id; + this.nombre = nombre; + this.correo = correo; + this.telefono = telefono; + this.status = status; + this.municipio = municipio; + this.pais = pais; + this.estado = estado; + this.cp = cp; + this.calle = calle; + this.numero = numero; + } + + 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 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 int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getMunicipio() { + return municipio; + } + + public void setMunicipio(String municipio) { + this.municipio = municipio; + } + + 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 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 getMarcaList() { + return marcaList; + } + + public void setMarcaList(List marcaList) { + this.marcaList = marcaList; + } + + @XmlTransient + public List getProductoList() { + return productoList; + } + + public void setProductoList(List productoList) { + this.productoList = productoList; + } + + @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 Proveedor)) { + return false; + } + Proveedor other = (Proveedor) 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.Proveedor[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Rol.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Rol.java new file mode 100644 index 0000000..0edaf3b --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Rol.java @@ -0,0 +1,114 @@ +/* + * 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 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 getUsuariosList() { + return usuariosList; + } + + public void setUsuariosList(List 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 + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Ubicacionalmacen.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Ubicacionalmacen.java new file mode 100644 index 0000000..e611c60 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Ubicacionalmacen.java @@ -0,0 +1,173 @@ +/* + * 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 = "ubicacionalmacen") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Ubicacionalmacen.findAll", query = "SELECT u FROM Ubicacionalmacen u"), + @NamedQuery(name = "Ubicacionalmacen.findById", query = "SELECT u FROM Ubicacionalmacen u WHERE u.id = :id"), + @NamedQuery(name = "Ubicacionalmacen.findByBodega", query = "SELECT u FROM Ubicacionalmacen u WHERE u.bodega = :bodega"), + @NamedQuery(name = "Ubicacionalmacen.findByPasillo", query = "SELECT u FROM Ubicacionalmacen u WHERE u.pasillo = :pasillo"), + @NamedQuery(name = "Ubicacionalmacen.findByEstante", query = "SELECT u FROM Ubicacionalmacen u WHERE u.estante = :estante"), + @NamedQuery(name = "Ubicacionalmacen.findBySeccion", query = "SELECT u FROM Ubicacionalmacen u WHERE u.seccion = :seccion"), + @NamedQuery(name = "Ubicacionalmacen.findByStatus", query = "SELECT u FROM Ubicacionalmacen u WHERE u.status = :status")}) +public class Ubicacionalmacen 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 = "bodega") + private String bodega; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "pasillo") + private String pasillo; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "estante") + private String estante; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "seccion") + private String seccion; + @Basic(optional = false) + @NotNull + @Column(name = "status") + private int status; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "ubicacionalmacenId") + private List productoList; + + public Ubicacionalmacen() { + } + + public Ubicacionalmacen(Integer id) { + this.id = id; + } + + public Ubicacionalmacen(Integer id, String bodega, String pasillo, String estante, String seccion, int status) { + this.id = id; + this.bodega = bodega; + this.pasillo = pasillo; + this.estante = estante; + this.seccion = seccion; + this.status = status; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getBodega() { + return bodega; + } + + public void setBodega(String bodega) { + this.bodega = bodega; + } + + public String getPasillo() { + return pasillo; + } + + public void setPasillo(String pasillo) { + this.pasillo = pasillo; + } + + public String getEstante() { + return estante; + } + + public void setEstante(String estante) { + this.estante = estante; + } + + public String getSeccion() { + return seccion; + } + + public void setSeccion(String seccion) { + this.seccion = seccion; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + @XmlTransient + public List getProductoList() { + return productoList; + } + + public void setProductoList(List productoList) { + this.productoList = productoList; + } + + @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 Ubicacionalmacen)) { + return false; + } + Ubicacionalmacen other = (Ubicacionalmacen) 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.Ubicacionalmacen[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Usuarios.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Usuarios.java new file mode 100644 index 0000000..15bafd0 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/modelo/Usuarios.java @@ -0,0 +1,259 @@ +/* + * 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 + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/msg/Mensaje.java b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/msg/Mensaje.java new file mode 100644 index 0000000..82c669e --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tjs/chapala/sistemas/msg/Mensaje.java @@ -0,0 +1,17 @@ +/* + * 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.msg; + +/** + * + * @author nickdalyrendon + */ +public enum Mensaje { + SIN_ERROR, + CAMPOS_INCOMPLETOS, + DATOS_INCORRECTOS, + ELEMENTO_DUPLICADO, + ELEMENTO_NO_ENCONTRADO +} diff --git a/Inventario-war/build.xml b/Inventario-war/build.xml new file mode 100644 index 0000000..e559f9f --- /dev/null +++ b/Inventario-war/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project Inventario-war. + + + diff --git a/Inventario-war/libs/primefaces-12.0.0.jar b/Inventario-war/libs/primefaces-12.0.0.jar new file mode 100644 index 0000000..88dab24 Binary files /dev/null and b/Inventario-war/libs/primefaces-12.0.0.jar differ diff --git a/Inventario-war/nbproject/ant-deploy.xml b/Inventario-war/nbproject/ant-deploy.xml new file mode 100644 index 0000000..fdc06d5 --- /dev/null +++ b/Inventario-war/nbproject/ant-deploy.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Inventario-war/nbproject/build-impl.xml b/Inventario-war/nbproject/build-impl.xml new file mode 100644 index 0000000..64e4158 --- /dev/null +++ b/Inventario-war/nbproject/build-impl.xml @@ -0,0 +1,1463 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Inventario-war/nbproject/faces-config.NavData b/Inventario-war/nbproject/faces-config.NavData new file mode 100644 index 0000000..e69de29 diff --git a/Inventario-war/nbproject/genfiles.properties b/Inventario-war/nbproject/genfiles.properties new file mode 100644 index 0000000..d569f0e --- /dev/null +++ b/Inventario-war/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=3a64461f +build.xml.script.CRC32=796f502a +build.xml.stylesheet.CRC32=1707db4f@1.96.0.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=3a64461f +nbproject/build-impl.xml.script.CRC32=ea47dfdd +nbproject/build-impl.xml.stylesheet.CRC32=334708a0@1.96.0.1 diff --git a/Inventario-war/nbproject/project.properties b/Inventario-war/nbproject/project.properties new file mode 100644 index 0000000..d4a8a3b --- /dev/null +++ b/Inventario-war/nbproject/project.properties @@ -0,0 +1,94 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-7.0.classpath} +excludes= +file.reference.primefaces-12.0.0.jar=libs/primefaces-12.0.0.jar +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.7 +j2ee.platform.classpath=${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv4ee7 +jar.compress=false +javac.classpath=\ + ${reference.Inventario-ejb.dist}:\ + ${file.reference.primefaces-12.0.0.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +persistence.xml.dir=${conf.dir} +platform.active=default_platform +project.Inventario-ejb=../Inventario-ejb +reference.Inventario-ejb.dist=${project.Inventario-ejb}/dist/Inventario-ejb.jar +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=Inventario-war.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/Inventario-war/nbproject/project.xml b/Inventario-war/nbproject/project.xml new file mode 100644 index 0000000..6477309 --- /dev/null +++ b/Inventario-war/nbproject/project.xml @@ -0,0 +1,39 @@ + + + org.netbeans.modules.web.project + + + Inventario-war + 1.6.5 + + + ${reference.Inventario-ejb.dist} + + + ${file.reference.primefaces-12.0.0.jar} + WEB-INF/lib + + + + + + + + + + + + .././lib/nblibraries.properties + + + + Inventario-ejb + jar + + dist + clean + dist + + + + diff --git a/Inventario-war/src/conf/MANIFEST.MF b/Inventario-war/src/conf/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/Inventario-war/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/seguridad/AutorizacionListener.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/seguridad/AutorizacionListener.java new file mode 100644 index 0000000..95c9db8 --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/seguridad/AutorizacionListener.java @@ -0,0 +1,63 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package mx.edu.tjs.chapala.sistemas.seguridad; + +import java.io.IOException; +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import javax.faces.application.NavigationHandler; +import javax.faces.context.FacesContext; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; + +/** + * + * @author 52332 + */ +@Named(value = "autorizacionListener") +@SessionScoped +public class AutorizacionListener implements PhaseListener{ + + /** + * Creates a new instance of AutorizacionListener + */ + public AutorizacionListener() { + } + + private static final long serialVersionUID = 1L; + + @Override + public void afterPhase(PhaseEvent event) { + try { + //Obtener la pagina actual para validar la sesion + String paginaActual = event.getFacesContext().getViewRoot().getViewId(); + + //inicializar la sesion en caso de no haber sesion + Login.getSesion(); + + //Revisar que no sea la pafina index y que no estes logueado + //para redireccionar + if (!paginaActual.contains("index.xhtml") && Login.getEstatus() == false) { + FacesContext.getCurrentInstance().getExternalContext().redirect("faces/index.xhtml?faces-redirect=true"); + + NavigationHandler nh = event.getFacesContext().getApplication().getNavigationHandler(); + nh.handleNavigation(event.getFacesContext(), null, "index"); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void beforePhase(PhaseEvent event) {} + + @Override + public PhaseId getPhaseId() { + return PhaseId.RESTORE_VIEW; + } + +} diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/seguridad/Login.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/seguridad/Login.java new file mode 100644 index 0000000..f9fdff7 --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/seguridad/Login.java @@ -0,0 +1,67 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package mx.edu.tjs.chapala.sistemas.seguridad; + +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +/** + * + * @author 52332 + */ +@Named(value = "login") +@SessionScoped + +public class Login implements Serializable { + +private static HttpSession httpSession; + + /** + * Creates a new instance of Login + */ + public Login() { + } + + public static void getSesion(){ + httpSession=(HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); + } + + + //metodo para salir + + public static String logout(){ + httpSession.removeAttribute("sesionActiva"); + httpSession.invalidate(); + return "index.xhtml"; + } + + public static String login(){ + //llamar bl para autenticacion que regresa un boolean + //todo:hacer un metodo en el bl que reciba el usuario y pass + boolean login=true; + if(login){ + httpSession.setAttribute("sesionActiva","true"); + return "ProductoLista.xhtml"; + }else{ + return "index.xhtml"; + } + } + + + public static boolean getEstatus(){ + if(httpSession!=null&& + httpSession.getId()!=null&& + !httpSession.getId().isEmpty()&& + httpSession.getAttribute("sesionActiva")!=null){ + return true; + }else{ + return false; + } + } + +} diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanCategoria.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanCategoria.java new file mode 100644 index 0000000..4ad8e90 --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanCategoria.java @@ -0,0 +1,163 @@ +/* + * 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.vista; + +import java.io.Serializable; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import javax.enterprise.context.SessionScoped; +import javax.inject.Named; +import mx.edu.tjs.chapala.sistemas.bl.CategoriaBLLocal; +import mx.edu.tjs.chapala.sistemas.bl.ProveedorBLLocal; +import mx.edu.tjs.chapala.sistemas.modelo.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Proveedor; +import org.primefaces.PrimeFaces; +import org.primefaces.util.LangUtils; + +/** + * + * @author nayelivilchismariscal + */ + +@Named(value = "demoBeanCategoria") +@SessionScoped +public class DemoBeanCategoria implements Serializable { + + @EJB + private CategoriaBLLocal categoriaBL; + private Categoria categoria = new Categoria(); + private String titulo; + private boolean nuevo; + private List filteredCustomers3; + +public DemoBeanCategoria (){ +} + public String agregar() { + Categoria p = new Categoria(); + p.setNombre("Limpieza"); + p.setStatus(1); + p.setId(1); + + categoriaBL.agregar(p); + return "index.xhtml"; + } + public String agregarCategoria() { + categoria.setStatus(1); + categoriaBL.agregar(categoria); + categoria = new Categoria(); //refresca el campo + PrimeFaces.current().executeScript("PF('dlg').hide()"); + return "categoriaLista.xhtml"; + } + + public String editar() { + Categoria p = new Categoria(); + p.setId(1); + p.setNombre("Carniceria"); + p.setStatus(1); + + categoriaBL.editar(p); + return "index.xhtml"; + } + public String buscarID() { + Categoria p = new Categoria(); + p.setId(20); + + categoriaBL.buscarId(p); + return "index.xhtml"; + } + + public String buscarNombre() { + Categoria p = new Categoria(); + p.setNombre("Carniceria"); + + categoriaBL.buscarNombre(p); + return "index.xhtml"; + } + public String buscarActivos() { + categoriaBL.buscarStatus(true); + return "index.xhtml"; + } + + public String buscarInactivos(){ + categoriaBL.buscarStatus(false); + return "index.xhtml"; + } + + public String buscarTodos(){ + categoriaBL.buscarStatus(true); + categoriaBL.buscarStatus(false); + return "index.xhtml"; + } + + public String eliminar() { + Categoria p = new Categoria(); + p.setId(1); + categoriaBL.eliminarId(p); + return "index.xhtml"; + } + + public List getCategorias(){ + return categoriaBL.buscarStatus(true); + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + public String getTitulo() { + return titulo; + } + + public void preparareditar(Categoria categoria){ + titulo="Editanto Categoria"; + this.categoria= categoria; + } + public void prepararnuevo(){ + nuevo= true; + titulo="Agregando Categoria"; + categoria=new Categoria(); + } + public boolean isNuevo() { + return nuevo; + } + + public void editarcategoria(){ + nuevo= false; + categoriaBL.editar(categoria); + PrimeFaces.current().executeScript("PF('dlg'.hide()"); + } + public void preparareliminar(Categoria categoria){ + this.categoria= categoria; + } + public void eliminarcategoria(){ + categoriaBL.eliminarId(categoria); + PrimeFaces.current().executeScript("PF('dlg2'.hide()"); + } + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } + + + Categoria customer = (Categoria) value; + return customer.getNombre().toLowerCase().contains(filterText) + || customer.getNombre().toLowerCase().contains(filterText); + } + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + +} + diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanMarca.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanMarca.java new file mode 100644 index 0000000..470c993 --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanMarca.java @@ -0,0 +1,181 @@ +/* + * 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.vista; + +import java.io.Serializable; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import javax.enterprise.context.SessionScoped; +import javax.inject.Named; +import mx.edu.tjs.chapala.sistemas.bl.CategoriaBLLocal; +import mx.edu.tjs.chapala.sistemas.bl.MarcaBLLocal; +import mx.edu.tjs.chapala.sistemas.modelo.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Marca; +import org.primefaces.PrimeFaces; +import org.primefaces.util.LangUtils; + +/** + * + * @author nayelivilchismariscal + */ +@Named(value = "demoBeanMarca") +@SessionScoped +public class DemoBeanMarca implements Serializable { + + @EJB + private MarcaBLLocal marcaBL; + private Marca marca = new Marca(); + private String titulo; + private boolean nuevo; + private List filteredCustomers3; + + public DemoBeanMarca() { + } + + public String agregar() { + Marca p = new Marca(); + p.setNombre("LG"); + p.setStatus(1); + + marcaBL.agregar(p); + return "index.xhtml"; + } + + ////////////////////////////////////////////////////////// + public String agregarMarca() { + marca.setStatus(1); + marcaBL.agregar(marca); + marca = new Marca(); //refresca el campo + PrimeFaces.current().executeScript("PF('dlg'.hide()"); + return "marcaLista.xhtml"; + } + + ///////////////////////////////////////////////////////// + + + + + + + + public String editar() { + Marca p = new Marca(); + p.setId(1); + p.setNombre("Samsung"); + + p.setStatus(0); + + marcaBL.editar(p); + return "index.xhtml"; + } + + public String buscarID() { + Marca p = new Marca(); + p.setId(1); + + marcaBL.buscarId(p); + return "index.xhtml"; + } + + public String buscarNombre() { + Marca p = new Marca(); + p.setNombre("LG"); + + marcaBL.buscarNombre(p); + return "index.xhtml"; + } + + public String buscarActivos() { + marcaBL.buscarStatus(true); + return "index.xhtml"; + } + + public String buscarInactivos() { + marcaBL.buscarStatus(false); + return "index.xhtml"; + } + + public String buscarTodos() { + marcaBL.buscarStatus(true); + marcaBL.buscarStatus(false); + return "index.xhtml"; + } + + public String eliminar() { + Marca p = new Marca(); + p.setId(1); + marcaBL.eliminarId(p); + return "index.xhtml"; + } + + public List getMarcas(){ + return marcaBL.buscarStatus(true); + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public String getTitulo() { + return titulo; + } + + public void preparareditar(Marca marca){ + nuevo=false; + titulo="Editar Marca"; + this.marca= marca; + } + public void prepararnuevo(){ + nuevo= true; + titulo="Agregar marca"; + marca=new Marca(); + } + + public boolean isNuevo() { + return nuevo; + } + + public void editarmarca(){ + nuevo= false; + marcaBL.editar(marca); + PrimeFaces.current().executeScript("PF('dlg'.hide()"); + } + public void preparareliminar(Marca marca){ + this.marca= marca; + + } + public void eliminarmarca(){ + marcaBL.eliminarId(marca); + } + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } + + + Marca customer = (Marca) value; + return customer.getNombre().toLowerCase().contains(filterText) + || customer.getNombre().toLowerCase().contains(filterText); + } + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + + + + +} \ No newline at end of file diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanProveedor.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanProveedor.java new file mode 100644 index 0000000..1a526d3 --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanProveedor.java @@ -0,0 +1,193 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package mx.edu.tjs.chapala.sistemas.vista; + +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import static java.lang.Integer.getInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.ValidatorException; +import mx.edu.tjs.chapala.sistemas.bl.ProveedorBL; +import mx.edu.tjs.chapala.sistemas.bl.ProveedorBLLocal; +import mx.edu.tjs.chapala.sistemas.modelo.Proveedor; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; +import org.primefaces.PrimeFaces; +import org.primefaces.util.LangUtils; + +/** + * + * @author nickdalyrendon + */ +@Named(value = "demoBeanProveedor") +@SessionScoped +public class DemoBeanProveedor implements Serializable { + + @EJB + private ProveedorBLLocal proveedorBL; + private Proveedor proveedor = new Proveedor(); + private String titulo; //editar + private boolean nuevo; + private List filteredCustomers3; + + + + + /** + * Creates a new instance of DemoBeanProveedor + */ + public DemoBeanProveedor() { + } + + public String agregarProveedor() { + Mensaje mensaje = proveedorBL.agregar(proveedor); + + switch (mensaje) { + case SIN_ERROR: + proveedor = new Proveedor(); //limpiar + PrimeFaces.current().executeScript("PF('dlg').hide()"); + PrimeFaces.current().ajax().update("formtabla:growl"); + return "proveedorLista.xhtml"; + + case ELEMENTO_DUPLICADO: + return null; + + default: + return null; + } + + } + + public String editarProveedor() { + + Mensaje mensaje = proveedorBL.editar(proveedor); + + switch (mensaje) { + case SIN_ERROR: + proveedor = new Proveedor(); + PrimeFaces.current().executeScript("PF('dlg').hide()"); + PrimeFaces.current().ajax().update("formtabla:growl"); + return "proveedorLista.xhtml"; + + case ELEMENTO_DUPLICADO: + return null; + + default: + return null; + } + + } + + public void eliminarProveedor() { + proveedorBL.eliminarId(proveedor); + } + + public String buscarActivos() { + proveedorBL.buscarStatus(true); + return "index.xhtml"; + } + + public String buscarInactivos() { + proveedorBL.buscarStatus(false); + return "index.xhtml"; + } + + public String buscarTodos() { + proveedorBL.buscarStatus(true); + proveedorBL.buscarStatus(false); + return "index.xhtml"; + } + + public String eliminar() { + Proveedor p = new Proveedor(); + p.setId(4); + proveedorBL.eliminarId(p); + return "index.xhtml"; + } + + public List getAll() { + return proveedorBL.buscarStatus(true); + } + + public Proveedor getProveedor() { + return proveedor; + } + + public void setProveedor(Proveedor proveedor) { + this.proveedor = proveedor; + } + + public String getTitulo() { + return titulo; + } + + public boolean isNuevo() { + return nuevo; + } + + //editar + public void prepararEditar(Proveedor proveedor) { + nuevo = false; + titulo = "E D I T A R"; + this.proveedor = proveedor; + + } + + public void prepararNuevo() { + nuevo = true; + titulo = "A G R E G A R"; + proveedor = new Proveedor(); + + } + + public void prepararEliminar(Proveedor proveedor) { + this.proveedor = proveedor; + } + + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } + + Proveedor customer = (Proveedor) value; + return customer.getNombre().toLowerCase().contains(filterText) + || customer.getCorreo().toLowerCase().contains(filterText) + || customer.getTelefono().toLowerCase().contains(filterText) + || customer.getMunicipio().toLowerCase().contains(filterText) + || customer.getEstado().toLowerCase().contains(filterText) + || customer.getCp().toLowerCase().contains(filterText); + } + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + + + + + + + + + + + +} + + + diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanUsuarios.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanUsuarios.java new file mode 100644 index 0000000..59cb326 --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemoBeanUsuarios.java @@ -0,0 +1,142 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package mx.edu.tjs.chapala.sistemas.vista; + +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import mx.edu.tjs.chapala.sistemas.bl.UsuariosBLLocal; +import mx.edu.tjs.chapala.sistemas.modelo.Usuarios; +import org.primefaces.util.LangUtils; + +/** + * + * @author Ely + */ +@Named(value = "demoBeanUsuarios") +@SessionScoped +public class DemoBeanUsuarios implements Serializable { + + @EJB + private UsuariosBLLocal usuariosBL; + private Usuarios usuarios= new Usuarios(); + private String titulo; + private boolean nuevo; + private List filteredCustomers3; + + public String getTitulo() { + return titulo; + } + + /** + * Creates a new instance of DemoBeanUsuarios + */ + public DemoBeanUsuarios() { + } + + public String agregar() { + usuarios.setStatus(1); + usuariosBL.agregar(usuarios); + usuarios= new Usuarios(); + return "usuariosLista.xhtml"; + } + + public String editar() { + usuariosBL.editar(usuarios); + return "usuariosLista.xhtml"; + } + + public String eliminar() { + usuariosBL.eliminarId(usuarios); + return "usuariosLista.xhtml"; + } + + public String buscarID() { + Usuarios u = new Usuarios(); + u.setId(4); + + usuariosBL.buscarId(u); + return "index.xhtml"; + } + + public String buscarNombre() { + Usuarios u = new Usuarios(); + u.setUsuario("eli"); + + usuariosBL.buscarNombre(u); + return "index.xhtml"; + } + + public String buscarActivos() { + usuariosBL.buscarStatus(true); + return "index.xhtml"; + } + + public String buscarInactivos(){ + usuariosBL.buscarStatus(false); + return "index.xhtml"; + } + + public String buscarTodos(){ + usuariosBL.buscarStatus(true); + usuariosBL.buscarStatus(false); + return "index.xhtml"; + } + + + public ListgetAll(){ + return usuariosBL.buscarStatus(true); + } + public Usuarios getUsuarios(){ + return usuarios; + } + public void setUsuarios(Usuarios usuarios){ + this.usuarios= usuarios; + } + + public boolean isNuevo() { + return nuevo; + } + public void prepararEditar(Usuarios usuarios){ + nuevo =false; + titulo="editando Usuario"; + this.usuarios=usuarios; + } + + public void prepararNuevo(){ + nuevo =true; + titulo="Agregando Usuario"; + usuarios= new Usuarios(); + } + public void prepararEliminar(Usuarios usuarios){ + this.usuarios=usuarios; + } + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } + + + Usuarios customer = (Usuarios) value; + return customer.getUsuario().toLowerCase().contains(filterText) + || customer.getUsuario().toLowerCase().contains(filterText); + } + + +} diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemonBeanProducto.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemonBeanProducto.java new file mode 100644 index 0000000..d6bbe65 --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemonBeanProducto.java @@ -0,0 +1,281 @@ +/* + * 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.vista; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import javax.enterprise.context.SessionScoped; +import javax.inject.Named; +import mx.edu.tjs.chapala.sistemas.bl.CategoriaBLLocal; +import mx.edu.tjs.chapala.sistemas.bl.MarcaBLLocal; +import mx.edu.tjs.chapala.sistemas.bl.ProductoBLLocal; +import mx.edu.tjs.chapala.sistemas.bl.ProveedorBLLocal; +import mx.edu.tjs.chapala.sistemas.bl.UbicacionAlmacenBLLocal; +import mx.edu.tjs.chapala.sistemas.modelo.Categoria; +import mx.edu.tjs.chapala.sistemas.modelo.Marca; +import mx.edu.tjs.chapala.sistemas.modelo.Producto; +import mx.edu.tjs.chapala.sistemas.modelo.Proveedor; +import mx.edu.tjs.chapala.sistemas.modelo.Ubicacionalmacen; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; +import static mx.edu.tjs.chapala.sistemas.msg.Mensaje.ELEMENTO_DUPLICADO; +import static mx.edu.tjs.chapala.sistemas.msg.Mensaje.SIN_ERROR; +import org.primefaces.PrimeFaces; +import org.primefaces.util.LangUtils; + +/** + * + * @author 52332 + */ +@Named(value = "demoBeanProductos") +@SessionScoped +public class DemonBeanProducto implements Serializable { + + @EJB + private ProductoBLLocal productoBL; + + @EJB + private ProveedorBLLocal proveedorBL; + + @EJB + private MarcaBLLocal marcaBL; + + @EJB + private CategoriaBLLocal categoriaBL; + + @EJB + private UbicacionAlmacenBLLocal ubicacionAlmacenBL; + + private List filteredCustomers3; + + + private Producto producto = new Producto(); + + private Marca marca = new Marca(); + + //crear el id de las llaves foraneas + private int marcaid; + + private int ubicacionid; + + private int proveedorid; + + private int categoriaid; + + + + + + private Categoria categoria = new Categoria(); + + private Proveedor proveedor = new Proveedor(); + + private Ubicacionalmacen ubicacionalmacen = new Ubicacionalmacen(); + + private String titulo; + + private boolean nuevo; + + public DemonBeanProducto() { + } + + public String agregarProducto() { + Mensaje mensaje = productoBL.agregar(producto); + + switch (mensaje) { + case SIN_ERROR: + producto = new Producto(); //limpiar + PrimeFaces.current().executeScript("PF('dlg').hide()"); + PrimeFaces.current().ajax().update("formtabla:growl"); + return "ProductoLista.xhtml"; + + case ELEMENTO_DUPLICADO: + return null; + + default: + return null; + } + } + + + + + + public String buscarID() { + Producto p = new Producto(); + p.setId(1); + + productoBL.buscarId(p); + return "index.xhtml"; + } + + public String buscarNombre() { + Producto p = new Producto(); + p.setNombre("fanta"); + + productoBL.buscarNombre(p); + return "index.xhtml"; + } + + public String buscarActivos() { + productoBL.buscarStatus(true); + return "index.xhtml"; + } + + public String buscarInactivos() { + productoBL.buscarStatus(false); + return "index.xhtml"; + } + + public String buscarTodos() { + productoBL.buscarStatus(true); + productoBL.buscarStatus(false); + return "index.xhtml"; + } + + public String eliminar() { + Producto p = new Producto(); + p.setId(1); + productoBL.eliminarId(p); + return "index.xhtml"; + } + + public List getAll() { + return productoBL.buscarStatus(true); + } + + public Producto getProducto() { + return producto; + } + + public void setProducto(Producto producto) { + this.producto = producto; + } + + //agregando para los botones de editar y eliminar + public void PrepararEditar(Producto producto) { + nuevo=false; + titulo = "E D I T A R"; + this.producto = producto; + + } + + public void prepararNuevo() { + nuevo = true; + titulo = "A G R E G A R"; + producto = new Producto(); + } + + public String getTitulo() { + return titulo; + } + + public void setTitulo(String titulo) { + this.titulo = titulo; + } + + public boolean isNuevo() { + return nuevo; + } + + public String editarProducto() { + + Mensaje mensaje = productoBL.editar(producto); + + switch (mensaje) { + case SIN_ERROR: + producto = new Producto(); + PrimeFaces.current().executeScript("PF('dlg').hide()"); + PrimeFaces.current().ajax().update("formtabla:growl"); + return "ProductoLista.xhtml"; + + case ELEMENTO_DUPLICADO: + return null; + + default: + return null; + } + + } + + //eliminar + public void prepararEliminar(Producto producto) { + this.producto = producto; + } + + public void eliminarProducto() { + productoBL.eliminarId(producto); + // PrimeFaces.current().executeScript("PF('dlg2').hide()"); + } + + + +//se agregan los get y los set de las llaves foreaneas de id + + public int getMarcaid() { + return marcaid; + } + + public void setMarcaid(int marcaid) { + this.marcaid = marcaid; + } + + public int getUbicacionid() { + return ubicacionid; + } + + public void setUbicacionid(int ubicacionid) { + this.ubicacionid = ubicacionid; + } + + public int getProveedorid() { + return proveedorid; + } + + public void setProveedorid(int proveedorid) { + this.proveedorid = proveedorid; + } + + public int getCategoriaid() { + return categoriaid; + } + + public void setCategoriaid(int categoriaid) { + this.categoriaid = categoriaid; + } + + //SE AÑADEN LOS GET Y LOS SET DE CUSTOM + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } + + + Producto customer = (Producto) value; + return customer.getNombre().toLowerCase().contains(filterText) + + || customer.getCodigo().toLowerCase().contains(filterText) + + || customer.getDescripcion().toLowerCase().contains(filterText); + + + + } + + +} diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemonBeanUbicacionalmacen.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemonBeanUbicacionalmacen.java new file mode 100644 index 0000000..8809244 --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/DemonBeanUbicacionalmacen.java @@ -0,0 +1,199 @@ +/* + * 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.vista; + +import java.io.Serializable; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import javax.enterprise.context.SessionScoped; +import javax.inject.Named; + +import mx.edu.tjs.chapala.sistemas.bl.UbicacionAlmacenBLLocal; +import mx.edu.tjs.chapala.sistemas.modelo.Producto; +import mx.edu.tjs.chapala.sistemas.modelo.Ubicacionalmacen; +import mx.edu.tjs.chapala.sistemas.msg.Mensaje; +import static mx.edu.tjs.chapala.sistemas.msg.Mensaje.ELEMENTO_DUPLICADO; +import static mx.edu.tjs.chapala.sistemas.msg.Mensaje.SIN_ERROR; +import org.primefaces.PrimeFaces; +import org.primefaces.util.LangUtils; + +/** + * + * @author 52332 + * + */ +@Named(value = "demoBeanUbicacionalmacen") +@SessionScoped +public class DemonBeanUbicacionalmacen implements Serializable { + + @EJB + private UbicacionAlmacenBLLocal ubicacionAlmacenBL; + + + private Ubicacionalmacen ubicacionalmacen = new Ubicacionalmacen(); + + private String titulo; + + private boolean nuevo; + private List filteredCustomers3; + + public DemonBeanUbicacionalmacen() { + } + //metodo de agregar en la vista + public String agregarUbicacion(){ + Mensaje mensaje = ubicacionAlmacenBL.agregar(ubicacionalmacen); + + switch (mensaje) { + case SIN_ERROR: + ubicacionalmacen = new Ubicacionalmacen(); //limpiar + PrimeFaces.current().executeScript("PF('dlg').hide()"); + PrimeFaces.current().ajax().update("formtabla:growl"); + return "UbicacionAlmacenLista.xhtml"; + + case ELEMENTO_DUPLICADO: + return null; + + default: + return null; + } + } + + + + + public String buscarID() { + Ubicacionalmacen u = new Ubicacionalmacen(); + u.setId(1); + + ubicacionAlmacenBL.buscarId(u); + return "index.xhtml"; + } + + public String buscarNombre() { + Ubicacionalmacen u = new Ubicacionalmacen(); + u.setBodega("buenos aires"); + + ubicacionAlmacenBL.buscarBodega(u); + return "index.xhtml"; + } + + public String buscarActivos() { + ubicacionAlmacenBL.buscarStatus(true); + return "index.xhtml"; + } + + public String buscarInactivos(){ + ubicacionAlmacenBL.buscarStatus(false); + return "index.xhtml"; + } + + public String buscarTodos(){ + ubicacionAlmacenBL.buscarStatus(true); + ubicacionAlmacenBL.buscarStatus(false); + return "index.xhtml"; + } + + public String eliminar() { + Ubicacionalmacen u = new Ubicacionalmacen(); + u.setId(2); + ubicacionAlmacenBL.eliminarId(u); + return "index.xhtml"; + } + + public List getAll(){ + return ubicacionAlmacenBL.buscarStatus(true); + + + } + + public Ubicacionalmacen getUbicacionalmacen() { + return ubicacionalmacen; + } + + public void setUbicacionalmacen(Ubicacionalmacen ubicacionalmacen) { + this.ubicacionalmacen = ubicacionalmacen; + } + + + public void PrepararEditar(Ubicacionalmacen ubicacionalmacen){ + + nuevo=false; + + titulo ="E D I T A R"; + this.ubicacionalmacen=ubicacionalmacen; + PrimeFaces.current().executeScript("PF('dlg').hide()"); + } + public void prepararNuevo(){ + nuevo=true; + titulo="A G R E G A R"; + ubicacionalmacen=new Ubicacionalmacen(); + + } + + public String getTitulo() { + return titulo; + } + public String editarUbicacion(){ + Mensaje mensaje = ubicacionAlmacenBL.editar(ubicacionalmacen); + + switch (mensaje) { + case SIN_ERROR: + ubicacionalmacen = new Ubicacionalmacen(); + PrimeFaces.current().executeScript("PF('dlg').hide()"); + PrimeFaces.current().ajax().update("formtabla:growl"); + return "UbicacionAlmacen.xhtml"; + + case ELEMENTO_DUPLICADO: + return null; + + default: + return null; + } + } + + public boolean isNuevo() { + return nuevo; + } + public void prepararEliminar(Ubicacionalmacen ubicacionalmacen){ + this.ubicacionalmacen=ubicacionalmacen; + } + + public void eliminarUbicacion(){ + ubicacionAlmacenBL.eliminarId(ubicacionalmacen); + // PrimeFaces.current().executeScript("PF('dlg2').hide()"); + } + + //se agregan los get y los set de custom + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } + + + Ubicacionalmacen customer = (Ubicacionalmacen) value; + return + customer.getBodega().toLowerCase().contains(filterText) + + || customer.getEstante().toLowerCase().contains(filterText) + + || customer.getPasillo().toLowerCase().contains(filterText) + || customer.getSeccion().toLowerCase().contains(filterText); + + + + } + +} \ No newline at end of file diff --git a/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/SelectOneMenuConverter.java b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/SelectOneMenuConverter.java new file mode 100644 index 0000000..78b828f --- /dev/null +++ b/Inventario-war/src/java/mx/edu/tjs/chapala/sistemas/vista/SelectOneMenuConverter.java @@ -0,0 +1,85 @@ + +import java.util.List; +import javax.faces.component.UIComponent; +import javax.faces.component.UISelectItem; +import javax.faces.component.UISelectItems; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.FacesConverter; + +/** + * The Class SelectOneMenuConverter. + */ +@FacesConverter("selectOneMenuConverter") +public class SelectOneMenuConverter implements Converter { + + @Override + public Object getAsObject(final FacesContext arg0, final UIComponent arg1, final String objectString) { + if (objectString == null) { + return null; + } + + return fromSelect(arg1, objectString); + } + + /** + * Serialize. + * + * @param object + * the object + * @return the string + */ + private String serialize(final Object object) { + if (object == null) { + return null; + } + return object.getClass() + "@" + object.hashCode(); + } + + /** + * From select. + * + * @param currentcomponent + * the currentcomponent + * @param objectString + * the object string + * @return the object + */ + private Object fromSelect(final UIComponent currentcomponent, final String objectString) { + + if (currentcomponent.getClass() == UISelectItem.class) { + final UISelectItem item = (UISelectItem) currentcomponent; + final Object value = item.getValue(); + if (objectString.equals(serialize(value))) { + return value; + } + } + + if (currentcomponent.getClass() == UISelectItems.class) { + final UISelectItems items = (UISelectItems) currentcomponent; + final List elements = (List) items.getValue(); + for (final Object element : elements) { + if (objectString.equals(serialize(element))) { + return element; + } + } + } + + + if (!currentcomponent.getChildren().isEmpty()) { + for (final UIComponent component : currentcomponent.getChildren()) { + final Object result = fromSelect(component, objectString); + if (result != null) { + return result; + } + } + } + return null; + } + + @Override + public String getAsString(final FacesContext arg0, final UIComponent arg1, final Object object) { + return serialize(object); + } + +} \ No newline at end of file diff --git a/Inventario-war/web/ProductoCrearEditar.xhtml b/Inventario-war/web/ProductoCrearEditar.xhtml new file mode 100644 index 0000000..fb20c64 --- /dev/null +++ b/Inventario-war/web/ProductoCrearEditar.xhtml @@ -0,0 +1,127 @@ + + + + + + + + + + +

P R O D U C T O S

+
+ + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + +

+ + + + + + +

+ + + + + + + +
+ + + + + + +
+ +
+ +
+ +
+ + + diff --git a/Inventario-war/web/ProductoLista.xhtml b/Inventario-war/web/ProductoLista.xhtml new file mode 100644 index 0000000..3421d24 --- /dev/null +++ b/Inventario-war/web/ProductoLista.xhtml @@ -0,0 +1,329 @@ + + + + + + + + + +

P R O D U C T O S

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + +

+ + + + + + +

+ + + + + + + +
+ + + + + + + +
+
+ + + + + + +

+

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+
+ + + + +

+

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + +
+ +
+
+ + + + diff --git a/Inventario-war/web/UbicacionAlmacenLista.xhtml b/Inventario-war/web/UbicacionAlmacenLista.xhtml new file mode 100644 index 0000000..aca7263 --- /dev/null +++ b/Inventario-war/web/UbicacionAlmacenLista.xhtml @@ -0,0 +1,215 @@ + + + + + + + + + +

A L M A C E N

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +

+

+ +
+ + + + + + + + + + + + + +
+ +
+ + + +
+
+
+ + + + +

+

+ +
+ + + + + + + + + + + + + +
+ + +
+
+ + + +
+
+ +
+ + + + diff --git a/Inventario-war/web/WEB-INF/faces-config.xml b/Inventario-war/web/WEB-INF/faces-config.xml new file mode 100644 index 0000000..6447ade --- /dev/null +++ b/Inventario-war/web/WEB-INF/faces-config.xml @@ -0,0 +1,33 @@ + + + + + + + + mx.edu.tjs.chapala.sistemas.seguridad.AutorizacionListener + + + diff --git a/Inventario-war/web/WEB-INF/glassfish-web.xml b/Inventario-war/web/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..584a477 --- /dev/null +++ b/Inventario-war/web/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Inventario-war/web/WEB-INF/web.xml b/Inventario-war/web/WEB-INF/web.xml new file mode 100644 index 0000000..15fcc1f --- /dev/null +++ b/Inventario-war/web/WEB-INF/web.xml @@ -0,0 +1,29 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/marcaLista.xhtml + + + + javax.faces.CONFIG_FILES + /WEB-INF/faces-config.xml + + diff --git a/Inventario-war/web/categoriaCrearEditar.xhtml b/Inventario-war/web/categoriaCrearEditar.xhtml new file mode 100644 index 0000000..1aa80b9 --- /dev/null +++ b/Inventario-war/web/categoriaCrearEditar.xhtml @@ -0,0 +1,60 @@ + + + + + + + + + +

C A T E G O R I A S

+
+ + + + + + + + + + + + + + + + + right + + + + + + + + +

+ + + + + + + + + + +
+
+ +
+ +
+ + + diff --git a/Inventario-war/web/categoriaEliminar.xhtml b/Inventario-war/web/categoriaEliminar.xhtml new file mode 100644 index 0000000..421fe0b --- /dev/null +++ b/Inventario-war/web/categoriaEliminar.xhtml @@ -0,0 +1,63 @@ + + + + + + + + + +

C A T E G O R I A S

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + +
+ + +
+
+
+ +
+ +
+ + + diff --git a/Inventario-war/web/categoriaLista.xhtml b/Inventario-war/web/categoriaLista.xhtml new file mode 100644 index 0000000..8173a98 --- /dev/null +++ b/Inventario-war/web/categoriaLista.xhtml @@ -0,0 +1,99 @@ + + + + + + + + + +

C A T E G O R I A S

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ +
+ + + + diff --git a/Inventario-war/web/eliminarProducto.xhtml b/Inventario-war/web/eliminarProducto.xhtml new file mode 100644 index 0000000..f07f900 --- /dev/null +++ b/Inventario-war/web/eliminarProducto.xhtml @@ -0,0 +1,93 @@ + + + + + + + + + +

P R O D U C T O S

+
+ + + + + + + + + + + + + + + + + + + + + + + +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ +
+ + + + +
+ +
+ + + diff --git a/Inventario-war/web/index.html b/Inventario-war/web/index.html new file mode 100644 index 0000000..4cea0a0 --- /dev/null +++ b/Inventario-war/web/index.html @@ -0,0 +1,15 @@ + + + + + TODO supply a title + + + + +
TODO write content
+ + diff --git a/Inventario-war/web/index.xhtml b/Inventario-war/web/index.xhtml new file mode 100644 index 0000000..42a3a67 --- /dev/null +++ b/Inventario-war/web/index.xhtml @@ -0,0 +1,23 @@ + + + + + Inventario + + + + +

login

+ + + + + + + + + + +
+ diff --git a/Inventario-war/web/infoProveedor.xhtml b/Inventario-war/web/infoProveedor.xhtml new file mode 100644 index 0000000..317eedd --- /dev/null +++ b/Inventario-war/web/infoProveedor.xhtml @@ -0,0 +1,87 @@ + + + + + + + + + +

P R O V E E D O R

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + +
+ +
+ + + diff --git a/Inventario-war/web/marcaCrearEditar.xhtml b/Inventario-war/web/marcaCrearEditar.xhtml new file mode 100644 index 0000000..1956128 --- /dev/null +++ b/Inventario-war/web/marcaCrearEditar.xhtml @@ -0,0 +1,68 @@ + + + + + + + + + +

M A R C A S

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + diff --git a/Inventario-war/web/marcaEliminar.xhtml b/Inventario-war/web/marcaEliminar.xhtml new file mode 100644 index 0000000..ecb3e58 --- /dev/null +++ b/Inventario-war/web/marcaEliminar.xhtml @@ -0,0 +1,60 @@ + + + + + + + + + +

Eliminar Marca

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+ +
+ +
+ + + \ No newline at end of file diff --git a/Inventario-war/web/marcaLista.xhtml b/Inventario-war/web/marcaLista.xhtml new file mode 100644 index 0000000..570294c --- /dev/null +++ b/Inventario-war/web/marcaLista.xhtml @@ -0,0 +1,153 @@ + + + + + + + + + + +

M A R C A S

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + +

+ + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ +
+ + +
+
+ + + +
+ + +
+ + + \ No newline at end of file diff --git a/Inventario-war/web/menu.xhtml b/Inventario-war/web/menu.xhtml new file mode 100644 index 0000000..717ac6e --- /dev/null +++ b/Inventario-war/web/menu.xhtml @@ -0,0 +1,49 @@ + + + + + + + + + + + +

M E N Ú

+
+ + + + + + +
+
+ + + +
+
+ + + + +
+
+ + + +
+ + +
+ + + \ No newline at end of file diff --git a/Inventario-war/web/proveedorCrearEditar.xhtml b/Inventario-war/web/proveedorCrearEditar.xhtml new file mode 100644 index 0000000..a3b2d77 --- /dev/null +++ b/Inventario-war/web/proveedorCrearEditar.xhtml @@ -0,0 +1,99 @@ + + + + + + + + + +

P R O V E E D O R

+
+ + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+
+ + +
+ +
+ + + diff --git a/Inventario-war/web/proveedorEliminar.xhtml b/Inventario-war/web/proveedorEliminar.xhtml new file mode 100644 index 0000000..aaa6fa0 --- /dev/null +++ b/Inventario-war/web/proveedorEliminar.xhtml @@ -0,0 +1,80 @@ + + + + + + + + + +

P R O V E E D O R

+
+ + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+ + +
+ +
+ + + diff --git a/Inventario-war/web/proveedorLista.xhtml b/Inventario-war/web/proveedorLista.xhtml new file mode 100644 index 0000000..a49372f --- /dev/null +++ b/Inventario-war/web/proveedorLista.xhtml @@ -0,0 +1,299 @@ + + + + + + + + + +

P R O V E E D O R E S

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + + +

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+
+ + + + +

+

+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+
+ + + + diff --git a/Inventario-war/web/resources/css/cssLayout.css b/Inventario-war/web/resources/css/cssLayout.css new file mode 100644 index 0000000..faa2b12 --- /dev/null +++ b/Inventario-war/web/resources/css/cssLayout.css @@ -0,0 +1,146 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 10px; + margin: 0px 0px 10px 0px; +} + + + +#left { + float: left; + padding: 5px; + width: 175px; + height:100%; + background-color: whitesmoke; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 10px; + margin-left: 180px; + + +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; + +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; + +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; + +} + +#topM { + position: relative; + background-color: #036fab; + color: white; + padding: 10px; + margin: 0px 0px 10px 0px; +} +.center_contentM { + position: relative; + background-color: #dddddd; + padding: 10px; + margin: 0px 0px 0px 0px; + height: 85vh; + +} + +.formulario-elemento { + width: 350px; + +} +.selectM{ + width: 900px; +} + +.form-container { + + margin-bottom: 30px; +} + +.column1{ + width: 20%; +} +.column2{ + width: 80%; + +} + +.botonMenu{ + align-content: center; + align-items: center; + color:black; + width: 160px; + height: 98px; + margin-right: 2px; + margin-right: -1px; +} + +.columnaOpc { + width: 130px; + text-align: center; + +} + +.columnaId { + width: 80px; + text-align: center; + +} + +.columnas{ + width: 98px; + text-align: center; +} + +.columnaTel{ + width: 120px; + text-align: center; +} + + + +th.ui-state-default { + text-align: center !important; +} + + + + + + + + + + diff --git a/Inventario-war/web/resources/css/default.css b/Inventario-war/web/resources/css/default.css new file mode 100644 index 0000000..6cbc3d1 --- /dev/null +++ b/Inventario-war/web/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/Inventario-war/web/template/menu1.xhtml b/Inventario-war/web/template/menu1.xhtml new file mode 100644 index 0000000..0685c6c --- /dev/null +++ b/Inventario-war/web/template/menu1.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Facelets Template + + + + +
+ Top +
+ +
+ Content +
+ +
+ + diff --git a/Inventario-war/web/template/principal.xhtml b/Inventario-war/web/template/principal.xhtml new file mode 100644 index 0000000..8869970 --- /dev/null +++ b/Inventario-war/web/template/principal.xhtml @@ -0,0 +1,48 @@ + + + + + + + + + + + + Inventario + + + + + +
+ Top +
+ +
+ Left +
+ + +
+
+ + +
+ Content +
+
+
+ + +
+ +
+ +
+ + diff --git a/Inventario-war/web/ubicacionAlmacenCrearEditar.xhtml b/Inventario-war/web/ubicacionAlmacenCrearEditar.xhtml new file mode 100644 index 0000000..929e050 --- /dev/null +++ b/Inventario-war/web/ubicacionAlmacenCrearEditar.xhtml @@ -0,0 +1,72 @@ + + + + + + + + + +

U B I C A C I O N

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/Inventario-war/web/ubicacionEliminar.xhtml b/Inventario-war/web/ubicacionEliminar.xhtml new file mode 100644 index 0000000..e5d0694 --- /dev/null +++ b/Inventario-war/web/ubicacionEliminar.xhtml @@ -0,0 +1,77 @@ + + + + + + + + + +

U B I C A C I O N

+
+ + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + + + + + diff --git a/Inventario-war/web/usuarioEliminar.xhtml b/Inventario-war/web/usuarioEliminar.xhtml new file mode 100644 index 0000000..81ca7d0 --- /dev/null +++ b/Inventario-war/web/usuarioEliminar.xhtml @@ -0,0 +1,66 @@ + + + + + + + + + +

U S U A R I O S

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + /> + + /> + + /> + + + +
+ + + +
+
+
+ +
+ +
+ + + diff --git a/Inventario-war/web/usuariosCrearEditar.xhtml b/Inventario-war/web/usuariosCrearEditar.xhtml new file mode 100644 index 0000000..714dd18 --- /dev/null +++ b/Inventario-war/web/usuariosCrearEditar.xhtml @@ -0,0 +1,70 @@ + + + + + + + + + +

U S U A R I O S

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + +
+ + + +
+ + +
+
+
+ +
+ + + diff --git a/Inventario-war/web/usuariosLista.xhtml b/Inventario-war/web/usuariosLista.xhtml new file mode 100644 index 0000000..08af381 --- /dev/null +++ b/Inventario-war/web/usuariosLista.xhtml @@ -0,0 +1,103 @@ + + + + + + + + + +

U S U A R I O S

+
+ + + + + + + + + + + + +         + + + + + + + + + +
+
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + +
+ +
+ + + diff --git a/Inventario-war/web/view.xhtml b/Inventario-war/web/view.xhtml new file mode 100644 index 0000000..0f9b71a --- /dev/null +++ b/Inventario-war/web/view.xhtml @@ -0,0 +1,86 @@ + + + + + + + + + +

P R O D U C T O

+
+ + + + + + + + + + + + + + + + + + + + + +
+

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ +
+ +
+ +
+ + + diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..a06033f --- /dev/null +++ b/build.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + Builds, tests, and runs the project Inventario. + + + diff --git a/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar new file mode 100644 index 0000000..b545720 Binary files /dev/null and b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/javaee-doc-api.jar b/lib/EclipseLink-GlassFish-v3/javaee-doc-api.jar new file mode 100644 index 0000000..9e19d4f Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/javaee-doc-api.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/javax.persistence.jar b/lib/EclipseLink-GlassFish-v3/javax.persistence.jar new file mode 100644 index 0000000..a4dd386 Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/javax.persistence.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.antlr.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.antlr.jar new file mode 100644 index 0000000..cff0ef8 Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.antlr.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.asm.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.asm.jar new file mode 100644 index 0000000..832e18e Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.asm.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.core.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.core.jar new file mode 100644 index 0000000..01bb838 Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.core.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.dbws.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.dbws.jar new file mode 100644 index 0000000..3c7d25b Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.dbws.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.jar new file mode 100644 index 0000000..1a8ba7e Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.jpql.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.jpql.jar new file mode 100644 index 0000000..53be498 Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.jpql.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.modelgen.processor.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.modelgen.processor.jar new file mode 100644 index 0000000..a0d8390 Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.modelgen.processor.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.moxy.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.moxy.jar new file mode 100644 index 0000000..29a1057 Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.moxy.jar differ diff --git a/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.oracle.jar b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.oracle.jar new file mode 100644 index 0000000..87782bf Binary files /dev/null and b/lib/EclipseLink-GlassFish-v3/org.eclipse.persistence.oracle.jar differ diff --git a/lib/javaee-endorsed-api-7.0/javaee-doc-api.jar b/lib/javaee-endorsed-api-7.0/javaee-doc-api.jar new file mode 100644 index 0000000..9e19d4f Binary files /dev/null and b/lib/javaee-endorsed-api-7.0/javaee-doc-api.jar differ diff --git a/lib/javaee-endorsed-api-7.0/javax.annotation-api.jar b/lib/javaee-endorsed-api-7.0/javax.annotation-api.jar new file mode 100644 index 0000000..9ab39ff Binary files /dev/null and b/lib/javaee-endorsed-api-7.0/javax.annotation-api.jar differ diff --git a/lib/javaee-endorsed-api-7.0/javax.xml.soap-api.jar b/lib/javaee-endorsed-api-7.0/javax.xml.soap-api.jar new file mode 100644 index 0000000..b9f4d5b Binary files /dev/null and b/lib/javaee-endorsed-api-7.0/javax.xml.soap-api.jar differ diff --git a/lib/javaee-endorsed-api-7.0/jaxb-api-osgi.jar b/lib/javaee-endorsed-api-7.0/jaxb-api-osgi.jar new file mode 100644 index 0000000..8be7c66 Binary files /dev/null and b/lib/javaee-endorsed-api-7.0/jaxb-api-osgi.jar differ diff --git a/lib/javaee-endorsed-api-7.0/jaxws-api.jar b/lib/javaee-endorsed-api-7.0/jaxws-api.jar new file mode 100644 index 0000000..c2ed58b Binary files /dev/null and b/lib/javaee-endorsed-api-7.0/jaxws-api.jar differ diff --git a/lib/javaee-endorsed-api-7.0/jsr181-api.jar b/lib/javaee-endorsed-api-7.0/jsr181-api.jar new file mode 100644 index 0000000..91538a7 Binary files /dev/null and b/lib/javaee-endorsed-api-7.0/jsr181-api.jar differ diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties new file mode 100644 index 0000000..a34c7c7 --- /dev/null +++ b/lib/nblibraries.properties @@ -0,0 +1,28 @@ +libs.CopyLibs.classpath=\ + ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar +libs.CopyLibs.displayName=CopyLibs Task +libs.CopyLibs.prop-version=3.0 +libs.EclipseLink-GlassFish-v3.classpath=\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.asm.jar:\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.jpql.jar:\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.core.jar:\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.jar:\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.jpa.modelgen.processor.jar:\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.oracle.jar:\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.dbws.jar:\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.moxy.jar:\ + ${base}/EclipseLink-GlassFish-v3/org.eclipse.persistence.antlr.jar:\ + ${base}/EclipseLink-GlassFish-v3/javax.persistence.jar +libs.EclipseLink-GlassFish-v3.displayName=EclipseLink from GlassFish +libs.EclipseLink-GlassFish-v3.javadoc=\ + ${base}/EclipseLink-GlassFish-v3/javaee-doc-api.jar +libs.javaee-endorsed-api-7.0.classpath=\ + ${base}/javaee-endorsed-api-7.0/javax.annotation-api.jar:\ + ${base}/javaee-endorsed-api-7.0/javax.xml.soap-api.jar:\ + ${base}/javaee-endorsed-api-7.0/jaxb-api-osgi.jar:\ + ${base}/javaee-endorsed-api-7.0/jaxws-api.jar:\ + ${base}/javaee-endorsed-api-7.0/jsr181-api.jar +libs.javaee-endorsed-api-7.0.displayName=Java EE 7 Endorsed API Library +libs.javaee-endorsed-api-7.0.javadoc=\ + ${base}/javaee-endorsed-api-7.0/javaee-doc-api.jar +libs.javaee-endorsed-api-7.0.prop-maven-dependencies=\n javax.annotation:javax.annotation-api:1.2\n javax.xml.bind:jaxb-api-osgi:2.2.7\n javax.xml.soap:javax.xml.soap-api:1.3.5\n javax.xml.ws:jaxws-api:2.2.8\n javax.jws:jsr181-api:1.0-MR1\n diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 0000000..fdc06d5 --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..deb89e7 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,660 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set build.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.excludes + Must set dist.jar + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..3eced02 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=0a02dad7 +build.xml.script.CRC32=b95b2ece +build.xml.stylesheet.CRC32=7e2ae9c8@1.73 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=0a02dad7 +nbproject/build-impl.xml.script.CRC32=8e5ae04d +nbproject/build-impl.xml.stylesheet.CRC32=abdce74a@1.73 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..971c6f5 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,41 @@ +build.classes.excludes=**/*.java,**/*.form,**/.nbattrs +build.dir=build +build.generated.dir=${build.dir}/generated +client.module.uri=Inventario-war +client.urlPart= +debug.classpath=${javac.classpath}::${jar.content.additional}:${run.classpath} +display.browser=true +dist.dir=dist +dist.jar=${dist.dir}/${jar.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-7.0.classpath} +j2ee.appclient.mainclass.args=${j2ee.appclient.tool.args} +j2ee.compile.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.7 +j2ee.platform.classpath=${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv4ee7 +jar.compress=false +jar.content.additional=\ + ${reference.Inventario-war.dist-ear}:\ + ${reference.Inventario-ejb.dist-ear} +jar.name=Inventario.ear +javac.debug=true +javac.deprecation=false +javac.source=1.7 +javac.target=1.7 +meta.inf=src/conf +no.dependencies=false +platform.active=default_platform +project.Inventario-ejb=Inventario-ejb +project.Inventario-war=Inventario-war +reference.Inventario-ejb.dist-ear=${project.Inventario-ejb}/dist/Inventario-ejb.jar +reference.Inventario-war.dist-ear=${project.Inventario-war}/dist/Inventario-war.war +resource.dir=setup +run.classpath= +source.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..8d19e83 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,42 @@ + + + org.netbeans.modules.j2ee.earproject + + + Inventario + 1.6.5 + + + + ${reference.Inventario-war.dist-ear} + / + + + ${reference.Inventario-ejb.dist-ear} + / + + + + + ./lib/nblibraries.properties + + + + Inventario-ejb + j2ee_ear_archive + + dist-ear + clean-ear + dist-ear + + + Inventario-war + j2ee_ear_archive + + dist-ear + clean-ear + dist-ear + + + + diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +