From 3db1733d226d4ff0d01a88b037c507ff847f01f2 Mon Sep 17 00:00:00 2001 From: IVAN ALEJANDRO PADILLA CORDOVA Date: Fri, 10 May 2024 08:43:40 -0600 Subject: [PATCH] principal v2 --- Inventario-ejb/build.xml | 68 + Inventario-ejb/nbproject/ant-deploy.xml | 131 ++ Inventario-ejb/nbproject/build-impl.xml | 1228 +++++++++++++++++ Inventario-ejb/nbproject/genfiles.properties | 8 + Inventario-ejb/nbproject/project.properties | 76 + Inventario-ejb/nbproject/project.xml | 17 + Inventario-ejb/src/conf/MANIFEST.MF | 1 + .../src/conf/META-INF/glassfish-resources.xml | 14 + Inventario-ejb/src/conf/persistence.xml | 8 + .../inventario/modelo/bl/CategoriaBL.java | 115 ++ .../modelo/bl/CategoriaBLLocal.java | 32 + .../inventario/modelo/bl/ColorBL.java | 171 +++ .../inventario/modelo/bl/ColorBLLocal.java | 37 + .../inventario/modelo/bl/GeneroBL.java | 101 ++ .../inventario/modelo/bl/GeneroBLLocal.java | 27 + .../inventario/modelo/bl/MarcaBL.java | 117 ++ .../inventario/modelo/bl/MarcaBLLocal.java | 30 + .../inventario/modelo/bl/ProductosBL.java | 236 ++++ .../modelo/bl/ProductosBLLocal.java | 45 + .../inventario/modelo/bl/ProveedoresBL.java | 132 ++ .../modelo/bl/ProveedoresBLLocal.java | 33 + .../sistemas/inventario/modelo/bl/RolBL.java | 171 +++ .../inventario/modelo/bl/RolBLLocal.java | 37 + .../inventario/modelo/bl/TallaBL.java | 111 ++ .../inventario/modelo/bl/TallaBLLocal.java | 30 + .../modelo/bl/UbicacionBLLocal.java | 40 + .../inventario/modelo/bl/UbucacionBL.java | 189 +++ .../inventario/modelo/bl/UsuariosBL.java | 271 ++++ .../inventario/modelo/bl/UsuariosBLLocal.java | 43 + .../sistemas/inventario/modelo/bl/bl.java | 13 + .../inventario/modelo/dao/CategoriaDAO.java | 102 ++ .../inventario/modelo/dao/ColorDAO.java | 96 ++ .../inventario/modelo/dao/GeneroDAO.java | 99 ++ .../inventario/modelo/dao/MarcaDAO.java | 100 ++ .../inventario/modelo/dao/ProductosDAO.java | 134 ++ .../inventario/modelo/dao/ProveedoresDAO.java | 140 ++ .../inventario/modelo/dao/RolDAO.java | 96 ++ .../inventario/modelo/dao/TallaDAO.java | 102 ++ .../inventario/modelo/dao/UbicacionDAO.java | 139 ++ .../inventario/modelo/dao/UsuariosDAO.java | 212 +++ .../inventario/modelo1/Categoria.java | 125 ++ .../sistemas/inventario/modelo1/Color.java | 114 ++ .../sistemas/inventario/modelo1/Genero.java | 114 ++ .../sistemas/inventario/modelo1/Marca.java | 114 ++ .../inventario/modelo1/Productos.java | 251 ++++ .../inventario/modelo1/Proveedores.java | 213 +++ .../sistemas/inventario/modelo1/Rol.java | 114 ++ .../sistemas/inventario/modelo1/Talla.java | 114 ++ .../inventario/modelo1/Ubicacion.java | 143 ++ .../sistemas/inventario/modelo1/Usuarios.java | 177 +++ .../sistemas/inventario/msg/Mensaje.java | 20 + build.xml | 61 + nbproject/ant-deploy.xml | 131 ++ nbproject/build-impl.xml | 635 +++++++++ nbproject/genfiles.properties | 8 + nbproject/project.properties | 40 + nbproject/project.xml | 39 + src/conf/MANIFEST.MF | 2 + 58 files changed, 7167 insertions(+) create mode 100644 Inventario-ejb/build.xml create mode 100644 Inventario-ejb/nbproject/ant-deploy.xml create mode 100644 Inventario-ejb/nbproject/build-impl.xml create mode 100644 Inventario-ejb/nbproject/genfiles.properties create mode 100644 Inventario-ejb/nbproject/project.properties create mode 100644 Inventario-ejb/nbproject/project.xml create mode 100644 Inventario-ejb/src/conf/MANIFEST.MF create mode 100644 Inventario-ejb/src/conf/META-INF/glassfish-resources.xml create mode 100644 Inventario-ejb/src/conf/persistence.xml create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/CategoriaBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/CategoriaBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ColorBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ColorBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/GeneroBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/GeneroBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/MarcaBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/MarcaBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProductosBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProductosBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProveedoresBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProveedoresBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/RolBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/RolBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/TallaBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/TallaBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UbicacionBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UbucacionBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UsuariosBL.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UsuariosBLLocal.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/bl.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/CategoriaDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ColorDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/GeneroDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/MarcaDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ProductosDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ProveedoresDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/RolDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/TallaDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/UbicacionDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/UsuariosDAO.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Categoria.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Color.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Genero.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Marca.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Productos.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Proveedores.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Rol.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Talla.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Ubicacion.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Usuarios.java create mode 100644 Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/msg/Mensaje.java create mode 100644 build.xml create mode 100644 nbproject/ant-deploy.xml create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/conf/MANIFEST.MF 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..a6987d7 --- /dev/null +++ b/Inventario-ejb/nbproject/build-impl.xml @@ -0,0 +1,1228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set platform.home + Must set platform.bootcp + Must set platform.java + Must set platform.javac + + The J2SE Platform is not correctly set up. + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. + Either open the project in the IDE and setup the Platform with the same name or add it manually. + For example like this: + ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) + or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..445ce7e --- /dev/null +++ b/Inventario-ejb/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=8d59014f +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=8d59014f +nbproject/build-impl.xml.script.CRC32=e8535368 +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..99a451f --- /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.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.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= +meta.inf=${source.root}/conf +meta.inf.excludes=sun-cmp-mappings.xml +platform.active=JDK_1.8 +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..3a4179b --- /dev/null +++ b/Inventario-ejb/nbproject/project.xml @@ -0,0 +1,17 @@ + + + org.netbeans.modules.j2ee.ejbjarproject + + + Inventario-ejb + 1.6.5 + + + + + + + + + + diff --git a/Inventario-ejb/src/conf/MANIFEST.MF b/Inventario-ejb/src/conf/MANIFEST.MF new file mode 100644 index 0000000..348f1bd --- /dev/null +++ b/Inventario-ejb/src/conf/MANIFEST.MF @@ -0,0 +1 @@ +Manifest-Version: 1.0 \ No newline at end of file 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..ccf2103 --- /dev/null +++ b/Inventario-ejb/src/conf/META-INF/glassfish-resources.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Inventario-ejb/src/conf/persistence.xml b/Inventario-ejb/src/conf/persistence.xml new file mode 100644 index 0000000..050c790 --- /dev/null +++ b/Inventario-ejb/src/conf/persistence.xml @@ -0,0 +1,8 @@ + + + + jdbc/Inventario_New + false + + + diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/CategoriaBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/CategoriaBL.java new file mode 100644 index 0000000..5f59529 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/CategoriaBL.java @@ -0,0 +1,115 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Categoria; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.CategoriaDAO; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +/** + * + * @author gael4 + */ +@Stateless +public class CategoriaBL implements CategoriaBLLocal { + + @Override + public Mensaje agregar(Categoria categoria) { + System.out.println("Llegaste al metodo de agregar"); + CategoriaDAO categoriaDAO = new CategoriaDAO(); + Categoria existeCategoria = categoriaDAO.buscarPorId(categoria); + //TODO: Agregar la logica + + //Este es un mensaje para probar el commit + + //TODO: agregar la logica + + //Test de validaciones + if(categoria.getCategoria().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(categoria.getCategoria().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if (existeCategoria != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }else{ + categoriaDAO.agregar(categoria); + return Mensaje.SIN_ERROR; + } + } + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + + @Override + public Mensaje buscarId(Categoria categoria) { + CategoriaDAO categoriaDAO = new CategoriaDAO(); + Categoria existeLibro = categoriaDAO.buscarPorId(categoria); + + if (existeLibro == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + categoriaDAO.buscarPorId(categoria); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Categoria buscarIdLi(Categoria categoria) { + CategoriaDAO a = new CategoriaDAO(); + return a.buscarPorId(categoria); + } + + + @Override + public Mensaje eliminarCategoria(Categoria categoria) { + CategoriaDAO a = new CategoriaDAO(); + Categoria existe = a.buscarPorId(categoria); + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.eliminar(categoria); + return Mensaje.SIN_ERROR; + + } + } + + + @Override + public Mensaje editarCategoria(Categoria categoria) { + System.out.println("Llegaste al metodo de editar"); + CategoriaDAO categoriaDao = new CategoriaDAO(); + Categoria existeCategoria = categoriaDao.buscarPorId(categoria); + //Test de validaciones + if(categoria.getCategoria().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(categoria.getCategoria().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if(categoria.getId()==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } + else{ + categoriaDao.editar(categoria); + return Mensaje.SIN_ERROR; + + } + } + public List buscarTodos() { + CategoriaDAO categoriaDAO = new CategoriaDAO(); + return categoriaDAO.buscarTodos(); +} +} \ No newline at end of file diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/CategoriaBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/CategoriaBLLocal.java new file mode 100644 index 0000000..f424a04 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/CategoriaBLLocal.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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Categoria; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + + +/** + * + * @author gael4 + */ +@Local +public interface CategoriaBLLocal { + + Mensaje agregar(Categoria categoria); + + Mensaje buscarId(Categoria categoria); + + Mensaje eliminarCategoria(Categoria categoria); + + Mensaje editarCategoria(Categoria categoria); + + Categoria buscarIdLi (Categoria categoria); + + List buscarTodos(); + +} \ No newline at end of file diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ColorBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ColorBL.java new file mode 100644 index 0000000..1595aec --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ColorBL.java @@ -0,0 +1,171 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.ColorDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Color; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +/** + * + * @author Ivan Alejandro PC + */ +@Stateless +public class ColorBL implements ColorBLLocal { + + @Override + public Mensaje agregar(Color color) { + System.out.println("Llegaste al metodo de agregar!!"); + ColorDAO rolDAO = new ColorDAO(); + + + if(color== null){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + Color existeRol = rolDAO.buscarPorId(color); + //TO DO: agregar la logica + + //Test de validaciones + if(color.getColor().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(color.getColor().length()>=45 ){ + return Mensaje.DATOS_INCORRECTOS; + } + + if (existeRol != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }else{ + rolDAO.agregar(color); + return Mensaje.SIN_ERROR; + + } + } + + + + @Override + public Mensaje buscarId(Color color) { + ColorDAO rolDAO = new ColorDAO(); + Color existeRol = rolDAO.buscarPorId(color); + + if(color== null){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (existeRol == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + rolDAO.buscarPorId(color); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Color buscarIdLi(Color color) { + + ColorDAO a = new ColorDAO(); + //Aqui le movi + return a.buscarPorId(color); + + } + + + + + + /*@Override + public Autor eliminar(Autor autor) { + AutorDAO a = new AutorDAO(); + a.eliminar(autor); + return autor; + }*/ + + @Override + public Mensaje eliminar(Color color) { + ColorDAO a = new ColorDAO(); + Color existe = a.buscarPorId(color); + + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + }else if(color==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + a.eliminar(color); + return Mensaje.SIN_ERROR; + + } + + + + } + + + @Override + public List buscarTodos() { + ColorDAO rolDAO = new ColorDAO(); + return rolDAO.buscarTodos(); +} + @Override + public Mensaje buscarColor(Color color) { + ColorDAO rolDAO = new ColorDAO(); + Color rE = rolDAO.buscarPorColorName(color); + + if (rE == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + return Mensaje.SIN_ERROR; + } + + } + + @Override + public Mensaje editar(Color color) { + System.out.println("Llegaste al metodo de editar"); + ColorDAO a = new ColorDAO(); + //Rol existeRol = a.buscarPorId(rol); + if(color== null){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + //Test de validaciones + if(color.getColor().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(color.getColor().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if(color.getId()==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + a.editar(color); + return Mensaje.SIN_ERROR; + + } + //autorDao.editar(autor); + + } + + + + + + + + + + + + + +} + + diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ColorBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ColorBLLocal.java new file mode 100644 index 0000000..a0650d5 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ColorBLLocal.java @@ -0,0 +1,37 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Color; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +/** + * + * @author Ivan Alejandro PC + */ +@Local +public interface ColorBLLocal { + + Mensaje agregar(Color color); + + Mensaje buscarColor(Color color); + + Mensaje buscarId(Color color); + + Color buscarIdLi(Color color); + + Mensaje eliminar(Color color); + + Mensaje editar(Color color); + + public List buscarTodos(); + + + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/GeneroBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/GeneroBL.java new file mode 100644 index 0000000..a428883 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/GeneroBL.java @@ -0,0 +1,101 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.GeneroDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Genero; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; + + +@Stateless +public class GeneroBL implements GeneroBLLocal { + + public Mensaje agregar(Genero genero) { + System.out.println("Llegaste al metodo de agregar"); + GeneroDAO generoDAO = new GeneroDAO(); + Genero existeGenero = generoDAO.buscarPorId(genero); + if(genero.getGenero().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(genero.getGenero().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if (existeGenero != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }else{ + generoDAO.agregar(genero); + return Mensaje.SIN_ERROR; + } + } + + @Override + public Mensaje buscarId(Genero genero) { + GeneroDAO generoDAO = new GeneroDAO(); + Genero existeGenero = generoDAO.buscarPorId(genero); + + if (existeGenero == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + generoDAO.buscarPorId(genero); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Genero buscarIdLi(Genero genero) { + GeneroDAO a = new GeneroDAO(); + return a.buscarPorId(genero); + } + + + @Override + public Mensaje eliminarGenero(Genero genero) { + GeneroDAO a = new GeneroDAO(); + Genero existe = a.buscarPorId(genero); + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } + else{ + a.eliminar(genero); + return Mensaje.SIN_ERROR; + } + } + + + @Override + public Mensaje editarGenero(Genero genero) { + System.out.println("Llegaste al metodo de editar"); + GeneroDAO proveedorDAO = new GeneroDAO(); + Genero existeproveedor = proveedorDAO.buscarPorId(genero); + //Test de validaciones + if(genero.getGenero().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(genero.getGenero().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if(genero.getId()==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } + else{ + proveedorDAO.editar(genero); + return Mensaje.SIN_ERROR; + + } + } + public List buscarTodos() { + GeneroDAO generoDAO = new GeneroDAO(); + return generoDAO.buscarTodos(); +} +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/GeneroBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/GeneroBLLocal.java new file mode 100644 index 0000000..34be18d --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/GeneroBLLocal.java @@ -0,0 +1,27 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Genero; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +@Local +public interface GeneroBLLocal { + Mensaje agregar(Genero genero); + + Mensaje buscarId(Genero genero); + + Genero buscarIdLi(Genero genero); + + Mensaje eliminarGenero(Genero genero); + + Mensaje editarGenero(Genero genero); + + List buscarTodos(); + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/MarcaBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/MarcaBL.java new file mode 100644 index 0000000..d15deaa --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/MarcaBL.java @@ -0,0 +1,117 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.MarcaDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Categoria; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Marca; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +/** + * + * @author gael4 + */ +@Stateless +public class MarcaBL implements MarcaBLLocal { + + @Override + public Mensaje agregar(Marca marca) { + System.out.println("Llegaste al metodo de agregar"); + MarcaDAO marcaDAO = new MarcaDAO(); + Marca existeMarca = marcaDAO.buscarPorId(marca); + //TODO: Agregar la logica + + //Este es un mensaje para probar el commit + + //TODO: agregar la logica + + //Test de validaciones + if(marca.getMarca().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(marca.getMarca().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if (existeMarca != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }else{ + marcaDAO.agregar(marca); + return Mensaje.SIN_ERROR; + } + } + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + + @Override + public Mensaje buscarId(Marca marca) { + MarcaDAO marcaDAO = new MarcaDAO(); + Marca existeMarca = marcaDAO.buscarPorId(marca); + + if (existeMarca == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + marcaDAO.buscarPorId(marca); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Marca buscarIdLi(Marca marca) { + MarcaDAO a = new MarcaDAO(); + return a.buscarPorId(marca); + } + + + @Override + public Mensaje eliminarMarca(Marca marca) { + MarcaDAO a = new MarcaDAO(); + Marca existe = a.buscarPorId(marca); + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.eliminar(marca); + return Mensaje.SIN_ERROR; + + } + } + + + @Override + public Mensaje editarMarca(Marca marca) { + System.out.println("Llegaste al metodo de editar"); + MarcaDAO marcaDao = new MarcaDAO(); + Marca existeMarca = marcaDao.buscarPorId(marca); + //Test de validaciones + if(marca.getMarca().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(marca.getMarca().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if(marca.getId()==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } + else{ + marcaDao.editar(marca); + return Mensaje.SIN_ERROR; + + } + } + + public List buscarTodos() { + MarcaDAO marcaDAO = new MarcaDAO(); + return marcaDAO.buscarTodos(); +} +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/MarcaBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/MarcaBLLocal.java new file mode 100644 index 0000000..2f37426 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/MarcaBLLocal.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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Marca; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +/** + * + * @author gael4 + */ +@Local +public interface MarcaBLLocal { + + Mensaje agregar(Marca marca); + + Mensaje buscarId(Marca marca); + + Mensaje eliminarMarca(Marca marca); + + Mensaje editarMarca(Marca marca); + + Marca buscarIdLi (Marca marca); + + List buscarTodos(); +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProductosBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProductosBL.java new file mode 100644 index 0000000..c301654 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProductosBL.java @@ -0,0 +1,236 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.ProductosDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Productos; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +/** + * + * @author Ivan Alejandro PC + */ +@Stateless +public class ProductosBL implements ProductosBLLocal { + + @Override + public Mensaje agregar(Productos productos) { + System.out.println("Llegaste al metodo de agregar!!"); + ProductosDAO productosDAO = new ProductosDAO(); + short status = 1; + productos.setStatus(status); + + if (productos == null) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + Productos existeProductos = productosDAO.buscarPorId(productos); + //TO DO: agregar la logica + + //Test de validaciones + if (productos.getNombre().isEmpty() || productos.getDescripcion().isEmpty() || productos.getPrecio().isEmpty() + || productos.getMaterial().isEmpty() + || productos.getExistencia()== 0 || productos.getExistencia() < 0 || productos.getColorid()== null || productos.getProveedoresid() == null + || productos.getUbicacionid()== null || productos.getTallaid()== null + || productos.getMarcaid()== null || productos.getCategoriaid()== null + || productos.getGeneroid()== null || productos.getStatus() == 0 ) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (productos.getNombre().length() >= 45 || productos.getDescripcion().length() >= 100 || productos.getPrecio().length() >= 45 + || productos.getMaterial().length() >= 45 || productos.getExistencia() == 0 || productos.getExistencia() == -1 ) { + return Mensaje.DATOS_INCORRECTOS; + } + + if(productos.getColorid() == null || productos.getProveedoresid()==null ||productos.getUbicacionid()==null || productos.getTallaid()==null + || productos.getMarcaid()==null || productos.getCategoriaid()==null || productos.getGeneroid()==null){ + return Mensaje.CAMPOS_INCOMPLETOS; + + } + + if (existeProductos != null) { + return Mensaje.ELEMENTO_DUPLICADO; + } else { + productosDAO.agregar(productos); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Mensaje buscarId(Productos productos) { + try{ + ProductosDAO productosDAO = new ProductosDAO(); + Productos existe = productosDAO.buscarPorId(productos); + if(existe.getStatus() == 0){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + + if (productos == null) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (existe == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + productosDAO.buscarPorId(productos); + return Mensaje.SIN_ERROR; + + } + } + } catch (NullPointerException e) { + // Maneja la excepción o notifica el error + return Mensaje.ELEMENTO_NO_ENCONTRADO; +} + } + + + @Override + public Mensaje buscarNombre(Productos productos) { + try{ + ProductosDAO productosDAO = new ProductosDAO(); + Productos existe = productosDAO.buscarPorNombre(productos); + + if(existe.getStatus()==0){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + + if (existe== null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + return Mensaje.SIN_ERROR; + } +} + } catch (NullPointerException e) { + // Maneja la excepción o notifica el error + return Mensaje.ELEMENTO_NO_ENCONTRADO; +} + + } + + @Override + public Mensaje buscarExistencia(Productos productos) { + ProductosDAO productosDAO = new ProductosDAO(); + Productos existe = productosDAO.buscarPorExistencia(productos); + + if(existe.getStatus()==0){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + + if (existe== null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + return Mensaje.SIN_ERROR; + } +} + } + + @Override + public List buscarStatus(short status) { + ProductosDAO productosDAO = new ProductosDAO(); + return productosDAO.buscarStatus(status); +} + + + @Override + public Productos buscarIdLi(Productos productos) { + + ProductosDAO a = new ProductosDAO(); + //Aqui le movi + return a.buscarPorId(productos); + + } + + + @Override + public Mensaje activarProductos(Productos productos) { + ProductosDAO a = new ProductosDAO(); + Productos existe = a.buscarPorId(productos); + + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.activar(productos); + return Mensaje.SIN_ERROR; + } + } + + @Override + public Mensaje desactivarProductos(Productos productos) { + try{ + ProductosDAO a = new ProductosDAO(); + Productos existe = a.buscarPorId(productos); + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.eliminar(productos); + return Mensaje.SIN_ERROR; + } + } catch (NullPointerException e) { + // Maneja la excepción o notifica el error + return Mensaje.ELEMENTO_NO_ENCONTRADO; +} + } + + @Override + public Mensaje editar(Productos productos) { + try{ + System.out.println("Llegaste al metodo de editar"); + ProductosDAO a = new ProductosDAO(); + + if(productos.getStatus()==1){ + if (productos == null) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + Productos existeProductos = a.buscarPorId(productos); + //TO DO: agregar la logica + + //Test de validaciones + if (productos.getNombre().isEmpty() || productos.getDescripcion().isEmpty() || productos.getPrecio().isEmpty() + || productos.getMaterial().isEmpty() + || productos.getExistencia()== 0 || productos.getExistencia() < 0 || productos.getColorid()==null || productos.getProveedoresid() == null + || productos.getUbicacionid()== null || productos.getTallaid()== null + || productos.getMarcaid()== null || productos.getCategoriaid()== null + || productos.getGeneroid()== null || productos.getStatus() == 0) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (productos.getNombre().length() >= 45 || productos.getDescripcion().length() >= 100 || productos.getPrecio().length() >= 45 + || productos.getMaterial().length() >= 45 || productos.getExistencia() == 0 || productos.getExistencia() == -1 ) { + return Mensaje.DATOS_INCORRECTOS; + } + + if(productos.getColorid()==null || productos.getProveedoresid()==null ||productos.getUbicacionid()==null || productos.getTallaid()==null + || productos.getMarcaid()==null || productos.getCategoriaid()==null || productos.getGeneroid()==null){ + return Mensaje.CAMPOS_INCOMPLETOS; + + } + + /*if (existeProductos != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }*/ else { + a.editar(productos); + return Mensaje.SIN_ERROR; + + } + + }else{ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } + + } catch (NullPointerException e) { + // Maneja la excepción o notifica el error + return Mensaje.ELEMENTO_NO_ENCONTRADO; +} + + } +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProductosBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProductosBLLocal.java new file mode 100644 index 0000000..545b6fd --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProductosBLLocal.java @@ -0,0 +1,45 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Productos; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +/** + * + * @author Ivan Alejandro PC + */ +@Local +public interface ProductosBLLocal { + + Mensaje agregar(Productos productos); + + Mensaje buscarId(Productos productos); + + Productos buscarIdLi(Productos productos); + + Mensaje buscarNombre(Productos productos); + + Mensaje buscarExistencia(Productos productos); + + //Mensaje buscarStatus(Usuarios usuarios); + + + + Mensaje editar(Productos productos); + + public List buscarStatus(short status); + + Mensaje activarProductos(Productos productos); + + Mensaje desactivarProductos(Productos productos); +// + + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProveedoresBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProveedoresBL.java new file mode 100644 index 0000000..f833d16 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProveedoresBL.java @@ -0,0 +1,132 @@ +package mx.edu.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Proveedores; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.ProveedoresDAO; +//import mx.edu.tsj.chapala.sistemas.inventario.modelo.Proveedores; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + + +@Stateless +public class ProveedoresBL implements ProveedoresBLLocal { + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + @Override + public Mensaje agregar(Proveedores proveedor) { + System.out.println("Llegaste al metodo de agregar"); + ProveedoresDAO ProveedorDAO = new ProveedoresDAO(); + Proveedores existeProveedor = ProveedorDAO.buscarPorId(proveedor); + if(proveedor.getNombre().isEmpty() || proveedor.getCorreo().isEmpty()|| proveedor.getDireccion().isEmpty() + || proveedor.getPais().isEmpty() || proveedor.getEstado().isEmpty()|| proveedor.getCiudad().isEmpty() || proveedor.getTelefono().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(proveedor.getNombre().length()>=255 || proveedor.getCorreo().length()>=70 || proveedor.getDireccion().length()>=100 + || proveedor.getPais().length()>=40 || proveedor.getCiudad().length()>=45 ||proveedor.getEstado().length()>=45 || proveedor.getTelefono().length()>=20){ + return Mensaje.DATOS_INCORRECTOS; + } + + if (existeProveedor != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }else{ + ProveedorDAO.agregar(proveedor); + return Mensaje.SIN_ERROR; + } + } + + @Override + public Mensaje buscarId(Proveedores proveedor) { + ProveedoresDAO ProveedorDAO = new ProveedoresDAO(); + Proveedores existeProovedor = ProveedorDAO.buscarPorId(proveedor); + + if (existeProovedor == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + ProveedorDAO.buscarPorId(proveedor); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Mensaje buscarNombre(Proveedores proveedor) { + ProveedoresDAO proveedorDAO = new ProveedoresDAO(); + Proveedores existeProveedor = proveedorDAO.buscarPorNombre(proveedor); + + if (existeProveedor == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + proveedorDAO.buscarPorNombre(proveedor); + return Mensaje.SIN_ERROR; + } + } + + @Override + public Proveedores buscarIdLi(Proveedores proveedor) { + ProveedoresDAO a = new ProveedoresDAO(); + return a.buscarPorId(proveedor); + } + + + @Override + public Mensaje eliminarProveedor(Proveedores proveedores) { + ProveedoresDAO a = new ProveedoresDAO(); + Proveedores existe = a.buscarPorId(proveedores); + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.eliminar(proveedores); + return Mensaje.SIN_ERROR; + } + } + + @Override + public Mensaje activarProveedor(Proveedores proveedores) { + ProveedoresDAO a = new ProveedoresDAO(); + Proveedores existe = a.buscarPorId(proveedores); + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.activar(proveedores); + return Mensaje.SIN_ERROR; + } + } + // + @Override + public Mensaje editarProveedor(Proveedores proveedor) { + System.out.println("Llegaste al metodo de editar"); + ProveedoresDAO proveedorDAO = new ProveedoresDAO(); + Proveedores existeproveedor = proveedorDAO.buscarPorId(proveedor); + //Test de validaciones + if(proveedor.getNombre().isEmpty() || proveedor.getCorreo().isEmpty()|| proveedor.getDireccion().isEmpty() + || proveedor.getCiudad().isEmpty() || proveedor.getTelefono().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(proveedor.getNombre().length()>=255 || proveedor.getCorreo().length()>=70 || proveedor.getDireccion().length()>=100 + || proveedor.getCiudad().length()>=45 || proveedor.getTelefono().length()>=20){ + return Mensaje.DATOS_INCORRECTOS; + } + + if(proveedor.getId()==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } + else{ + proveedorDAO.editar(proveedor); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public List buscarStatus(short status) { + ProveedoresDAO usuariosDAO = new ProveedoresDAO(); + return usuariosDAO.buscarPorStatus(status); + } +} \ No newline at end of file diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProveedoresBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProveedoresBLLocal.java new file mode 100644 index 0000000..66ebb5f --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/ProveedoresBLLocal.java @@ -0,0 +1,33 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Proveedores; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +/** + * + * @author omara + */ +@Local +public interface ProveedoresBLLocal { + Mensaje agregar(Proveedores proveedor); + + Mensaje buscarId(Proveedores proveedor); + + Mensaje buscarNombre(Proveedores proveedor); + + Proveedores buscarIdLi(Proveedores proveedor); + + Mensaje eliminarProveedor(Proveedores proveedores); + + Mensaje editarProveedor(Proveedores proveedor); + + Mensaje activarProveedor(Proveedores proveedores); + + List buscarStatus(short status); +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/RolBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/RolBL.java new file mode 100644 index 0000000..70060ab --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/RolBL.java @@ -0,0 +1,171 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.RolDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Rol; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +/** + * + * @author Ivan Alejandro PC + */ +@Stateless +public class RolBL implements RolBLLocal { + + @Override + public Mensaje agregar(Rol rol) { + System.out.println("Llegaste al metodo de agregar!!"); + RolDAO rolDAO = new RolDAO(); + + + if(rol== null){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + Rol existeRol = rolDAO.buscarPorId(rol); + //TO DO: agregar la logica + + //Test de validaciones + if(rol.getRolUsuario().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(rol.getRolUsuario().length()>=45 ){ + return Mensaje.DATOS_INCORRECTOS; + } + + if (existeRol != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }else{ + rolDAO.agregar(rol); + return Mensaje.SIN_ERROR; + + } + } + + + + @Override + public Mensaje buscarId(Rol rol) { + RolDAO rolDAO = new RolDAO(); + Rol existeRol = rolDAO.buscarPorId(rol); + + if(rol== null){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (existeRol == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + rolDAO.buscarPorId(rol); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Rol buscarIdLi(Rol rol) { + + RolDAO a = new RolDAO(); + //Aqui le movi + return a.buscarPorId(rol); + + } + + + + + + /*@Override + public Autor eliminar(Autor autor) { + AutorDAO a = new AutorDAO(); + a.eliminar(autor); + return autor; + }*/ + + @Override + public Mensaje eliminar(Rol rol) { + RolDAO a = new RolDAO(); + Rol existe = a.buscarPorId(rol); + + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + }else if(rol==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + a.eliminar(rol); + return Mensaje.SIN_ERROR; + + } + + + + } + + + @Override + public List buscarTodos() { + RolDAO rolDAO = new RolDAO(); + return rolDAO.buscarTodos(); +} + @Override + public Mensaje buscarRol(Rol rol) { + RolDAO rolDAO = new RolDAO(); + Rol rE = rolDAO.buscarPorRolName(rol); + + if (rE == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + return Mensaje.SIN_ERROR; + } + + } + + @Override + public Mensaje editar(Rol rol) { + System.out.println("Llegaste al metodo de editar"); + RolDAO a = new RolDAO(); + //Rol existeRol = a.buscarPorId(rol); + if(rol== null){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + //Test de validaciones + if(rol.getRolUsuario().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(rol.getRolUsuario().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if(rol.getId()==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + a.editar(rol); + return Mensaje.SIN_ERROR; + + } + //autorDao.editar(autor); + + } + + + + + + + + + + + + + +} + + diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/RolBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/RolBLLocal.java new file mode 100644 index 0000000..19e2d59 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/RolBLLocal.java @@ -0,0 +1,37 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Rol; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +/** + * + * @author Ivan Alejandro PC + */ +@Local +public interface RolBLLocal { + + Mensaje agregar(Rol rol); + + Mensaje buscarRol(Rol rol); + + Mensaje buscarId(Rol rol); + + Rol buscarIdLi(Rol rol); + + Mensaje eliminar(Rol rol); + + Mensaje editar(Rol rol); + + public List buscarTodos(); + + + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/TallaBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/TallaBL.java new file mode 100644 index 0000000..1c4e91a --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/TallaBL.java @@ -0,0 +1,111 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.TallaDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Talla; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +/** + * + * @author gael4 + */ +@Stateless +public class TallaBL implements TallaBLLocal { + + @Override + public Mensaje agregar(Talla talla) { + System.out.println("Llegaste al metodo de agregar"); + TallaDAO tallaDAO = new TallaDAO(); + Talla existeMarca = tallaDAO.buscarPorId(talla); + //TODO: Agregar la logica + + //Este es un mensaje para probar el commit + + //TODO: agregar la logica + + //Test de validaciones + if(talla.getTalla().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(talla.getTalla().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if (existeMarca != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }else{ + tallaDAO.agregar(talla); + return Mensaje.SIN_ERROR; + } + } + + @Override + public Mensaje buscarId(Talla talla) { + TallaDAO tallaDAO = new TallaDAO(); + Talla existeTalla = tallaDAO.buscarPorId(talla); + + if (existeTalla == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + tallaDAO.buscarPorId(talla); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Talla buscarIdLi(Talla talla) { + TallaDAO a = new TallaDAO(); + return a.buscarPorId(talla); + } + + @Override + public Mensaje eliminarTalla(Talla talla) { + TallaDAO a = new TallaDAO(); + Talla existe = a.buscarPorId(talla); + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.eliminar(talla); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Mensaje editarTalla(Talla talla) { + System.out.println("Llegaste al metodo de editar"); + TallaDAO tallaDao = new TallaDAO(); + Talla existeTalla = tallaDao.buscarPorId(talla); + //Test de validaciones + if(talla.getTalla().isEmpty()){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(talla.getTalla().length()>=45){ + return Mensaje.DATOS_INCORRECTOS; + } + + if(talla.getId()==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } + else{ + tallaDao.editar(talla); + return Mensaje.SIN_ERROR; + + } + } + + public List buscarTodos() { + TallaDAO tallaDAO = new TallaDAO(); + return tallaDAO.buscarTodos(); +} +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/TallaBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/TallaBLLocal.java new file mode 100644 index 0000000..cb92e4b --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/TallaBLLocal.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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Talla; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +/** + * + * @author gael4 + */ +@Local +public interface TallaBLLocal { + Mensaje agregar(Talla talla); + + Mensaje buscarId(Talla talla); + + Mensaje eliminarTalla(Talla talla); + + Mensaje editarTalla(Talla talla); + + Talla buscarIdLi (Talla talla); + + List buscarTodos(); + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UbicacionBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UbicacionBLLocal.java new file mode 100644 index 0000000..3fa6274 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UbicacionBLLocal.java @@ -0,0 +1,40 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Ubicacion; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +/** + * + * @author Ivan Alejandro PC + */ +@Local +public interface UbicacionBLLocal { + + Mensaje agregar(Ubicacion ubicacion); + + Mensaje buscarId(Ubicacion ubicacion); + + Ubicacion buscarIdLi(Ubicacion ubicacion); + + Mensaje buscarNombre(Ubicacion ubicacion); + + Mensaje buscarEstante(Ubicacion ubicacion); + + Mensaje buscarFila(Ubicacion ubicacion); + + Mensaje eliminar(Ubicacion ubicacion); + + Mensaje editar(Ubicacion ubicacion); + public List buscarTodos(); + + + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UbucacionBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UbucacionBL.java new file mode 100644 index 0000000..d319d45 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UbucacionBL.java @@ -0,0 +1,189 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.UbicacionDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Ubicacion; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +/** + * + * @author Ivan Alejandro PC + */ +@Stateless +public class UbucacionBL implements UbicacionBLLocal { + + @Override + public Mensaje agregar(Ubicacion ubicacion) { + System.out.println("Llegaste al metodo de agregar!!"); + UbicacionDAO ubicacionDAO = new UbicacionDAO(); + + + + if(ubicacion.getNombreAlmacen().isEmpty() || ubicacion.getEstante().isEmpty() || ubicacion.getFila() == 0 || + ubicacion.getFila()<= 0){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(ubicacion== null){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + Ubicacion existeUbicacion = ubicacionDAO.buscarPorId(ubicacion); + + if(ubicacion.getNombreAlmacen().length()>=255 | ubicacion.getEstante().length()>=100 ){ + return Mensaje.DATOS_INCORRECTOS; + } + + if (existeUbicacion != null) { + return Mensaje.ELEMENTO_DUPLICADO; + }else{ + ubicacionDAO.agregar(ubicacion); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public List buscarTodos() { + UbicacionDAO u = new UbicacionDAO(); + return u.buscarTodos(); +} + + + + + @Override + public Mensaje buscarId(Ubicacion ubicacion) { + UbicacionDAO ubicacionDAO = new UbicacionDAO(); + Ubicacion existeUbicacion = ubicacionDAO.buscarPorId(ubicacion); + + if(ubicacion== null ){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (existeUbicacion == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + ubicacionDAO.buscarPorId(ubicacion); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Ubicacion buscarIdLi(Ubicacion ubicacion) { + + UbicacionDAO ubicacionDAO = new UbicacionDAO(); + //Aqui le movi + return ubicacionDAO.buscarPorId(ubicacion); + + } + + @Override + public Mensaje buscarNombre(Ubicacion ubicacion) { + UbicacionDAO ubicacionDAO = new UbicacionDAO(); + Ubicacion existeUbicacion = ubicacionDAO.buscarPorNombre(ubicacion); + + if (existeUbicacion == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + return Mensaje.SIN_ERROR; + } + + } + + @Override + public Mensaje buscarEstante(Ubicacion ubicacion) { + UbicacionDAO ubicacionDAO = new UbicacionDAO(); + Ubicacion existeUbicacion = ubicacionDAO.buscarPorEstante(ubicacion); + + if (existeUbicacion == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + return Mensaje.SIN_ERROR; + } + + } + + @Override + public Mensaje buscarFila(Ubicacion ubicacion) { + UbicacionDAO ubicacionDAO = new UbicacionDAO(); + Ubicacion existeUbicacion = ubicacionDAO.buscarPorFila(ubicacion); + + if (existeUbicacion == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + return Mensaje.SIN_ERROR; + } + + } + + + @Override + public Mensaje eliminar(Ubicacion ubicacion) { + UbicacionDAO ubicacionDAO = new UbicacionDAO(); + Ubicacion existe = ubicacionDAO.buscarPorId(ubicacion); + + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + }else if(ubicacion==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + ubicacionDAO.eliminar(ubicacion); + return Mensaje.SIN_ERROR; + + } + + + + } + + @Override + public Mensaje editar(Ubicacion ubicacion) { + System.out.println("Llegaste al metodo de editar"); + UbicacionDAO ubicacionDAO = new UbicacionDAO(); + //Rol existeRol = a.buscarPorId(rol); + if(ubicacion== null){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + //Test de validaciones + if(ubicacion.getNombreAlmacen().isEmpty() | ubicacion.getEstante().isEmpty() | ubicacion.getFila() == 0 + ||ubicacion.getFila()<= 0){ + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if(ubicacion.getNombreAlmacen().length()>=255 | ubicacion.getEstante().length()>=100 ){ + return Mensaje.DATOS_INCORRECTOS; + } + + if(ubicacion.getId()==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + ubicacionDAO.editar(ubicacion); + return Mensaje.SIN_ERROR; + + } + //autorDao.editar(autor); + + } + + + + + + + + + + + + + +} + + diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UsuariosBL.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UsuariosBL.java new file mode 100644 index 0000000..5686113 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UsuariosBL.java @@ -0,0 +1,271 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Stateless; +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.RolDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo.dao.UsuariosDAO; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Rol; + +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Usuarios; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; + +/** + * + * @author Ivan Alejandro PC + */ +@Stateless +public class UsuariosBL implements UsuariosBLLocal { + + @Override + public Mensaje agregar(Usuarios usuarios) { + System.out.println("Llegaste al metodo de agregar!!"); + UsuariosDAO usuariosDAO = new UsuariosDAO(); + RolDAO rolDAO = new RolDAO(); + short status = 1; + usuarios.setStatus(status); + + if (usuarios == null) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + Usuarios existeUsuarios = usuariosDAO.buscarPorId(usuarios); + + //TO DO: agregar la logica + + //Test de validaciones + if (usuarios.getUsuario().isEmpty() || usuarios.getPassword().isEmpty() || usuarios.getSexo().isEmpty() + || usuarios.getStatus() == 0) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (usuarios.getUsuario().length() >= 45 || usuarios.getPassword().length() >= 45 || usuarios.getSexo().length() >= 45) { + return Mensaje.DATOS_INCORRECTOS; + } + if(usuarios.getRolid()==null){ + return Mensaje.CAMPOS_INCOMPLETOS; + + } + + if (existeUsuarios != null) { + return Mensaje.ELEMENTO_DUPLICADO; + } else { + usuariosDAO.agregar(usuarios); + return Mensaje.SIN_ERROR; + + } + } + + @Override + public Mensaje buscarId(Usuarios usuarios) { + try { + // Intenta acceder al objeto + + + UsuariosDAO usuariosDAO = new UsuariosDAO(); + Usuarios existeUsuario = usuariosDAO.buscarPorId(usuarios); + if (usuarios.getId()!= null) { + // Acceder a propiedades o métodos del objeto + if(existeUsuario.getStatus() == 0 ){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + + if (usuarios == null) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (existeUsuario == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + usuariosDAO.buscarPorId(usuarios); + return Mensaje.SIN_ERROR; + + } + } +}else{ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + } catch (NullPointerException e) { + // Maneja la excepción o notifica el error + return Mensaje.ELEMENTO_NO_ENCONTRADO; +} + + } + + + @Override + public Mensaje buscarNombre(Usuarios usuarios) { + try{ + UsuariosDAO usuariosDAO = new UsuariosDAO(); + Usuarios existeUsuario = usuariosDAO.buscarPorNombre(usuarios); + + if(existeUsuario.getStatus()==0){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + }else{ + + if (existeUsuario == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + return Mensaje.SIN_ERROR; + } +} + } catch (NullPointerException e) { + // Maneja la excepción o notifica el error + return Mensaje.ELEMENTO_NO_ENCONTRADO; +} + } + + @Override + public List buscarStatus(short status) { + UsuariosDAO usuariosDAO = new UsuariosDAO(); + return usuariosDAO.buscarStatus(status); +} + + + + @Override + public Usuarios buscarIdLi(Usuarios usuarios) { + UsuariosDAO a = new UsuariosDAO(); + //Aqui le movi + if (a.buscarPorId(usuarios) != null) { + return a.buscarPorId(usuarios); + // Realizar operaciones con el objeto + } else { + return null; + // Manejar el caso en que el objeto sea null + } + + } + + + + + + /*@Override + public Autor eliminar(Autor autor) { + AutorDAO a = new AutorDAO(); + a.eliminar(autor); + return autor; + }*/ + + + @Override + public Mensaje activarUsuarios(Usuarios usuarios) { + UsuariosDAO a = new UsuariosDAO(); + Usuarios existe = a.buscarPorId(usuarios); + + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.activar(usuarios); + return Mensaje.SIN_ERROR; + } + } + + @Override + public Mensaje desactivarUsuarios(Usuarios usuarios) { + UsuariosDAO a = new UsuariosDAO(); + Usuarios existe = a.buscarPorId(usuarios); + if(existe==null){ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + + } + else{ + a.eliminar(usuarios); + return Mensaje.SIN_ERROR; + } + } + + @Override + public Mensaje editar(Usuarios usuarios) { + System.out.println("Llegaste al metodo de editar"); + UsuariosDAO a = new UsuariosDAO(); + //Usuarios existeUsuario = a.buscarPorId(usuarios); + if(usuarios.getStatus()==1){ + if (usuarios == null) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + //Test de validaciones + if (usuarios.getUsuario().isEmpty() || usuarios.getPassword().isEmpty()) { + return Mensaje.CAMPOS_INCOMPLETOS; + } + + if (usuarios.getUsuario().length() >= 45 || usuarios.getPassword().length() >= 45) { + return Mensaje.DATOS_INCORRECTOS; + } + if(usuarios.getRolid()==null){ + return Mensaje.CAMPOS_INCOMPLETOS; + + } + + if (usuarios.getId() == null) { + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } else { + a.editar(usuarios); + return Mensaje.SIN_ERROR; + + } + + }else{ + return Mensaje.ELEMENTO_NO_ENCONTRADO; + } + + //autorDao.editar(autor); + + } + + + + + //Test e login + //Este si funciona pero solo valida usuario y password + public Usuarios buscarPorLoginBL(String username, String password) { + if (username == null || password == null) { + return null; + } + UsuariosDAO usuariosDAO = new UsuariosDAO(); // Instanciar tu clase DAO aquí, o inyectarla si estás usando CDI + return usuariosDAO.buscarPorLoginV2(username, password); + +} + + /*public Usuarios buscarPorLoginStatus(boolean status, Usuarios a) { + UsuariosDAO usuariosDAO = new UsuariosDAO(); + return (Usuarios) usuariosDAO.buscarLogin(status, a.getUsuario(), a.getPassword()); +}*/ +public Usuarios buscarPorLoginStatus(boolean status, Usuarios a) { + if (a.getUsuario().isEmpty() || a.getPassword().isEmpty()) { + System.out.println("Por favor, ingrese usuario y contraseña."); + return null; + } + + UsuariosDAO usuariosDAO = new UsuariosDAO(); + //Usuarios usuario = (Usuarios) usuariosDAO.buscarLogin(status, a.getUsuario(), a.getPassword()); + Usuarios usuario = usuariosDAO.buscarLogin(status, a.getUsuario(), a.getPassword()); + + if (usuario == null) { + System.out.println("Usuario o contraseña incorrectos."); + } else if (usuario.getStatus() == 0) { + System.out.println("El usuario no se ha registrado."); + } + + return usuario; +} + + + + + + + + + //----------------- + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UsuariosBLLocal.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UsuariosBLLocal.java new file mode 100644 index 0000000..43700d8 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/UsuariosBLLocal.java @@ -0,0 +1,43 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +import java.util.List; +import javax.ejb.Local; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Usuarios; +//import mx.edu.chapala.tsj.sistemas.modelo1.Autor; +//import mx.edu.chapala.tsj.sistemas.msg.Mensaje; +import mx.edu.tsj.chapala.sistemas.inventario.msg.Mensaje; +/** + * + * @author Ivan Alejandro PC + */ +@Local +public interface UsuariosBLLocal { + + Mensaje agregar(Usuarios usuarios); + + Mensaje buscarId(Usuarios usuarios); + + Usuarios buscarIdLi(Usuarios usuarios); + + Mensaje buscarNombre(Usuarios usuarios); + + //Mensaje buscarStatus(Usuarios usuarios); + + + + Mensaje editar(Usuarios usuarios); + + public List buscarStatus(short status); + + Mensaje activarUsuarios(Usuarios usuarios); + + Mensaje desactivarUsuarios(Usuarios usuarios); + + public Usuarios buscarPorLoginBL(String username, String password); + public Usuarios buscarPorLoginStatus(boolean status, Usuarios a); + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/bl.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/bl.java new file mode 100644 index 0000000..21e002b --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/bl/bl.java @@ -0,0 +1,13 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.bl; + +/** + * + * @author Ivan Alejandro PC + */ +public class bl { + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/CategoriaDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/CategoriaDAO.java new file mode 100644 index 0000000..b70e383 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/CategoriaDAO.java @@ -0,0 +1,102 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Categoria; + +/** + * + * @author gael4 //hola + */ +public class CategoriaDAO { + + private EntityManager em; //Manejadro de identidades + + public CategoriaDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Categoria a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Categoria a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + + + + } + public void eliminar(Categoria a){ + em.getTransaction().begin();//Empezar + em.remove(em.merge(a));//Eliminar en la BD + em.getTransaction().commit();// terminar + + } + + + + + + public Categoria buscarPorId(Categoria a){ + if (a == null || a.getId()== null) { + return null; + } + 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 buscarPorGenero(Categoria a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Genero.findByGenero"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Categoria) q.getResultList().get(0); + } +} + + public Categoria buscarTodos(Categoria a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Genero.findAll"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Categoria) q.getResultList().get(0); + } +} + + public List buscarTodos(){ + + Query q = em.createNamedQuery("Categoria.findAll"); + return q.getResultList(); + } +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ColorDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ColorDAO.java new file mode 100644 index 0000000..7a31cde --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ColorDAO.java @@ -0,0 +1,96 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Color; + +/** + * + * @author Ivan Alejandro PC + */ +public class ColorDAO { + + private EntityManager em; //Manejadro de identidades + + public ColorDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Color a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Color a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + + + + } + public void eliminar(Color a){ + em.getTransaction().begin();//Empezar + em.remove(em.merge(a));//Eliminar en la BD + em.getTransaction().commit();// terminar + + } + + + public Color buscarPorColorName(Color a){ + /*if(a.getStatus()==0){ + return null; + }*/ + if (a.getColor()== null) { + return null; + } + Query q = em.createNamedQuery("Color.findByColor"); + q.setParameter("rolUsuario", a.getColor()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + return resultList.get(0); + } +} + + + public Color buscarPorId(Color a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Color.findById"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Color) q.getResultList().get(0); + } +} + + + + public List buscarTodos(){ + Query q = em.createNamedQuery("Color.findAll"); + return q.getResultList(); +} + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/GeneroDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/GeneroDAO.java new file mode 100644 index 0000000..a227fc5 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/GeneroDAO.java @@ -0,0 +1,99 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.Collections; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Genero; + +/** + * + * @author Ivan Alejandro PC + */ +public class GeneroDAO { + + private EntityManager em; //Manejadro de identidades + + public GeneroDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Genero a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Genero a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + + + + } + public void eliminar(Genero a){ + em.getTransaction().begin();//Empezar + em.remove(em.merge(a));//Eliminar en la BD + em.getTransaction().commit();// terminar + + } + + + + + + public Genero buscarPorId(Genero a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Genero.findById"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Genero) q.getResultList().get(0); + } +} + + public Genero buscarPorGenero(Genero a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Genero.findByGenero"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Genero) q.getResultList().get(0); + } +} + +public List buscarTodos(){ + /*if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Genero.findAll"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return q.getResultList(); + }*/ + Query q = em.createNamedQuery("Genero.findAll"); + return q.getResultList(); + } +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/MarcaDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/MarcaDAO.java new file mode 100644 index 0000000..46b17e4 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/MarcaDAO.java @@ -0,0 +1,100 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Marca; + +/** + * + * @author Ivan Alejandro PC + */ +public class MarcaDAO { + + private EntityManager em; //Manejadro de identidades + + public MarcaDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Marca a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Marca a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + } + + public void eliminar(Marca a){ + em.getTransaction().begin();//Empezar + em.remove(em.merge(a));//Eliminar en la BD + em.getTransaction().commit();// terminar + + } + + + + public Marca buscarPorId(Marca a){ + if (a == null || a.getId()== null) { + return null; + } + 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 buscarPorGenero(Marca a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Marca.findByMarca"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Marca) q.getResultList().get(0); + } +} + + public Marca buscarTodos(Marca a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Marca.findAll"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Marca) q.getResultList().get(0); + } +} + + public List buscarTodos(){ + + Query q = em.createNamedQuery("Marca.findAll"); + return q.getResultList(); + } + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ProductosDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ProductosDAO.java new file mode 100644 index 0000000..59a3ef6 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ProductosDAO.java @@ -0,0 +1,134 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Productos; + +/** + * + * @author Ivan Alejandro PC + */ +public class ProductosDAO { + + private EntityManager em; //Manejadro de identidades + + public ProductosDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Productos a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Productos a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + + + + } + + public void activar(Productos a){ + em.getTransaction().begin();//Empezar + //em.remove(em.merge(a));//Eliminar en la BD + a.setStatus((short)1); + em.merge(a); + em.getTransaction().commit();// terminar + } + + public void eliminar(Productos a){ + em.getTransaction().begin();//Empezar + //em.remove(em.merge(a));//Eliminar en la BD + a.setStatus((short)0); + em.merge(a); + em.getTransaction().commit();// terminar + } + + + + + + public Productos buscarPorId(Productos a){ + if (a != null) { + Query q = em.createNamedQuery("Productos.findById"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Productos) q.getResultList().get(0); + } + // Hacer algo con el objeto +} else { + return null; + // El objeto es null, manejar este caso +} + /* if (a == null || a.getId()== null | a.getId() == -1) { + return null; + }*/ + +} + + public Productos buscarPorNombre(Productos a){ + /*if(a.getStatus()==0){ + return null; + }*/ + if (a.getNombre()== null) { + return null; + } + Query q = em.createNamedQuery("Productos.findByNombre"); + q.setParameter("nombre", a.getNombre()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + return resultList.get(0); + } +} + public List buscarStatus(short status) { + Query q = em.createNamedQuery("Productos.findByStatus"); + q.setParameter("status", status); + return q.getResultList(); +} + + public List buscarTodos(boolean status){ + Query q = em.createNamedQuery("Productos.findAll"); + int s = status?1:0; + q.setParameter("status", s); + return q.getResultList(); +} + + + public Productos buscarPorExistencia(Productos a){ + if (a == null || a.getId()== null || a.getExistencia()==0 || a.getExistencia()==-1) { + return null; + } + Query q = em.createNamedQuery("Productos.findByExistencia"); + q.setParameter("existencia", a.getExistencia()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Productos) q.getResultList(); + } +} + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ProveedoresDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ProveedoresDAO.java new file mode 100644 index 0000000..3890709 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/ProveedoresDAO.java @@ -0,0 +1,140 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +//import mx.edu.tsj.chapala.sistemas.inventario.modelo.Proveedores; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Proveedores; + +/** + * + * @author Ivan Alejandro PC + */ +public class ProveedoresDAO { + + private EntityManager em; //Manejadro de identidades + + public ProveedoresDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Proveedores a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Proveedores a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + } + public void eliminar(Proveedores a){ + em.getTransaction().begin();//Empezar + //em.remove(em.merge(a));//Eliminar en la BD + a.setStatus((short)0); + em.merge(a); + em.getTransaction().commit();// terminar + } + + public void activar(Proveedores a){ + em.getTransaction().begin();//Empezar + //em.remove(em.merge(a));//Eliminar en la BD + a.setStatus((short)1); + em.merge(a); + em.getTransaction().commit();// terminar + } + + public Proveedores buscarPorId(Proveedores a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Proveedores.findById"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Proveedores) q.getResultList().get(0); + } +} + + public Proveedores buscarPorNombre(Proveedores a){ + if (a.getNombre()== null) { + return null; + } + Query q = em.createNamedQuery("Proveedores.findByNombre"); + q.setParameter("nombre", a.getNombre()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + return resultList.get(0); + } +} + + public Proveedores buscarTodos(Proveedores a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Proveedores.findAll"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Proveedores) q.getResultList().get(0); + } +} + + public Proveedores buscarPorCorreo(Proveedores a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Proveedores.findByCorreo"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Proveedores) q.getResultList().get(0); + } +} + public List buscarPorStatus(short status){ + Query q = em.createNamedQuery("Proveedores.findByStatus"); + q.setParameter("status", status); + return q.getResultList(); + +} + + public Proveedores buscarPorTipoProducto(Proveedores a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Proveedores.findByTipoProducto"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Proveedores) q.getResultList().get(0); + } + } + + public List getTodos(boolean status){ + Query q = em.createNamedQuery("Proveedores.findByStatus"); + //q.setParameter("status", 1); + //return q.getResultList(); + int s = status?1:0; + q.setParameter("status", s); + return q.getResultList(); + } +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/RolDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/RolDAO.java new file mode 100644 index 0000000..7619615 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/RolDAO.java @@ -0,0 +1,96 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Rol; + +/** + * + * @author Ivan Alejandro PC + */ +public class RolDAO { + + private EntityManager em; //Manejadro de identidades + + public RolDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Rol a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Rol a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + + + + } + public void eliminar(Rol a){ + em.getTransaction().begin();//Empezar + em.remove(em.merge(a));//Eliminar en la BD + em.getTransaction().commit();// terminar + + } + + + public Rol buscarPorRolName(Rol a){ + /*if(a.getStatus()==0){ + return null; + }*/ + if (a.getRolUsuario()== null) { + return null; + } + Query q = em.createNamedQuery("Rol.findByRolUsuario"); + q.setParameter("rolUsuario", a.getRolUsuario()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + return resultList.get(0); + } +} + + + public Rol buscarPorId(Rol a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Rol.findById"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Rol) q.getResultList().get(0); + } +} + + + + public List buscarTodos(){ + Query q = em.createNamedQuery("Rol.findAll"); + return q.getResultList(); +} + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/TallaDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/TallaDAO.java new file mode 100644 index 0000000..0aac5c4 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/TallaDAO.java @@ -0,0 +1,102 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Talla; + +/** + * + * @author Ivan Alejandro PC + */ +public class TallaDAO { + + private EntityManager em; //Manejadro de identidades + + public TallaDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Talla a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Talla a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + + + + } + public void eliminar(Talla a){ + em.getTransaction().begin();//Empezar + em.remove(em.merge(a));//Eliminar en la BD + em.getTransaction().commit();// terminar + + } + + + + + + public Talla buscarPorId(Talla a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Talla.findById"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Talla) q.getResultList().get(0); + } +} + + public Talla buscarPorTalla(Talla a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Talla.findByTalla"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Talla) q.getResultList().get(0); + } +} + + public Talla buscarTodos(Talla a){ + if (a == null || a.getId()== null) { + return null; + } + Query q = em.createNamedQuery("Talla.findAll"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Talla) q.getResultList().get(0); + } +} + + public List buscarTodos(){ + + Query q = em.createNamedQuery("Talla.findAll"); + return q.getResultList(); + } +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/UbicacionDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/UbicacionDAO.java new file mode 100644 index 0000000..8cfc7f0 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/UbicacionDAO.java @@ -0,0 +1,139 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Ubicacion; + +/** + * + * @author Ivan Alejandro PC + */ +public class UbicacionDAO { + + private EntityManager em; //Manejadro de identidades + + public UbicacionDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Ubicacion a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Ubicacion a){ + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + + + + } + public void eliminar(Ubicacion a){ + em.getTransaction().begin();//Empezar + em.remove(em.merge(a));//Eliminar en la BD + em.getTransaction().commit();// terminar + + } + + + + + + public Ubicacion buscarPorId(Ubicacion a){ + if (a != null) { + if (a.getId() == null) { + // Manejar el caso en que el ID sea nulo + return null; + } + if (a == null || a.getId()== null | a.getId() == -1) { + return null; + } + Query q = em.createNamedQuery("Ubicacion.findById"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Ubicacion) q.getResultList().get(0); + } + }else{ + return null; + } + +} + + public Ubicacion buscarPorNombre(Ubicacion a){ + /*if(a.getStatus()==0){ + return null; + }*/ + if (a.getNombreAlmacen()== null) { + return null; + } + Query q = em.createNamedQuery("Ubicacion.findByNombreAlmacen"); + q.setParameter("nombreAlmacen", a.getNombreAlmacen()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + return resultList.get(0); + } +} + + public Ubicacion buscarPorEstante(Ubicacion a){ + /*if(a.getStatus()==0){ + return null; + }*/ + if (a.getEstante()== null) { + return null; + } + Query q = em.createNamedQuery("Ubicacion.findByEstante"); + q.setParameter("estante", a.getEstante()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + return resultList.get(0); + } +} + + public Ubicacion buscarPorFila(Ubicacion a){ + /*if(a.getStatus()==0){ + return null; + }*/ + if (a.getFila()== -1 | a.getFila() == 0) { + return null; + } + Query q = em.createNamedQuery("Ubicacion.findByFila"); + q.setParameter("fila", a.getFila()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + return resultList.get(0); + } +} + + public List buscarTodos(){ + Query q = em.createNamedQuery("Ubicacion.findAll"); + return q.getResultList(); +} + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/UsuariosDAO.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/UsuariosDAO.java new file mode 100644 index 0000000..dbfe4c1 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo/dao/UsuariosDAO.java @@ -0,0 +1,212 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo.dao; + +import java.util.ArrayList; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import mx.edu.tsj.chapala.sistemas.inventario.modelo1.Usuarios; + +/** + * + * @author Ivan Alejandro PC + */ +public class UsuariosDAO { + + private EntityManager em; //Manejadro de identidades + + public UsuariosDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("Inventario-ejbPU"); + em = emf.createEntityManager(); + } + /* + Este es un prueba de actualizar + */ + + public void agregar(Usuarios a){ + em.getTransaction().begin();//Empezar + em.persist(a);//Almacenar en la BD + em.getTransaction().commit();// terminar + + } + + public void editar(Usuarios a){ + + + em.getTransaction().begin();//Empezar + em.merge(a);//Actualizar en la BD + em.getTransaction().commit();// terminar + + + + } + + public void activar(Usuarios a){ + em.getTransaction().begin();//Empezar + //em.remove(em.merge(a));//Eliminar en la BD + a.setStatus((short)1); + em.merge(a); + em.getTransaction().commit();// terminar + } + + public void eliminar(Usuarios a){ + em.getTransaction().begin();//Empezar + //em.remove(em.merge(a));//Eliminar en la BD + a.setStatus((short)0); + em.merge(a); + em.getTransaction().commit();// terminar + } + + + + public Usuarios buscarPorId(Usuarios a){ + if (a != null) { + // Hacer algo con el objeto + Query q = em.createNamedQuery("Usuarios.findById"); + q.setParameter("id", a.getId()); + if(q.getResultList().isEmpty()){ + return null; + } else { + return (Usuarios) q.getResultList().get(0); + } +} else { + return null; + // El objeto es null, manejar este caso +} + + /* if (a == null || a.getId()== null | a.getId() == -1) { + return null; + }*/ + +} + + public Usuarios buscarPorNombre(Usuarios a){ + /*if(a.getStatus()==0){ + return null; + }*/ + if (a.getUsuario() == null) { + return null; + } + Query q = em.createNamedQuery("Usuarios.findByUsuario"); + q.setParameter("usuario", a.getUsuario()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + return resultList.get(0); + } +} + + public List buscarStatus(short status) { + Query q = em.createNamedQuery("Usuarios.findByStatus"); + q.setParameter("status", status); + return q.getResultList(); +} + + + public List buscarTodos(boolean status){ + Query q = em.createNamedQuery("Usuarios.findAll"); + int s = status?1:0; + q.setParameter("status", s); + return q.getResultList(); +} + + //Aqui es un test para crear las validaciones de usuarios + + /*public Usuarios validarUsuario(String usuario, String contrasena) { + Usuarios usuarioEncontrado = buscarPorValidaciones(usuario); + if (usuarioEncontrado != null && usuarioEncontrado.getPassword().equals(contrasena)) { + return usuarioEncontrado; + } else { + return null; + } +} + +private Usuarios buscarPorValidaciones(String usuario) { + Query q = em.createNamedQuery("Usuarios.validar"); + q.setParameter("usuario", usuario); + List resultList = q.getResultList(); + return resultList.isEmpty() ? null : resultList.get(0); +}*/ + /*public Usuarios validarUsuario(String usuario, String contrasena) { + Usuarios usuarioEncontrado = buscarPorValidaciones(usuario); + if (usuarioEncontrado != null && usuarioEncontrado.getPassword().equals(contrasena)) { + return usuarioEncontrado; + } else { + return null; + } + } + + private Usuarios buscarPorValidaciones(String usuario) { + Query q = em.createNamedQuery("Usuarios.validar"); + q.setParameter("usuario", usuario); + List resultList = q.getResultList(); + return resultList.isEmpty() ? null : resultList.get(0); + } + */ + //Test para validar el login + public Usuarios buscarLogin(boolean status, String username, String password) { + if (username == null) { + return null; + } + Query q = em.createNamedQuery("Usuarios.validar"); + int s = status ? 1 : 0; + q.setParameter("status", s); + q.setParameter("usuario", username); + q.setParameter("password", password); + List resultList = q.getResultList(); + if (resultList.isEmpty()) { + return null; + } else { + return resultList.get(0); // Devuelve el primer elemento de la lista + } +} + + + + /*public List buscarLogin(boolean status, Usuarios a){ + if (a.getUsuario() == null) { + return null; + } + Query q = em.createNamedQuery("Usuarios.validar"); + int s = status?1:0; + q.setParameter("status", s); + q.setParameter("usuario", a.getUsuario()); + q.setParameter("password", a.getPassword()); + List resultList = q.getResultList(); + if(resultList.isEmpty()){ + return null; + } else { + //return resultList.get(0); + return q.getResultList(); + } + //return q.getResultList(); +} + */ + + public Usuarios buscarPorLoginV2(String username, String password) { + if (username == null || password == null) { + return null; + } + Query q = em.createNamedQuery("Usuarios.login"); + q.setParameter("usuario", username); + q.setParameter("password", password); + List resultList = q.getResultList(); + if (resultList.isEmpty()) { + return null; + } else { + return resultList.get(0); // Suponiendo que el nombre de usuario es único + } +} + + + + + + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Categoria.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Categoria.java new file mode 100644 index 0000000..be4c71c --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Categoria.java @@ -0,0 +1,125 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +import java.util.Collection; +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 Ivan Alejandro PC + */ +@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.findByCategoria", query = "SELECT c FROM Categoria c WHERE c.categoria = :categoria")}) +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 = "categoria") + private String categoria; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaid") + private Collection proveedoresCollection; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaid") + private Collection productosCollection; + + public Categoria() { + } + + public Categoria(Integer id) { + this.id = id; + } + + public Categoria(Integer id, String categoria) { + this.id = id; + this.categoria = categoria; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + @XmlTransient + public Collection getProveedoresCollection() { + return proveedoresCollection; + } + + public void setProveedoresCollection(Collection proveedoresCollection) { + this.proveedoresCollection = proveedoresCollection; + } + + @XmlTransient + public Collection getProductosCollection() { + return productosCollection; + } + + public void setProductosCollection(Collection productosCollection) { + this.productosCollection = productosCollection; + } + + @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.tsj.chapala.sistemas.inventario.modelo1.Categoria[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Color.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Color.java new file mode 100644 index 0000000..6ec645a --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Color.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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +import java.util.Collection; +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 Ivan Alejandro PC + */ +@Entity +@Table(name = "color") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Color.findAll", query = "SELECT c FROM Color c"), + @NamedQuery(name = "Color.findById", query = "SELECT c FROM Color c WHERE c.id = :id"), + @NamedQuery(name = "Color.findByColor", query = "SELECT c FROM Color c WHERE c.color = :color")}) +public class Color 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 = "color") + private String color; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "colorid") + private Collection productosCollection; + + public Color() { + } + + public Color(Integer id) { + this.id = id; + } + + public Color(Integer id, String color) { + this.id = id; + this.color = color; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + @XmlTransient + public Collection getProductosCollection() { + return productosCollection; + } + + public void setProductosCollection(Collection productosCollection) { + this.productosCollection = productosCollection; + } + + @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 Color)) { + return false; + } + Color other = (Color) 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.tsj.chapala.sistemas.inventario.modelo1.Color[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Genero.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Genero.java new file mode 100644 index 0000000..c355c0d --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Genero.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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +import java.util.Collection; +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 Ivan Alejandro PC + */ +@Entity +@Table(name = "genero") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Genero.findAll", query = "SELECT g FROM Genero g"), + @NamedQuery(name = "Genero.findById", query = "SELECT g FROM Genero g WHERE g.id = :id"), + @NamedQuery(name = "Genero.findByGenero", query = "SELECT g FROM Genero g WHERE g.genero = :genero")}) +public class Genero 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 = "genero") + private String genero; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "generoid") + private Collection productosCollection; + + public Genero() { + } + + public Genero(Integer id) { + this.id = id; + } + + public Genero(Integer id, String genero) { + this.id = id; + this.genero = genero; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getGenero() { + return genero; + } + + public void setGenero(String genero) { + this.genero = genero; + } + + @XmlTransient + public Collection getProductosCollection() { + return productosCollection; + } + + public void setProductosCollection(Collection productosCollection) { + this.productosCollection = productosCollection; + } + + @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 Genero)) { + return false; + } + Genero other = (Genero) 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.tsj.chapala.sistemas.inventario.modelo1.Genero[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Marca.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Marca.java new file mode 100644 index 0000000..7d7428e --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Marca.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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +import java.util.Collection; +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 Ivan Alejandro PC + */ +@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.findByMarca", query = "SELECT m FROM Marca m WHERE m.marca = :marca")}) +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 = "marca") + private String marca; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "marcaid") + private Collection productosCollection; + + public Marca() { + } + + public Marca(Integer id) { + this.id = id; + } + + public Marca(Integer id, String marca) { + this.id = id; + this.marca = marca; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getMarca() { + return marca; + } + + public void setMarca(String marca) { + this.marca = marca; + } + + @XmlTransient + public Collection getProductosCollection() { + return productosCollection; + } + + public void setProductosCollection(Collection productosCollection) { + this.productosCollection = productosCollection; + } + + @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.tsj.chapala.sistemas.inventario.modelo1.Marca[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Productos.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Productos.java new file mode 100644 index 0000000..d9c931c --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Productos.java @@ -0,0 +1,251 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +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.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * @author Ivan Alejandro PC + */ +@Entity +@Table(name = "productos") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Productos.findAll", query = "SELECT p FROM Productos p"), + @NamedQuery(name = "Productos.findById", query = "SELECT p FROM Productos p WHERE p.id = :id"), + @NamedQuery(name = "Productos.findByNombre", query = "SELECT p FROM Productos p WHERE p.nombre = :nombre"), + @NamedQuery(name = "Productos.findByDescripcion", query = "SELECT p FROM Productos p WHERE p.descripcion = :descripcion"), + @NamedQuery(name = "Productos.findByPrecio", query = "SELECT p FROM Productos p WHERE p.precio = :precio"), + @NamedQuery(name = "Productos.findByMaterial", query = "SELECT p FROM Productos p WHERE p.material = :material"), + @NamedQuery(name = "Productos.findByExistencia", query = "SELECT p FROM Productos p WHERE p.existencia = :existencia"), + @NamedQuery(name = "Productos.findByStatus", query = "SELECT p FROM Productos p WHERE p.status = :status")}) +public class Productos 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 = 100) + @Column(name = "descripcion") + private String descripcion; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "precio") + private String precio; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "material") + private String material; + @Basic(optional = false) + @NotNull + @Column(name = "existencia") + private int existencia; + @Basic(optional = false) + @NotNull + @Column(name = "status") + private short status; + @JoinColumn(name = "Categoria_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Categoria categoriaid; + @JoinColumn(name = "Color_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Color colorid; + @JoinColumn(name = "Genero_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Genero generoid; + @JoinColumn(name = "Marca_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Marca marcaid; + @JoinColumn(name = "Proveedores_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Proveedores proveedoresid; + @JoinColumn(name = "Talla_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Talla tallaid; + @JoinColumn(name = "Ubicacion_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Ubicacion ubicacionid; + + public Productos() { + } + + public Productos(Integer id) { + this.id = id; + } + + public Productos(Integer id, String nombre, String descripcion, String precio, String material, int existencia, short status) { + this.id = id; + this.nombre = nombre; + this.descripcion = descripcion; + this.precio = precio; + this.material = material; + this.existencia = existencia; + 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 getDescripcion() { + return descripcion; + } + + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + public String getPrecio() { + return precio; + } + + public void setPrecio(String precio) { + this.precio = precio; + } + + public String getMaterial() { + return material; + } + + public void setMaterial(String material) { + this.material = material; + } + + public int getExistencia() { + return existencia; + } + + public void setExistencia(int existencia) { + this.existencia = existencia; + } + + public short getStatus() { + return status; + } + + public void setStatus(short status) { + this.status = status; + } + + public Categoria getCategoriaid() { + return categoriaid; + } + + public void setCategoriaid(Categoria categoriaid) { + this.categoriaid = categoriaid; + } + + public Color getColorid() { + return colorid; + } + + public void setColorid(Color colorid) { + this.colorid = colorid; + } + + public Genero getGeneroid() { + return generoid; + } + + public void setGeneroid(Genero generoid) { + this.generoid = generoid; + } + + public Marca getMarcaid() { + return marcaid; + } + + public void setMarcaid(Marca marcaid) { + this.marcaid = marcaid; + } + + public Proveedores getProveedoresid() { + return proveedoresid; + } + + public void setProveedoresid(Proveedores proveedoresid) { + this.proveedoresid = proveedoresid; + } + + public Talla getTallaid() { + return tallaid; + } + + public void setTallaid(Talla tallaid) { + this.tallaid = tallaid; + } + + public Ubicacion getUbicacionid() { + return ubicacionid; + } + + public void setUbicacionid(Ubicacion ubicacionid) { + this.ubicacionid = ubicacionid; + } + + @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 Productos)) { + return false; + } + Productos other = (Productos) 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.tsj.chapala.sistemas.inventario.modelo1.Productos[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Proveedores.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Proveedores.java new file mode 100644 index 0000000..667d41b --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Proveedores.java @@ -0,0 +1,213 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +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.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; + + +@Entity +@Table(name = "proveedores") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Proveedores.findAll", query = "SELECT p FROM Proveedores p"), + @NamedQuery(name = "Proveedores.findById", query = "SELECT p FROM Proveedores p WHERE p.id = :id"), + @NamedQuery(name = "Proveedores.findByNombre", query = "SELECT p FROM Proveedores p WHERE p.nombre = :nombre"), + @NamedQuery(name = "Proveedores.findByCorreo", query = "SELECT p FROM Proveedores p WHERE p.correo = :correo"), + @NamedQuery(name = "Proveedores.findByDireccion", query = "SELECT p FROM Proveedores p WHERE p.direccion = :direccion"), + @NamedQuery(name = "Proveedores.findByPais", query = "SELECT p FROM Proveedores p WHERE p.pais = :pais"), + @NamedQuery(name = "Proveedores.findByCiudad", query = "SELECT p FROM Proveedores p WHERE p.ciudad = :ciudad"), + @NamedQuery(name = "Proveedores.findByEstado", query = "SELECT p FROM Proveedores p WHERE p.estado = :estado"), + @NamedQuery(name = "Proveedores.findByTelefono", query = "SELECT p FROM Proveedores p WHERE p.telefono = :telefono"), + @NamedQuery(name = "Proveedores.findByStatus", query = "SELECT p FROM Proveedores p WHERE p.status = :status")}) +public class Proveedores 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 = 255) + @Column(name = "nombre") + private String nombre; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 70) + @Column(name = "correo") + private String correo; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 100) + @Column(name = "direccion") + private String direccion; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 40) + @Column(name = "pais") + private String pais; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "ciudad") + private String ciudad; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "estado") + private String estado; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 20) + @Column(name = "telefono") + private String telefono; + @Basic(optional = false) + @NotNull + @Column(name = "status") + private short status; + @JoinColumn(name = "Categoria_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Categoria categoriaid; + + public Proveedores() { + } + + public Proveedores(Integer id) { + this.id = id; + } + + public Proveedores(Integer id, String nombre, String correo, String direccion, String pais, String ciudad, String estado, String telefono, short status) { + this.id = id; + this.nombre = nombre; + this.correo = correo; + this.direccion = direccion; + this.pais = pais; + this.ciudad = ciudad; + this.estado = estado; + this.telefono = telefono; + 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 getCorreo() { + return correo; + } + + public void setCorreo(String correo) { + this.correo = correo; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public String getPais() { + return pais; + } + + public void setPais(String pais) { + this.pais = pais; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getTelefono() { + return telefono; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public short getStatus() { + return status; + } + + public void setStatus(short status) { + this.status = status; + } + + public Categoria getCategoriaid() { + return categoriaid; + } + + public void setCategoriaid(Categoria categoriaid) { + this.categoriaid = categoriaid; + } + + @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 Proveedores)) { + return false; + } + Proveedores other = (Proveedores) 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.tsj.chapala.sistemas.inventario.modelo1.Proveedores[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Rol.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Rol.java new file mode 100644 index 0000000..8edf689 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +import java.util.Collection; +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 Ivan Alejandro PC + */ +@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.findByRolUsuario", query = "SELECT r FROM Rol r WHERE r.rolUsuario = :rolUsuario")}) +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 = "rolUsuario") + private String rolUsuario; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "rolid") + private Collection usuariosCollection; + + public Rol() { + } + + public Rol(Integer id) { + this.id = id; + } + + public Rol(Integer id, String rolUsuario) { + this.id = id; + this.rolUsuario = rolUsuario; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getRolUsuario() { + return rolUsuario; + } + + public void setRolUsuario(String rolUsuario) { + this.rolUsuario = rolUsuario; + } + + @XmlTransient + public Collection getUsuariosCollection() { + return usuariosCollection; + } + + public void setUsuariosCollection(Collection usuariosCollection) { + this.usuariosCollection = usuariosCollection; + } + + @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.tsj.chapala.sistemas.inventario.modelo1.Rol[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Talla.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Talla.java new file mode 100644 index 0000000..67c3745 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Talla.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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +import java.util.Collection; +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 Ivan Alejandro PC + */ +@Entity +@Table(name = "talla") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Talla.findAll", query = "SELECT t FROM Talla t"), + @NamedQuery(name = "Talla.findById", query = "SELECT t FROM Talla t WHERE t.id = :id"), + @NamedQuery(name = "Talla.findByTalla", query = "SELECT t FROM Talla t WHERE t.talla = :talla")}) +public class Talla 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 = 10) + @Column(name = "talla") + private String talla; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "tallaid") + private Collection productosCollection; + + public Talla() { + } + + public Talla(Integer id) { + this.id = id; + } + + public Talla(Integer id, String talla) { + this.id = id; + this.talla = talla; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTalla() { + return talla; + } + + public void setTalla(String talla) { + this.talla = talla; + } + + @XmlTransient + public Collection getProductosCollection() { + return productosCollection; + } + + public void setProductosCollection(Collection productosCollection) { + this.productosCollection = productosCollection; + } + + @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 Talla)) { + return false; + } + Talla other = (Talla) 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.tsj.chapala.sistemas.inventario.modelo1.Talla[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Ubicacion.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Ubicacion.java new file mode 100644 index 0000000..af68c76 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Ubicacion.java @@ -0,0 +1,143 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo1; + +import java.io.Serializable; +import java.util.Collection; +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 Ivan Alejandro PC + */ +@Entity +@Table(name = "ubicacion") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Ubicacion.findAll", query = "SELECT u FROM Ubicacion u"), + @NamedQuery(name = "Ubicacion.findById", query = "SELECT u FROM Ubicacion u WHERE u.id = :id"), + @NamedQuery(name = "Ubicacion.findByNombreAlmacen", query = "SELECT u FROM Ubicacion u WHERE u.nombreAlmacen = :nombreAlmacen"), + @NamedQuery(name = "Ubicacion.findByEstante", query = "SELECT u FROM Ubicacion u WHERE u.estante = :estante"), + @NamedQuery(name = "Ubicacion.findByFila", query = "SELECT u FROM Ubicacion u WHERE u.fila = :fila")}) +public class Ubicacion 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 = 255) + @Column(name = "nombreAlmacen") + private String nombreAlmacen; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 100) + @Column(name = "estante") + private String estante; + @Basic(optional = false) + @NotNull + @Column(name = "fila") + private int fila; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "ubicacionid") + private Collection productosCollection; + + public Ubicacion() { + } + + public Ubicacion(Integer id) { + this.id = id; + } + + public Ubicacion(Integer id, String nombreAlmacen, String estante, int fila) { + this.id = id; + this.nombreAlmacen = nombreAlmacen; + this.estante = estante; + this.fila = fila; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNombreAlmacen() { + return nombreAlmacen; + } + + public void setNombreAlmacen(String nombreAlmacen) { + this.nombreAlmacen = nombreAlmacen; + } + + public String getEstante() { + return estante; + } + + public void setEstante(String estante) { + this.estante = estante; + } + + public int getFila() { + return fila; + } + + public void setFila(int fila) { + this.fila = fila; + } + + @XmlTransient + public Collection getProductosCollection() { + return productosCollection; + } + + public void setProductosCollection(Collection productosCollection) { + this.productosCollection = productosCollection; + } + + @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 Ubicacion)) { + return false; + } + Ubicacion other = (Ubicacion) 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.tsj.chapala.sistemas.inventario.modelo1.Ubicacion[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Usuarios.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Usuarios.java new file mode 100644 index 0000000..cc4afc5 --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/modelo1/Usuarios.java @@ -0,0 +1,177 @@ +/* + * 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.tsj.chapala.sistemas.inventario.modelo1; + +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 Ivan Alejandro PC + */ +@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.findByPassword", query = "SELECT u FROM Usuarios u WHERE u.password = :password"), + @NamedQuery(name = "Usuarios.findByFechaRegistro", query = "SELECT u FROM Usuarios u WHERE u.fechaRegistro = :fechaRegistro"), + @NamedQuery(name = "Usuarios.findBySexo", query = "SELECT u FROM Usuarios u WHERE u.sexo = :sexo"), + @NamedQuery(name = "Usuarios.findByStatus", query = "SELECT u FROM Usuarios u WHERE u.status = :status"), + @NamedQuery(name = "Usuarios.validar", query = "SELECT u FROM Usuarios u WHERE u.status = :status and u.usuario = :usuario and u.password = :password"), + @NamedQuery(name = "Usuarios.login", query = "SELECT u FROM Usuarios u WHERE u.usuario = :usuario and u.password = :password")}) + +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 = "password") + private String password; + @Basic(optional = false) + @NotNull + @Column(name = "fechaRegistro") + @Temporal(TemporalType.DATE) + private Date fechaRegistro; + @Basic(optional = false) + @NotNull + @Size(min = 1, max = 45) + @Column(name = "sexo") + private String sexo; + @Basic(optional = false) + @NotNull + @Column(name = "status") + private short status; + @JoinColumn(name = "Rol_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Rol rolid; + + public Usuarios() { + } + + public Usuarios(Integer id) { + this.id = id; + } + + public Usuarios(Integer id, String usuario, String password, Date fechaRegistro, String sexo, short status) { + this.id = id; + this.usuario = usuario; + this.password = password; + this.fechaRegistro = fechaRegistro; + this.sexo = sexo; + this.status = status; + } + + 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 getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Date getFechaRegistro() { + return fechaRegistro; + } + + public void setFechaRegistro(Date fechaRegistro) { + this.fechaRegistro = fechaRegistro; + } + + public String getSexo() { + return sexo; + } + + public void setSexo(String sexo) { + this.sexo = sexo; + } + + public short getStatus() { + return status; + } + + public void setStatus(short status) { + this.status = status; + } + + public Rol getRolid() { + return rolid; + } + + public void setRolid(Rol rolid) { + this.rolid = rolid; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Usuarios)) { + return false; + } + Usuarios other = (Usuarios) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "mx.edu.tsj.chapala.sistemas.inventario.modelo1.Usuarios[ id=" + id + " ]"; + } + +} diff --git a/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/msg/Mensaje.java b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/msg/Mensaje.java new file mode 100644 index 0000000..d0fa59c --- /dev/null +++ b/Inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/inventario/msg/Mensaje.java @@ -0,0 +1,20 @@ +/* + * 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.tsj.chapala.sistemas.inventario.msg; + +/** + * + * @author Ivan Alejandro PC + */ +public enum Mensaje { + //Erroes genrales que se va a dar en la app + SIN_ERROR, + CAMPOS_INCOMPLETOS, + DATOS_INCORRECTOS, + ELEMENTO_DUPLICADO, + ELEMENTO_NO_ENCONTRADO, + AUTOR_O_EDITORIAL_INCOMPLETOS, + +} 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/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..abb1239 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,635 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..12e49fa --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=c2bbad60 +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=c2bbad60 +nbproject/build-impl.xml.script.CRC32=8a3446c7 +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..43843d4 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,40 @@ +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.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 +source.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..96b2572 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,39 @@ + + + org.netbeans.modules.j2ee.earproject + + + Inventario + 1.6.5 + + + + ${reference.Inventario-war.dist-ear} + / + + + ${reference.Inventario-ejb.dist-ear} + / + + + + + + 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 +