Browse Source

version god login

master
ktalamantes 4 months ago
commit
44ab978872
  1. 5
      .gitignore
  2. 61
      build.xml
  3. 68
      inventario-ejb/build.xml
  4. 131
      inventario-ejb/nbproject/ant-deploy.xml
  5. 1235
      inventario-ejb/nbproject/build-impl.xml
  6. 8
      inventario-ejb/nbproject/genfiles.properties
  7. 78
      inventario-ejb/nbproject/project.properties
  8. 18
      inventario-ejb/nbproject/project.xml
  9. 2
      inventario-ejb/src/conf/MANIFEST.MF
  10. 13
      inventario-ejb/src/conf/META-INF/glassfish-resources.xml
  11. 8
      inventario-ejb/src/conf/persistence.xml
  12. 107
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/CategoriasBL.java
  13. 30
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/CategoriasBLLocal.java
  14. 127
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/DetallespBL.java
  15. 31
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/DetallespBLLocal.java
  16. 132
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/PedidosBL.java
  17. 33
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/PedidosBLLocal.java
  18. 127
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/ProductosBL.java
  19. 31
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/ProductosBLLocal.java
  20. 134
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/ProveedoresBL.java
  21. 33
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/ProveedoresBLLocal.java
  22. 140
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/UsuariosBL.java
  23. 33
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/UsuariosBLLocal.java
  24. 78
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/CategoriasDAO.java
  25. 81
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/DetallespDAO.java
  26. 76
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/PedidosDAO.java
  27. 78
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/ProductosDAO.java
  28. 74
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/ProveedoresDAO.java
  29. 96
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/UsuariosDAO.java
  30. 125
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Categorias.java
  31. 135
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Detallesp.java
  32. 155
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Pedidos.java
  33. 193
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Productos.java
  34. 169
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Proveedores.java
  35. 190
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Usuarios.java
  36. 18
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/msj/Mensaje.java
  37. 13
      inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/msj/ejemplo.java
  38. 71
      inventario-war/build.xml
  39. BIN
      inventario-war/libs/primefaces-12.0.0.jar
  40. 131
      inventario-war/nbproject/ant-deploy.xml
  41. 1438
      inventario-war/nbproject/build-impl.xml
  42. 0
      inventario-war/nbproject/faces-config.NavData
  43. 8
      inventario-war/nbproject/genfiles.properties
  44. 95
      inventario-war/nbproject/project.properties
  45. 36
      inventario-war/nbproject/project.xml
  46. 2
      inventario-war/src/conf/MANIFEST.MF
  47. 61
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/seguridad/AutorizacionListener.java
  48. 127
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/seguridad/Login.java
  49. 86
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/SelectOneMenuConverter.java
  50. 101
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanCategorias.java
  51. 185
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanDetallesp.java
  52. 102
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanPedidos.java
  53. 100
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanProductos.java
  54. 189
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanProveedores.java
  55. 188
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanUsuarios.java
  56. 13
      inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/ejemplo.java
  57. 88
      inventario-war/web/CategoriasCrearEditar.xhtml
  58. 81
      inventario-war/web/CategoriasEliminar.xhtml
  59. 107
      inventario-war/web/CategoriasLista.xhtml
  60. 91
      inventario-war/web/PedidosCrearEditar.xhtml
  61. 86
      inventario-war/web/PedidosEliminar.xhtml
  62. 120
      inventario-war/web/PedidosLista.xhtml
  63. 105
      inventario-war/web/ProductosCrearEditar.xhtml
  64. 91
      inventario-war/web/ProductosEliminar.xhtml
  65. 136
      inventario-war/web/ProductosLista.xhtml
  66. 88
      inventario-war/web/ProveedoresCrearEditar.xhtml
  67. 125
      inventario-war/web/ProveedoresLista.xhtml
  68. 91
      inventario-war/web/UsuariosCrearEditar.xhtml
  69. 138
      inventario-war/web/UsuariosLista.xhtml
  70. 30
      inventario-war/web/WEB-INF/faces-config.xml
  71. 25
      inventario-war/web/WEB-INF/glassfish-web.xml
  72. 28
      inventario-war/web/WEB-INF/web.xml
  73. 94
      inventario-war/web/detallespCrearEditar.xhtml
  74. 85
      inventario-war/web/detallespEliminar.xhtml
  75. 122
      inventario-war/web/detallespLista.xhtml
  76. 30
      inventario-war/web/ejemplo.xhtml
  77. 90
      inventario-war/web/index.xhtml
  78. 89
      inventario-war/web/proveedoresEliminar.xhtml
  79. 62
      inventario-war/web/resources/css/cssLayout.css
  80. 35
      inventario-war/web/resources/css/default.css
  81. 47
      inventario-war/web/template/PrincipalE.xhtml
  82. 128
      inventario-war/web/template/templeteE.xhtml
  83. 89
      inventario-war/web/usuariosEliminar.xhtml
  84. 131
      nbproject/ant-deploy.xml
  85. 635
      nbproject/build-impl.xml
  86. 8
      nbproject/genfiles.properties
  87. 40
      nbproject/project.properties
  88. 39
      nbproject/project.xml
  89. 2
      src/conf/MANIFEST.MF

5
.gitignore

@ -0,0 +1,5 @@
/inventario-ejb/build/
/inventario-ejb/dist/
/inventario-war/build/
/inventario-war/dist/
/build/

61
build.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="inventario" default="default" basedir="." xmlns:ear="http://www.netbeans.org/ns/j2ee-earproject/2">
<description>Builds, tests, and runs the project inventario.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
pre-init: called before initialization of project properties
post-init: called after initialization of project properties
pre-compile: called before javac compilation
post-compile: called after javac compilation
pre-dist: called before archive building
post-dist: called after archive building
post-clean: called after cleaning build products
pre-run-deploy: called before deploying
post-run-deploy: called after deploying
Example of pluging an obfuscator after the compilation could look like
<target name="post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Other way how to customize the build is by overriding existing main targets.
The target of interest are:
do-dist: archive building
run: execution of project
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>

68
inventario-ejb/build.xml

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="inventario-ejb" default="default" basedir="." xmlns:ejbjarproject="http://www.netbeans.org/ns/j2ee-ejbjarproject/3">
<description>Builds, tests, and runs the project inventario-ejb.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying
(Targets beginning with '-' are not intended to be called on their own.)
Example of pluging an obfuscator after the compilation could look like
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Other way how to customize the build is by overriding existing main targets.
The target of interest are:
init-macrodef-javac: defines macro for javac compilation
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>

131
inventario-ejb/nbproject/ant-deploy.xml

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project default="-deploy-ant" basedir=".">
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
<property file="${deploy.ant.properties.file}" />
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
<available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
</target>
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.sun.web}" validate="false">
</xmlproperty>
<delete file="${temp.sun.web}"/>
<condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
<isset property="sun-web-app.context-root"/>
</condition>
<condition property="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
<isset property="sun-web-app.context-root"/>
</condition>
</target>
<target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
<tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.gf.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.gf.web}">
<replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.gf.web}" validate="false">
</xmlproperty>
<delete file="${temp.gf.web}"/>
<condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
<isset property="glassfish-web-app.context-root"/>
</condition>
<condition property="deploy.context.root.argument" value="&amp;contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
<isset property="glassfish-web-app.context-root"/>
</condition>
</target>
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
<property name="deploy.context.root.argument" value=""/>
</target>
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
<mkdir dir="${gfv3.resources.dir}"/>
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
<copy todir="${gfv3.resources.dir}/META-INF">
<fileset dir="${deploy.ant.resource.dir}"/>
</copy>
<jar destfile="${deploy.ant.archive}" update="true">
<fileset dir="${gfv3.resources.dir}"/>
</jar>
<delete dir="${gfv3.resources.dir}"/>
</target>
<target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
<antcall target="-deploy-without-pw"/>
<antcall target="-deploy-with-pw"/>
</target>
<target name="-deploy-without-pw" unless="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-deploy-with-pw" if="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
<antcall target="-undeploy-without-pw"/>
<antcall target="-undeploy-with-pw"/>
</target>
<target name="-undeploy-without-pw" unless="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-with-pw" if="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
</project>

1235
inventario-ejb/nbproject/build-impl.xml

File diff suppressed because it is too large

8
inventario-ejb/nbproject/genfiles.properties

@ -0,0 +1,8 @@
build.xml.data.CRC32=2131a66c
build.xml.script.CRC32=4fa0940f
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=2131a66c
nbproject/build-impl.xml.script.CRC32=4bc75cbf
nbproject/build-impl.xml.stylesheet.CRC32=62693482@1.75

78
inventario-ejb/nbproject/project.properties

@ -0,0 +1,78 @@
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=
file.reference.primefaces-12.0.0.jar=..\\inventario-war\\libs\\primefaces-12.0.0.jar
includes=**
j2ee.compile.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=1.7
j2ee.platform.classpath=${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsit.classpath=
j2ee.server.type=gfv4ee7
jar.compress=false
jar.name=inventario-ejb.jar
jars.in.ejbjar=false
javac.classpath=\
${file.reference.primefaces-12.0.0.jar}
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

18
inventario-ejb/nbproject/project.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.j2ee.ejbjarproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2ee-ejbjarproject/3">
<name>inventario-ejb</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<explicit-platform explicit-source-supported="true"/>
<included-library dirs="200">file.reference.primefaces-12.0.0.jar</included-library>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

2
inventario-ejb/src/conf/MANIFEST.MF

@ -0,0 +1,2 @@
Manifest-Version: 1.0

13
inventario-ejb/src/conf/META-INF/glassfish-resources.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="mysql_inventario_rootPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="databaseName" value="inventario"/>
<property name="User" value="root"/>
<property name="Password" value="root"/>
<property name="URL" value="jdbc:mysql://localhost/inventario"/>
<property name="driverClass" value="org.gjt.mm.mysql.Driver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="java:module/myconnec" object-type="user" pool-name="mysql_inventario_rootPool"/>
</resources>

8
inventario-ejb/src/conf/persistence.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="inventario-ejbPU" transaction-type="JTA">
<jta-data-source>jdbc/inventario</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence>

107
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/CategoriasBL.java

@ -0,0 +1,107 @@
/*
* 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.modelo.bl;
import java.util.List;
import javax.ejb.Stateless;
import mx.edu.tsj.chapala.sistemas.modelo.dao.CategoriasDAO;
import mx.edu.tsj.chapala.sistemas.modelos.Categorias;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Stateless
public class CategoriasBL implements CategoriasBLLocal {
@Override
public Mensaje agregar(Categorias categorias) {
System.out.println("Llegaste al metodo de agregar!!");
CategoriasDAO categoriasDAO = new CategoriasDAO();
//Usuarios existeUsuario = usuariosDao.buscarPorId(usuarios);
//Categorias existeCategorias = categoriasDAO.buscarPorId(categorias);
Categorias existeCategorias = categoriasDAO.buscarPorId(categorias);
if(categorias.getNombre().isEmpty() || categorias.getDescripcion().isEmpty()){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(categorias.getNombre().length()>=45 || categorias.getDescripcion().length()>=45){
return Mensaje.DATOS_INCORRECTOS;
}
if (existeCategorias != null) {
return Mensaje.ELEMENTO_DUPLICADO;
}else{
categoriasDAO.agregar(categorias);
return Mensaje.SIN_ERROR;
}
}
@Override
public Mensaje buscarId(Categorias categorias) {
//UsuariosDAO usuariosDao = new UsuariosDAO();
CategoriasDAO categoriasDAO = new CategoriasDAO();
//Usuarios existeUsuario = usuariosDao.buscarPorId(usuarios);
Categorias existeCategorias = categoriasDAO.buscarPorId(categorias);
if (existeCategorias== null) {
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}else{
//usuariosDao.buscarPorId(usuarios);
categoriasDAO.buscarPorId(categorias);
return Mensaje.SIN_ERROR;
}
}
@Override
public Categorias buscarIdLi(Categorias categorias) {
CategoriasDAO c = new CategoriasDAO();
//Aqui le movi
return c.buscarPorId(categorias);
}
@Override
public Mensaje editar(Categorias categorias) {
System.out.println("Llegaste al metodo de agregar!!");
CategoriasDAO categoriasDAO = new CategoriasDAO();
//Usuarios existeUsuario = usuariosDao.buscarPorId(usuarios);
//Categorias existeCategorias = categoriasDAO.buscarPorId(categorias);
Categorias existeCategorias = categoriasDAO.buscarPorId(categorias);
if(categorias.getNombre().isEmpty() || categorias.getDescripcion().isEmpty()){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(categorias.getNombre().length()>=45 || categorias.getDescripcion().length()>=45){
return Mensaje.DATOS_INCORRECTOS;
}
if(categorias.getId()==null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
//usuariosDao.editar(usuarios);
categoriasDAO.editar(categorias);
return Mensaje.SIN_ERROR;
}
//autorDao.editar(autor);
}
public List<Categorias> getAll(){
//UsuariosDAO usuariosDAO = new UsuariosDAO();
CategoriasDAO categoriasDAO = new CategoriasDAO();
//return usuariosDAO.getTodos(true);
return categoriasDAO.getTodos();
}
}

30
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/CategoriasBLLocal.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.modelo.bl;
import java.util.List;
import javax.ejb.Local;
import mx.edu.tsj.chapala.sistemas.modelos.Categorias;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Local
public interface CategoriasBLLocal {
Mensaje agregar(Categorias categorias);
Mensaje buscarId(Categorias categorias);
Categorias buscarIdLi(Categorias categorias);
//Mensaje eliminar(Categorias categorias);
Mensaje editar(Categorias categorias);
List<Categorias> getAll();
}

127
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/DetallespBL.java

@ -0,0 +1,127 @@
/*
* 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.modelo.bl;
import java.util.List;
import javax.ejb.Stateless;
import mx.edu.tsj.chapala.sistemas.modelo.dao.DetallespDAO;
import mx.edu.tsj.chapala.sistemas.modelo.dao.ProductosDAO;
import mx.edu.tsj.chapala.sistemas.modelos.Detallesp;
import mx.edu.tsj.chapala.sistemas.modelos.Productos;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Stateless
public class DetallespBL implements DetallespBLLocal {
@Override
public Mensaje agregar(Detallesp detallesp) {
System.out.println("Llegaste al metodo de agregar!!");
//roductosDAO productosDAO = new ProductosDAO();
DetallespDAO detallesDAO = new DetallespDAO();
//Productos existeProductos = productosDAO.buscarPorId(productos);
Detallesp existeDetalles = detallesDAO.buscarPorId(detallesp);
if(detallesp.getCantidad().isEmpty() || detallesp.getPrecioU() == 0){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(detallesp.getCantidad().length()>=45 || detallesp.getPrecioU()>=45){
return Mensaje.DATOS_INCORRECTOS;
}
if (existeDetalles != null) {
return Mensaje.ELEMENTO_DUPLICADO;
} else {
detallesDAO.agregar(detallesp);
return Mensaje.SIN_ERROR;
}
}
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
@Override
public Mensaje buscarId(Detallesp detallesp) {
DetallespDAO detallesDAO = new DetallespDAO();
//Productos existeProductos = productosDAO.buscarPorId(productos);
Detallesp existeDetalles = detallesDAO.buscarPorId(detallesp);
if (existeDetalles == null) {
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}else{
detallesDAO.buscarPorId(detallesp);
return Mensaje.SIN_ERROR;
}
}
@Override
public Detallesp buscarIdLi(Detallesp detallesp) {
//ProductosDAO a = new ProductosDAO();
DetallespDAO a = new DetallespDAO();
//Aqui le movi
//return a.buscarPorId(productos);
return a.buscarPorId(detallesp);
}
@Override
public Mensaje eliminar(Detallesp detallesp) {
//ProductosDAO a = new ProductosDAO();
DetallespDAO a = new DetallespDAO();
//Productos existe = a.buscarPorId(productos);
Detallesp existe = a.buscarPorId(detallesp);
if(existe==null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
//a.eliminar(productos);
//a.eliminar(detallesp);
return Mensaje.SIN_ERROR;
}
}
@Override
public Mensaje editar(Detallesp detallesp) {
System.out.println("Llegaste al metodo de editar");
//ProductosDAO productosDao = new ProductosDAO();
DetallespDAO detallesDAO = new DetallespDAO();
//Productos existeProductos = productosDao.buscarPorIdLi(productos);
Detallesp existeDetalles = detallesDAO.buscarPorIdLi(detallesp);
//Test de validaciones
if(detallesp.getCantidad().isEmpty() || detallesp.getPrecioU() == 0){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(detallesp.getCantidad().length()>=45 || detallesp.getPrecioU()>=45){
return Mensaje.DATOS_INCORRECTOS;
}
if(detallesp.getId()==null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
//productosDao.editar(productos);
detallesDAO.editar(detallesp);
return Mensaje.SIN_ERROR;
}
}
public List<Detallesp> getAll(){
//UsuariosDAO usuariosDAO = new UsuariosDAO();
DetallespDAO detallespDAO = new DetallespDAO();
//return usuariosDAO.getTodos(true);
return detallespDAO.getTodos();
}
}

31
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/DetallespBLLocal.java

@ -0,0 +1,31 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/J2EE/EJB30/SessionLocal.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.modelo.bl;
import java.util.List;
import javax.ejb.Local;
import mx.edu.tsj.chapala.sistemas.modelos.Categorias;
import mx.edu.tsj.chapala.sistemas.modelos.Detallesp;
import mx.edu.tsj.chapala.sistemas.modelos.Productos;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Local
public interface DetallespBLLocal {
Mensaje agregar(Detallesp detallesp);
Mensaje buscarId(Detallesp detallesp);
Detallesp buscarIdLi(Detallesp detallesp);
Mensaje eliminar(Detallesp detallesp);
Mensaje editar(Detallesp detallesp);
List<Detallesp> getAll();
}

132
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/PedidosBL.java

@ -0,0 +1,132 @@
/*
* 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.modelo.bl;
import java.util.List;
import javax.ejb.Stateless;
import mx.edu.tsj.chapala.sistemas.modelo.dao.PedidosDAO;
import mx.edu.tsj.chapala.sistemas.modelos.Pedidos;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author
*/
@Stateless
public class PedidosBL implements PedidosBLLocal {
@Override
public Mensaje agregar(Pedidos pedidos) {
System.out.println("Llegaste al metodo de agregar!!");
PedidosDAO pedidosDAO = new PedidosDAO();
Pedidos existePedidos = pedidosDAO.buscarPorId(pedidos);
if(pedidos.getFecha() != null || pedidos.getTotal().isEmpty() ){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(pedidos.getFecha() != null || pedidos.getTotal().length()>=45 ){
return Mensaje.DATOS_INCORRECTOS;
}
if (existePedidos != null) {
return Mensaje.ELEMENTO_DUPLICADO;
}else{
pedidosDAO.agregar(pedidos);
return Mensaje.SIN_ERROR;
}
}
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
@Override
public Mensaje buscarId(Pedidos pedidos) {
PedidosDAO pedidosDAO = new PedidosDAO();
Pedidos existePedidos = pedidosDAO.buscarPorId(pedidos);
if (existePedidos == null) {
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}else{
pedidosDAO.buscarPorId(pedidos);
return Mensaje.SIN_ERROR;
}
}
@Override
public Pedidos buscarIdLi(Pedidos pedidos) {
PedidosDAO a = new PedidosDAO();
//Aqui le movi
return a.buscarPorId(pedidos);
}
@Override
public Mensaje eliminar(Pedidos pedidos) {
PedidosDAO a = new PedidosDAO();
Pedidos existe = a.buscarPorId(pedidos);
if(existe==null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
a.eliminar(pedidos);
return Mensaje.SIN_ERROR;
}
}
@Override
public Mensaje editar(Pedidos pedidos) {
System.out.println("Llegaste al metodo de editar");
PedidosDAO pedidosDAO = new PedidosDAO();
Pedidos existePedidos = pedidosDAO.buscarPorIdLi(pedidos);
//Test de validaciones
if(pedidos.getFecha() != null || pedidos.getTotal().isEmpty() ) {
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(pedidos.getFecha() != null || pedidos.getTotal().length()>=45 ){
return Mensaje.DATOS_INCORRECTOS;
}
if(pedidos.getId() !=null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
pedidosDAO.editar(pedidos);
return Mensaje.SIN_ERROR;
}
}
public List<Pedidos> getAll(){
PedidosDAO pedidosDAO = new PedidosDAO();
return pedidosDAO.getTodos(true);
}
@Override
public Mensaje desactivarPedidos(Pedidos pedidos) {
PedidosDAO a = new PedidosDAO();
Pedidos existe = a.buscarPorId(pedidos);
if(existe==null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
a.eliminar(pedidos);
return Mensaje.SIN_ERROR;
}
}
}

33
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/PedidosBLLocal.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.modelo.bl;
import java.util.List;
import javax.ejb.Local;
import mx.edu.tsj.chapala.sistemas.modelos.Pedidos;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author lwyou
*/
@Local
public interface PedidosBLLocal {
Mensaje agregar(Pedidos pedidos);
Mensaje buscarId(Pedidos pedidos);
Pedidos buscarIdLi(Pedidos pedidos);
Mensaje eliminar(Pedidos pedidos);
Mensaje editar(Pedidos pedidos);
List<Pedidos> getAll();
Mensaje desactivarPedidos(Pedidos pedidos);
}

127
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/ProductosBL.java

@ -0,0 +1,127 @@
/*
* 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.modelo.bl;
import java.util.List;
import javax.ejb.Stateless;
import mx.edu.tsj.chapala.sistemas.modelo.dao.ProductosDAO;
import mx.edu.tsj.chapala.sistemas.modelo.dao.UsuariosDAO;
import mx.edu.tsj.chapala.sistemas.modelos.Productos;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author lwyou
*/
@Stateless
public class ProductosBL implements ProductosBLLocal {
@Override
public Mensaje agregar(Productos productos) {
System.out.println("Llegaste al metodo de agregar!!");
ProductosDAO productosDAO = new ProductosDAO();
Productos existeProductos = productosDAO.buscarPorId(productos);
//TO DO: agregar la logica
//Test de validaciones
//if(autor.getNombre().isEmpty() || autor.getPaterno().isEmpty() || autor.getMaterno().isEmpty() ||
// autor.getMail().isEmpty()){
if(productos.getNombre().isEmpty() || productos.getDescripcion().isEmpty() || productos.getPrecio().isEmpty() ||
productos.getStock().isEmpty()){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(productos.getNombre().length()>=45 || productos.getDescripcion().length()>=45 || productos.getPrecio().length()>=45 ||
productos.getStock().length()>=45 || productos.getEstatus()>=45 ){
return Mensaje.DATOS_INCORRECTOS;
}
if (existeProductos != null) {
return Mensaje.ELEMENTO_DUPLICADO;
}else{
productosDAO.agregar(productos);
return Mensaje.SIN_ERROR;
}
}
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
@Override
public Mensaje buscarId(Productos productos) {
ProductosDAO productosDAO = new ProductosDAO();
Productos existeProductos = productosDAO.buscarPorId(productos);
if (existeProductos == null) {
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}else{
productosDAO.buscarPorId(productos);
return Mensaje.SIN_ERROR;
}
}
@Override
public Productos buscarIdLi(Productos productos) {
ProductosDAO a = new ProductosDAO();
//Aqui le movi
return a.buscarPorId(productos);
}
@Override
public Mensaje eliminar(Productos productos) {
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;
}
}
@Override
public Mensaje editar(Productos productos) {
System.out.println("Llegaste al metodo de editar");
ProductosDAO productosDao = new ProductosDAO();
Productos existeProductos = productosDao.buscarPorIdLi(productos);
//Test de validaciones
if(productos.getNombre().isEmpty() || productos.getDescripcion().isEmpty() || productos.getPrecio().isEmpty() ||
productos.getStock().isEmpty() ) {
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(productos.getNombre().length()>=45 || productos.getDescripcion().length()>=45 || productos.getPrecio().length()>=45 ||
productos.getStock().length()>=45 || productos.getEstatus()>=45 ){
return Mensaje.DATOS_INCORRECTOS;
}
if(productos.getId()==null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
productosDao.editar(productos);
return Mensaje.SIN_ERROR;
}
}
public List<Productos> getAll(){
//UsuariosDAO usuariosDAO = new UsuariosDAO();
ProductosDAO productosDAO = new ProductosDAO();
return productosDAO.getTodos(true);
//return usuariosDAO.getTodos(true);
}
}

31
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/ProductosBLLocal.java

@ -0,0 +1,31 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/J2EE/EJB30/SessionLocal.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.modelo.bl;
import java.util.List;
import javax.ejb.Local;
import mx.edu.tsj.chapala.sistemas.modelos.Productos;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author lwyou
*/
@Local
public interface ProductosBLLocal {
Mensaje agregar(Productos productos);
Mensaje buscarId(Productos productos);
Productos buscarIdLi(Productos productos);
Mensaje eliminar(Productos productos);
Mensaje editar(Productos productos);
List<Productos> getAll();
}

134
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/ProveedoresBL.java

@ -0,0 +1,134 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/J2EE/EJB30/StatelessEjbClass.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.modelo.bl;
import java.util.List;
import javax.ejb.Stateless;
import mx.edu.tsj.chapala.sistemas.modelo.dao.ProveedoresDAO;
import mx.edu.tsj.chapala.sistemas.modelos.Proveedores;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author lwyou
*/
@Stateless
public class ProveedoresBL implements ProveedoresBLLocal {
@Override
public Mensaje agregar(Proveedores proveedores) {
System.out.println("Llegaste al metodo de agregar!!");
ProveedoresDAO proveedoresDAO = new ProveedoresDAO();
Proveedores existeProveedores = proveedoresDAO.buscarPorId(proveedores);
if(proveedores.getNombre().isEmpty() || proveedores.getDireccion().isEmpty() || proveedores.getPais().isEmpty() ||
proveedores.getCantidad().isEmpty()){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(proveedores.getNombre().length()>=45 || proveedores.getDireccion().length()>=45 || proveedores.getPais().length()>=45 ||
proveedores.getCantidad().length()>=45){
return Mensaje.DATOS_INCORRECTOS;
}
if (existeProveedores != null) {
return Mensaje.ELEMENTO_DUPLICADO;
}else{
proveedoresDAO.agregar(proveedores);
return Mensaje.SIN_ERROR;
}
}
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
@Override
public Mensaje buscarId(Proveedores proveedores) {
ProveedoresDAO proveedoresDAO = new ProveedoresDAO();
Proveedores existeProveedores = proveedoresDAO.buscarPorId(proveedores);
if (existeProveedores == null) {
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}else{
proveedoresDAO.buscarPorId(proveedores);
return Mensaje.SIN_ERROR;
}
}
@Override
public Proveedores buscarIdLi(Proveedores proveedores) {
ProveedoresDAO a = new ProveedoresDAO();
//Aqui le movi
return a.buscarPorId(proveedores);
}
@Override
public Mensaje eliminar(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 editar(Proveedores proveedores) {
System.out.println("Llegaste al metodo de editar");
ProveedoresDAO proveedoresDAO = new ProveedoresDAO();
Proveedores existeProveedores = proveedoresDAO.buscarPorIdLi(proveedores);
//Test de validaciones
if(proveedores.getNombre().isEmpty() || proveedores.getDireccion().isEmpty() || proveedores.getPais().isEmpty() ||
proveedores.getCantidad().isEmpty()){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(proveedores.getNombre().length()>=45 || proveedores.getDireccion().length()>=45 || proveedores.getPais().length()>=45 ||
proveedores.getCantidad().length()>=45){
return Mensaje.DATOS_INCORRECTOS;
}
if(proveedores.getId()==null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
proveedoresDAO.editar(proveedores);
return Mensaje.SIN_ERROR;
}
}
public List<Proveedores> getAll(){
ProveedoresDAO proveedoresDAO = new ProveedoresDAO();
return proveedoresDAO.getTodos(true);
}
@Override
public Mensaje desactivarProveedores(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;
}
}
}

33
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/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.modelo.bl;
import java.util.List;
import javax.ejb.Local;
import mx.edu.tsj.chapala.sistemas.modelos.Proveedores;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author lwyou
*/
@Local
public interface ProveedoresBLLocal {
Mensaje agregar(Proveedores proveedores);
Mensaje buscarId(Proveedores proveedores);
Proveedores buscarIdLi(Proveedores proveedores);
Mensaje eliminar(Proveedores proveedores);
Mensaje editar(Proveedores proveedores);
List<Proveedores> getAll();
Mensaje desactivarProveedores(Proveedores proveedores);
}

140
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/UsuariosBL.java

@ -0,0 +1,140 @@
/*
* 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.modelo.bl;
import java.util.List;
import javax.ejb.Stateless;
import mx.edu.tsj.chapala.sistemas.modelo.dao.UsuariosDAO;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Stateless
public class UsuariosBL implements UsuariosBLLocal {
@Override
public Mensaje agregar(Usuarios usuarios) {
System.out.println("Llegaste al metodo de agregar!!");
UsuariosDAO usuariosDao = new UsuariosDAO();
Usuarios existeUsuario = usuariosDao.buscarPorId(usuarios);
if(usuarios.getNombre().isEmpty() || usuarios.getApellidoP().isEmpty() ||
usuarios.getApellidoM().isEmpty() || usuarios.getEmail().isEmpty() || usuarios.getTelefono().isEmpty()){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(usuarios.getNombre().length()>=45 || usuarios.getApellidoP().length()>=45 || usuarios.getApellidoM().length()>=45 ||
usuarios.getEmail().length()>=45 || usuarios.getTelefono().length()>=45){
return Mensaje.DATOS_INCORRECTOS;
}
if (existeUsuario != null) {
return Mensaje.ELEMENTO_DUPLICADO;
}else{
usuariosDao.agregar(usuarios);
return Mensaje.SIN_ERROR;
}
}
@Override
public Mensaje buscarId(Usuarios usuarios) {
UsuariosDAO usuariosDao = new UsuariosDAO();
Usuarios existeUsuario = usuariosDao.buscarPorId(usuarios);
if (existeUsuario == null) {
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}else{
usuariosDao.buscarPorId(usuarios);
return Mensaje.SIN_ERROR;
}
}
@Override
public Usuarios buscarIdLi(Usuarios usuarios) {
UsuariosDAO u = new UsuariosDAO();
//Aqui le movi
return u.buscarPorId(usuarios);
}
@Override
public Mensaje eliminar(Usuarios usuarios) {
UsuariosDAO u = new UsuariosDAO();
Usuarios existe = u.buscarPorId(usuarios);
if(existe==null && existe.getEstatus()==0){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
u.eliminar(usuarios);
return Mensaje.SIN_ERROR;
}
}
@Override
public Mensaje editar(Usuarios usuarios) {
System.out.println("Llegaste al metodo de editar");
UsuariosDAO usuariosDao = new UsuariosDAO();
Usuarios existeUsuario = usuariosDao.buscarPorIdLi(usuarios);
//Test de validaciones
if(usuarios.getNombre().isEmpty() || usuarios.getApellidoP().isEmpty() ||
usuarios.getApellidoM().isEmpty() || usuarios.getEmail().isEmpty() || usuarios.getTelefono().isEmpty()){
return Mensaje.CAMPOS_INCOMPLETOS;
}
if(usuarios.getNombre().length()>=45 || usuarios.getApellidoP().length()>=45 || usuarios.getApellidoM().length()>=45 ||
usuarios.getEmail().length()>=45 || usuarios.getTelefono().length()>=45){
return Mensaje.DATOS_INCORRECTOS;
}
if(usuarios.getId()==null){
return Mensaje.ELEMENTO_NO_ENCONTRADO;
}
else{
usuariosDao.editar(usuarios);
return Mensaje.SIN_ERROR;
}
//autorDao.editar(autor);
}
@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;
}
}
public List<Usuarios> getAll(){
UsuariosDAO usuariosDAO = new UsuariosDAO();
return usuariosDAO.getTodos(true);
}
//Test validar contraseña
public Usuarios buscarPorLoginStatus(boolean status, Usuarios a) {
UsuariosDAO usuariosDAO = new UsuariosDAO();
return (Usuarios) usuariosDAO.buscarLogin(status, a.getNombre(), a.getContrasena());
}
}

33
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/bl/UsuariosBLLocal.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.modelo.bl;
import java.util.List;
import javax.ejb.Local;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Local
public interface UsuariosBLLocal {
Mensaje agregar(Usuarios usuarios);
Mensaje buscarId(Usuarios usuarios);
Usuarios buscarIdLi(Usuarios usuarios);
Mensaje eliminar(Usuarios usuarios);
Mensaje editar(Usuarios usuarios);
List<Usuarios> getAll();
Mensaje desactivarUsuarios(Usuarios usuarios);
public Usuarios buscarPorLoginStatus(boolean status, Usuarios a);
}

78
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/CategoriasDAO.java

@ -0,0 +1,78 @@
/*
* 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.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.modelos.Categorias;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
/**
*
* @author sktal
*/
public class CategoriasDAO {
private EntityManager em; //MANEJADOR DE ENTIDADES
public CategoriasDAO(){
EntityManagerFactory emf = Persistence.createEntityManagerFactory("inventario-ejbPU");
em=emf.createEntityManager();
}
public void agregar(Categorias c){
em.getTransaction().begin();
em.persist(c); //Agrega en la BD
em.getTransaction().commit();
}
public void editar(Categorias c){
em.getTransaction().begin();
//em.remove(em.merge(usuarios));
em.merge(c); // Edita en la BD
em.getTransaction().commit();
}
//-----------IMPLEMENTAR ESTA PARTE EN WORKBENCH-----------------
/*public void eliminar(Categorias c){
em.getTransaction().begin();
//em.remove(em.merge(m));
c.setEstatus((short)0);
em.merge(c);
em.getTransaction().commit();
}*/
public Categorias buscarPorIdLi(Categorias c){
Query q = em.createNamedQuery("Categorias.findById");
q.setParameter("id", c.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Categorias) q.getResultList().get(0);
}
}
public Categorias buscarPorId(Categorias c){
if (c == null || c.getId()== null) {
return null;
}
Query q = em.createNamedQuery("Categorias.findById");
q.setParameter("id", c.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Categorias) q.getResultList().get(0);
}
}
public List<Categorias> getTodos() {
Query q = em.createNamedQuery("Categorias.findAll");
return q.getResultList();
}
}

81
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/DetallespDAO.java

@ -0,0 +1,81 @@
/*
* 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.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.modelos.Detallesp;
import mx.edu.tsj.chapala.sistemas.modelos.Productos;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
//import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
/**
*
* @author sktal
*/
public class DetallespDAO {
private EntityManager em; //MANEJADOR DE ENTIDADES
public DetallespDAO(){
EntityManagerFactory emf = Persistence.createEntityManagerFactory("inventario-ejbPU");
em=emf.createEntityManager();
}
public void agregar(Detallesp d){
em.getTransaction().begin();
em.persist(d); //Agrega en la BD
em.getTransaction().commit();
}
public void editar(Detallesp d){
em.getTransaction().begin();
//em.remove(em.merge(usuarios));
em.merge(d); // Edita en la BD
em.getTransaction().commit();
}
//-----------IMPLEMENTAR ESTA PARTE EN WORKBENCH-------------
/*public void eliminar(Detallesp d) {
em.getTransaction().begin();
//em.remove(em.merge(m));
d.setEstatus((short) 0);
em.merge(d);
em.getTransaction().commit();
}*/
public Detallesp buscarPorIdLi(Detallesp d){
Query q = em.createNamedQuery("Detallesp.findById");
q.setParameter("id", d.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Detallesp) q.getResultList().get(0);
}
}
public Detallesp buscarPorId(Detallesp d){
if (d == null || d.getId()== null) {
return null;
}
Query q = em.createNamedQuery("Detallesp.findById");
q.setParameter("id", d.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Detallesp) q.getResultList().get(0);
}
}
public List<Detallesp> getTodos() {
Query q = em.createNamedQuery("Detallesp.findAll");
return q.getResultList();
}
}

76
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/PedidosDAO.java

@ -0,0 +1,76 @@
/*
* 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.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.modelos.Pedidos;
public class PedidosDAO {
private EntityManager em; //MANEJADOR DE ENTIDADES
public PedidosDAO(){
EntityManagerFactory emf = Persistence.createEntityManagerFactory("inventario-ejbPU");
em=emf.createEntityManager();
}
public void agregar(Pedidos p){
em.getTransaction().begin();
em.persist(p); //Agrega en la BD
em.getTransaction().commit();
}
public void editar(Pedidos p){
em.getTransaction().begin();
//em.remove(em.merge(usuarios));
em.merge(p); // Edita en la BD
em.getTransaction().commit();
}
public void eliminar(Pedidos p){
em.getTransaction().begin();
//em.remove(em.merge(u)); // Elimina en la BD
//usuarios.setStatus(0);
//em.marge(usuarios);
em.getTransaction().commit();
}
public Pedidos buscarPorIdLi(Pedidos p){
Query q = em.createNamedQuery("Pedidos.findById");
q.setParameter("id", p.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Pedidos) q.getResultList().get(0);
}
}
public Pedidos buscarPorId(Pedidos p){
if (p == null || p.getId()== null) {
return null;
}
Query q = em.createNamedQuery("Pedidos.findById");
q.setParameter("id", p.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Pedidos) q.getResultList().get(0);
}
}
public List<Pedidos> getTodos(boolean status){
Query q = em.createNamedQuery("Pedidos.findByEstatus");
int s = status?1:0;
q.setParameter("estatus", s);
return q.getResultList();
}
}

78
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/ProductosDAO.java

@ -0,0 +1,78 @@
/*
* 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.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.modelos.Productos;
//import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
/**
*
* @author sktal
*/
public class ProductosDAO {
private EntityManager em; //MANEJADOR DE ENTIDADES
public ProductosDAO(){
EntityManagerFactory emf = Persistence.createEntityManagerFactory("inventario-ejbPU");
em=emf.createEntityManager();
}
public void agregar(Productos p){
em.getTransaction().begin();
em.persist(p); //Agrega en la BD
em.getTransaction().commit();
}
public void editar(Productos p){
em.getTransaction().begin();
//em.remove(em.merge(usuarios));
em.merge(p); // Edita en la BD
em.getTransaction().commit();
}
public void eliminar(Productos p){
em.getTransaction().begin();
//em.remove(em.merge(u)); // Elimina en la BD
p.setEstatus((short)0);
em.merge(p);
em.getTransaction().commit();
}
public Productos buscarPorIdLi(Productos p){
Query q = em.createNamedQuery("Productos.findById");
q.setParameter("id", p.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Productos) q.getResultList().get(0);
}
}
public Productos buscarPorId(Productos p){
if (p == null || p.getId()== null) {
return null;
}
Query q = em.createNamedQuery("Productos.findById");
q.setParameter("id", p.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Productos) q.getResultList().get(0);
}
}
public List<Productos> getTodos(boolean status){
Query q = em.createNamedQuery("Productos.findByEstatus");
int s = status?1:0;
q.setParameter("estatus", s);
return q.getResultList();
}
}

74
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/ProveedoresDAO.java

@ -0,0 +1,74 @@
/*
* 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.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.modelos.Proveedores;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
public class ProveedoresDAO {
private EntityManager em; //MANEJADOR DE ENTIDADES
public ProveedoresDAO(){
EntityManagerFactory emf = Persistence.createEntityManagerFactory("inventario-ejbPU");
em=emf.createEntityManager();
}
public void agregar(Proveedores p){
em.getTransaction().begin();
em.persist(p); //Agrega en la BD
em.getTransaction().commit();
}
public void editar(Proveedores p){
em.getTransaction().begin();
//em.remove(em.merge(usuarios));
em.merge(p); // Edita en la BD
em.getTransaction().commit();
}
public void eliminar(Proveedores p){
em.getTransaction().begin();
//em.remove(em.merge(u)); // Elimina en la BD
//usuarios.setStatus(0);
//em.marge(usuarios);
em.getTransaction().commit();
}
public Proveedores buscarPorIdLi(Proveedores p){
Query q = em.createNamedQuery("Proveedores.findById");
q.setParameter("id", p.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Proveedores) q.getResultList().get(0);
}
}
public Proveedores buscarPorId(Proveedores p){
if (p == null || p.getId()== null) {
return null;
}
Query q = em.createNamedQuery("Usuarios.findById");
q.setParameter("id", p.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Proveedores) q.getResultList().get(0);
}
}
public List<Proveedores> getTodos(boolean status){
Query q = em.createNamedQuery("Proveedores.findByEstatus");
int s = status?1:0;
q.setParameter("estatus", s);
return q.getResultList();
}
}

96
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelo/dao/UsuariosDAO.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.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.modelos.Usuarios;
/**
*
* @author sktal
*/
public class UsuariosDAO {
private EntityManager em; //MANEJADOR DE ENTIDADES
public UsuariosDAO(){
EntityManagerFactory emf = Persistence.createEntityManagerFactory("inventario-ejbPU");
em=emf.createEntityManager();
}
public void agregar(Usuarios u){
em.getTransaction().begin();
em.persist(u); //Agrega en la BD
em.getTransaction().commit();
}
public void editar(Usuarios u){
em.getTransaction().begin();
//em.remove(em.merge(usuarios));
em.merge(u); // Edita en la BD
em.getTransaction().commit();
}
public void eliminar(Usuarios u){
em.getTransaction().begin();
//em.remove(em.merge(m));
u.setEstatus((short)0);
em.merge(u);
em.getTransaction().commit();
}
public Usuarios buscarPorIdLi(Usuarios u) {
Query q = em.createNamedQuery("Usuarios.findById");
q.setParameter("id", u.getId());
if (q.getResultList().isEmpty()) {
return null;
} else {
return (Usuarios) q.getResultList().get(0);
}
}
public Usuarios buscarPorId(Usuarios u){
if (u == null || u.getId()== null) {
return null;
}
Query q = em.createNamedQuery("Usuarios.findById");
q.setParameter("id", u.getId());
if(q.getResultList().isEmpty()){
return null;
}else{
return (Usuarios) q.getResultList().get(0);
}
}
public List<Usuarios> getTodos(boolean status){
Query q = em.createNamedQuery("Usuarios.findByEstatus");
int s = status?1:0;
q.setParameter("estatus", s);
return q.getResultList();
}
//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("estatus", s);
q.setParameter("nombre", username);
q.setParameter("contrasena", password);
List<Usuarios> resultList = q.getResultList();
if (resultList.isEmpty()) {
return null;
} else {
return resultList.get(0); // Devuelve el primer elemento de la lista
}
}
}

125
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Categorias.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.modelos;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author sktal
*/
@Entity
@Table(name = "categorias")
@NamedQueries({
@NamedQuery(name = "Categorias.findAll", query = "SELECT c FROM Categorias c"),
@NamedQuery(name = "Categorias.findById", query = "SELECT c FROM Categorias c WHERE c.id = :id"),
@NamedQuery(name = "Categorias.findByNombre", query = "SELECT c FROM Categorias c WHERE c.nombre = :nombre"),
@NamedQuery(name = "Categorias.findByDescripcion", query = "SELECT c FROM Categorias c WHERE c.descripcion = :descripcion")})
public class Categorias implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "nombre")
private String nombre;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "descripcion")
private String descripcion;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriasId")
private List<Productos> productosList;
public Categorias() {
}
public Categorias(Integer id) {
this.id = id;
}
public Categorias(Integer id, String nombre, String descripcion) {
this.id = id;
this.nombre = nombre;
this.descripcion = descripcion;
}
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 List<Productos> getProductosList() {
return productosList;
}
public void setProductosList(List<Productos> productosList) {
this.productosList = productosList;
}
@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 Categorias)) {
return false;
}
Categorias other = (Categorias) 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.modelos.Categorias[ id=" + id + " ]";
}
}

135
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Detallesp.java

@ -0,0 +1,135 @@
/*
* 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.modelos;
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;
/**
*
* @author sktal
*/
@Entity
@Table(name = "detallesp")
@NamedQueries({
@NamedQuery(name = "Detallesp.findAll", query = "SELECT d FROM Detallesp d"),
@NamedQuery(name = "Detallesp.findById", query = "SELECT d FROM Detallesp d WHERE d.id = :id"),
@NamedQuery(name = "Detallesp.findByCantidad", query = "SELECT d FROM Detallesp d WHERE d.cantidad = :cantidad"),
@NamedQuery(name = "Detallesp.findByPrecioU", query = "SELECT d FROM Detallesp d WHERE d.precioU = :precioU")})
public class Detallesp 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 = "cantidad")
private String cantidad;
@Basic(optional = false)
@NotNull
@Column(name = "precioU")
private long precioU;
@JoinColumn(name = "pedidos_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private Pedidos pedidosId;
@JoinColumn(name = "productos_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private Productos productosId;
public Detallesp() {
}
public Detallesp(Integer id) {
this.id = id;
}
public Detallesp(Integer id, String cantidad, long precioU) {
this.id = id;
this.cantidad = cantidad;
this.precioU = precioU;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCantidad() {
return cantidad;
}
public void setCantidad(String cantidad) {
this.cantidad = cantidad;
}
public long getPrecioU() {
return precioU;
}
public void setPrecioU(long precioU) {
this.precioU = precioU;
}
public Pedidos getPedidosId() {
return pedidosId;
}
public void setPedidosId(Pedidos pedidosId) {
this.pedidosId = pedidosId;
}
public Productos getProductosId() {
return productosId;
}
public void setProductosId(Productos productosId) {
this.productosId = productosId;
}
@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 Detallesp)) {
return false;
}
Detallesp other = (Detallesp) 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.modelos.Detallesp[ id=" + id + " ]";
}
}

155
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Pedidos.java

@ -0,0 +1,155 @@
/*
* 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.modelos;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author sktal
*/
@Entity
@Table(name = "pedidos")
@NamedQueries({
@NamedQuery(name = "Pedidos.findAll", query = "SELECT p FROM Pedidos p"),
@NamedQuery(name = "Pedidos.findById", query = "SELECT p FROM Pedidos p WHERE p.id = :id"),
@NamedQuery(name = "Pedidos.findByFecha", query = "SELECT p FROM Pedidos p WHERE p.fecha = :fecha"),
@NamedQuery(name = "Pedidos.findByTotal", query = "SELECT p FROM Pedidos p WHERE p.total = :total"),
@NamedQuery(name = "Pedidos.findByEstatus", query = "SELECT p FROM Pedidos p WHERE p.estatus = :estatus")})
public class Pedidos 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
@Column(name = "fecha")
@Temporal(TemporalType.DATE)
private Date fecha;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "total")
private String total;
@Basic(optional = false)
@NotNull
@Column(name = "estatus")
private short estatus;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pedidosId")
private List<Detallesp> detallespList;
@JoinColumn(name = "usuarios_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private Usuarios usuariosId;
public Pedidos() {
}
public Pedidos(Integer id) {
this.id = id;
}
public Pedidos(Integer id, Date fecha, String total, short estatus) {
this.id = id;
this.fecha = fecha;
this.total = total;
this.estatus = estatus;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public String getTotal() {
return total;
}
public void setTotal(String total) {
this.total = total;
}
public short getEstatus() {
return estatus;
}
public void setEstatus(short estatus) {
this.estatus = estatus;
}
public List<Detallesp> getDetallespList() {
return detallespList;
}
public void setDetallespList(List<Detallesp> detallespList) {
this.detallespList = detallespList;
}
public Usuarios getUsuariosId() {
return usuariosId;
}
public void setUsuariosId(Usuarios usuariosId) {
this.usuariosId = usuariosId;
}
@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 Pedidos)) {
return false;
}
Pedidos other = (Pedidos) 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.modelos.Pedidos[ id=" + id + " ]";
}
}

193
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Productos.java

@ -0,0 +1,193 @@
/*
* 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.modelos;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author sktal
*/
@Entity
@Table(name = "productos")
@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.findByStock", query = "SELECT p FROM Productos p WHERE p.stock = :stock"),
@NamedQuery(name = "Productos.findByEstatus", query = "SELECT p FROM Productos p WHERE p.estatus = :estatus")})
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 = 45)
@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 = "stock")
private String stock;
@Basic(optional = false)
@NotNull
@Column(name = "estatus")
private short estatus;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "productosId")
private List<Detallesp> detallespList;
@JoinColumn(name = "categorias_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private Categorias categoriasId;
@JoinColumn(name = "proveedores_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private Proveedores proveedoresId;
public Productos() {
}
public Productos(Integer id) {
this.id = id;
}
public Productos(Integer id, String nombre, String descripcion, String precio, String stock, short estatus) {
this.id = id;
this.nombre = nombre;
this.descripcion = descripcion;
this.precio = precio;
this.stock = stock;
this.estatus = estatus;
}
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 getStock() {
return stock;
}
public void setStock(String stock) {
this.stock = stock;
}
public short getEstatus() {
return estatus;
}
public void setEstatus(short estatus) {
this.estatus = estatus;
}
public List<Detallesp> getDetallespList() {
return detallespList;
}
public void setDetallespList(List<Detallesp> detallespList) {
this.detallespList = detallespList;
}
public Categorias getCategoriasId() {
return categoriasId;
}
public void setCategoriasId(Categorias categoriasId) {
this.categoriasId = categoriasId;
}
public Proveedores getProveedoresId() {
return proveedoresId;
}
public void setProveedoresId(Proveedores proveedoresId) {
this.proveedoresId = proveedoresId;
}
@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.modelos.Productos[ id=" + id + " ]";
}
}

169
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Proveedores.java

@ -0,0 +1,169 @@
/*
* 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.modelos;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author sktal
*/
@Entity
@Table(name = "proveedores")
@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.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.findByCantidad", query = "SELECT p FROM Proveedores p WHERE p.cantidad = :cantidad"),
@NamedQuery(name = "Proveedores.findByEstatus", query = "SELECT p FROM Proveedores p WHERE p.estatus = :estatus")})
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 = 45)
@Column(name = "nombre")
private String nombre;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "direccion")
private String direccion;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "pais")
private String pais;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "cantidad")
private String cantidad;
@Basic(optional = false)
@NotNull
@Column(name = "estatus")
private short estatus;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "proveedoresId")
private List<Productos> productosList;
public Proveedores() {
}
public Proveedores(Integer id) {
this.id = id;
}
public Proveedores(Integer id, String nombre, String direccion, String pais, String cantidad, short estatus) {
this.id = id;
this.nombre = nombre;
this.direccion = direccion;
this.pais = pais;
this.cantidad = cantidad;
this.estatus = estatus;
}
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 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 getCantidad() {
return cantidad;
}
public void setCantidad(String cantidad) {
this.cantidad = cantidad;
}
public short getEstatus() {
return estatus;
}
public void setEstatus(short estatus) {
this.estatus = estatus;
}
public List<Productos> getProductosList() {
return productosList;
}
public void setProductosList(List<Productos> productosList) {
this.productosList = productosList;
}
@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.modelos.Proveedores[ id=" + id + " ]";
}
}

190
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/modelos/Usuarios.java

@ -0,0 +1,190 @@
/*
* 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.modelos;
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.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 sktal
*/
@Entity
@Table(name = "usuarios")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Usuarios.findAll", query = "SELECT u FROM Usuarios u"),
@NamedQuery(name = "Usuarios.findById", query = "SELECT u FROM Usuarios u WHERE u.id = :id"),
@NamedQuery(name = "Usuarios.findByNombre", query = "SELECT u FROM Usuarios u WHERE u.nombre = :nombre"),
@NamedQuery(name = "Usuarios.findByApellidoP", query = "SELECT u FROM Usuarios u WHERE u.apellidoP = :apellidoP"),
@NamedQuery(name = "Usuarios.findByApellidoM", query = "SELECT u FROM Usuarios u WHERE u.apellidoM = :apellidoM"),
@NamedQuery(name = "Usuarios.findByEmail", query = "SELECT u FROM Usuarios u WHERE u.email = :email"),
@NamedQuery(name = "Usuarios.findByTelefono", query = "SELECT u FROM Usuarios u WHERE u.telefono = :telefono"),
@NamedQuery(name = "Usuarios.findByEstatus", query = "SELECT u FROM Usuarios u WHERE u.estatus = :estatus"),
@NamedQuery(name = "Usuarios.findByContrasena", query = "SELECT u FROM Usuarios u WHERE u.contrasena = :contrasena"),
@NamedQuery(name = "Usuarios.validar", query = "SELECT u FROM Usuarios u WHERE u.estatus = :estatus and u.nombre = :nombre and u.contrasena = :contrasena")})
public class Usuarios implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "nombre")
private String nombre;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "apellidoP")
private String apellidoP;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "apellidoM")
private String apellidoM;
// @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "email")
private String email;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "telefono")
private String telefono;
@Basic(optional = false)
@NotNull
@Column(name = "estatus")
private short estatus;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 20)
@Column(name = "contrasena")
private String contrasena;
public Usuarios() {
}
public Usuarios(Integer id) {
this.id = id;
}
public Usuarios(Integer id, String nombre, String apellidoP, String apellidoM, String email, String telefono, short estatus, String contrasena) {
this.id = id;
this.nombre = nombre;
this.apellidoP = apellidoP;
this.apellidoM = apellidoM;
this.email = email;
this.telefono = telefono;
this.estatus = estatus;
this.contrasena = contrasena;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellidoP() {
return apellidoP;
}
public void setApellidoP(String apellidoP) {
this.apellidoP = apellidoP;
}
public String getApellidoM() {
return apellidoM;
}
public void setApellidoM(String apellidoM) {
this.apellidoM = apellidoM;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTelefono() {
return telefono;
}
public void setTelefono(String telefono) {
this.telefono = telefono;
}
public short getEstatus() {
return estatus;
}
public void setEstatus(short estatus) {
this.estatus = estatus;
}
public String getContrasena() {
return contrasena;
}
public void setContrasena(String contrasena) {
this.contrasena = contrasena;
}
@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.modelos.Usuarios[ id=" + id + " ]";
}
}

18
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/msj/Mensaje.java

@ -0,0 +1,18 @@
/*
* 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.msj;
/**
*
* @author sktal
*/
public enum Mensaje {
SIN_ERROR,
CAMPOS_INCOMPLETOS,
DATOS_INCORRECTOS,
ELEMENTO_DUPLICADO,
ELEMENTO_NO_ENCONTRADO,
AUTOR_O_EDITORIAL_INCOMPLETOS,
}

13
inventario-ejb/src/java/mx/edu/tsj/chapala/sistemas/msj/ejemplo.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.msj;
/**
*
* @author sktal
*/
public class ejemplo {
}

71
inventario-war/build.xml

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="inventario-war" default="default" basedir=".">
<description>Builds, tests, and runs the project inventario-war.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying
Example of pluging an obfuscator after the compilation could look like
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Other way how to customize the build is by overriding existing main targets.
The target of interest are:
init-macrodef-javac: defines macro for javac compilation
init-macrodef-junit: defines macro for junit execution
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>

BIN
inventario-war/libs/primefaces-12.0.0.jar

Binary file not shown.

131
inventario-war/nbproject/ant-deploy.xml

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project default="-deploy-ant" basedir=".">
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
<property file="${deploy.ant.properties.file}" />
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
<available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
</target>
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.sun.web}" validate="false">
</xmlproperty>
<delete file="${temp.sun.web}"/>
<condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
<isset property="sun-web-app.context-root"/>
</condition>
<condition property="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
<isset property="sun-web-app.context-root"/>
</condition>
</target>
<target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
<tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.gf.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.gf.web}">
<replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.gf.web}" validate="false">
</xmlproperty>
<delete file="${temp.gf.web}"/>
<condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
<isset property="glassfish-web-app.context-root"/>
</condition>
<condition property="deploy.context.root.argument" value="&amp;contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
<isset property="glassfish-web-app.context-root"/>
</condition>
</target>
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
<property name="deploy.context.root.argument" value=""/>
</target>
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
<mkdir dir="${gfv3.resources.dir}"/>
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
<copy todir="${gfv3.resources.dir}/META-INF">
<fileset dir="${deploy.ant.resource.dir}"/>
</copy>
<jar destfile="${deploy.ant.archive}" update="true">
<fileset dir="${gfv3.resources.dir}"/>
</jar>
<delete dir="${gfv3.resources.dir}"/>
</target>
<target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
<antcall target="-deploy-without-pw"/>
<antcall target="-deploy-with-pw"/>
</target>
<target name="-deploy-without-pw" unless="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-deploy-with-pw" if="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
<antcall target="-undeploy-without-pw"/>
<antcall target="-undeploy-with-pw"/>
</target>
<target name="-undeploy-without-pw" unless="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-with-pw" if="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
</project>

1438
inventario-war/nbproject/build-impl.xml

File diff suppressed because it is too large

0
inventario-war/nbproject/faces-config.NavData

8
inventario-war/nbproject/genfiles.properties

@ -0,0 +1,8 @@
build.xml.data.CRC32=9a6c4398
build.xml.script.CRC32=2c5921fb
build.xml.stylesheet.CRC32=1707db4f@1.96.0.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=9a6c4398
nbproject/build-impl.xml.script.CRC32=dede17b0
nbproject/build-impl.xml.stylesheet.CRC32=334708a0@1.96.0.1

95
inventario-war/nbproject/project.properties

@ -0,0 +1,95 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=true
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets
build.classes.dir=${build.web.dir}/WEB-INF/classes
build.classes.excludes=**/*.java,**/*.form
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
build.web.dir=${build.dir}/web
build.web.excludes=${build.classes.excludes}
client.urlPart=
compile.jsps=false
conf.dir=${source.root}/conf
debug.classpath=${build.classes.dir}:${javac.classpath}
debug.test.classpath=\
${run.test.classpath}
display.browser=true
# Files to be excluded from distribution war
dist.archive.excludes=
dist.dir=dist
dist.ear.war=${dist.dir}/${war.ear.name}
dist.javadoc.dir=${dist.dir}/javadoc
dist.war=${dist.dir}/${war.name}
endorsed.classpath=\
${libs.javaee-endorsed-api-7.0.classpath}
excludes=
file.reference.primefaces-12.0.0.jar=libs\\primefaces-12.0.0.jar
includes=**
j2ee.compile.on.save=true
j2ee.copy.static.files.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=1.7
j2ee.platform.classpath=${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsit.classpath=
j2ee.server.type=gfv4ee7
jar.compress=false
javac.classpath=\
${reference.inventario-ejb.dist}:\
${file.reference.primefaces-12.0.0.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.debug=true
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.7
javac.target=1.7
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.preview=true
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
lib.dir=${web.docbase.dir}/WEB-INF/lib
no.dependencies=false
persistence.xml.dir=${conf.dir}
platform.active=default_platform
project.inventario-ejb=../inventario-ejb
reference.inventario-ejb.dist=${project.inventario-ejb}/dist/inventario-ejb.jar
resource.dir=setup
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
# Space-separated list of JVM arguments used when running a class with a main method or a unit test
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
runmain.jvmargs=
source.encoding=UTF-8
source.root=src
src.dir=${source.root}/java
test.src.dir=test
war.content.additional=
war.ear.name=${war.name}
war.name=inventario-war.war
web.docbase.dir=web
webinf.dir=web/WEB-INF

36
inventario-war/nbproject/project.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/web-project/3">
<name>inventario-war</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<web-module-libraries>
<library dirs="100">
<file>${reference.inventario-ejb.dist}</file>
</library>
<library dirs="200">
<file>${file.reference.primefaces-12.0.0.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
<root id="src.dir" name="Source Packages"/>
</source-roots>
<test-roots>
<root id="test.src.dir" name="Test Packages"/>
</test-roots>
</data>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>inventario-ejb</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>dist</target>
<clean-target>clean</clean-target>
<id>dist</id>
</reference>
</references>
</configuration>
</project>

2
inventario-war/src/conf/MANIFEST.MF

@ -0,0 +1,2 @@
Manifest-Version: 1.0

61
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/seguridad/AutorizacionListener.java

@ -0,0 +1,61 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.seguridad;
import java.io.IOException;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import javax.faces.application.NavigationHandler;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
/**
*
* @author sktal
*/
@Named(value = "autorizacionListener")
@SessionScoped
public class AutorizacionListener implements PhaseListener {
/**
* Creates a new instance of AutorizacionListener
*/
public AutorizacionListener() {
}
private static final long serialVersionUID = 1L;
@Override
public void afterPhase(PhaseEvent event) {
try {
//Obtener la pagina actual para validar la sesion
String paginaActual = event.getFacesContext().getViewRoot().getViewId();
//inicializar la sesion en caso de no haber sesion
Login.getSesion();
//Revisar que no sea la pafina index y que no estes logueado
//para redireccionar
if (!paginaActual.contains("index.xhtml") && Login.getEstatus() == false) {
FacesContext.getCurrentInstance().getExternalContext().redirect("faces/index.xhtml?faces-redirect=true");
NavigationHandler nh = event.getFacesContext().getApplication().getNavigationHandler();
nh.handleNavigation(event.getFacesContext(), null, "index");
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void beforePhase(PhaseEvent event) {}
@Override
public PhaseId getPhaseId() {
return PhaseId.RESTORE_VIEW;
}
}

127
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/seguridad/Login.java

@ -0,0 +1,127 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.seguridad;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
import mx.edu.tsj.chapala.sistemas.modelo.bl.UsuariosBL;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
/**
*
* @author sktal
*/
@Named(value = "loginDem")
@SessionScoped
public class Login implements Serializable {
//Variable
private static HttpSession httpSession;
private UsuariosBL usuariosBL;
private String username;
private String password;
public Login() {
}
@PostConstruct
public void init() {
usuariosBL = new UsuariosBL(); // O cualquier método adecuado para inicializar usuariosBL
}
public static void getSesion(){
httpSession = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
}
public String logout(){
httpSession.removeAttribute("sesionActiva");
httpSession.invalidate();
username = "";
password = "";
return "index.xhtml";
}
/*
public static String logout(){
httpSession.removeAttribute("sesionActiva");
httpSession.invalidate();
return "index.xhtml";
}
*/
public String buscarPorLogin() {
Usuarios usuario = new Usuarios();
usuario.setNombre(username);
usuario.setContrasena(password);
short status = 1;
usuario.setEstatus(status);
//usuario.setStatus(true);
usuario = usuariosBL.buscarPorLoginStatus(true, usuario);
if (usuario != null) {
httpSession.setAttribute("sesionActiva", true);
// Aquí podrías redirigir a otra página si el login fue exitoso
return "UsuariosLista.xhtml";
} else {
// Aquí podrías mostrar un mensaje de error si el login falló
return "index.xhtml";
}
}
//Codigo de validacion de usuario
public static String login(){
//Llamar a BL para autenticar que regresa un boolean
//TODO: hacer un metodo en el BL que reciba el usuario y password
boolean login = true;
if(login){
httpSession.setAttribute("sesionActiva", "true");
return "UsuariosLista.xhtml";
}else{
return "index.xhtml";
}
}
public UsuariosBL getUsuariosBL() {
return usuariosBL;
}
public void setUsuariosBL(UsuariosBL usuariosBL) {
this.usuariosBL = usuariosBL;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public static boolean getEstatus(){
if(httpSession!=null&&
httpSession.getId()!=null&&
!httpSession.getId().isEmpty()&&
httpSession.getAttribute("sesionActiva")!=null){
return true;
}else{
return false;
}
}
}

86
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/SelectOneMenuConverter.java

@ -0,0 +1,86 @@
package mx.edu.itsj.vista;
import java.util.List;
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectItem;
import javax.faces.component.UISelectItems;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
/**
* The Class SelectOneMenuConverter.
*/
@FacesConverter("selectOneMenuConverter")
public class SelectOneMenuConverter implements Converter {
@Override
public Object getAsObject(final FacesContext arg0, final UIComponent arg1, final String objectString) {
if (objectString == null) {
return null;
}
return fromSelect(arg1, objectString);
}
/**
* Serialize.
*
* @param object
* the object
* @return the string
*/
private String serialize(final Object object) {
if (object == null) {
return null;
}
return object.getClass() + "@" + object.hashCode();
}
/**
* From select.
*
* @param currentcomponent
* the currentcomponent
* @param objectString
* the object string
* @return the object
*/
private Object fromSelect(final UIComponent currentcomponent, final String objectString) {
if (currentcomponent.getClass() == UISelectItem.class) {
final UISelectItem item = (UISelectItem) currentcomponent;
final Object value = item.getValue();
if (objectString.equals(serialize(value))) {
return value;
}
}
if (currentcomponent.getClass() == UISelectItems.class) {
final UISelectItems items = (UISelectItems) currentcomponent;
final List<Object> elements = (List<Object>) items.getValue();
for (final Object element : elements) {
if (objectString.equals(serialize(element))) {
return element;
}
}
}
if (!currentcomponent.getChildren().isEmpty()) {
for (final UIComponent component : currentcomponent.getChildren()) {
final Object result = fromSelect(component, objectString);
if (result != null) {
return result;
}
}
}
return null;
}
@Override
public String getAsString(final FacesContext arg0, final UIComponent arg1, final Object object) {
return serialize(object);
}
}

101
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanCategorias.java

@ -0,0 +1,101 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.vista;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import mx.edu.tsj.chapala.sistemas.modelo.bl.CategoriasBLLocal;
import mx.edu.tsj.chapala.sistemas.modelos.Categorias;
/**
*
* @author sktal
*/
@Named(value = "demoBeanCategorias")
@SessionScoped
public class demoBeanCategorias implements Serializable {
@EJB
private CategoriasBLLocal categoriasBL;
private Categorias categorias = new Categorias();
private boolean nuevo;
private String titulo;
public CategoriasBLLocal getCategoriasBL() {
return categoriasBL;
}
public void setCategoriasBL(CategoriasBLLocal categoriasBL) {
this.categoriasBL = categoriasBL;
}
public Categorias getCategorias() {
return categorias;
}
public void setCategorias(Categorias categorias) {
this.categorias = categorias;
}
public demoBeanCategorias() {
}
/*public void eliminarCategoria(){
usuariosBL.eliminar(usuarios);
//usuariosBL.desactivarUsuarios(usuarios);
}*/
public String agregarC(){
//categorias.setEstatus((short)1);
//usuariosBL.agregar(usuarios);
categoriasBL.agregar(categorias);
//usuarios = new Usuarios();
categorias = new Categorias();
return "CategoriasLista.xhtml";
}
public List<Categorias> getAll(){
return categoriasBL.getAll();
}
public String getTitulo() {
return titulo;
}
public boolean isNuevo() {
return nuevo;
}
public void prepararEditar(Categorias categorias){
nuevo = false;
titulo = "Editando categoria";
this.categorias = categorias;
}
public void prepararNuevo(){
nuevo = true;
titulo = "Agregando Categoria";
categorias = new Categorias();
}
public void editarCategoria(){
//usuariosBL.editar(usuarios);
categoriasBL.editar(categorias);
}
public void prepararEliminar(Categorias categorias){
this.categorias = categorias;
titulo = "Eliminando categoria";
}
}

185
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanDetallesp.java

@ -0,0 +1,185 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.vista;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import mx.edu.tsj.chapala.sistemas.modelo.bl.DetallespBLLocal;
import mx.edu.tsj.chapala.sistemas.modelo.bl.UsuariosBLLocal;
import mx.edu.tsj.chapala.sistemas.modelos.Detallesp;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Named(value = "demoBeanDetallesp")
@SessionScoped
public class demoBeanDetallesp implements Serializable {
@EJB
private DetallespBLLocal detallesBL;
private Detallesp detalles = new Detallesp();
private boolean nuevo;
//Creado clase 19 de marzo
private String titulo;
public DetallespBLLocal getDetallespBL() {
return detallesBL;
}
public void setDetallesp(DetallespBLLocal detallesBL) {
this.detallesBL = detallesBL;
}
public Detallesp getDetallesp() {
return detalles;
}
public void setDetallesp(Detallesp detallesp) {
this.detalles = detalles;
}
/**
* Creates a new instance of demoBeanDetallesp
*/
public demoBeanDetallesp() {
}
public void eliminarDetalle(){
//usuariosBL.eliminar(usuarios);
detallesBL.eliminar(detalles);
//usuariosBL.desactivarUsuarios(usuarios);
}
public String agregarDetalle(){
//detallesp.setEstatus(1);
detallesBL.agregar(detalles);
detalles = new Detallesp();
return "index.xhtml";
}
public String metodo() {
Detallesp d = new Detallesp();
/*u.setNombre("Kevin");
u.setApellidoP("Talamantes");
u.setApellidoM("Talamantes");
u.setEmail("skta@gmail.com");
u.setTelefono("3314457485");
*/
d.setCantidad("30");
d.setPrecioU((long) 45.00);
//Mensaje m = editorialBL.agregar(a);
Mensaje m = detallesBL.agregar(d);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("SE AGREGRO");
} else {
System.out.println("NO SE AGREGO");
}
//editorialBL.agregar(a);
return "usuarios.xhtml";
}
public String buscar() {
//Usuarios u = new Usuarios();
Detallesp d = new Detallesp();
//u.setId(2);
d.setId(2);
Mensaje m = detallesBL.buscarId(d);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("Encontre al usuario: ");
System.out.println(detallesBL.buscarId(d));
} else {
System.out.println("NO SE ENCONTRO");
}
return "usuarios.xhtml";
}
public String eliminar() {
Detallesp d = detallesBL.buscarIdLi(new Detallesp(2));
//Mensaje m = editorialBL.eliminar(a);
Mensaje m = detallesBL.eliminar(d);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("SE ELIMINO");
} else {
System.out.println("NO SE PUDO");
}
//System.out.println("Editorial eliminada: ");
//System.out.println(editorialBL.eliminar(a));
return "usuarios.xhtml";
}
public String editar() {
try {
Detallesp d = detallesBL.buscarIdLi(new Detallesp(2));
d.setCantidad("50");
d.setPrecioU((long) 55.00);
//editorialBL.editar(a);
//Mensaje m = editorialBL.editar(a);
Mensaje m = detallesBL.editar(d);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("SE EDITO");
} else {
System.out.println("NO SE PUDO");
}
} catch (Exception e) {
System.out.println("Ha ocurrido un error: " + Mensaje.ELEMENTO_NO_ENCONTRADO);
}
return "editorial.xhtml";
}
public List<Detallesp> getAll(){
return detallesBL.getAll();
}
public String getTitulo() {
return titulo;
}
public boolean isNuevo() {
return nuevo;
}
public void prepararEditar(Detallesp detalles){
nuevo = false;
titulo = "Editando usuario";
this.detalles = detalles;
}
public void prepararNuevo(){
nuevo = true;
titulo = "Agregando Detalles";
detalles = new Detallesp();
}
public void editarDetalles(){
detallesBL.editar(detalles);
}
public void prepararEliminar(Detallesp detalles){
this.detalles = detalles;
titulo = "Eliminando detalles";
}
}

102
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanPedidos.java

@ -0,0 +1,102 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.vista;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import mx.edu.tsj.chapala.sistemas.modelo.bl.PedidosBLLocal;
import mx.edu.tsj.chapala.sistemas.modelos.Pedidos;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author lwyou
*/
@Named(value = "demoBeanPedidos")
@SessionScoped
public class demoBeanPedidos implements Serializable {
@EJB
private PedidosBLLocal pedidosBL;
private Pedidos pedidos = new Pedidos();
private boolean nuevo;
private String titulo;
public PedidosBLLocal getPedidosBL() {
return pedidosBL;
}
public void setPedidosBL(PedidosBLLocal pedidosBL) {
this.pedidosBL = pedidosBL;
}
public Pedidos getPedidos() {
return pedidos;
}
public void setPedidos(Pedidos pedidos) {
this.pedidos = pedidos;
}
/**
* Creates a new instance of demoBeanProductos
*/
public demoBeanPedidos() {
}
public void eliminarPedidos(){
pedidosBL.eliminar(pedidos);
//usuariosBL.desactivarUsuarios(usuarios);
}
public String agregarP(){
pedidos.setEstatus((short)1);
pedidosBL.agregar(pedidos);
//usuarios = new Usuarios();
pedidos = new Pedidos();
return "PedidosLista.xhtml";
}
public List<Pedidos> getAll(){
return pedidosBL.getAll();
}
public String getTitulo() {
return titulo;
}
public boolean isNuevo() {
return nuevo;
}
public void prepararEditar(Pedidos pedidos){
nuevo = false;
titulo = "Editando pedidos";
this.pedidos= pedidos;
}
public void prepararNuevo(){
nuevo = true;
titulo = "Agregando pedidos";
pedidos = new Pedidos();
}
public void editarPedidos(){
pedidosBL.editar(pedidos);
}
public void prepararEliminar(Pedidos pedidos){
this.pedidos = pedidos;
titulo = "Eliminando pedidos";
}
}

100
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanProductos.java

@ -0,0 +1,100 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.vista;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import mx.edu.tsj.chapala.sistemas.modelo.bl.ProductosBLLocal;
import mx.edu.tsj.chapala.sistemas.modelo.bl.UsuariosBLLocal;
import mx.edu.tsj.chapala.sistemas.modelos.Productos;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
/**
*
* @author sktal
*/
@Named(value = "demoBeanProductos")
@SessionScoped
public class demoBeanProductos implements Serializable {
@EJB
private ProductosBLLocal productosBL;
private Productos productos = new Productos();
private boolean nuevo;
private String titulo;
public ProductosBLLocal getProductosBL() {
return productosBL;
}
public void setProductosBL(ProductosBLLocal productosBL) {
this.productosBL = productosBL;
}
public Productos getProductos() {
return productos;
}
public void setProductos(Productos productos) {
this.productos = productos;
}
/**
* Creates a new instance of demoBeanProductos
*/
public demoBeanProductos() {
}
public void eliminarProducto(){
productosBL.eliminar(productos);
//usuariosBL.desactivarUsuarios(usuarios);
}
public String agregarP(){
productos.setEstatus((short)1);
productosBL.agregar(productos);
//usuarios = new Usuarios();
productos = new Productos();
return "ProductosLista.xhtml";
}
public List<Productos> getAll(){
return productosBL.getAll();
}
public String getTitulo() {
return titulo;
}
public boolean isNuevo() {
return nuevo;
}
public void prepararEditar(Productos productos){
nuevo = false;
titulo = "Editando producto";
this.productos = productos;
}
public void prepararNuevo(){
nuevo = true;
titulo = "Agregando producto";
productos = new Productos();
}
public void editarProductos(){
productosBL.editar(productos);
}
public void prepararEliminar(Productos productos){
this.productos = productos;
titulo = "Eliminando productos";
}
}

189
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanProveedores.java

@ -0,0 +1,189 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.vista;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import mx.edu.tsj.chapala.sistemas.modelo.bl.ProveedoresBLLocal;
import mx.edu.tsj.chapala.sistemas.modelos.Proveedores;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Named(value = "demoBeanProveedores")
@SessionScoped
public class demoBeanProveedores implements Serializable {
@EJB
private ProveedoresBLLocal proveedoresBL;
private boolean nuevo;
private String titulo;
private Proveedores proveedores = new Proveedores();
public ProveedoresBLLocal getProveedoresBL() {
return proveedoresBL;
}
public void setProveedoresBL(ProveedoresBLLocal proveedoresBL) {
this.proveedoresBL = proveedoresBL;
}
public Proveedores getProveedores() {
return proveedores;
}
public void setProveedores(Proveedores proveedores) {
this.proveedores = proveedores;
}
/**
* Creates a new instance of demoBeanProveedores
*/
public demoBeanProveedores() {
}
public void eliminarProveedores(){
//proveedoresBL.eliminar(proveedores);
proveedoresBL.desactivarProveedores(proveedores);
}
public String agregarP(){
proveedores.setEstatus((short)1);
proveedoresBL.agregar(proveedores);
proveedores = new Proveedores();
return "ProveedoresLista.xhtml";
}
public String metodo() {
//Editorial a = new Editorial();
Proveedores u = new Proveedores();
// u.setNombre("Kevin");
//u.setApellidoP("Talamantes");
// u.setApellidoM("Talamantes");
//u.setEmail("skta@gmail.com");
//u.setTelefono("3314457485");
//Mensaje m = editorialBL.agregar(a);
Mensaje m = proveedoresBL.agregar(u);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("SE AGREGRO");
} else {
System.out.println("NO SE AGREGO");
}
//editorialBL.agregar(a);
return "Proveedores.xhtml";
}
public String buscar() {
Proveedores u = new Proveedores();
u.setId(2);
Mensaje m = proveedoresBL.buscarId(u);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("Encontre al usuario: ");
System.out.println(proveedoresBL.buscarId(u));
} else {
System.out.println("NO SE ENCONTRO");
}
return "Proveedores.xhtml";
}
public String eliminar() {
//Editorial a = editorialBL.buscarIdLi(new Editorial(2));
Proveedores u = proveedoresBL.buscarIdLi(new Proveedores(2));
//Mensaje m = editorialBL.eliminar(a);
Mensaje m = proveedoresBL.eliminar(u);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("SE ELIMINO");
} else {
System.out.println("NO SE PUDO");
}
//System.out.println("Editorial eliminada: ");
//System.out.println(editorialBL.eliminar(a));
return "Proveedores.xhtml";
}
public String editar() {
try {
//Editorial a = editorialBL.buscarIdLi(new Editorial(2));
Proveedores u = proveedoresBL.buscarIdLi(new Proveedores(2));
// u.setNombre("Pancho");
// u.setApellidoP("Galvez");
// u.setApellidoM("Santillan");
// u.setEmail("santillan@gmail.com");
//u.setTelefono("331254781");
//editorialBL.editar(a);
//Mensaje m = editorialBL.editar(a);
Mensaje m = proveedoresBL.editar(u);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("SE EDITO");
} else {
System.out.println("NO SE PUDO");
}
} catch (Exception e) {
System.out.println("Ha ocurrido un error: " + Mensaje.ELEMENTO_NO_ENCONTRADO);
}
return "Proveedores.xhtml";
}
public List<Proveedores> getAll(){
return proveedoresBL.getAll();
}
public boolean isNuevo() {
return nuevo;
}
public String getTitulo() {
return titulo;
}
public void prepararEditar(Proveedores proveedores){
nuevo = false;
titulo = "Editando Proveedor";
this.proveedores = proveedores;
}
public void prepararNuevo(){
nuevo = true;
titulo = "Agregando Proveedor";
proveedores = new Proveedores();
}
public void editarProveedores(){
proveedoresBL.editar(proveedores);
}
public void prepararEliminar(Proveedores proveedores){
this.proveedores = proveedores;
titulo = "Eliminando proveedor";
}
}

188
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/demoBeanUsuarios.java

@ -0,0 +1,188 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template
*/
package mx.edu.tsj.chapala.sistemas.vista;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import mx.edu.tsj.chapala.sistemas.modelo.bl.UsuariosBLLocal;
import mx.edu.tsj.chapala.sistemas.modelos.Usuarios;
import mx.edu.tsj.chapala.sistemas.msj.Mensaje;
/**
*
* @author sktal
*/
@Named(value = "demoBeanUsuarios")
@SessionScoped
public class demoBeanUsuarios implements Serializable {
@EJB
private UsuariosBLLocal usuariosBL;
private Usuarios usuarios = new Usuarios();
private boolean nuevo;
//Creado clase 19 de marzo
private String titulo;
public UsuariosBLLocal getUsuariosBL() {
return usuariosBL;
}
public void setUsuariosBL(UsuariosBLLocal usuariosBL) {
this.usuariosBL = usuariosBL;
}
public Usuarios getUsuarios() {
return usuarios;
}
public void setUsuarios(Usuarios usuarios) {
this.usuarios = usuarios;
}
/**
* Creates a new instance of demoBeanUsuarios
*/
public demoBeanUsuarios() {
}
public void eliminarUsuario(){
usuariosBL.eliminar(usuarios);
//usuariosBL.desactivarUsuarios(usuarios);
}
public String agregarU(){
usuarios.setEstatus((short)1);
usuariosBL.agregar(usuarios);
usuarios = new Usuarios();
return "UsuariosLista.xhtml";
}
public String metodo() {
//Editorial a = new Editorial();
Usuarios u = new Usuarios();
u.setNombre("Kevin");
u.setApellidoP("Talamantes");
u.setApellidoM("Talamantes");
u.setEmail("skta@gmail.com");
u.setTelefono("3314457485");
//Mensaje m = editorialBL.agregar(a);
Mensaje m = usuariosBL.agregar(u);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("SE AGREGRO");
} else {
System.out.println("NO SE AGREGO");
}
//editorialBL.agregar(a);
return "usuarios.xhtml";
}
public String buscar() {
Usuarios u = new Usuarios();
u.setId(2);
Mensaje m = usuariosBL.buscarId(u);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("Encontre al usuario: ");
System.out.println(usuariosBL.buscarId(u));
} else {
System.out.println("NO SE ENCONTRO");
}
return "usuarios.xhtml";
}
public String eliminar() {
//Editorial a = editorialBL.buscarIdLi(new Editorial(2));
Usuarios u = usuariosBL.buscarIdLi(new Usuarios(2));
//Mensaje m = editorialBL.eliminar(a);
if(u.getEstatus()==0){
System.out.println("No existe. ");
} else{
u.setEstatus((short)0);
usuariosBL.eliminar(u);
System.out.println("Fue eliminado con exito. ");
}
//System.out.println("Editorial eliminada: ");
//System.out.println(editorialBL.eliminar(a));
return "usuarios.xhtml";
}
public String editar() {
try {
//Editorial a = editorialBL.buscarIdLi(new Editorial(2));
Usuarios u = usuariosBL.buscarIdLi(new Usuarios(2));
u.setNombre("Pancho");
u.setApellidoP("Galvez");
u.setApellidoM("Santillan");
u.setEmail("santillan@gmail.com");
u.setTelefono("331254781");
//editorialBL.editar(a);
//Mensaje m = editorialBL.editar(a);
Mensaje m = usuariosBL.editar(u);
System.out.println(m);
if (m.compareTo(Mensaje.SIN_ERROR) == 0) {
System.out.println("SE EDITO");
} else {
System.out.println("NO SE PUDO");
}
} catch (Exception e) {
System.out.println("Ha ocurrido un error: " + Mensaje.ELEMENTO_NO_ENCONTRADO);
}
return "editorial.xhtml";
}
public List<Usuarios> getAll(){
return usuariosBL.getAll();
}
public String getTitulo() {
return titulo;
}
public boolean isNuevo() {
return nuevo;
}
public void prepararEditar(Usuarios usuarios){
nuevo = false;
titulo = "Editando usuario";
this.usuarios = usuarios;
}
public void prepararNuevo(){
nuevo = true;
titulo = "Agregando Usuario";
usuarios = new Usuarios();
}
public void editarUsuario(){
usuariosBL.editar(usuarios);
}
public void prepararEliminar(Usuarios usuarios){
this.usuarios = usuarios;
titulo = "Eliminando usuario";
}
}

13
inventario-war/src/java/mx/edu/tsj/chapala/sistemas/vista/ejemplo.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.vista;
/**
*
* @author sktal
*/
public class ejemplo {
}

88
inventario-war/web/CategoriasCrearEditar.xhtml

@ -0,0 +1,88 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
<h5>CATEGORIAS</h5>
</ui:define>
<ui:define name="left" >
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<div class="card">
<f:view>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:growl id="growl-sticky" for="sticky-key" showDetail="true" sticky="true" />
<h1><h:outputText value="#{demoBeanCategorias.titulo}"/></h1>
<p:panelGrid columns="2">
<p:outputLabel value="Nombre:" for="nombre" />
<p:inputText id="nombre" value="#{demoBeanCategorias.categorias.nombre}" title="Nombre" required="true" validatorMessage="Solo acepta letras." requiredMessage="Este campo es requerido.">
<f:validateRegex pattern="^[a-zA-Z]{1,25}$" for="Nombre"/>
</p:inputText>
<p:outputLabel value="Descripcion:" for="descripcion" />
<p:inputText id="descripcion" value="#{demoBeanCategorias.categorias.descripcion}" title="Descripcion" required="true" validatorMessage="Solo acepta letras." requiredMessage="Este campo es requerido.">
<f:validateRegex pattern="^[a-zA-Z]{1,25}$" for="Descripcion"/>
</p:inputText>
</p:panelGrid>
<p:commandButton styleClass="rounded-button ui-button-success" action="#{demoBeanCategorias.agregarC()}" icon="pi pi-save" value="GUARDAR" update="growl" rendered="#{demoBeanCategorias.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-success" action="CategoriasLista.xhtml" actionListener="#{demoBeanCategorias.editarCategoria()}" value="Editar" update="growl" rendered="#{!demoBeanCategorias.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-secondary" action="CategoriasLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</f:view>
</div>
</ui:define>
</ui:composition>
</body>
</html>

81
inventario-war/web/CategoriasEliminar.xhtml

@ -0,0 +1,81 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<h1><h:outputText value="#{demoBeanCategorias.titulo}"/></h1>
<p:panelGrid columns="2">
<h:outputText value="Id:"/>
<h:outputText value="#{demoBeanCategorias.categorias.id}" title="Id"/>
<h:outputText value="Nombre:"/>
<h:outputText value="#{demoBeanCategorias.categorias.nombre}" title="Nombre"/>
<h:outputText value="Descripcion:"/>
<h:outputText value="#{demoBeanCategorias.categorias.descripcion}" title="Descripcion"/>
</p:panelGrid>
<p:commandButton styleClass="rounded-button ui-button-danger" action="CategoriasLista.xhtml" actionListener="#{demoBeanCategorias.editarCategoria()}" value="Eliminar" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-secondary" action="CategoriasLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

107
inventario-war/web/CategoriasLista.xhtml

@ -0,0 +1,107 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<div class="card" ajax="false">
<f:view>
<h:form>
<p:commandButton styleClass="rounded-button ui-button-success" action="CategoriasCrearEditar.xhtml" icon="pi pi-fw pi-plus" actionListener="#{demoBeanCategorias.prepararNuevo()}" value="AGREGAR" ajax="false"/>
<h:form>
<div style="text-align: center;">
<h1><h:outputText value="CATEGORIAS"/></h1>
</div>
<p:dataTable value="#{demoBeanCategorias.all}" var="item">
<p:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Nombre"/>
</f:facet>
<h:outputText value="#{item.nombre}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Descripcion"/>
</f:facet>
<h:outputText value="#{item.descripcion}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Opciones"/>
</f:facet>
<p:commandButton styleClass="rounded-button ui-button-warning" action="CategoriasCrearEditar.xhtml" actionListener="#{demoBeanCategorias.prepararEditar(item)}" value="Editar" ajax="false"/>
</p:column>
</p:dataTable>
</h:form>
</h:form>
</f:view>
</div>
</ui:define>
</ui:composition>
<script>
$.fn.dataTable.ext.errMode = 'none';
new DataTable('table');
</script>
</body>
</html>

91
inventario-war/web/PedidosCrearEditar.xhtml

@ -0,0 +1,91 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:growl id="growl-sticky" for="sticky-key" showDetail="true" sticky="true" />
<h1><h:outputText value="#{demoBeanPedidos.titulo}"/></h1>
<p:panelGrid columns="2">
<p:outputLabel value="Fecha:" for="fecha" />
<p:inputText id="fecha" value="#{demoBeanPedidos.pedidos.fecha}" title="Fecha" required="true" requiredMessage="The Fecha field is required."/>
<p:outputLabel value="Total:" for="total" />
<p:inputText id="total" value="#{demoBeanPedidos.pedidos.total}" title="Total" required="true" requiredMessage="The Total field is required."/>
<p:outputLabel value="UsuariosId:" for="usuariosId" />
<p:selectOneMenu id="usuariosId" value="#{demoBeanPedidos.pedidos.usuariosId}" required="true" converter="selectOneMenuConverter" requiredMessage="The UsuariosId field is required.">
<!-- TODO: update below reference to list of available items-->
<f:selectItems value="#{demoBeanUsuarios.all}" var="item" itemLabel="#{item.nombre}" itemValue="#{item}"/>
</p:selectOneMenu>
</p:panelGrid>
<p:commandButton styleClass="ui-button-raised ui-button-success" action="#{demoBeanPedidos.agregarP()}" icon="pi pi-save" value="GUARDAR" update="growl" rendered="#{demoBeanPedidos.nuevo}" ajax="false"/>
<p:commandButton action="PedidosLista.xhtml" actionListener="#{demoBeanPedidos.editarPedidos()}" value="Editar" update="growl" rendered="#{!demoBeanPedidos.nuevo}" ajax="false"/>
<p:commandButton styleClass="ui-button-raised ui-button-danger" action="PedidosLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

86
inventario-war/web/PedidosEliminar.xhtml

@ -0,0 +1,86 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<h1><h:outputText value="View"/></h1>
<p:panelGrid columns="2">
<h:outputText value="Id:"/>
<h:outputText value="#{demoBeanPedidos.pedidos.id}" title="Id"/>
<h:outputText value="Fecha:"/>
<h:outputText value="#{demoBeanPedidos.pedidos.fecha}" title="Fecha"/>
<h:outputText value="Total"/>
<h:outputText value="#{demoBeanPedidos.pedidos.total}" title="Total"/>
<h:outputText value="Estatus:"/>
<h:outputText value="#{demoBeanPedidos.pedidos.estatus==1?'Activo':'Inactivo'}" title="Estatus"/>
<h:outputText value="UsuariosId:"/>
<h:outputText value="#{demoBeanPedidos.pedidos.usuariosId}" title="UsuariosId"/>
</p:panelGrid>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

120
inventario-war/web/PedidosLista.xhtml

@ -0,0 +1,120 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:commandButton styleClass="rounded-button ui-button-success" action="PedidosCrearEditar.xhtml" icon="pi pi-fw pi-plus" actionListener="#{demoBeanPedidos.prepararNuevo()}" value="AGREGAR" ajax="true"/>
<h:form>
<h1><h:outputText value="List"/></h1>
<p:dataTable value="#{demoBeanPedidos.all}" var="item">
<p:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Fecha"/>
</f:facet>
<h:outputText value="#{item.fecha}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Total"/>
</f:facet>
<h:outputText value="#{item.total}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Estatus"/>
</f:facet>
<h:outputText value="#{item.estatus==1?'Activo':'Inactivo'}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="UsuariosId"/>
</f:facet>
<h:outputText value="#{item.usuariosId}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Opciones"/>
</f:facet>
<p:commandButton styleClass="rounded-button ui-button-warning" action="PedidosCrearEditar.xhtml" actionListener="#{demoBeanPedidos.prepararEditar(item)}" value="Editar" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-danger" action="PedidosEliminar.xhtml" actionListener="#{demoBeanPedidos.prepararEliminar(item)}" value="Eliminar" ajax="false"/>
</p:column>
</p:dataTable>
</h:form>
</h:form>
</f:view>
</ui:define>
</ui:composition>
<script>
$.fn.dataTable.ext.errMode = 'none';
new DataTable('table');
</script>
</body>
</html>

105
inventario-war/web/ProductosCrearEditar.xhtml

@ -0,0 +1,105 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:growl id="growl-sticky" for="sticky-key" showDetail="true" sticky="true" />
<h1><h:outputText value="#{demoBeanProductos.titulo}"/></h1>
<p:panelGrid columns="2">
<p:outputLabel value="Nombre:" for="nombre" />
<p:inputText id="nombre" value="#{demoBeanProductos.productos.nombre}" title="Nombre" required="true" validatorMessage="Solo acepta letras." requiredMessage="Este campo es requerido.">
<f:validateRegex pattern="^[a-zA-Z]{1,25}$" for="Nombre"/>
</p:inputText>
<p:outputLabel value="Descripcion:" for="descripcion" />
<p:inputText id="descripcion" value="#{demoBeanProductos.productos.descripcion}" title="Descripcion" required="true" validatorMessage="Solo acepta letras." requiredMessage="Este campo es requerido.">
<f:validateRegex pattern="^[a-zA-Z]{1,25}$" for="Descripcion"/>
</p:inputText>
<p:outputLabel value="Precio:" for="precio" />
<p:inputText id="precio" value="#{demoBeanProductos.productos.precio}" title="Precio" required="true" validatorMessage="Solo acepta numeros." requiredMessage="Este campo es requerido.">
<f:validateRegex pattern="^\d+(\.\d{1,2})?$" for="Precio"/>
</p:inputText>
<p:outputLabel value="Stock:" for="stock" />
<p:inputText id="stock" value="#{demoBeanProductos.productos.stock}" title="Stock" required="true" validatorMessage="Solo acepta numeros." requiredMessage="Este campo es requerido.">
<f:validateRegex pattern="^\d+$" for="Stock"/>
</p:inputText>
<p:outputLabel value="CategoriasId:" for="categoriasId" />
<p:selectOneMenu id="categoriasId" value="#{demoBeanProductos.productos.categoriasId}" required="true" converter="selectOneMenuConverter" requiredMessage="Este campo es requerido.">
<!-- TODO: update below reference to list of available items-->
<f:selectItems value="#{demoBeanCategorias.all}" var="item" itemLabel="#{item.nombre}" itemValue="#{item}"/>
</p:selectOneMenu>
<p:outputLabel value="ProveedoresId:" for="proveedoresId" />
<p:selectOneMenu id="proveedoresId" value="#{demoBeanProductos.productos.proveedoresId}" required="true" converter="selectOneMenuConverter" requiredMessage="Este campo es requerido.">
<!-- TODO: update below reference to list of available items-->
<f:selectItems value="#{demoBeanProveedores.all}" var="item" itemLabel="#{item.nombre}" itemValue="#{item}"/>
</p:selectOneMenu>
</p:panelGrid>
<p:commandButton styleClass="rounded-button ui-button-success" action="#{demoBeanProductos.agregarP()}" icon="pi pi-save" value="GUARDAR" update="growl" rendered="#{demoBeanProductos.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-success" action="ProductosLista.xhtml" actionListener="#{demoBeanProductos.editarProductos()}" value="Editar" update="growl" rendered="#{!demoBeanProductos.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-secondary" action="ProductosLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

91
inventario-war/web/ProductosEliminar.xhtml

@ -0,0 +1,91 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<h1><h:outputText value="#{demoBeanProductos.titulo}"/></h1>
<p:panelGrid columns="2">
<h:outputText value="Id:"/>
<h:outputText value="#{demoBeanProductos.productos.id}" title="Id"/>
<h:outputText value="Nombre:"/>
<h:outputText value="#{demoBeanProductos.productos.nombre}" title="Nombre"/>
<h:outputText value="Descripcion:"/>
<h:outputText value="#{demoBeanProductos.productos.descripcion}" title="Descripcion"/>
<h:outputText value="Precio:"/>
<h:outputText value="#{demoBeanProductos.productos.precio}" title="Precio"/>
<h:outputText value="Stock:"/>
<h:outputText value="#{demoBeanProductos.productos.stock}" title="Stock"/>
<h:outputText value="Estatus:"/>
<h:outputText value="#{demoBeanProductos.productos.estatus==1?'Activo':'Inactivo'}" title="Estatus"/>
<h:outputText value="CategoriasId:"/>
<h:outputText value="#{demoBeanProductos.productos.categoriasId.nombre}" title="CategoriasId"/>
<h:outputText value="ProveedoresId:"/>
<h:outputText value="#{demoBeanProductos.productos.proveedoresId.nombre}" title="ProveedoresId"/>
</p:panelGrid>
<p:commandButton styleClass="rounded-button ui-button-danger" action="ProductosLista.xhtml" actionListener="#{demoBeanProductos.eliminarProducto()}" value="Eliminar" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-secondary" action="ProductosLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

136
inventario-war/web/ProductosLista.xhtml

@ -0,0 +1,136 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:commandButton styleClass="rounded-button ui-button-success" action="ProductosCrearEditar.xhtml" icon="pi pi-fw pi-plus" actionListener="#{demoBeanProductos.prepararNuevo()}" value="AGREGAR" ajax="true"/>
<h:form>
<div style="text-align: center;">
<h1><h:outputText value="PRODUCTOS"/></h1>
</div>
<p:dataTable value="#{demoBeanProductos.all}" var="item">
<p:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Nombre"/>
</f:facet>
<h:outputText value="#{item.nombre}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Descripcion"/>
</f:facet>
<h:outputText value="#{item.descripcion}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Precio"/>
</f:facet>
<h:outputText value="#{item.precio}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Stock"/>
</f:facet>
<h:outputText value="#{item.stock}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Estatus"/>
</f:facet>
<h:outputText value="#{item.estatus==1?'Activo':'Inactivo'}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="CategoriasId"/>
</f:facet>
<h:outputText value="#{item.categoriasId.nombre}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="ProveedoresId"/>
</f:facet>
<h:outputText value="#{item.proveedoresId.nombre}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Opciones"/>
</f:facet>
<p:commandButton styleClass="rounded-button ui-button-warning" action="ProductosCrearEditar.xhtml" actionListener="#{demoBeanProductos.prepararEditar(item)}" value="Editar" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-danger" action="ProductosEliminar.xhtml" actionListener="#{demoBeanProductos.prepararEliminar(item)}" value="Eliminar" ajax="false"/>
</p:column>
</p:dataTable>
</h:form>
</h:form>
</f:view>
</ui:define>
</ui:composition>
<script>
$.fn.dataTable.ext.errMode = 'none';
new DataTable('table');
</script>
</body>
</html>

88
inventario-war/web/ProveedoresCrearEditar.xhtml

@ -0,0 +1,88 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:growl id="growl-sticky" for="sticky-key" showDetail="true" sticky="true" />
<h1><h:outputText value="#{demoBeanProveedores.titulo}"/></h1>
<p:panelGrid columns="2">
<p:outputLabel value="Nombre:" for="nombre" />
<p:inputText id="nombre" value="#{demoBeanProveedores.proveedores.nombre}" title="Nombre" required="true" requiredMessage="The Nombre field is required."/>
<p:outputLabel value="Direccion:" for="direccion" />
<p:inputText id="direccion" value="#{demoBeanProveedores.proveedores.direccion}" title="Direccion" required="true" requiredMessage="The Direccion field is required."/>
<p:outputLabel value="Pais:" for="pais" />
<p:inputText id="pais" value="#{demoBeanProveedores.proveedores.pais}" title="Pais" required="true" requiredMessage="The Pais field is required."/>
<p:outputLabel value="Cantidad:" for="cantidad" />
<p:inputText id="cantidad" value="#{demoBeanProveedores.proveedores.cantidad}" title="Cantidad" required="true" requiredMessage="The Cantidad field is required."/>
</p:panelGrid>
<p:commandButton styleClass="rounded-button ui-button-success" action="#{demoBeanProveedores.agregarP()}" icon="pi pi-save" value="GUARDAR" update="growl" rendered="#{demoBeanProveedores.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-success" action="ProveedoresLista.xhtml" actionListener="#{demoBeanProveedores.editarProveedores()}" value="Editar" update="growl" rendered="#{!demoBeanProveedores.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-secondary" action="ProveedoresLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

125
inventario-war/web/ProveedoresLista.xhtml

@ -0,0 +1,125 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:commandButton styleClass="rounded-button ui-button-success" action="ProveedoresCrearEditar.xhtml" icon="pi pi-fw pi-plus" actionListener="#{demoBeanProveedores.prepararNuevo()}" value="AGREGAR" ajax="false"/>
<h:form>
<div style="text-align: center;">
<h1><h:outputText value="PROVEEDORES"/></h1>
</div>
<p:dataTable value="#{demoBeanProveedores.all}" var="item">
<p:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Nombre"/>
</f:facet>
<h:outputText value="#{item.nombre}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Direccion"/>
</f:facet>
<h:outputText value="#{item.direccion}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Pais"/>
</f:facet>
<h:outputText value="#{item.pais}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Cantidad"/>
</f:facet>
<h:outputText value="#{item.cantidad}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Estatus"/>
</f:facet>
<h:outputText value="#{item.estatus==1?'Activo':'Inactivo'}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Opciones"/>
</f:facet>
<p:commandButton styleClass="rounded-button ui-button-warning" action="ProveedoresCrearEditar.xhtml" actionListener="#{demoBeanProveedores.prepararEditar(item)}" value="Editar" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-danger" action="proveedoresEliminar.xhtml" actionListener="#{demoBeanProveedores.prepararEliminar(item)}" value="Eliminar" ajax="false"/>
     </p:column>
</p:dataTable>
</h:form>
</h:form>
</f:view>
</ui:define>
</ui:composition>
<script>
$.fn.dataTable.ext.errMode = 'none';
new DataTable('table');
</script>
</body>
</html>

91
inventario-war/web/UsuariosCrearEditar.xhtml

@ -0,0 +1,91 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:growl id="growl-sticky" for="sticky-key" showDetail="true" sticky="true" />
<h1><h:outputText value="#{demoBeanUsuarios.titulo}"/></h1>
<p:panelGrid columns="2">
<p:outputLabel value="Nombre:" for="nombre" />
<p:inputText id="nombre" value="#{demoBeanUsuarios.usuarios.nombre}" title="Nombre" required="true" requiredMessage="Este campo es requerido."/>
<p:outputLabel value="ApellidoP:" for="apellidoP" />
<p:inputText id="apellidoP" value="#{demoBeanUsuarios.usuarios.apellidoP}" title="ApellidoP" required="true" requiredMessage="Este campo es requerido."/>
<p:outputLabel value="ApellidoM:" for="apellidoM" />
<p:inputText id="apellidoM" value="#{demoBeanUsuarios.usuarios.apellidoM}" title="ApellidoM" required="true" requiredMessage="Este campo es requerido."/>
<p:outputLabel value="Email:" for="email" />
<p:inputText id="email" value="#{demoBeanUsuarios.usuarios.email}" title="Email" required="true" requiredMessage="Este campo es requerido."/>
<p:outputLabel value="Telefono:" for="telefono" />
<p:inputText id="telefono" value="#{demoBeanUsuarios.usuarios.telefono}" title="Telefono" required="true" requiredMessage="Este campo es requerido."/>
<p:outputLabel value="Contraseña:" for="contraseña" />
<p:inputText id="telefono" value="#{demoBeanUsuarios.usuarios.contrasena}" title="Contraseña" required="true" requiredMessage="Este campo es requerido."/>
</p:panelGrid>
<p:commandButton styleClass="rounded-button ui-button-success" action="#{demoBeanUsuarios.agregarU()}" icon="pi pi-save" value="GUARDAR" update="growl" rendered="#{demoBeanUsuarios.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-success" action="UsuariosLista.xhtml" actionListener="#{demoBeanUsuarios.editarUsuario()}" value="Editar" update="growl" rendered="#{!demoBeanUsuarios.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-secondary" action="UsuariosLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

138
inventario-war/web/UsuariosLista.xhtml

@ -0,0 +1,138 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:commandButton styleClass="rounded-button ui-button-success" action="UsuariosCrearEditar.xhtml" icon="pi pi-fw pi-plus" actionListener="#{demoBeanUsuarios.prepararNuevo()}" value="AGREGAR" ajax="true"/>
<h:form>
<div style="text-align: center;">
<h1><h:outputText value="USUARIOS"/></h1>
</div>
<p:dataTable value="#{demoBeanUsuarios.all}" var="item">
<p:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Nombre"/>
</f:facet>
<h:outputText value="#{item.nombre}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="ApellidoP"/>
</f:facet>
<h:outputText value="#{item.apellidoP}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="ApellidoM"/>
</f:facet>
<h:outputText value="#{item.apellidoM}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Email"/>
</f:facet>
<h:outputText value="#{item.email}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Telefono"/>
</f:facet>
<h:outputText value="#{item.telefono}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Estatus"/>
</f:facet>
<h:outputText value="#{item.estatus==1?'Activo':'Inactivo'}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Contraseña"/>
</f:facet>
<h:outputText value="#{item.contrasena}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Opciones"/>
</f:facet>
<p:commandButton styleClass="rounded-button ui-button-warning" action="UsuariosCrearEditar.xhtml" actionListener="#{demoBeanUsuarios.prepararEditar(item)}" value="Editar" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-danger" action="usuariosEliminar.xhtml" actionListener="#{demoBeanUsuarios.prepararEliminar(item)}" value="Eliminar" ajax="false"/>
</p:column>
</p:dataTable>
</h:form>
</h:form>
</f:view>
</ui:define>
</ui:composition>
<script>
$.fn.dataTable.ext.errMode = 'none';
new DataTable('table');
</script>
</body>
</html>

30
inventario-war/web/WEB-INF/faces-config.xml

@ -0,0 +1,30 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<lifecycle>
<phase-listener>mx.edu.tsj.chapala.sistemas.seguridad.AutorizacionListener</phase-listener>
</lifecycle>
</faces-config>

25
inventario-war/web/WEB-INF/glassfish-web.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<!--
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>

28
inventario-war/web/WEB-INF/web.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/UsuariosLista.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
</web-app>

94
inventario-war/web/detallespCrearEditar.xhtml

@ -0,0 +1,94 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:growl id="growl-sticky" for="sticky-key" showDetail="true" sticky="true" />
<h1><h:outputText value="Create/Edit"/></h1>
<p:panelGrid columns="2">
<p:outputLabel value="Cantidad:" for="cantidad" />
<p:inputText id="cantidad" value="#{demoBeanDetallesp.detallesp.cantidad}" title="Cantidad" required="true" requiredMessage="Este campo es requerido."/>
<p:outputLabel value="PrecioU:" for="precioU" />
<p:inputText id="precioU" value="#{demoBeanDetallesp.detallesp.precioU}" title="PrecioU" required="true" requiredMessage="Este campo es requerido."/>
<p:outputLabel value="PedidosId:" for="pedidosId" />
<p:selectOneMenu id="pedidosId" value="#{demoBeanDetallesp.detallesp.pedidosId}" required="true" requiredMessage="Este campo es requerido.">
<!-- TODO: update below reference to list of available items-->
<f:selectItems value="#{demoBeanPedidos.all}" var="item" itemLabel="#{item.nombre}" itemValue="#{item}"/>
</p:selectOneMenu>
<p:outputLabel value="ProductosId:" for="productosId" />
<p:selectOneMenu id="productosId" value="#{demoBeanDetallesp.detallesp.productosId}" required="true" requiredMessage="Este campo es requerido.">
<!-- TODO: update below reference to list of available items-->
<f:selectItems value="#{demoBeanProductos.all}" var="item" itemLabel="#{item.nombre}" itemValue="#{item}"/>
</p:selectOneMenu>
</p:panelGrid>
<p:commandButton styleClass="rounded-button ui-button-success" action="#{demoBeanDetallesp.agregarDetalle()}" icon="pi pi-save" value="GUARDAR" update="growl" rendered="#{demoBeanDetallesp.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-success" action="detallespLista.xhtml" actionListener="#{demoBeanDetallesp.editarDetalles()}" value="Editar" update="growl" rendered="#{!demoBeanDetallesp.nuevo}" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-secondary" action="detallespLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

85
inventario-war/web/detallespEliminar.xhtml

@ -0,0 +1,85 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<h1><h:outputText value="View"/></h1>
<p:panelGrid columns="2">
<h:outputText value="Id:"/>
<h:outputText value="#{demoBeanDetallesp.detallesp.id}" title="Id"/>
<h:outputText value="Cantidad:"/>
<h:outputText value="#{demoBeanDetallesp.detallesp.cantidad}" title="Cantidad"/>
<h:outputText value="PrecioU:"/>
<h:outputText value="#{demoBeanDetallesp.detallesp.precioU}" title="PrecioU"/>
<h:outputText value="PedidosId:"/>
<h:outputText value="#{demoBeanDetallesp.detallesp.pedidosId}" title="PedidosId"/>
<h:outputText value="ProductosId:"/>
<h:outputText value="#{demoBeanDetallesp.detallesp.productosId}" title="ProductosId"/>
</p:panelGrid>
<p:commandButton action="detallespLista.xhtml" actionListener="#{demoBeanDetallesp.eliminarDetalle()}" value="Eliminar"/>
<p:commandButton action="detallespLista.xhtml" value="Cancelar" immediate="true"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

122
inventario-war/web/detallespLista.xhtml

@ -0,0 +1,122 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<p:commandButton styleClass="rounded-button ui-button-success" action="detallespCrearEditar.xhtml" icon="pi pi-fw pi-plus" actionListener="#{demoBeanDetallesp.prepararNuevo()}" value="AGREGAR" ajax="true"/>
<h:form>
<div style="text-align: center;">
<h1><h:outputText value="DETALLES"/></h1>
</div>
<p:dataTable value="#{demoBeanDetallesp.all}" var="item">
<p:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Cantidad"/>
</f:facet>
<h:outputText value="#{item.cantidad}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="PrecioU"/>
</f:facet>
<h:outputText value="#{item.precioU}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="PedidosId"/>
</f:facet>
<h:outputText value="#{item.pedidosId}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="ProductosId"/>
</f:facet>
<h:outputText value="#{item.productosId}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Opciones"/>
</f:facet>
<p:commandButton styleClass="rounded-button ui-button-warning" action="detallespCrearEditar.xhtml" actionListener="#{demoBeanDetallesp.prepararEditar(item)}" value="Editar" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-danger" action="detallespEliminar.xhtml" actionListener="#{demoBeanDetallesp.prepararEliminar(item)}" value="Eliminar" ajax="false"/>
</p:column>
</p:dataTable>
</h:form>
</h:form>
</f:view>
</ui:define>
<ui:define name="bottom">
</ui:define>
</ui:composition>
<script>
$.fn.dataTable.ext.errMode = 'none';
new DataTable('table');
</script>
</body>
</html>

30
inventario-war/web/ejemplo.xhtml

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
<title>Inicio de sesión</title>
<h:outputStylesheet library="css" name="styles.css" />
</h:head>
<h:body>
<h:form id="loginForm">
<h2>Bienvenido</h2>
<h:panelGrid columns="2" id="loginPanel">
<h:outputLabel for="username" value="Usuario:" />
<h:inputText id="username" value="#{demoBeanLogin.username}" required="true" validatorMessage="Se requiere campo Usuario" >
<f:validateLength minimum="1" maximum="100" />
</h:inputText>
<h:outputLabel for="password" value="Contraseña:" />
<h:inputSecret id="password" value="#{demoBeanLogin.password}" required="true" validatorMessage="Se requiere campo Contraseña" >
<f:validateLength minimum="1" maximum="100" />
</h:inputSecret>
<h:commandButton value="Iniciar sesión" action="#{demoBeanLogin.buscarPorLogin}" />
<h:messages globalOnly="true" styleClass="error" />
</h:panelGrid>
</h:form>
</h:body>
</html>

90
inventario-war/web/index.xhtml

@ -0,0 +1,90 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Facelet</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #7f00b2;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.form-container {
background-color: #fff;
padding: 40px;
border-radius: 5px;
box-shadow: 0 20px 20px rgba(0,0,0,0.1);
}
.form-container h1 {
margin-top: 0;
text-align: center;
}
.form-container form {
text-align: center;
}
.form-container .form-group {
margin-bottom: 15px;
}
.form-container .form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.form-container .form-group input[type="text"],
.form-container .form-group input[type="password"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
.form-container .btn-login {
background-color: #007bff;
color: #fff;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 3px;
cursor: pointer;
}
.form-container .btn-login:hover {
background-color: #0056b3;
}
.campo-invalido {
border-color: red !important;
}
</style>
</h:head>
<h:body>
<div class="form-container">
<h1>Iniciar sesión</h1>
<h:form>
<p:growl id="growl" showDetail="true" />
<p:growl id="growl-sticky" for="sticky-key" showDetail="true" sticky="true" />
<div class="form-group">
<p:outputLabel value="Usuario:" for="username" />
<p:inputText id="username" value="#{loginDem.username}" title="Username" required="true" validatorMessage="El campo usuario es requerido. " requiredMessage="El campo usuario es requerido.">
<f:validateRegex pattern="^[a-zA-Z]{1,25}$" for="Username"/>
</p:inputText>
</div>
<div class="form-group" ajax="true">
<p:outputLabel value="Contraseña:" for="password" />
<p:inputText id="password" value="#{loginDem.password}" title="Password" required="true" validatorMessage="El campo contraseña solo acepta numeros. " requiredMessage="El campo contraseña es requerido.">
<f:validateRegex pattern="^[0-9]{1,25}$" for="Password"/>
</p:inputText>
</div>
<p:commandButton value="INGRESAR" action="#{loginDem.buscarPorLogin()}" update="growl" styleClass="btn-login" ajax="false"/>
</h:form>
</div>
</h:body>
</html>

89
inventario-war/web/proveedoresEliminar.xhtml

@ -0,0 +1,89 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<h1><h:outputText value="View"/></h1>
<p:panelGrid columns="2">
<h:outputText value="Id:"/>
<h:outputText value="#{demoBeanProveedores.proveedores.id}" title="Id"/>
<h:outputText value="Nombre:"/>
<h:outputText value="#{demoBeanProveedores.proveedores.nombre}" title="Nombre"/>
<h:outputText value="Direccion:"/>
<h:outputText value="#{demoBeanProveedores.proveedores.direccion}" title="Direccion"/>
<h:outputText value="Pais:"/>
<h:outputText value="#{demoBeanProveedores.proveedores.pais}" title="Pais"/>
<h:outputText value="Cantidad:"/>
<h:outputText value="#{demoBeanProveedores.proveedores.cantidad}" title="Cantidad"/>
<h:outputText value="Estatus:"/>
<h:outputText value="#{demoBeanProveedores.proveedores.estatus==1?'Activo':'Inactivo'}" title="Estatus"/>
</p:panelGrid>
<p:commandButton action="ProveedoresLista.xhtml" actionListener="#{demoBeanProveedores.eliminarProveedores()}" value="Eliminar"/>
<p:commandButton action="ProveedoresLista.xhtml" value="Cancelar" immediate="true"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

62
inventario-war/web/resources/css/cssLayout.css

@ -0,0 +1,62 @@
#top {
position: relative;
background-color: #7f00b2;
color: white;
padding: 20px;
margin: 0px 0px 10px 0px;
}
#bottom {
background-color: #97e9ff;
padding: 5px;
margin: 10px 0px 0px 0px;
position: fixed; /* Fija el elemento a la posición del viewport */
bottom: 0; /* Posiciona el elemento en la parte inferior */
left: 0; /* Posiciona el elemento en la esquina izquierda */
width: 100%; /* Ocupa todo el ancho de la pantalla */
z-index: 100;
}
#left {
float: left;
background-color: #ab3ed8;
padding: 5px;
width: 175px;
height: 600px; /* Altura fija de 300px */
}
.center_content {
position: relative;
background-color: #dddddd;
padding: 5px;
}
.left_content {
background-color: #dddddd;
padding: 5px;
margin-left: 170px;
/*height: 300px; /* Altura fija de 300px */
}
.right_content {
background-color: #dddddd;
padding: 5px;
margin: 0px 6px 0px 180px;
}
#top a:link, #top a:visited {
color: white;
font-weight : bold;
text-decoration: none;
}
#top a:link:hover, #top a:visited:hover {
color: black;
font-weight : bold;
text-decoration : underline;
}

35
inventario-war/web/resources/css/default.css

@ -0,0 +1,35 @@
body {
background-color: #ffffff;
font-size: 12px;
font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif;
color: #000000;
margin: 10px;
}
#left {
background-color: navy; /* Color de fondo azul marino */
color: white; /* Color del texto en blanco para mayor contraste */
padding: 20px; /* Espacio interno para separar el contenido del borde */
}
h1 {
font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif;
border-bottom: 1px solid #AFAFAF;
font-size: 16px;
font-weight: bold;
margin: 0px;
padding: 0px;
color: #D20005;
}
a:link, a:visited {
color: #045491;
font-weight : bold;
text-decoration: none;
}
a:link:hover, a:visited:hover {
color: #045491;
font-weight : bold;
text-decoration : underline;
}

47
inventario-war/web/template/PrincipalE.xhtml

@ -0,0 +1,47 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h:outputStylesheet name="./css/default.css"/>
<h:outputStylesheet name="./css/cssLayout.css"/>
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<link href="https://cdn.datatables.net/v/dt/dt-2.0.3/datatables.min.css" rel="stylesheet"/>
<script src="https://cdn.datatables.net/v/dt/dt-2.0.3/datatables.min.js"></script>
<title>Facelets Template</title>
</h:head>
<h:body>
<div id="top">
<ui:insert name="top"></ui:insert>
</div>
<div>
<div id="left">
<ui:insert name="left">Left</ui:insert>
</div>
<div>
<div id="content" class="right_content">
<ui:insert name="content">Content</ui:insert>
</div>
</div>
</div>
</h:body>
<div id="bottom">
<center>
<h5>Kevin Talamantes, Francisco Salazar</h5>
<h5>2024</h5>
</center>
</div>
</html>

128
inventario-war/web/template/templeteE.xhtml

@ -0,0 +1,128 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h:outputStylesheet name="./css/default.css"/>
<h:outputStylesheet name="./css/cssLayout.css"/>
<title>Facelets Template</title>
<style>
#top {
height: 80px;
background-color: #00986c; /* Color de fondo para el top */
text-align: center;
color: #000000; /* Texto blanco */
}
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #ffffff; /* Fondo blanco */
color: #000000; /* Texto negro */
font-size: 16px; /* Tamaño de fuente deseado */
}
#top-container {
align-content:center;
justify-content: center;
align-items: center; /* Esta propiedad centra el contenido verticalmente */
}
#main-container {
display: flex;
font-size: 60px; /* Tamaño de fuente deseado */
flex: 1; /* Ocupa todo el espacio restante después del top */
/* Utiliza todo el ancho disponible */
}
#left {
background-color: #F9F9F9;
width: 200px; /* Ancho fijo para el menú lateral */
flex-shrink: 0; /* No permitir que el menú lateral se encoja */
}
#content {
width: 100%;
flex-grow: 1; /* Permite que el contenido crezca para ocupar el espacio disponible */
overflow-y: auto; /* Permite desplazamiento si el contenido es más grande que el contenedor */
padding: 20px; /* Espacio interno */
font-size: 60px; /* Tamaño de fuente deseado */
}
.card {
width: 100%;
background-color: #F9F9F9; /* Color de fondo para el contenido */
padding: 20px; /* Espaciado interno */
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); /* Sombra */
}
.left_content {
padding: 20px; /* Espaciado interno */
color: #000000; /* Texto negro */
}
</style>
</h:head>
<h:body>
<div id="top" class="top">
<ui:insert name="top">
<div style="text-align: center; margin-top: 20px; margin-bottom: 20px;">
<h5 style="font-size: 18px;">MENÚ DE OPCIONES</h5>
</div>
</ui:insert>
</div>
<div id="main-container">
<div id="left">
<div class="card" >
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:150px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" >
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" >
<p:submenu label="Opciones">
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" >
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" >
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
</p:tieredMenu>
</h:form>
</div>
</div>
<div id="content" >
<ui:insert name="content">Content</ui:insert>
</div>
</div>
</h:body>
</html>

89
inventario-war/web/usuariosEliminar.xhtml

@ -0,0 +1,89 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./template/PrincipalE.xhtml">
<ui:define name="top">
top
</ui:define>
<ui:define name="left">
<div class="card">
<h:form>
<p:growl id="messages" showDetail="true"/>
<p:tieredMenu style="width:165px" >
<p:submenu label="Usuarios" icon="pi pi-fw pi-user">
<p:submenu label="Opciones">
<p:menuitem value="Lista de usuarios" outcome="UsuariosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Categorias" icon="pi pi-fw pi-tags">
<p:submenu label="Opciones">
<p:menuitem value="Lista de categorias" outcome="CategoriasLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Detalles" icon="pi pi-fw pi-file">
<p:submenu label="Opciones" >
<p:menuitem value="Lista de detalles" outcome="detallespLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Productos" icon="pi pi-fw pi-shopping-cart">
<p:submenu label="Opciones">
<p:menuitem value="Lista de productos" outcome="ProductosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Proveedores" icon="pi pi-fw pi-users">
<p:submenu label="Opciones">
<p:menuitem value="Lista de proveedores" outcome="ProveedoresLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:submenu label="Pedidos" icon="pi pi-fw pi-calendar">
<p:submenu label="Opciones">
<p:menuitem value="Lista de pedidos" outcome="PedidosLista.xhtml" ajax="false"/>
</p:submenu>
</p:submenu>
<p:divider/>
<p:menuitem value="Salir" icon="pi pi-fw pi-power-off" action="#{loginDem.logout()}"/>
</p:tieredMenu>
</h:form>
</div>
</ui:define>
<ui:define name="content">
<f:view>
<h:form>
<h1><h:outputText value="#{demoBeanUsuarios.titulo}"/></h1>
<p:panelGrid columns="2">
<h:outputText value="Nombre:"/>
<h:outputText value="#{demoBeanUsuarios.usuarios.nombre}" title="Nombre"/>
<h:outputText value="ApellidoP:"/>
<h:outputText value="#{demoBeanUsuarios.usuarios.apellidoP}" title="ApellidoP"/>
<h:outputText value="ApellidoM:"/>
<h:outputText value="#{demoBeanUsuarios.usuarios.apellidoM}" title="ApellidoM"/>
<h:outputText value="Email:"/>
<h:outputText value="#{demoBeanUsuarios.usuarios.email}" title="Email"/>
<h:outputText value="Telefono:"/>
<h:outputText value="#{demoBeanUsuarios.usuarios.telefono}" title="Telefono"/>
<h:outputText value="Estatus:"/>
<h:outputText value="#{demoBeanUsuarios.usuarios.estatus==1?'Activo':'Inactivo'}" title="Estatus"/>
<h:outputText value="Contraseña:"/>
<h:outputText value="#{demoBeanUsuarios.usuarios.contrasena}" title="Contraseña"/>
</p:panelGrid>
<p:commandButton styleClass="rounded-button ui-button-danger" action="UsuariosLista.xhtml" actionListener="#{demoBeanUsuarios.eliminarUsuario()}" value="Eliminar" ajax="false"/>
<p:commandButton styleClass="rounded-button ui-button-secondary" action="UsuariosLista.xhtml" value="Cancelar" immediate="true" ajax="false"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>

131
nbproject/ant-deploy.xml

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project default="-deploy-ant" basedir=".">
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
<property file="${deploy.ant.properties.file}" />
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
<available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
</target>
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.sun.web}" validate="false">
</xmlproperty>
<delete file="${temp.sun.web}"/>
<condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
<isset property="sun-web-app.context-root"/>
</condition>
<condition property="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
<isset property="sun-web-app.context-root"/>
</condition>
</target>
<target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
<tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.gf.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.gf.web}">
<replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.gf.web}" validate="false">
</xmlproperty>
<delete file="${temp.gf.web}"/>
<condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
<isset property="glassfish-web-app.context-root"/>
</condition>
<condition property="deploy.context.root.argument" value="&amp;contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
<isset property="glassfish-web-app.context-root"/>
</condition>
</target>
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
<property name="deploy.context.root.argument" value=""/>
</target>
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
<mkdir dir="${gfv3.resources.dir}"/>
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
<copy todir="${gfv3.resources.dir}/META-INF">
<fileset dir="${deploy.ant.resource.dir}"/>
</copy>
<jar destfile="${deploy.ant.archive}" update="true">
<fileset dir="${gfv3.resources.dir}"/>
</jar>
<delete dir="${gfv3.resources.dir}"/>
</target>
<target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
<antcall target="-deploy-without-pw"/>
<antcall target="-deploy-with-pw"/>
</target>
<target name="-deploy-without-pw" unless="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-deploy-with-pw" if="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
<antcall target="-undeploy-without-pw"/>
<antcall target="-undeploy-with-pw"/>
</target>
<target name="-undeploy-without-pw" unless="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-with-pw" if="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
</project>

635
nbproject/build-impl.xml

@ -0,0 +1,635 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- dist
- execution
- debugging
- cleanup
-->
<project xmlns:ear2="http://www.netbeans.org/ns/j2ee-earproject/2" basedir=".." default="default" name="inventario-impl">
<import file="ant-deploy.xml"/>
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<target depends="dist" description="Build whole project." name="default"/>
<!--
INITIALIZATION SECTION
-->
<target name="pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="pre-init" name="init-private">
<property file="nbproject/private/private.properties"/>
</target>
<target depends="pre-init,init-private" name="init-userdir">
<property location="${netbeans.user}/build.properties" name="user.properties.file"/>
</target>
<target depends="pre-init,init-private,init-userdir" name="init-user">
<property file="${user.properties.file}"/>
</target>
<target depends="pre-init,init-private,init-userdir,init-user" name="init-project">
<property file="nbproject/project.properties"/>
</target>
<target depends="pre-init,init-private,init-userdir,init-user,init-project" name="do-init">
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
<condition property="do.compile.jsps">
<istrue value="${compile.jsps}"/>
</condition>
<condition property="do.display.browser.old">
<and>
<istrue value="${display.browser}"/>
<isset property="client.module.uri"/>
<not>
<isset property="app.client"/>
</not>
<not>
<isset property="browser.context"/>
</not>
</and>
</condition>
<condition property="do.display.browser">
<and>
<istrue value="${display.browser}"/>
<isset property="client.module.uri"/>
<not>
<isset property="app.client"/>
</not>
<isset property="browser.context"/>
</and>
</condition>
<available file="${meta.inf}/MANIFEST.MF" property="has.custom.manifest"/>
<!--
Variables needed to support directory deployment.
-->
<condition property="do.package.with.custom.manifest.not.directory.deploy">
<and>
<isset property="has.custom.manifest"/>
<isfalse value="${directory.deployment.supported}"/>
</and>
</condition>
<condition property="do.package.without.custom.manifest.not.directory.deploy">
<and>
<not>
<isset property="has.custom.manifest"/>
</not>
<isfalse value="${directory.deployment.supported}"/>
</and>
</condition>
<condition property="do.package.not.directory.deploy">
<isfalse value="${directory.deployment.supported}"/>
</condition>
<!--End Variables needed to support directory deployment.-->
<condition else="" property="j2ee.appclient.mainclass.tool.param" value="-mainclass ${main.class}">
<and>
<isset property="main.class"/>
<not>
<equals arg1="${main.class}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition else="" property="j2ee.appclient.jvmoptions.param" value="${j2ee.appclient.jvmoptions}">
<and>
<isset property="j2ee.appclient.jvmoptions"/>
<not>
<equals arg1="${j2ee.appclient.jvmoptions}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition else="" property="application.args.param" value="${application.args}">
<and>
<isset property="application.args"/>
<not>
<equals arg1="${application.args}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="can.debug.appclient">
<and>
<isset property="netbeans.home"/>
<isset property="app.client"/>
</and>
</condition>
<path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
<condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
<and>
<isset property="endorsed.classpath"/>
<length length="0" string="${endorsed.classpath}" when="greater"/>
</and>
</condition>
</target>
<target depends="init" name="-init-cos">
<condition else="false" property="build.deploy.on.save">
<or>
<istrue value="${j2ee.deploy.on.save}"/>
<istrue value="${j2ee.compile.on.save}"/>
</or>
</condition>
</target>
<target name="post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="pre-init,init-private,init-userdir,init-user,init-project,do-init" name="init-check">
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="build.generated.dir">Must set build.generated.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.jar">Must set dist.jar</fail>
</target>
<target name="-init-taskdefs">
<fail unless="libs.CopyLibs.classpath">
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
&lt;netbeans_installation&gt;/java&lt;version&gt;/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
</fail>
<taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/>
</target>
<!--
pre NB7.2 profiling section; consider it deprecated
-->
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
<target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="profiler.info.jvmargs.agent" name="-profile-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-profile-pre-init, init, -profile-post-init" if="profiler.info.jvmargs.agent" name="-profile-init-check">
<fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
<fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
</target>
<!--
end of pre NB7.2 profiling section
-->
<target depends="pre-init,init-private,init-userdir,init-user,init-project,do-init,post-init,init-check,-init-taskdefs" name="init"/>
<!--
COMPILATION SECTION
-->
<target depends="init" name="deps-jar" unless="no.deps">
<condition property="build.deploy.on.save" value="false">
<not>
<isset property="build.deploy.on.save"/>
</not>
</condition>
</target>
<target depends="init" name="deps-j2ee-archive" unless="no.deps">
<condition property="build.deploy.on.save" value="false">
<not>
<isset property="build.deploy.on.save"/>
</not>
</condition>
<ant antfile="${project.inventario-ejb}/build.xml" inheritall="false" target="dist-ear">
<property location="${build.dir}" name="dist.ear.dir"/>
<property name="deploy.on.save" value="${build.deploy.on.save}"/>
</ant>
<ant antfile="${project.inventario-war}/build.xml" inheritall="false" target="dist-ear">
<property location="${build.dir}" name="dist.ear.dir"/>
<property name="deploy.on.save" value="${build.deploy.on.save}"/>
</ant>
</target>
<target depends="init,deps-jar,deps-j2ee-archive" name="pre-pre-compile"/>
<target name="pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,pre-pre-compile,pre-compile,-do-compile-deps" name="do-compile">
<copy todir="${build.dir}/META-INF">
<fileset dir="${meta.inf}"/>
</copy>
</target>
<target depends="init,deps-jar,pre-pre-compile,pre-compile" name="-do-compile-deps">
<copyfiles files="${reference.inventario-war.dist-ear}" todir="${build.dir}//"/>
<copyfiles files="${reference.inventario-ejb.dist-ear}" todir="${build.dir}//"/>
</target>
<target name="post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,pre-pre-compile,pre-compile,do-compile,post-compile" description="Compile project." name="compile"/>
<!--
DIST BUILDING SECTION
-->
<target name="pre-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,pre-dist" name="do-dist-without-manifest" unless="has.custom.manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<fileset dir="${build.dir}"/>
</jar>
</target>
<target depends="init,compile,pre-dist" if="has.custom.manifest" name="do-dist-with-manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}" manifest="${meta.inf}/MANIFEST.MF">
<fileset dir="${build.dir}"/>
</jar>
</target>
<!--
TARGETS NEEDED TO SUPPORT DIRECTORY DEPLOYMENT
-->
<target depends="init,compile,pre-dist" if="do.package.without.custom.manifest.not.directory.deploy" name="-do-tmp-dist-without-manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<fileset dir="${build.dir}"/>
</jar>
</target>
<target depends="init,compile,pre-dist" if="do.package.with.custom.manifest.not.directory.deploy" name="-do-tmp-dist-with-manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}" manifest="${meta.inf}/MANIFEST.MF">
<fileset dir="${build.dir}"/>
</jar>
</target>
<target depends="init,compile,pre-dist,-do-tmp-dist-without-manifest,-do-tmp-dist-with-manifest" name="-do-dist-directory-deploy"/>
<target depends="init,compile,pre-dist,-do-dist-directory-deploy,post-dist" description="Build distribution (JAR) - if directory deployment is not supported." name="dist-directory-deploy"/>
<!--
END TARGETS NEEDED TO SUPPORT DIRECTORY DEPLOYMENT
-->
<target name="post-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,pre-dist,do-dist-without-manifest,do-dist-with-manifest,post-dist" description="Build distribution (JAR)." name="dist"/>
<!--
EXECUTION SECTION
-->
<target depends="run-deploy,run-display-browser,run-ac" description="Deploy to server." name="run"/>
<target name="pre-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="post-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-pre-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. -->
</target>
<target name="-post-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. -->
</target>
<target name="-run-deploy-am" unless="no.deps">
<!-- Task to deploy to the Access Manager runtime. -->
<ant antfile="${project.inventario-ejb}/build.xml" inheritall="false" target="-run-deploy-am"/>
<ant antfile="${project.inventario-war}/build.xml" inheritall="false" target="-run-deploy-am"/>
</target>
<target depends="-init-cos,dist-directory-deploy,pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,post-run-deploy" name="run-deploy"/>
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy clientModuleUri="${client.module.uri}" clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
<target name="-init-deploy-ant" unless="netbeans.home">
<property name="deploy.ant.archive" value="${dist.jar}"/>
<property name="deploy.ant.resource.dir" value="${resource.dir}"/>
<property name="deploy.ant.enabled" value="true"/>
</target>
<target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/>
<target if="netbeans.home" name="-run-undeploy-nb">
<fail message="Undeploy is not supported from within the IDE"/>
</target>
<target depends="dist" name="verify">
<nbverify file="${dist.jar}"/>
</target>
<target depends="run-deploy,-init-display-browser,-display-browser-nb-old,-display-browser-nb,-display-browser-cl" name="run-display-browser"/>
<target if="do.display.browser" name="-init-display-browser">
<condition property="do.display.browser.nb.old">
<and>
<isset property="netbeans.home"/>
<not>
<isset property="browser.context"/>
</not>
</and>
</condition>
<condition property="do.display.browser.nb">
<and>
<isset property="netbeans.home"/>
<isset property="browser.context"/>
</and>
</condition>
<condition property="do.display.browser.cl">
<and>
<isset property="deploy.ant.enabled"/>
<isset property="deploy.ant.client.url"/>
</and>
</condition>
</target>
<target if="do.display.browser.nb.old" name="-display-browser-nb-old">
<nbbrowse url="${client.url}"/>
</target>
<target if="do.display.browser.nb" name="-display-browser-nb">
<nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/>
</target>
<target if="do.display.browser.cl" name="-get-browser" unless="browser">
<condition property="browser" value="rundll32">
<os family="windows"/>
</condition>
<condition else="" property="browser.args" value="url.dll,FileProtocolHandler">
<os family="windows"/>
</condition>
<condition property="browser" value="/usr/bin/open">
<os family="mac"/>
</condition>
<property environment="env"/>
<condition property="browser" value="${env.BROWSER}">
<isset property="env.BROWSER"/>
</condition>
<condition property="browser" value="/usr/bin/firefox">
<available file="/usr/bin/firefox"/>
</condition>
<condition property="browser" value="/usr/local/firefox/firefox">
<available file="/usr/local/firefox/firefox"/>
</condition>
<condition property="browser" value="/usr/bin/mozilla">
<available file="/usr/bin/mozilla"/>
</condition>
<condition property="browser" value="/usr/local/mozilla/mozilla">
<available file="/usr/local/mozilla/mozilla"/>
</condition>
<condition property="browser" value="/usr/sfw/lib/firefox/firefox">
<available file="/usr/sfw/lib/firefox/firefox"/>
</condition>
<condition property="browser" value="/opt/csw/bin/firefox">
<available file="/opt/csw/bin/firefox"/>
</condition>
<condition property="browser" value="/usr/sfw/lib/mozilla/mozilla">
<available file="/usr/sfw/lib/mozilla/mozilla"/>
</condition>
<condition property="browser" value="/opt/csw/bin/mozilla">
<available file="/opt/csw/bin/mozilla"/>
</condition>
</target>
<target depends="-get-browser" if="do.display.browser.cl" name="-display-browser-cl">
<fail unless="browser">
Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable.
</fail>
<property name="browse.url" value="${deploy.ant.client.url}${client.urlPart}"/>
<echo>Launching ${browse.url}</echo>
<exec executable="${browser}" spawn="true">
<arg line="${browser.args} ${browse.url}"/>
</exec>
</target>
<target if="app.client" name="run-ac">
<antcall target="-run-ac"/>
</target>
<target depends="init,-as-retrieve-option-workaround,-init-run-macros,-run-appclient-pregfv3,-run-appclient" name="-run-ac"/>
<target if="j2ee.appclient.tool.args" name="-run-appclient-pregfv3">
<ear2:run-appclient-pregfv3/>
</target>
<target name="-run-appclient" unless="j2ee.appclient.tool.args">
<ear2:run-appclient subprojectname="${app.client}"/>
</target>
<target if="j2ee.appclient.mainclass.args" name="-as-retrieve-option-workaround" unless="j2ee.clientName">
<property name="client.jar" value="${dist.dir}/inventarioClient.jar"/>
<sleep seconds="3"/>
<copy failonerror="false" file="${wa.copy.client.jar.from}/inventario/inventarioClient.jar" todir="${dist.dir}"/>
<copy failonerror="false" flatten="true" todir="${dist.dir}/">
<fileset dir="${wa.copy.client.jar.from}/inventario" includes="**/inventarioClient.jar"/>
</copy>
<copy flatten="true" todir="${dist.dir}/inventarioClient">
<fileset dir="${wa.copy.client.jar.from}/inventario" includes="**/*.*ar"/>
</copy>
<copy failonerror="false" flatten="false" todir="${dist.dir}/inventarioClient">
<fileset dir="${dist.dir}/gfdeploy/inventario" includes="**/*.jar"/>
</copy>
</target>
<target depends="init" name="-init-run-macros">
<macrodef name="run-appclient" uri="http://www.netbeans.org/ns/j2ee-earproject/2">
<attribute name="subprojectname"/>
<attribute default="${application.args.param}" name="args"/>
<element name="customize" optional="true"/>
<sequential>
<java dir="${basedir}" fork="true" jar="${client.jar}">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${j2ee.appclient.tool.jvmoptions}${client.jar},arg=-name,arg=@{subprojectname}"/>
<jvmarg line="${j2ee.appclient.jvmoptions.param}"/>
<arg line="@{args}"/>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
<macrodef name="run-appclient-pregfv3" uri="http://www.netbeans.org/ns/j2ee-earproject/2">
<element name="customize" optional="true"/>
<sequential>
<java classname="${j2ee.appclient.tool.mainclass}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${j2ee.appclient.tool.jvmoptions}"/>
<jvmarg line="${j2ee.appclient.jvmoptions.param}"/>
<arg line="${j2ee.appclient.tool.args}"/>
<arg line="-client ${client.jar}"/>
<arg line="${j2ee.appclient.mainclass.tool.param}"/>
<arg line="${application.args.param}"/>
<classpath>
<path path="${j2ee.platform.classpath}:${j2ee.appclient.tool.runtime}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<!--
DEBUGGING SECTION
-->
<target depends="run-debug,run-debug-appclient" description="Deploy to server." name="debug"/>
<target depends="dist" description="Debug project in IDE." if="netbeans.home" name="run-debug" unless="app.client">
<nbdeploy clientModuleUri="${client.module.uri}" clientUrlPart="${client.urlPart}" debugmode="true"/>
<antcall target="connect-debugger"/>
<antcall target="debug-display-browser-old"/>
<antcall target="debug-display-browser"/>
</target>
<target name="connect-debugger" unless="is.debugged">
<condition property="listeningcp" value="sourcepath">
<istrue value="${j2ee.compile.on.save}"/>
</condition>
<nbjpdaconnect address="${jpda.address}" host="${jpda.host}" listeningcp="${listeningcp}" name="${jpda.host}:${jpda.address}" transport="${jpda.transport}">
<classpath>
<path path="${debug.classpath}"/>
<fileset dir="${build.dir}" includes="lib/*.jar"/>
</classpath>
<sourcepath>
<path path="${ear.docbase.dirs}"/>
</sourcepath>
</nbjpdaconnect>
</target>
<target if="do.display.browser.old" name="debug-display-browser-old">
<nbbrowse url="${client.url}"/>
</target>
<target if="do.display.browser" name="debug-display-browser">
<nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/>
</target>
<target if="can.debug.appclient" name="run-debug-appclient">
<antcall target="-run-debug-appclient"/>
</target>
<target depends="init,-init-debug-args,-debug-appclient-deploy,-as-retrieve-option-workaround,-init-debug-macros,-debug-appclient-start-nbjpda,-debug-appclient-pregfv3,-debug-appclient,connect-debugger" name="-run-debug-appclient"/>
<target name="-init-debug-args"/>
<target depends="init,-init-debug-args,-as-retrieve-option-workaround,-init-run-macros" name="-init-debug-macros">
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport-appclient" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2ee-earproject/2">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address.appclient" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport-appclient}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="debug-appclient" uri="http://www.netbeans.org/ns/j2ee-earproject/2">
<attribute name="subprojectname"/>
<sequential>
<ear2:run-appclient subprojectname="@{subprojectname}">
<customize>
<jvmarg value="-agentlib:jdwp=transport=${debug-transport-appclient},address=${jpda.address.appclient}"/>
</customize>
</ear2:run-appclient>
</sequential>
</macrodef>
<macrodef name="debug-appclient-pregfv3" uri="http://www.netbeans.org/ns/j2ee-earproject/2">
<sequential>
<ear2:run-appclient-pregfv3>
<customize>
<jvmarg value="-agentlib:jdwp=transport=${debug-transport-appclient},address=${jpda.address.appclient}"/>
</customize>
</ear2:run-appclient-pregfv3>
</sequential>
</macrodef>
</target>
<target name="-debug-appclient-deploy">
<nbstartserver debugmode="true"/>
<nbdeploy clientModuleUri="${client.module.uri}" clientUrlPart="${client.urlPart}" debugmode="true"/>
</target>
<target name="-debug-appclient-start-nbjpda">
<ear2:nbjpdastart classpath="" name="${app.client}"/>
</target>
<target if="j2ee.appclient.tool.args" name="-debug-appclient-pregfv3">
<ear2:debug-appclient-pregfv3/>
</target>
<target name="-debug-appclient" unless="j2ee.appclient.tool.args">
<ear2:debug-appclient subprojectname="${app.client}"/>
</target>
<!--
=================
PROFILING SECTION
=================
-->
<!--
pre NB7.2 profiling section; consider it deprecated
-->
<target description="Profile a J2EE project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
<condition else="start-profiled-server" property="profiler.startserver.target" value="start-profiled-server-extraargs">
<isset property="profiler.info.jvmargs.extra"/>
</condition>
<antcall target="${profiler.startserver.target}"/>
<antcall target="run"/>
<antcall target="-profile-start-loadgen"/>
</target>
<target name="start-profiled-server">
<nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}">
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg value="${profiler.j2ee.agentID}"/>
</nbstartprofiledserver>
</target>
<target name="start-profiled-server-extraargs">
<nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}">
<jvmarg value="${profiler.info.jvmargs.extra}"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg value="${profiler.j2ee.agentID}"/>
</nbstartprofiledserver>
</target>
<!--
end of pre NB7.2 profiling section
-->
<target if="netbeans.home" name="-profile-check">
<condition property="profiler.configured">
<or>
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
</or>
</condition>
</target>
<target depends="dist" name="-do-profile">
<startprofiler/>
<nbstartserver profilemode="true"/>
<nbdeploy clientUrlPart="${client.urlPart}" forceRedeploy="true" profilemode="true"/>
<antcall target="-profile-start-loadgen"/>
</target>
<target depends="-profile-check,-profile-pre72" description="Profile a J2EE project in the IDE." if="profiler.configured" name="profile">
<antcall target="-do-profile"/>
</target>
<target if="profiler.loadgen.path" name="-profile-start-loadgen">
<loadgenstart path="${profiler.loadgen.path}"/>
</target>
<!--
CLEANUP SECTION
-->
<target depends="init" name="deps-clean" unless="no.deps">
<condition property="build.deploy.on.save" value="false">
<not>
<isset property="build.deploy.on.save"/>
</not>
</condition>
<ant antfile="${project.inventario-ejb}/build.xml" inheritall="false" target="clean-ear">
<property location="${build.dir}" name="dist.ear.dir"/>
<property name="deploy.on.save" value="${build.deploy.on.save}"/>
</ant>
<ant antfile="${project.inventario-war}/build.xml" inheritall="false" target="clean-ear">
<property location="${build.dir}" name="dist.ear.dir"/>
<property name="deploy.on.save" value="${build.deploy.on.save}"/>
</ant>
</target>
<target depends="init" name="do-clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${build.dir}"/>
</target>
<target depends="init" if="netbeans.home" name="undeploy-clean">
<nbundeploy failOnError="false" startServer="false"/>
</target>
<target name="post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,undeploy-clean,deps-clean,do-clean,post-clean" description="Clean build products." name="clean"/>
</project>

8
nbproject/genfiles.properties

@ -0,0 +1,8 @@
build.xml.data.CRC32=0a78aec7
build.xml.script.CRC32=2acbabf1
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=0a78aec7
nbproject/build-impl.xml.script.CRC32=ccf5040b
nbproject/build-impl.xml.stylesheet.CRC32=abdce74a@1.73

40
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.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsit.classpath=
j2ee.server.type=gfv4ee7
jar.compress=false
jar.content.additional=\
${reference.inventario-war.dist-ear}:\
${reference.inventario-ejb.dist-ear}
jar.name=inventario.ear
javac.debug=true
javac.deprecation=false
javac.source=1.7
javac.target=1.7
meta.inf=src/conf
no.dependencies=false
platform.active=default_platform
project.inventario-ejb=inventario-ejb
project.inventario-war=inventario-war
reference.inventario-ejb.dist-ear=${project.inventario-ejb}/dist/inventario-ejb.jar
reference.inventario-war.dist-ear=${project.inventario-war}/dist/inventario-war.war
resource.dir=setup
source.root=.

39
nbproject/project.xml

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.j2ee.earproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2ee-earproject/2">
<name>inventario</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<web-module-libraries/>
<web-module-additional-libraries>
<library>
<file>${reference.inventario-war.dist-ear}</file>
<path-in-war>/</path-in-war>
</library>
<library>
<file>${reference.inventario-ejb.dist-ear}</file>
<path-in-war>/</path-in-war>
</library>
</web-module-additional-libraries>
</data>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>inventario-ejb</foreign-project>
<artifact-type>j2ee_ear_archive</artifact-type>
<script>build.xml</script>
<target>dist-ear</target>
<clean-target>clean-ear</clean-target>
<id>dist-ear</id>
</reference>
<reference>
<foreign-project>inventario-war</foreign-project>
<artifact-type>j2ee_ear_archive</artifact-type>
<script>build.xml</script>
<target>dist-ear</target>
<clean-target>clean-ear</clean-target>
<id>dist-ear</id>
</reference>
</references>
</configuration>
</project>

2
src/conf/MANIFEST.MF

@ -0,0 +1,2 @@
Manifest-Version: 1.0
Loading…
Cancel
Save