commit ce480f6857463c0c2c048ab6a6a8ec91754de16e Author: chore Date: Fri May 10 08:45:32 2024 -0500 proyecto inventario jakarta diff --git a/baseSC.mwb b/baseSC.mwb new file mode 100644 index 0000000..5602d77 Binary files /dev/null and b/baseSC.mwb differ diff --git a/baseSC.mwb.bak b/baseSC.mwb.bak new file mode 100644 index 0000000..57cdc01 Binary files /dev/null and b/baseSC.mwb.bak differ diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..89c4a0a --- /dev/null +++ b/build.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + Builds, tests, and runs the project si. + + + diff --git a/ejecutableDB.sql b/ejecutableDB.sql new file mode 100644 index 0000000..08a5258 --- /dev/null +++ b/ejecutableDB.sql @@ -0,0 +1,191 @@ +-- MySQL Script generated by MySQL Workbench +-- Fri May 3 12:31:54 2024 +-- Model: New Model Version: 1.0 +-- MySQL Workbench Forward Engineering + +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; + +-- ----------------------------------------------------- +-- Schema sistemadeinventario +-- ----------------------------------------------------- + +-- ----------------------------------------------------- +-- Schema sistemadeinventario +-- ----------------------------------------------------- +CREATE SCHEMA IF NOT EXISTS `sistemadeinventario` DEFAULT CHARACTER SET utf8 ; +USE `sistemadeinventario` ; + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`departamento` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`departamento` ( + `id` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(20) NULL, + `anaquel` VARCHAR(15) NULL, + `status` INT NULL, + PRIMARY KEY (`id`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`tipo` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`tipo` ( + `id` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(20) NULL, + `status` INT NULL, + PRIMARY KEY (`id`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`marca` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`marca` ( + `id` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(20) NULL, + `status` INT NULL, + `rutafoto` VARCHAR(100) NULL, + PRIMARY KEY (`id`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`pais` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`pais` ( + `id` INT NOT NULL, + `nombre` VARCHAR(45) NULL, + PRIMARY KEY (`id`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`estado` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`estado` ( + `id` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(45) NULL, + `pais_idpais` INT NOT NULL, + PRIMARY KEY (`id`), + INDEX `fk_estado_pais1_idx` (`pais_idpais` ASC) VISIBLE, + CONSTRAINT `fk_estado_pais1` + FOREIGN KEY (`pais_idpais`) + REFERENCES `sistemadeinventario`.`pais` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`provedor` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`provedor` ( + `id` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(20) NULL, + `direccion` VARCHAR(20) NULL, + `correo` VARCHAR(15) NULL, + `telefono` VARCHAR(10) NULL, + `status` INT NULL, + `estado_idestado` INT NOT NULL, + PRIMARY KEY (`id`), + INDEX `fk_provedor_estado1_idx` (`estado_idestado` ASC) VISIBLE, + CONSTRAINT `fk_provedor_estado1` + FOREIGN KEY (`estado_idestado`) + REFERENCES `sistemadeinventario`.`estado` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`producto` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`producto` ( + `id` INT NOT NULL AUTO_INCREMENT, + `cantidad` VARCHAR(10) NULL, + `nombre` VARCHAR(20) NULL, + `precio` INT NULL, + `codigoBarras` VARCHAR(15) NULL, + `medida` INT NULL, + `lote` VARCHAR(10) NULL, + `departamento_id` INT NOT NULL, + `tipo_idtipo` INT NOT NULL, + `marca_idmarca` INT NOT NULL, + `provedor_idprovedor` INT NOT NULL, + `status` INT NULL, + PRIMARY KEY (`id`), + INDEX `fk_producto_departamento_idx` (`departamento_id` ASC) VISIBLE, + INDEX `fk_producto_tipo1_idx` (`tipo_idtipo` ASC) VISIBLE, + INDEX `fk_producto_marca1_idx` (`marca_idmarca` ASC) VISIBLE, + INDEX `fk_producto_provedor1_idx` (`provedor_idprovedor` ASC) VISIBLE, + CONSTRAINT `fk_producto_departamento` + FOREIGN KEY (`departamento_id`) + REFERENCES `sistemadeinventario`.`departamento` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_producto_tipo1` + FOREIGN KEY (`tipo_idtipo`) + REFERENCES `sistemadeinventario`.`tipo` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_producto_marca1` + FOREIGN KEY (`marca_idmarca`) + REFERENCES `sistemadeinventario`.`marca` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_producto_provedor1` + FOREIGN KEY (`provedor_idprovedor`) + REFERENCES `sistemadeinventario`.`provedor` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`rol` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`rol` ( + `id` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(20) NULL, + PRIMARY KEY (`id`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `sistemadeinventario`.`usuario` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`usuario` ( + `id` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(45) NULL, + `sexo` CHAR NULL, + `telefono` VARCHAR(10) NULL, + `correo` VARCHAR(20) NULL, + `direccion` VARCHAR(40) NULL, + `status` INT NULL, + `npila` VARCHAR(15) NULL, + `username` VARCHAR(20) NULL, + `rutafoto` VARCHAR(100) NULL, + `rol_idrol` INT NOT NULL, + `estado_idestado` INT NOT NULL, + PRIMARY KEY (`id`), + INDEX `fk_usuario_rol1_idx` (`rol_idrol` ASC) VISIBLE, + INDEX `fk_usuario_estado1_idx` (`estado_idestado` ASC) VISIBLE, + CONSTRAINT `fk_usuario_rol1` + FOREIGN KEY (`rol_idrol`) + REFERENCES `sistemadeinventario`.`rol` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_usuario_estado1` + FOREIGN KEY (`estado_idestado`) + REFERENCES `sistemadeinventario`.`estado` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 0000000..fdc06d5 --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..18ff77a --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,635 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set build.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.excludes + Must set dist.jar + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..aec1a53 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=34f09548 +build.xml.script.CRC32=33d89256 +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=34f09548 +nbproject/build-impl.xml.script.CRC32=fc2c4efb +nbproject/build-impl.xml.stylesheet.CRC32=abdce74a@1.73 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..b81bf6e --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,40 @@ +build.classes.excludes=**/*.java,**/*.form,**/.nbattrs +build.dir=build +build.generated.dir=${build.dir}/generated +client.module.uri=si-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.si-war.dist-ear}:\ + ${reference.si-ejb.dist-ear} +jar.name=si.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.si-ejb=si-ejb +project.si-war=si-war +reference.si-ejb.dist-ear=${project.si-ejb}/dist/si-ejb.jar +reference.si-war.dist-ear=${project.si-war}/dist/si-war.war +resource.dir=setup +source.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..d9e6b12 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,39 @@ + + + org.netbeans.modules.j2ee.earproject + + + si + 1.6.5 + + + + ${reference.si-war.dist-ear} + / + + + ${reference.si-ejb.dist-ear} + / + + + + + + si-ejb + j2ee_ear_archive + + dist-ear + clean-ear + dist-ear + + + si-war + j2ee_ear_archive + + dist-ear + clean-ear + dist-ear + + + + diff --git a/primefaces-12.0.0.jar b/primefaces-12.0.0.jar new file mode 100644 index 0000000..88dab24 Binary files /dev/null and b/primefaces-12.0.0.jar differ diff --git a/si-ejb/build.xml b/si-ejb/build.xml new file mode 100644 index 0000000..a8f2565 --- /dev/null +++ b/si-ejb/build.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + Builds, tests, and runs the project si-ejb. + + + diff --git a/si-ejb/nbproject/ant-deploy.xml b/si-ejb/nbproject/ant-deploy.xml new file mode 100644 index 0000000..fdc06d5 --- /dev/null +++ b/si-ejb/nbproject/ant-deploy.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/si-ejb/nbproject/build-impl.xml b/si-ejb/nbproject/build-impl.xml new file mode 100644 index 0000000..98d06f0 --- /dev/null +++ b/si-ejb/nbproject/build-impl.xml @@ -0,0 +1,1228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set platform.home + Must set platform.bootcp + Must set platform.java + Must set platform.javac + + The J2SE Platform is not correctly set up. + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. + Either open the project in the IDE and setup the Platform with the same name or add it manually. + For example like this: + ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) + or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set main.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/si-ejb/nbproject/genfiles.properties b/si-ejb/nbproject/genfiles.properties new file mode 100644 index 0000000..1bfa99c --- /dev/null +++ b/si-ejb/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=a1d126bb +build.xml.script.CRC32=6d214eeb +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=a1d126bb +nbproject/build-impl.xml.script.CRC32=639812f4 +nbproject/build-impl.xml.stylesheet.CRC32=62693482@1.75 diff --git a/si-ejb/nbproject/project.properties b/si-ejb/nbproject/project.properties new file mode 100644 index 0000000..19d4b5d --- /dev/null +++ b/si-ejb/nbproject/project.properties @@ -0,0 +1,76 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processor.options=-Aeclipselink.canonicalmodel.use_static_factory=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form,**/.nbattrs +build.dir=build +build.ear.classes.dir=${build.dir}/classes +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +debug.classpath=${javac.classpath}:${build.classes.dir} +debug.test.classpath=\ + ${run.test.classpath} +dist.dir=dist +dist.ear.jar=${dist.dir}/${jar.name} +dist.jar=${dist.dir}/${jar.name} +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath=\ + ${libs.javaee-endorsed-api-7.0.classpath} +excludes= +includes=** +j2ee.compile.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.7 +j2ee.platform.classpath=${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv4ee7 +jar.compress=false +jar.name=si-ejb.jar +jars.in.ejbjar=false +javac.classpath= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath}:\ + ${libs.EclipseLink-GlassFish-v3.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +meta.inf=${source.root}/conf +meta.inf.excludes=sun-cmp-mappings.xml +platform.active=JDK_21 +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test diff --git a/si-ejb/nbproject/project.xml b/si-ejb/nbproject/project.xml new file mode 100644 index 0000000..0e3f39d --- /dev/null +++ b/si-ejb/nbproject/project.xml @@ -0,0 +1,17 @@ + + + org.netbeans.modules.j2ee.ejbjarproject + + + si-ejb + 1.6.5 + + + + + + + + + + diff --git a/si-ejb/src/conf/MANIFEST.MF b/si-ejb/src/conf/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/si-ejb/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/si-ejb/src/conf/META-INF/glassfish-resources.xml b/si-ejb/src/conf/META-INF/glassfish-resources.xml new file mode 100644 index 0000000..ecd6d5f --- /dev/null +++ b/si-ejb/src/conf/META-INF/glassfish-resources.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/si-ejb/src/conf/persistence.xml b/si-ejb/src/conf/persistence.xml new file mode 100644 index 0000000..b1dd9b0 --- /dev/null +++ b/si-ejb/src/conf/persistence.xml @@ -0,0 +1,8 @@ + + + + jdbc/sistemadeinventario + false + + + diff --git a/si-ejb/src/java/hola/BL/DepartamentoBLLocal.java b/si-ejb/src/java/hola/BL/DepartamentoBLLocal.java new file mode 100644 index 0000000..d6017ab --- /dev/null +++ b/si-ejb/src/java/hola/BL/DepartamentoBLLocal.java @@ -0,0 +1,28 @@ +/* + * 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 hola.BL; + +import hola.modelo.Departamento; +import hola.msg.Mensaje; +import java.util.List; +import javax.ejb.Local; + +/** + * + * @author eduar + */ +@Local +public interface DepartamentoBLLocal { + + Mensaje agregar(Departamento departamento); + + Departamento buscarId(Departamento departamento); + + List buscarValidos(boolean estado); + + void eliminarId(Departamento departamento); + + void editar(Departamento departamento); +} diff --git a/si-ejb/src/java/hola/BL/MarcaBL.java b/si-ejb/src/java/hola/BL/MarcaBL.java new file mode 100644 index 0000000..43ab563 --- /dev/null +++ b/si-ejb/src/java/hola/BL/MarcaBL.java @@ -0,0 +1,104 @@ +/* + * 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 hola.BL; + +import hola.dao.MarcaDAO; +import hola.modelo.Marca; +import hola.msg.Mensaje; +import java.util.List; +import java.util.Optional; +import javax.ejb.Stateless; + +/** + * + * @author Josue + */ +@Stateless +public class MarcaBL implements MarcaBLLocal { + +@Override +public Mensaje agregar(Marca marca) { + // Comentario de lógica: Método para agregar una marca + System.out.println("Llegaste al método de agregar Marca"); + MarcaDAO marcaDAO = new MarcaDAO(); + Mensaje m = null; + + // Validar que los campos requeridos no estén vacíos + if (marca.getNombre().isEmpty()) { + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + // Enviar mensaje de error si algún campo está incompleto + return Mensaje.CAMPOS_INCOMPLETOS; + } + + // Buscar si la marca ya existe en la base de datos + Optional marcaEncontradaOptional = marcaDAO.buscarMarca(marca); + + if (marcaEncontradaOptional.isPresent()) { + // Manejar el caso en el que se encontró al menos una marca duplicada + marcaEncontradaOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + System.out.println(m); + } else { + // Agregar la marca a la base de datos si no está duplicada + marcaDAO.agregar(marca); + m = Mensaje.SIN_ERROR; + } + + return m; +} + +@Override +public Marca buscarId(Marca marca) { + // Comentario de lógica: Método para buscar una marca por ID + MarcaDAO marcaDAO = new MarcaDAO(); + return marcaDAO.buscarPorId(marca); +} + +@Override +public void eliminarId(Marca marca) { + // Comentario de lógica: Método para eliminar una marca por ID + MarcaDAO marcaDAO = new MarcaDAO(); + if (marcaDAO.eliminar(marca)) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } +} + +@Override +public void editar(Marca marca) { + // Comentario de lógica: Método para editar una marca + MarcaDAO marcaDAO = new MarcaDAO(); + + // Validar que los campos requeridos no estén vacíos + if (marca.getNombre().isEmpty() || marca.getStatus() == null) { + // Enviar mensaje de error si algún campo está incompleto + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + return; + } + + try { + // Editar la marca solo si todas las validaciones son exitosas + if (marcaDAO.editar(marca)) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } + } catch (Exception e) { + // Capturar cualquier excepción que ocurra durante la edición de la marca + System.out.println(Mensaje.DATOS_INCORRECTOS); + e.printStackTrace(); + } +} + +@Override +public List buscarValidos(boolean estado) { + MarcaDAO marcaDAO = new MarcaDAO(); + List listaMarcas = marcaDAO.buscarValidos(estado); + // Llama al método buscarValidos de MarcaDAO y devuelve la lista resultante + System.out.println(listaMarcas); + return listaMarcas; +} +} diff --git a/si-ejb/src/java/hola/BL/MarcaBLLocal.java b/si-ejb/src/java/hola/BL/MarcaBLLocal.java new file mode 100644 index 0000000..802e631 --- /dev/null +++ b/si-ejb/src/java/hola/BL/MarcaBLLocal.java @@ -0,0 +1,24 @@ +/* + * 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 hola.BL; + +import hola.modelo.Marca; +import hola.msg.Mensaje; +import java.util.List; +import javax.ejb.Local; + +/** + * + * @author Josue + */ +@Local +public interface MarcaBLLocal { + public Mensaje agregar(Marca marca); + public Marca buscarId(Marca marca); + public void eliminarId(Marca marca); + public void editar(Marca marca); + public List buscarValidos(boolean estado); + +} diff --git a/si-ejb/src/java/hola/BL/ProductoBL.java b/si-ejb/src/java/hola/BL/ProductoBL.java new file mode 100644 index 0000000..1f68a15 --- /dev/null +++ b/si-ejb/src/java/hola/BL/ProductoBL.java @@ -0,0 +1,118 @@ +/* + * 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 hola.BL; + + +import hola.dao.ProductoDAO; + +import hola.modelo.Producto; +import hola.msg.Mensaje; +import java.util.List; +import java.util.Optional; +import javax.ejb.Stateless; + +/** + * + * @author eduar + */ +@Stateless +public class ProductoBL implements ProductoBLLocal { + @Override + public Mensaje agregar(Producto producto) { + System.out.println("Llegaste al metodo de agregar Producto"); + ProductoDAO productoDAO = new ProductoDAO(); + Mensaje m = null; + + // Validar que los campos requeridos no estén vacíos + if (producto.getNombre().isEmpty() + || producto.getCantidad().isEmpty() + || producto.getPrecio()<=0 + || producto.getCodigoBarras().isEmpty() + || producto.getMedida()<=0 + || producto.getLote().isEmpty()) + { + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + // Enviar mensaje de error si algún campo está incompleto + return Mensaje.CAMPOS_INCOMPLETOS; + } + + // Buscar si el proveedor ya existe en la base de datos + Optional productoEncontradoOptional = productoDAO.buscarProducto(producto); + + if (productoEncontradoOptional.isPresent()) { + // Manejar el caso en el que se encontró al menos un proveedor duplicado + productoEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + } else { + // Agregar el proveedor a la base de datos si no está duplicado + productoDAO.agregar(producto); + //registroDAO.agregar(registro); + m = Mensaje.SIN_ERROR; + } + + return m; + } + + @Override + public Producto buscarId(Producto producto) { + // Comentario de lógica: Método para buscar un proveedor por ID + ProductoDAO d = new ProductoDAO(); + return d.buscarPorId(producto); + } + + @Override + public void eliminarId(Producto producto) { + // Comentario de lógica: Método para eliminar un proveedor por ID + ProductoDAO d = new ProductoDAO(); + if (d.eliminar(producto)) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } + } + + @Override + public void editar(Producto producto) { + // Comentario de lógica: Método para editar un proveedor + + ProductoDAO productoDAO = new ProductoDAO(); + + // Validar que los campos requeridos no estén vacíos + if (producto.getNombre().isEmpty() + || producto.getCantidad().isEmpty() + || producto.getPrecio()<=0 + || producto.getCodigoBarras().isEmpty() + || producto.getMedida()<=0 + || producto.getLote().isEmpty()){ + + // Enviar mensaje de error si algún campo está incompleto + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + return; + } + + try { + // Editar el proveedor solo si todas las validaciones son exitosas + if (productoDAO.editar(producto) == true) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } + } catch (Exception e) { + // Capturar cualquier excepción que ocurra durante la edición del proveedor + System.out.println(Mensaje.DATOS_INCORRECTOS); + e.printStackTrace(); + } + + } + + @Override + public List buscarValidos(boolean estado) { + ProductoDAO productoDAO = new ProductoDAO(); + List l = productoDAO.buscarValidosD(estado); + // Llama al método buscarValidos de ProductoDAO y devuelve la lista resultante + System.out.println(l); + return l; + } +} diff --git a/si-ejb/src/java/hola/BL/ProductoBLLocal.java b/si-ejb/src/java/hola/BL/ProductoBLLocal.java new file mode 100644 index 0000000..94efcee --- /dev/null +++ b/si-ejb/src/java/hola/BL/ProductoBLLocal.java @@ -0,0 +1,29 @@ +/* + * 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 hola.BL; + + +import hola.modelo.Producto; +import hola.msg.Mensaje; +import java.util.List; +import javax.ejb.Local; + +/** + * + * @author eduar + */ +@Local +public interface ProductoBLLocal { + + Mensaje agregar(Producto producto); + + Producto buscarId(Producto producto); + + List buscarValidos(boolean estado); + + void eliminarId(Producto producto); + + void editar(Producto producto); +} diff --git a/si-ejb/src/java/hola/BL/ProvedorBL.java b/si-ejb/src/java/hola/BL/ProvedorBL.java new file mode 100644 index 0000000..cd7608e --- /dev/null +++ b/si-ejb/src/java/hola/BL/ProvedorBL.java @@ -0,0 +1,113 @@ +/* + * 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 hola.BL; + +import hola.dao.ProvedorDAO; +import hola.modelo.Provedor; +import hola.msg.Mensaje; +import java.util.List; +import java.util.Optional; +import javax.ejb.Stateless; + +/** + * + * @author Josue + */ +@Stateless +public class ProvedorBL implements ProvedorBLLocal { + + @Override + public Mensaje agregar(Provedor provedor) { + // Comentario de lógica: Método para agregar un proveedor +//, Registro registro// + System.out.println("Llegaste al metodo de agregar Proveedor"); + ProvedorDAO provedorDAO = new ProvedorDAO(); + Mensaje m = null; + + // Validar que los campos requeridos no estén vacíos + if (provedor.getNombre().isEmpty() + || provedor.getDireccion().isEmpty() + || provedor.getCorreo().isEmpty() + || provedor.getTelefono().isEmpty()) { + + // Enviar mensaje de error si algún campo está incompleto + return Mensaje.CAMPOS_INCOMPLETOS; + } + + // Buscar si el proveedor ya existe en la base de datos + Optional provedorEncontradoOptional = provedorDAO.buscarProvedor(provedor); + + if (provedorEncontradoOptional.isPresent()) { + // Manejar el caso en el que se encontró al menos un proveedor duplicado + provedorEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + } else { + // Agregar el proveedor a la base de datos si no está duplicado + provedorDAO.agregar(provedor); + //registroDAO.agregar(registro); + m = Mensaje.SIN_ERROR; + } + + return m; + } + + @Override + public Provedor buscarId(Provedor provedor) { + // Comentario de lógica: Método para buscar un proveedor por ID + ProvedorDAO p = new ProvedorDAO(); + return p.buscarPorId(provedor); + } + + @Override + public void eliminarId(Provedor provedor) { + // Comentario de lógica: Método para eliminar un proveedor por ID + ProvedorDAO p = new ProvedorDAO(); + if (p.eliminar(provedor)) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } + } + + @Override + public void editar(Provedor provedor) { + // Comentario de lógica: Método para editar un proveedor + + ProvedorDAO provedorDAO = new ProvedorDAO(); + + // Validar que los campos requeridos no estén vacíos + if (provedor.getNombre().isEmpty() + || provedor.getDireccion().isEmpty() + || provedor.getCorreo().isEmpty() + || provedor.getTelefono().isEmpty()) { + + // Enviar mensaje de error si algún campo está incompleto + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + return; + } + + try { + // Editar el proveedor solo si todas las validaciones son exitosas + if (provedorDAO.editar(provedor) == true) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } + } catch (Exception e) { + // Capturar cualquier excepción que ocurra durante la edición del proveedor + System.out.println(Mensaje.DATOS_INCORRECTOS); + e.printStackTrace(); + } + + } + @Override + public List buscarValidos(boolean estado) { + ProvedorDAO proovedorDAO = new ProvedorDAO(); + List l = proovedorDAO.buscarValidos(estado); + // Llama al método buscarValidos de ProductoDAO y devuelve la lista resultante + System.out.println(l); + return l; + } +} diff --git a/si-ejb/src/java/hola/BL/ProvedorBLLocal.java b/si-ejb/src/java/hola/BL/ProvedorBLLocal.java new file mode 100644 index 0000000..6b14cce --- /dev/null +++ b/si-ejb/src/java/hola/BL/ProvedorBLLocal.java @@ -0,0 +1,24 @@ +/* + * 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 hola.BL; + +import hola.modelo.Provedor; +import hola.msg.Mensaje; +import java.util.List; +import javax.ejb.Local; + +/** + * + * @author Josue + */ +@Local +public interface ProvedorBLLocal { + public Mensaje agregar(Provedor provedor); + public Provedor buscarId(Provedor provedor); + public void eliminarId(Provedor provedor); + public void editar(Provedor provedor); + public List buscarValidos(boolean estado); + +} diff --git a/si-ejb/src/java/hola/BL/TipoBL.java b/si-ejb/src/java/hola/BL/TipoBL.java new file mode 100644 index 0000000..ee49b20 --- /dev/null +++ b/si-ejb/src/java/hola/BL/TipoBL.java @@ -0,0 +1,112 @@ +/* + * 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 hola.BL; + +import hola.dao.TipoDAO; +import hola.modelo.Tipo; +import hola.msg.Mensaje; +import java.util.List; +import java.util.Optional; +import javax.ejb.Stateless; + +/** + * + * @author chore + */ +@Stateless +public class TipoBL implements TipoBLLocal { + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + @Override + public Mensaje agregar(Tipo tipo) { + // Comentario de lógica: Método para agregar un proveedor +//, Registro registro// + System.out.println("Llegaste al metodo de agregar Tipo"); + TipoDAO tipoDAO = new TipoDAO(); + Mensaje m = null; + + // Validar que los campos requeridos no estén vacíos + if (tipo.getNombre().isEmpty()) { + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + // Enviar mensaje de error si algún campo está incompleto + return Mensaje.CAMPOS_INCOMPLETOS; + } + + // Buscar si el proveedor ya existe en la base de datos + Optional tipoEncontradoOptional = tipoDAO.buscarTipo(tipo); + + if (tipoEncontradoOptional.isPresent()) { + // Manejar el caso en el que se encontró al menos un proveedor duplicado + tipoEncontradoOptional.get(); + m = Mensaje.ELEMENTO_DUPLICADO; + } else { + // Agregar el proveedor a la base de datos si no está duplicado + tipoDAO.agregar(tipo); + //registroDAO.agregar(registro); + m = Mensaje.SIN_ERROR; + } + + return m; + } + + @Override + public Tipo buscarId(Tipo tipo) { + // Comentario de lógica: Método para buscar un proveedor por ID + TipoDAO tdao = new TipoDAO(); + return tdao.buscarPorId(tipo); + } + + @Override + public void eliminarId(Tipo tipo) { + // Comentario de lógica: Método para eliminar un proveedor por ID + TipoDAO tdao = new TipoDAO(); + if (tdao.eliminar(tipo)) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } + } + + @Override + public void editar(Tipo tipo) { + // Comentario de lógica: Método para editar un proveedor + + TipoDAO tipoDAO = new TipoDAO(); + + // Validar que los campos requeridos no estén vacíos + if (tipo.getNombre().isEmpty() + || tipo.getNombre().isEmpty() + || tipo.getStatus() == null) { + + // Enviar mensaje de error si algún campo está incompleto + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + return; + } + + try { + // Editar el proveedor solo si todas las validaciones son exitosas + if (tipoDAO.editar(tipo) == true) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } + } catch (Exception e) { + // Capturar cualquier excepción que ocurra durante la edición del proveedor + System.out.println(Mensaje.DATOS_INCORRECTOS); + e.printStackTrace(); + } + + } + + @Override + public List buscarValidos(boolean estado) { + TipoDAO tipoDAO = new TipoDAO(); + List l = tipoDAO.buscarValidos(estado); + // Llama al método buscarValidos de ProductoDAO y devuelve la lista resultante + System.out.println(l); + return l; + } +} diff --git a/si-ejb/src/java/hola/BL/TipoBLLocal.java b/si-ejb/src/java/hola/BL/TipoBLLocal.java new file mode 100644 index 0000000..55302a6 --- /dev/null +++ b/si-ejb/src/java/hola/BL/TipoBLLocal.java @@ -0,0 +1,29 @@ +/* + * 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 hola.BL; + +import hola.modelo.Tipo; +import hola.msg.Mensaje; +import java.util.List; +import javax.ejb.Local; + +/** + * + * @author chore + */ +@Local +public interface TipoBLLocal { + + public Mensaje agregar(Tipo tipo); + + public Tipo buscarId(Tipo tipo); + + public void eliminarId(Tipo tipo); + + public void editar(Tipo tipo); + + public List buscarValidos(boolean estado); + +} diff --git a/si-ejb/src/java/hola/BL/UsuarioBL.java b/si-ejb/src/java/hola/BL/UsuarioBL.java new file mode 100644 index 0000000..1cdf7ef --- /dev/null +++ b/si-ejb/src/java/hola/BL/UsuarioBL.java @@ -0,0 +1,144 @@ +/* + * 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 hola.BL; + +import hola.dao.UsuarioDAO; +import hola.modelo.Usuario; +import hola.msg.Mensaje; +import java.util.List; +import java.util.Optional; +import javax.ejb.Stateless; +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +/** + * + * @author chore + */ +@Stateless +public class UsuarioBL implements UsuarioBLLocal { + + // Add business logic below. (Right-click in editor and choose + // "Insert Code > Add Business Method") + @Override + public Mensaje agregar(Usuario usuario) { + // Comentario de lógica: Método para agregar un proveedor +//, Registro registro// + System.out.println("Llegaste al metodo de agregar Usuario"); + UsuarioDAO usuarioDAO = new UsuarioDAO(); + Mensaje m = null; + + // Validar que los campos requeridos no estén vacíos + if (usuario.getNombre().isEmpty() + || usuario.getSexo()== null + || usuario.getTelefono().isEmpty() + || usuario.getCorreo().isEmpty() + || usuario.getDireccion().isEmpty() + || usuario.getNpila().isEmpty() + || usuario.getUsername().isEmpty()) { + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + // Enviar mensaje de error si algún campo está incompleto + return Mensaje.CAMPOS_INCOMPLETOS; + } + + // Buscar si el proveedor ya existe en la base de datos + Optional usuarioEncontradoOptional = usuarioDAO.buscarUsuario(usuario); + + if (usuarioEncontradoOptional.isPresent()) { + // Manejar el caso en el que se encontró al menos un proveedor duplicado + usuarioEncontradoOptional.get(); + addMessage(FacesMessage.SEVERITY_ERROR, "Error", "Elemento duplicado"); + m = Mensaje.ELEMENTO_DUPLICADO; + } else { + // Agregar el proveedor a la base de datos si no está duplicado + usuarioDAO.agregar(usuario); + //registroDAO.agregar(registro); + m = Mensaje.SIN_ERROR; + } + + return m; + } + + @Override + public Usuario buscarId(Usuario usuario) { + // Comentario de lógica: Método para buscar un proveedor por ID + UsuarioDAO udao = new UsuarioDAO(); + return udao.buscarPorId(usuario); + } + + @Override + public void eliminarId(Usuario usuario) { + // Comentario de lógica: Método para eliminar un proveedor por ID + UsuarioDAO udao = new UsuarioDAO(); + if (udao.eliminar(usuario)) { + System.out.println(Mensaje.SIN_ERROR); + } else { + System.out.println(Mensaje.NO_EXISTE); + } + } + + @Override + public Mensaje editar(Usuario usuario) { + // Comentario de lógica: Método para editar un proveedor + Mensaje m; + UsuarioDAO usuarioDAO = new UsuarioDAO(); + + // Validar que los campos requeridos no estén vacíos + if (usuario.getNombre().isEmpty() + || usuario.getNombre().isEmpty() + || usuario.getTelefono().isEmpty() + || usuario.getCorreo().isEmpty() + || usuario.getDireccion().isEmpty() + || usuario.getStatus() == null) { + + // Enviar mensaje de error si algún campo está incompleto + m = Mensaje.CAMPOS_INCOMPLETOS; + System.out.println(Mensaje.CAMPOS_INCOMPLETOS); + return m; + } + + try { + // Editar el proveedor solo si todas las validaciones son exitosas + Optional user = usuarioDAO.buscarUsuario(usuario); + if (user.isPresent()) { + + addMessage(FacesMessage.SEVERITY_ERROR, "Error", "Elemento duplicado"); + m = Mensaje.ELEMENTO_DUPLICADO; + } else { + + if (usuarioDAO.editar(usuario) == true) { + m = Mensaje.SIN_ERROR; + System.out.println(Mensaje.SIN_ERROR); + return m; + } else { + m = Mensaje.N0_EXISTE; + System.out.println(Mensaje.NO_EXISTE); + return m; + } + } + } catch (Exception e) { + // Capturar cualquier excepción que ocurra durante la edición del proveedor + m = Mensaje.DATOS_INCORRECTOS; + System.out.println(Mensaje.DATOS_INCORRECTOS); + e.printStackTrace(); + } + return m; + + } + + @Override + public List buscarValidos(boolean estado) { + UsuarioDAO usuarioDAO = new UsuarioDAO(); + List l = usuarioDAO.buscarValidos(estado); + // Llama al método buscarValidos de ProductoDAO y devuelve la lista resultante + System.out.println(l); + return l; + } + + public void addMessage(FacesMessage.Severity severity, String summary, String detail) { + FacesContext.getCurrentInstance().addMessage("MensajeUsuario", new FacesMessage(severity, summary, detail)); + } + +} diff --git a/si-ejb/src/java/hola/BL/UsuarioBLLocal.java b/si-ejb/src/java/hola/BL/UsuarioBLLocal.java new file mode 100644 index 0000000..f3ddc74 --- /dev/null +++ b/si-ejb/src/java/hola/BL/UsuarioBLLocal.java @@ -0,0 +1,28 @@ +/* + * 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 hola.BL; + +import hola.modelo.Usuario; +import hola.msg.Mensaje; +import java.util.List; +import javax.ejb.Local; + +/** + * + * @author chore + */ +@Local +public interface UsuarioBLLocal { + + public Mensaje agregar(Usuario usuario); + + public Usuario buscarId(Usuario usuario); + + public void eliminarId(Usuario usuario); + + public Mensaje editar(Usuario usuario); + + public List buscarValidos(boolean estado); +} diff --git a/si-ejb/src/java/hola/dao/DepartamentoDAO.java b/si-ejb/src/java/hola/dao/DepartamentoDAO.java new file mode 100644 index 0000000..bce253a --- /dev/null +++ b/si-ejb/src/java/hola/dao/DepartamentoDAO.java @@ -0,0 +1,134 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package hola.dao; + +import hola.modelo.Departamento; +import java.util.List; +import java.util.Optional; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; + +/** + * + * @author eduar + */ +public class DepartamentoDAO { + + + private EntityManager em;//Manejador de entidades + + public DepartamentoDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("si-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Departamento departamento) { + em.getTransaction().begin(); + departamento.setStatus(1); + em.persist(departamento);//Almacenar en DB + em.getTransaction().commit(); + + } + + public boolean editar(Departamento departamento) { + if (buscarPorId(departamento) == null) { + return false; + } else { + em.getTransaction().begin(); + em.merge(departamento);//edita en la base de datos + em.getTransaction().commit(); + return true; + } + + } + + public boolean eliminar(Departamento departamento) { + if (buscarPorId(departamento) == null) { + return false; + } else { + + // Iniciar transacción + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Departamento t = em.find(Departamento.class, departamento.getId()); + + // Conservar datos existentes + departamento.setNombre(t.getNombre()); + departamento.setAnaquel(t.getAnaquel()); + + // Modificar solo el estado + departamento.setStatus(0); + em.merge(departamento); + em.getTransaction().commit(); + return true; + } + + } + + public Departamento buscarPorId(Departamento departamento) { + Query q = em.createNamedQuery("Departamento.findById"); + q.setParameter("id", departamento.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Departamento) q.getResultList().get(0); + } + + } + + public List buscarValidosD(boolean status) { + Query q = em.createNamedQuery("Departamento.findByStatus"); + int s = status ? 1 : 0; + q.setParameter("status", s); + if (s == 1) { + System.out.println("Activos"); + } else { + System.out.println("Inactivos"); + } + return q.getResultList(); + } + + public Departamento buscarPorNombre(Departamento departamento) { + Query q = em.createNamedQuery("Departamento.findByNombre"); + q.setParameter("nombre", departamento.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Departamento) q.getResultList().get(0); + } + } + + public Optional buscarDepartamento(Departamento departamento) { + + Query q1 = em.createNamedQuery("Departamento.findByNombre"); + q1.setParameter("nombre", departamento.getNombre()); + + Query q2 = em.createNamedQuery("Departamento.findByAnaquel"); + q2.setParameter("anaquel", departamento.getNombre()); + + List resultadoNombre = q1.getResultList(); + List resultadoAnaquel = q2.getResultList(); + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty() + && !resultadoAnaquel.isEmpty()) { + // Compara si la misma editorial está en los tres resultados + Departamento departamentoEncontrado = resultadoNombre.stream() + .filter(resultadoAnaquel::contains) + .findFirst() + .orElse(null); + + return Optional.ofNullable(departamentoEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + +} diff --git a/si-ejb/src/java/hola/dao/MarcaDAO.java b/si-ejb/src/java/hola/dao/MarcaDAO.java new file mode 100644 index 0000000..8d95491 --- /dev/null +++ b/si-ejb/src/java/hola/dao/MarcaDAO.java @@ -0,0 +1,105 @@ +/* + * 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 hola.dao; +import hola.modelo.Marca; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import java.util.List; +import java.util.Optional; + +public class MarcaDAO { + + private EntityManager eme; + + public MarcaDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("si-ejbPU"); + eme = emf.createEntityManager(); + } + + public void agregar(Marca marca) { + eme.getTransaction().begin(); + marca.setStatus(1); + eme.persist(marca); // Almacenar en la base de datos + eme.getTransaction().commit(); + } + + public boolean editar(Marca marca) { + if (buscarPorId(marca) == null) { + return false; + } else { + eme.getTransaction().begin(); + eme.merge(marca); // Editar en la base de datos + eme.getTransaction().commit(); + return true; + } + } + + public boolean eliminar(Marca marca) { + if (buscarPorId(marca) == null) { + return false; + } else { + eme.getTransaction().begin(); + // Obtener la marca actualizada desde la base de datos + Marca m = eme.find(Marca.class, marca.getId()); + // Conservar otros datos y modificar solo el estado + marca.setNombre(m.getNombre()); + marca.setStatus(0); + eme.merge(marca); + eme.getTransaction().commit(); + return true; + } + } + + public Marca buscarPorId(Marca marca) { + Query q = eme.createNamedQuery("Marca.findById"); + q.setParameter("id", marca.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Marca) q.getResultList().get(0); + } + } + + public List buscarValidos(boolean status) { + Query q = eme.createNamedQuery("Marca.findByStatus"); + int s = status ? 1 : 0; + q.setParameter("status", s); + if (s == 1) { + System.out.println("Marcas Activas"); + } else { + System.out.println("Marcas Inactivas"); + } + return q.getResultList(); + } + + public Marca buscarPorNombre(Marca marca) { + Query q = eme.createNamedQuery("Marca.findByNombre"); + q.setParameter("nombre", marca.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Marca) q.getResultList().get(0); + } + } + + public Optional buscarMarca(Marca marca) { + Query q = eme.createNamedQuery("Marca.findByNombre"); + q.setParameter("nombre", marca.getNombre()); + + List resultadoNombre = q.getResultList(); + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty()) { + // Devuelve el primer resultado encontrado + Marca marcaEncontrada = resultadoNombre.get(0); + return Optional.ofNullable(marcaEncontrada); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } +} diff --git a/si-ejb/src/java/hola/dao/ProductoDAO.java b/si-ejb/src/java/hola/dao/ProductoDAO.java new file mode 100644 index 0000000..230ec42 --- /dev/null +++ b/si-ejb/src/java/hola/dao/ProductoDAO.java @@ -0,0 +1,162 @@ +/* + * 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 hola.dao; + +import hola.modelo.Producto; +import java.util.List; +import java.util.Optional; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; + +/** + * + * @author eduar + */ +public class ProductoDAO { + + private EntityManager em;//Manejador de entidades + + public ProductoDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("si-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Producto producto) { + em.getTransaction().begin(); + producto.setStatus(1); + em.persist(producto);//Almacenar en DB + em.getTransaction().commit(); + + } + + public boolean editar(Producto producto) { + if (buscarPorId(producto) == null) { + return false; + } else { + em.getTransaction().begin(); + em.merge(producto);//edita en la base de datos + em.getTransaction().commit(); + return true; + } + + } + + public boolean eliminar(Producto producto) { + if (buscarPorId(producto) == null) { + return false; + } else { + + // Iniciar transacción + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Producto t = em.find(Producto.class, producto.getId()); + + // Conservar datos existentes + producto.setNombre(t.getNombre()); + producto.setCantidad(t.getCantidad()); + producto.setPrecio(t.getPrecio()); + producto.setCodigoBarras(t.getCodigoBarras()); + producto.setMedida(t.getMedida()); + producto.setLote(t.getLote()); + + + // Modificar solo el estado + producto.setStatus(0); + em.merge(producto); + em.getTransaction().commit(); + return true; + } + + } + + public Producto buscarPorId(Producto producto) { + Query q = em.createNamedQuery("Producto.findById"); + q.setParameter("id", producto.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Producto) q.getResultList().get(0); + } + + } + + public List buscarValidosD(boolean status) { + Query q = em.createNamedQuery("Producto.findByStatus"); + int s = status ? 1 : 0; + q.setParameter("status", s); + if (s == 1) { + System.out.println("Activos"); + } else { + System.out.println("Inactivos"); + } + return q.getResultList(); + } + + public Producto buscarPorNombre(Producto producto) { + Query q = em.createNamedQuery("Producto.findByNombre"); + q.setParameter("nombre", producto.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Producto) q.getResultList().get(0); + } + } + + public Optional buscarProducto(Producto producto) { + + Query q1 = em.createNamedQuery("Producto.findByNombre"); + q1.setParameter("nombre", producto.getNombre()); + + Query q2 = em.createNamedQuery("Producto.findByCantidad"); + q2.setParameter("cantidad", producto.getCantidad()); + + Query q3 = em.createNamedQuery("Producto.findByPrecio"); + q3.setParameter("precio", producto.getPrecio()); + + Query q4 = em.createNamedQuery("Producto.findByCodigoBarras"); + q4.setParameter("codigoBarras", producto.getCodigoBarras()); + + Query q5 = em.createNamedQuery("Producto.findByMedida"); + q5.setParameter("medida", producto.getMedida()); + + Query q6 = em.createNamedQuery("Producto.findByLote"); + q6.setParameter("lote", producto.getLote()); + + List resultadoNombre = q1.getResultList(); + List resultadoCantidad = q2.getResultList(); + List resultadoPrecio = q3.getResultList(); + List resultadoCodigoBarras = q4.getResultList(); + List resultadoMedida = q5.getResultList(); + List resultadoLote = q6.getResultList(); + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty() + && !resultadoCantidad.isEmpty() + && !resultadoPrecio.isEmpty() + && !resultadoCodigoBarras.isEmpty() + && !resultadoMedida.isEmpty() + && !resultadoLote.isEmpty()) { + // Compara si la misma editorial está en los tres resultados + Producto productoEncontrado = resultadoNombre.stream() + .filter(resultadoCantidad::contains) + .filter(resultadoPrecio::contains) + .filter(resultadoCodigoBarras::contains) + .filter(resultadoMedida::contains) + .filter(resultadoLote::contains) + .findFirst() + .orElse(null); + + return Optional.ofNullable(productoEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + +} diff --git a/si-ejb/src/java/hola/dao/ProvedorDAO.java b/si-ejb/src/java/hola/dao/ProvedorDAO.java new file mode 100644 index 0000000..79d56ed --- /dev/null +++ b/si-ejb/src/java/hola/dao/ProvedorDAO.java @@ -0,0 +1,148 @@ +/* + * 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 hola.dao; + +import hola.modelo.Provedor; +import java.util.List; +import java.util.Optional; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; + +/** + * + * @author Josue + */ +public class ProvedorDAO { + + private EntityManager em; + + public ProvedorDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("si-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Provedor provedor) { + em.getTransaction().begin(); + provedor.setStatus(1); + em.persist(provedor);//Almacenar en DB + em.getTransaction().commit(); + + } + + public boolean editar(Provedor provedor) { + if (buscarPorId(provedor) == null) { + return false; + } else { + em.getTransaction().begin(); + em.merge(provedor);//edita en la base de datos + em.getTransaction().commit(); + return true; + } + + } + + public boolean eliminar(Provedor provedor) { + if (buscarPorId(provedor) == null) { + return false; + } else { + + // Iniciar transacción + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Provedor p = em.find(Provedor.class, provedor.getId()); + + // Conservar datos existentes + provedor.setNombre(p.getNombre()); + provedor.setDireccion(p.getDireccion()); + provedor.setCorreo(p.getCorreo()); + provedor.setTelefono(p.getTelefono()); + + + // Modificar solo el estado + provedor.setStatus(2); + em.merge(provedor); + em.getTransaction().commit(); + return true; + } + + } + + public Provedor buscarPorId(Provedor d) { + Query q = em.createNamedQuery("Provedor.findById"); + q.setParameter("id", d.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Provedor) q.getResultList().get(0); + } + + } + + public List buscarValidos(boolean status) { + Query q = em.createNamedQuery("Provedor.findByStatus"); + int s = status ? 1 : 0; + q.setParameter("status", s); + if (s == 1) { + System.out.println("Activos"); + } else { + System.out.println("Inactivos"); + } + return q.getResultList(); + } + + public Provedor buscarPorNombre(Provedor departamento) { + Query q = em.createNamedQuery("Provedor.findByNombre"); + q.setParameter("nombre", departamento.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Provedor) q.getResultList().get(0); + } + } + + public Optional buscarProvedor(Provedor d) { + + Query q1 = em.createNamedQuery("Provedor.findByNombre"); + q1.setParameter("nombre", d.getNombre()); + + Query q2 = em.createNamedQuery("Provedor.findByDireccion"); + q2.setParameter("direccion", d.getDireccion()); + + Query q3 = em.createNamedQuery("Provedor.findByCorreo"); + q3.setParameter("correo", d.getCorreo()); + + Query q4 = em.createNamedQuery("Provedor.findByTelefono"); + q4.setParameter("telefono", d.getTelefono()); + + List resultadoNombre = q1.getResultList(); + List resultadoDireccion = q2.getResultList(); + List resultadoCorreo = q3.getResultList(); + List resultadoTelefono = q4.getResultList(); + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty() + && !resultadoDireccion.isEmpty() + && !resultadoCorreo.isEmpty() + && !resultadoTelefono.isEmpty()) { + // Compara si la misma editorial está en los tres resultados + Provedor departamentoEncontrado = resultadoNombre.stream() + .filter(resultadoDireccion::contains) + .filter(resultadoCorreo::contains) + .filter(resultadoTelefono::contains) + .findFirst() + .orElse(null); + + return Optional.ofNullable(departamentoEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + +} diff --git a/si-ejb/src/java/hola/dao/TipoDAO.java b/si-ejb/src/java/hola/dao/TipoDAO.java new file mode 100644 index 0000000..f0482c8 --- /dev/null +++ b/si-ejb/src/java/hola/dao/TipoDAO.java @@ -0,0 +1,126 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package hola.dao; + +import hola.modelo.Tipo; +import java.util.List; +import java.util.Optional; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; + +/** + * + * @author chore + */ +public class TipoDAO { + + private EntityManager em; + + public TipoDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("si-ejbPU"); + em = emf.createEntityManager(); + + } + + public void agregar(Tipo tipo) { + em.getTransaction().begin(); + tipo.setStatus(1); + em.persist(tipo);//Almacenar en DB + em.getTransaction().commit(); + + } + + public boolean editar(Tipo tipo) { + if (buscarPorId(tipo) == null) { + return false; + } else { + em.getTransaction().begin(); + em.merge(tipo);//edita en la base de datos + em.getTransaction().commit(); + return true; + } + + } + + public boolean eliminar(Tipo tipo) { + if (buscarPorId(tipo) == null) { + return false; + } else { + + // Iniciar transacción + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Tipo t = em.find(Tipo.class, tipo.getId()); + + // Conservar datos existentes + tipo.setNombre(t.getNombre()); + + // Modificar solo el estado + tipo.setStatus(0); + em.merge(tipo); + em.getTransaction().commit(); + return true; + } + + } + + public Tipo buscarPorId(Tipo tipo) { + Query q = em.createNamedQuery("Tipo.findById"); + q.setParameter("id", tipo.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Tipo) q.getResultList().get(0); + } + + } + + public List buscarValidos(boolean status) { + Query q = em.createNamedQuery("Tipo.findByStatus"); + int s = status ? 1 : 0; + q.setParameter("status", s); + if (s == 1) { + System.out.println("Activos"); + } else { + System.out.println("Inactivos"); + } + return q.getResultList(); + } + + public Tipo buscarPorNombre(Tipo tipo) { + Query q = em.createNamedQuery("Tipo.findByNombre"); + q.setParameter("nombre", tipo.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Tipo) q.getResultList().get(0); + } + } + + public Optional buscarTipo(Tipo tipo) { + + Query q1 = em.createNamedQuery("Tipo.findByNombre"); + q1.setParameter("nombre", tipo.getNombre()); + + List resultadoNombre = q1.getResultList(); + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty()) { + // Compara si la misma editorial está en los tres resultados + Tipo tipoEncontrado = resultadoNombre.stream() + .findFirst() + .orElse(null); + + return Optional.ofNullable(tipoEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + +} diff --git a/si-ejb/src/java/hola/dao/UsuarioDAO.java b/si-ejb/src/java/hola/dao/UsuarioDAO.java new file mode 100644 index 0000000..dbc7073 --- /dev/null +++ b/si-ejb/src/java/hola/dao/UsuarioDAO.java @@ -0,0 +1,146 @@ + /* + * 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 hola.dao; + +import hola.modelo.Usuario; +import java.util.List; +import java.util.Optional; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; + +/** + * + * @author chore + */ +public class UsuarioDAO { + private EntityManager em; + + public UsuarioDAO() { + EntityManagerFactory emf = Persistence.createEntityManagerFactory("si-ejbPU"); + em = emf.createEntityManager(); + + } + public void agregar(Usuario usuario) { + em.getTransaction().begin(); + usuario.setStatus(1); + em.persist(usuario);//Almacenar en DB + em.getTransaction().commit(); + + } + + public boolean editar(Usuario usuario) { + if (buscarPorId(usuario) == null) { + return false; + } else { + em.getTransaction().begin(); + em.merge(usuario);//edita en la base de datos + em.getTransaction().commit(); + return true; + } + + } + + public boolean eliminar(Usuario usuario) { + if (buscarPorId(usuario) == null) { + return false; + } else { + + // Iniciar transacción + em.getTransaction().begin(); + + // Obtener proveedor actualizado desde la base de datos + Usuario u = em.find(Usuario.class, usuario.getId()); + + // Conservar datos existentes + usuario.setNombre(u.getNombre()); + usuario.setTelefono(u.getTelefono()); + usuario.setCorreo(u.getCorreo()); + usuario.setDireccion(u.getDireccion()); + + + // Modificar solo el estado + usuario.setStatus(0); + em.merge(usuario); + em.getTransaction().commit(); + return true; + } + + } + + public Usuario buscarPorId(Usuario usuario) { + Query q = em.createNamedQuery("Usuario.findById"); + q.setParameter("id", usuario.getId()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Usuario) q.getResultList().get(0); + } + + } + + public List buscarValidos(boolean status) { + Query q = em.createNamedQuery("Usuario.findByStatus"); + int s = status ? 1 : 0; + q.setParameter("status", s); + if (s == 1) { + System.out.println("Activos"); + } else { + System.out.println("Inactivos"); + } + return q.getResultList(); + } + + public Usuario buscarPorNombre(Usuario usuario) { + Query q = em.createNamedQuery("Usuario.findByNombre"); + q.setParameter("nombre", usuario.getNombre()); + if (q.getResultList().isEmpty()) { + return null; + } else { + return (Usuario) q.getResultList().get(0); + } + } + + public Optional buscarUsuario(Usuario usuario) { + + Query q1 = em.createNamedQuery("Usuario.findByNombre"); + q1.setParameter("nombre", usuario.getNombre()); + + Query q2 = em.createNamedQuery("Usuario.findByTelefono"); + q2.setParameter("telefono", usuario.getTelefono()); + + Query q3 = em.createNamedQuery("Usuario.findByCorreo"); + q3.setParameter("correo", usuario.getCorreo()); + + Query q4 = em.createNamedQuery("Usuario.findByDireccion"); + q4.setParameter("direccion", usuario.getDireccion()); + + List resultadoNombre = q1.getResultList(); + List resultadoTelefono = q2.getResultList(); + List resultadoCorreo = q3.getResultList(); + List resultadoDireccion = q4.getResultList(); + + // Verifica si hay resultados para todos los campos + if (!resultadoNombre.isEmpty() + && !resultadoTelefono.isEmpty() + && !resultadoCorreo.isEmpty() + && !resultadoDireccion.isEmpty()) { + // Compara si la misma editorial está en los tres resultados + Usuario usuarioEncontrado = resultadoNombre.stream() + .filter(resultadoTelefono::contains) + .filter(resultadoCorreo::contains) + .filter(resultadoDireccion::contains) + .findFirst() + .orElse(null); + + return Optional.ofNullable(usuarioEncontrado); + } else { + // Devuelve Optional vacío para indicar ausencia de resultados + return Optional.empty(); + } + } + +} diff --git a/si-ejb/src/java/hola/modelo/Departamento.java b/si-ejb/src/java/hola/modelo/Departamento.java new file mode 100644 index 0000000..c2e5437 --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Departamento.java @@ -0,0 +1,129 @@ +/* + * 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 hola.modelo; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * + * @author chore + */ +@Entity +@Table(name = "departamento", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Departamento.findAll", query = "SELECT d FROM Departamento d"), + @NamedQuery(name = "Departamento.findById", query = "SELECT d FROM Departamento d WHERE d.id = :id"), + @NamedQuery(name = "Departamento.findByNombre", query = "SELECT d FROM Departamento d WHERE d.nombre = :nombre"), + @NamedQuery(name = "Departamento.findByAnaquel", query = "SELECT d FROM Departamento d WHERE d.anaquel = :anaquel"), + @NamedQuery(name = "Departamento.findByStatus", query = "SELECT d FROM Departamento d WHERE d.status = :status")}) +public class Departamento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(name = "id") + private Integer id; + @Size(max = 20) + @Column(name = "nombre") + private String nombre; + @Size(max = 15) + @Column(name = "anaquel") + private String anaquel; + @Column(name = "status") + private Integer status; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "departamentoId") + private List productoList; + + public Departamento() { + } + + public Departamento(Integer id) { + this.id = id; + } + + 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 getAnaquel() { + return anaquel; + } + + public void setAnaquel(String anaquel) { + this.anaquel = anaquel; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + @XmlTransient + public List getProductoList() { + return productoList; + } + + public void setProductoList(List productoList) { + this.productoList = productoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Departamento)) { + return false; + } + Departamento other = (Departamento) 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 "hola.modelo.Departamento[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/modelo/Estado.java b/si-ejb/src/java/hola/modelo/Estado.java new file mode 100644 index 0000000..25365a6 --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Estado.java @@ -0,0 +1,130 @@ +/* + * 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 hola.modelo; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * + * @author chore + */ +@Entity +@Table(name = "estado", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Estado.findAll", query = "SELECT e FROM Estado e"), + @NamedQuery(name = "Estado.findById", query = "SELECT e FROM Estado e WHERE e.id = :id"), + @NamedQuery(name = "Estado.findByNombre", query = "SELECT e FROM Estado e WHERE e.nombre = :nombre")}) +public class Estado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(name = "id") + private Integer id; + @Size(max = 45) + @Column(name = "nombre") + private String nombre; + @JoinColumn(name = "pais_idpais", referencedColumnName = "id") + @ManyToOne(optional = false) + private Pais paisIdpais; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "estadoIdestado") + private List provedorList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "estadoIdestado") + private List usuarioList; + + public Estado() { + } + + public Estado(Integer id) { + this.id = id; + } + + 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 Pais getPaisIdpais() { + return paisIdpais; + } + + public void setPaisIdpais(Pais paisIdpais) { + this.paisIdpais = paisIdpais; + } + + @XmlTransient + public List getProvedorList() { + return provedorList; + } + + public void setProvedorList(List provedorList) { + this.provedorList = provedorList; + } + + @XmlTransient + public List getUsuarioList() { + return usuarioList; + } + + public void setUsuarioList(List usuarioList) { + this.usuarioList = usuarioList; + } + + @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 Estado)) { + return false; + } + Estado other = (Estado) 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 "hola.modelo.Estado[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/modelo/Marca.java b/si-ejb/src/java/hola/modelo/Marca.java new file mode 100644 index 0000000..4916dda --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Marca.java @@ -0,0 +1,117 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package hola.modelo; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * + * @author chore + */ +@Entity +@Table(name = "marca", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Marca.findAll", query = "SELECT m FROM Marca m"), + @NamedQuery(name = "Marca.findById", query = "SELECT m FROM Marca m WHERE m.id = :id"), + @NamedQuery(name = "Marca.findByNombre", query = "SELECT m FROM Marca m WHERE m.nombre = :nombre"), + @NamedQuery(name = "Marca.findByStatus", query = "SELECT m FROM Marca m WHERE m.status = :status")}) +public class Marca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(name = "id") + private Integer id; + @Size(max = 20) + @Column(name = "nombre") + private String nombre; + @Column(name = "status") + private Integer status; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "marcaIdmarca") + private List productoList; + + public Marca() { + } + + public Marca(Integer id) { + this.id = id; + } + + 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 Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + @XmlTransient + public List getProductoList() { + return productoList; + } + + public void setProductoList(List productoList) { + this.productoList = productoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Marca)) { + return false; + } + Marca other = (Marca) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "hola.modelo.Marca[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/modelo/Pais.java b/si-ejb/src/java/hola/modelo/Pais.java new file mode 100644 index 0000000..0718fdb --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Pais.java @@ -0,0 +1,105 @@ +/* + * 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 hola.modelo; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * + * @author chore + */ +@Entity +@Table(name = "pais", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Pais.findAll", query = "SELECT p FROM Pais p"), + @NamedQuery(name = "Pais.findById", query = "SELECT p FROM Pais p WHERE p.id = :id"), + @NamedQuery(name = "Pais.findByNombre", query = "SELECT p FROM Pais p WHERE p.nombre = :nombre")}) +public class Pais implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @NotNull + @Column(name = "id") + private Integer id; + @Size(max = 45) + @Column(name = "nombre") + private String nombre; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "paisIdpais") + private List estadoList; + + public Pais() { + } + + public Pais(Integer id) { + this.id = id; + } + + 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; + } + + @XmlTransient + public List getEstadoList() { + return estadoList; + } + + public void setEstadoList(List estadoList) { + this.estadoList = estadoList; + } + + @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 Pais)) { + return false; + } + Pais other = (Pais) 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 "hola.modelo.Pais[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/modelo/Producto.java b/si-ejb/src/java/hola/modelo/Producto.java new file mode 100644 index 0000000..11b06e4 --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Producto.java @@ -0,0 +1,206 @@ +/* + * 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 hola.modelo; + +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.Size; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * @author chore + */ +@Entity +@Table(name = "producto", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Producto.findAll", query = "SELECT p FROM Producto p"), + @NamedQuery(name = "Producto.findById", query = "SELECT p FROM Producto p WHERE p.id = :id"), + @NamedQuery(name = "Producto.findByCantidad", query = "SELECT p FROM Producto p WHERE p.cantidad = :cantidad"), + @NamedQuery(name = "Producto.findByNombre", query = "SELECT p FROM Producto p WHERE p.nombre = :nombre"), + @NamedQuery(name = "Producto.findByPrecio", query = "SELECT p FROM Producto p WHERE p.precio = :precio"), + @NamedQuery(name = "Producto.findByCodigoBarras", query = "SELECT p FROM Producto p WHERE p.codigoBarras = :codigoBarras"), + @NamedQuery(name = "Producto.findByMedida", query = "SELECT p FROM Producto p WHERE p.medida = :medida"), + @NamedQuery(name = "Producto.findByLote", query = "SELECT p FROM Producto p WHERE p.lote = :lote"), + @NamedQuery(name = "Producto.findByStatus", query = "SELECT p FROM Producto p WHERE p.status = :status")}) +public class Producto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(name = "id") + private Integer id; + @Size(max = 10) + @Column(name = "cantidad") + private String cantidad; + @Size(max = 20) + @Column(name = "nombre") + private String nombre; + @Column(name = "precio") + private Integer precio; + @Size(max = 15) + @Column(name = "codigoBarras") + private String codigoBarras; + @Column(name = "medida") + private Integer medida; + @Size(max = 10) + @Column(name = "lote") + private String lote; + @Column(name = "status") + private Integer status; + @JoinColumn(name = "departamento_id", referencedColumnName = "id") + @ManyToOne(optional = false) + private Departamento departamentoId; + @JoinColumn(name = "marca_idmarca", referencedColumnName = "id") + @ManyToOne(optional = false) + private Marca marcaIdmarca; + @JoinColumn(name = "provedor_idprovedor", referencedColumnName = "id") + @ManyToOne(optional = false) + private Provedor provedorIdprovedor; + @JoinColumn(name = "tipo_idtipo", referencedColumnName = "id") + @ManyToOne(optional = false) + private Tipo tipoIdtipo; + + public Producto() { + } + + public Producto(Integer id) { + this.id = id; + } + + 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 String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public Integer getPrecio() { + return precio; + } + + public void setPrecio(Integer precio) { + this.precio = precio; + } + + public String getCodigoBarras() { + return codigoBarras; + } + + public void setCodigoBarras(String codigoBarras) { + this.codigoBarras = codigoBarras; + } + + public Integer getMedida() { + return medida; + } + + public void setMedida(Integer medida) { + this.medida = medida; + } + + public String getLote() { + return lote; + } + + public void setLote(String lote) { + this.lote = lote; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Departamento getDepartamentoId() { + return departamentoId; + } + + public void setDepartamentoId(Departamento departamentoId) { + this.departamentoId = departamentoId; + } + + public Marca getMarcaIdmarca() { + return marcaIdmarca; + } + + public void setMarcaIdmarca(Marca marcaIdmarca) { + this.marcaIdmarca = marcaIdmarca; + } + + public Provedor getProvedorIdprovedor() { + return provedorIdprovedor; + } + + public void setProvedorIdprovedor(Provedor provedorIdprovedor) { + this.provedorIdprovedor = provedorIdprovedor; + } + + public Tipo getTipoIdtipo() { + return tipoIdtipo; + } + + public void setTipoIdtipo(Tipo tipoIdtipo) { + this.tipoIdtipo = tipoIdtipo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Producto)) { + return false; + } + Producto other = (Producto) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "hola.modelo.Producto[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/modelo/Provedor.java b/si-ejb/src/java/hola/modelo/Provedor.java new file mode 100644 index 0000000..1aeb4f6 --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Provedor.java @@ -0,0 +1,166 @@ +/* + * 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 hola.modelo; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * + * @author chore + */ +@Entity +@Table(name = "provedor", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Provedor.findAll", query = "SELECT p FROM Provedor p"), + @NamedQuery(name = "Provedor.findById", query = "SELECT p FROM Provedor p WHERE p.id = :id"), + @NamedQuery(name = "Provedor.findByNombre", query = "SELECT p FROM Provedor p WHERE p.nombre = :nombre"), + @NamedQuery(name = "Provedor.findByDireccion", query = "SELECT p FROM Provedor p WHERE p.direccion = :direccion"), + @NamedQuery(name = "Provedor.findByCorreo", query = "SELECT p FROM Provedor p WHERE p.correo = :correo"), + @NamedQuery(name = "Provedor.findByTelefono", query = "SELECT p FROM Provedor p WHERE p.telefono = :telefono"), + @NamedQuery(name = "Provedor.findByStatus", query = "SELECT p FROM Provedor p WHERE p.status = :status")}) +public class Provedor implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(name = "id") + private Integer id; + @Size(max = 20) + @Column(name = "nombre") + private String nombre; + @Size(max = 20) + @Column(name = "direccion") + private String direccion; + @Size(max = 15) + @Column(name = "correo") + private String correo; + @Size(max = 10) + @Column(name = "telefono") + private String telefono; + @Column(name = "status") + private Integer status; + @JoinColumn(name = "estado_idestado", referencedColumnName = "id") + @ManyToOne(optional = false) + private Estado estadoIdestado; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "provedorIdprovedor") + private List productoList; + + public Provedor() { + } + + public Provedor(Integer id) { + this.id = id; + } + + 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 getCorreo() { + return correo; + } + + public void setCorreo(String correo) { + this.correo = correo; + } + + public String getTelefono() { + return telefono; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Estado getEstadoIdestado() { + return estadoIdestado; + } + + public void setEstadoIdestado(Estado estadoIdestado) { + this.estadoIdestado = estadoIdestado; + } + + @XmlTransient + public List getProductoList() { + return productoList; + } + + public void setProductoList(List productoList) { + this.productoList = productoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Provedor)) { + return false; + } + Provedor other = (Provedor) 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 "hola.modelo.Provedor[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/modelo/Rol.java b/si-ejb/src/java/hola/modelo/Rol.java new file mode 100644 index 0000000..4760f17 --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Rol.java @@ -0,0 +1,106 @@ +/* + * 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 hola.modelo; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * + * @author chore + */ +@Entity +@Table(name = "rol", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Rol.findAll", query = "SELECT r FROM Rol r"), + @NamedQuery(name = "Rol.findById", query = "SELECT r FROM Rol r WHERE r.id = :id"), + @NamedQuery(name = "Rol.findByNombre", query = "SELECT r FROM Rol r WHERE r.nombre = :nombre")}) +public class Rol implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(name = "id") + private Integer id; + @Size(max = 20) + @Column(name = "nombre") + private String nombre; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "rolIdrol") + private List usuarioList; + + public Rol() { + } + + public Rol(Integer id) { + this.id = id; + } + + 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; + } + + @XmlTransient + public List getUsuarioList() { + return usuarioList; + } + + public void setUsuarioList(List usuarioList) { + this.usuarioList = usuarioList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Rol)) { + return false; + } + Rol other = (Rol) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "hola.modelo.Rol[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/modelo/Tipo.java b/si-ejb/src/java/hola/modelo/Tipo.java new file mode 100644 index 0000000..b19567f --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Tipo.java @@ -0,0 +1,117 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package hola.modelo; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + * + * @author chore + */ +@Entity +@Table(name = "tipo", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Tipo.findAll", query = "SELECT t FROM Tipo t"), + @NamedQuery(name = "Tipo.findById", query = "SELECT t FROM Tipo t WHERE t.id = :id"), + @NamedQuery(name = "Tipo.findByNombre", query = "SELECT t FROM Tipo t WHERE t.nombre = :nombre"), + @NamedQuery(name = "Tipo.findByStatus", query = "SELECT t FROM Tipo t WHERE t.status = :status")}) +public class Tipo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(name = "id") + private Integer id; + @Size(max = 20) + @Column(name = "nombre") + private String nombre; + @Column(name = "status") + private Integer status; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoIdtipo") + private List productoList; + + public Tipo() { + } + + public Tipo(Integer id) { + this.id = id; + } + + 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 Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + @XmlTransient + public List getProductoList() { + return productoList; + } + + public void setProductoList(List productoList) { + this.productoList = productoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Tipo)) { + return false; + } + Tipo other = (Tipo) 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 "hola.modelo.Tipo[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/modelo/Usuario.java b/si-ejb/src/java/hola/modelo/Usuario.java new file mode 100644 index 0000000..f45e651 --- /dev/null +++ b/si-ejb/src/java/hola/modelo/Usuario.java @@ -0,0 +1,197 @@ +/* + * 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 hola.modelo; + +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.Size; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * @author chore + */ +@Entity +@Table(name = "usuario", catalog = "sistemadeinventario", schema = "") +@XmlRootElement +@NamedQueries({ + @NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u"), + @NamedQuery(name = "Usuario.findById", query = "SELECT u FROM Usuario u WHERE u.id = :id"), + @NamedQuery(name = "Usuario.findByNombre", query = "SELECT u FROM Usuario u WHERE u.nombre = :nombre"), + @NamedQuery(name = "Usuario.findBySexo", query = "SELECT u FROM Usuario u WHERE u.sexo = :sexo"), + @NamedQuery(name = "Usuario.findByTelefono", query = "SELECT u FROM Usuario u WHERE u.telefono = :telefono"), + @NamedQuery(name = "Usuario.findByCorreo", query = "SELECT u FROM Usuario u WHERE u.correo = :correo"), + @NamedQuery(name = "Usuario.findByDireccion", query = "SELECT u FROM Usuario u WHERE u.direccion = :direccion"), + @NamedQuery(name = "Usuario.findByStatus", query = "SELECT u FROM Usuario u WHERE u.status = :status"), + @NamedQuery(name = "Usuario.findByNpila", query = "SELECT u FROM Usuario u WHERE u.npila = :npila"), + @NamedQuery(name = "Usuario.findByUsername", query = "SELECT u FROM Usuario u WHERE u.username = :username")}) +public class Usuario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic(optional = false) + @Column(name = "id") + private Integer id; + @Size(max = 45) + @Column(name = "nombre") + private String nombre; + @Column(name = "sexo") + private Character sexo; + @Size(max = 10) + @Column(name = "telefono") + private String telefono; + @Size(max = 20) + @Column(name = "correo") + private String correo; + @Size(max = 40) + @Column(name = "direccion") + private String direccion; + @Column(name = "status") + private Integer status; + @Size(max = 15) + @Column(name = "npila") + private String npila; + @Size(max = 20) + @Column(name = "username") + private String username; + @JoinColumn(name = "estado_idestado", referencedColumnName = "id") + @ManyToOne(optional = false) + private Estado estadoIdestado; + @JoinColumn(name = "rol_idrol", referencedColumnName = "id") + @ManyToOne(optional = false) + private Rol rolIdrol; + + public Usuario() { + } + + public Usuario(Integer id) { + this.id = id; + } + + 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 Character getSexo() { + return sexo; + } + + public void setSexo(Character sexo) { + this.sexo = sexo; + } + + public String getTelefono() { + return telefono; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public String getCorreo() { + return correo; + } + + public void setCorreo(String correo) { + this.correo = correo; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getNpila() { + return npila; + } + + public void setNpila(String npila) { + this.npila = npila; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public Estado getEstadoIdestado() { + return estadoIdestado; + } + + public void setEstadoIdestado(Estado estadoIdestado) { + this.estadoIdestado = estadoIdestado; + } + + public Rol getRolIdrol() { + return rolIdrol; + } + + public void setRolIdrol(Rol rolIdrol) { + this.rolIdrol = rolIdrol; + } + + @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 Usuario)) { + return false; + } + Usuario other = (Usuario) 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 "hola.modelo.Usuario[ id=" + id + " ]"; + } + +} diff --git a/si-ejb/src/java/hola/msg/Mensaje.java b/si-ejb/src/java/hola/msg/Mensaje.java new file mode 100644 index 0000000..24a77bb --- /dev/null +++ b/si-ejb/src/java/hola/msg/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 hola.msg; + +/** + * + * @author chore + */ +public enum Mensaje { + SIN_ERROR, + CAMPOS_INCOMPLETOS, + DATOS_INCORRECTOS, + ELEMENTO_DUPLICADO, + N0_EXISTE, ERROR_INTERNO, NO_EXISTE, + +} diff --git a/si-war/build.xml b/si-war/build.xml new file mode 100644 index 0000000..d8b004b --- /dev/null +++ b/si-war/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project si-war. + + + diff --git a/si-war/nbproject/ant-deploy.xml b/si-war/nbproject/ant-deploy.xml new file mode 100644 index 0000000..fdc06d5 --- /dev/null +++ b/si-war/nbproject/ant-deploy.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/si-war/nbproject/build-impl.xml b/si-war/nbproject/build-impl.xml new file mode 100644 index 0000000..ad3bda4 --- /dev/null +++ b/si-war/nbproject/build-impl.xml @@ -0,0 +1,1465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set platform.home + Must set platform.bootcp + Must set platform.java + Must set platform.javac + + The J2SE Platform is not correctly set up. + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. + Either open the project in the IDE and setup the Platform with the same name or add it manually. + For example like this: + ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) + or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/si-war/nbproject/genfiles.properties b/si-war/nbproject/genfiles.properties new file mode 100644 index 0000000..4ccaf5c --- /dev/null +++ b/si-war/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=0499affd +build.xml.script.CRC32=3bf2a027 +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=0499affd +nbproject/build-impl.xml.script.CRC32=a23c42c9 +nbproject/build-impl.xml.stylesheet.CRC32=334708a0@1.96.0.1 diff --git a/si-war/nbproject/project.properties b/si-war/nbproject/project.properties new file mode 100644 index 0000000..f75899c --- /dev/null +++ b/si-war/nbproject/project.properties @@ -0,0 +1,94 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-7.0.classpath} +excludes= +file.reference.primefaces-12.0.0.jar=C:\\Users\\chore\\Downloads\\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.si-ejb.dist}:\ + ${file.reference.primefaces-12.0.0.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +persistence.xml.dir=${conf.dir} +platform.active=JDK_21 +project.si-ejb=../si-ejb +reference.si-ejb.dist=${project.si-ejb}/dist/si-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=si-war.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/si-war/nbproject/project.xml b/si-war/nbproject/project.xml new file mode 100644 index 0000000..d7a58a6 --- /dev/null +++ b/si-war/nbproject/project.xml @@ -0,0 +1,37 @@ + + + org.netbeans.modules.web.project + + + si-war + 1.6.5 + + + + ${reference.si-ejb.dist} + + + ${file.reference.primefaces-12.0.0.jar} + WEB-INF/lib + + + + + + + + + + + + + si-ejb + jar + + dist + clean + dist + + + + diff --git a/si-war/src/conf/MANIFEST.MF b/si-war/src/conf/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/si-war/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/si-war/src/java/hola/vista/DemoBeanDepartamento.java b/si-war/src/java/hola/vista/DemoBeanDepartamento.java new file mode 100644 index 0000000..93df6c3 --- /dev/null +++ b/si-war/src/java/hola/vista/DemoBeanDepartamento.java @@ -0,0 +1,115 @@ +/* + * 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 hola.vista; + +import hola.BL.DepartamentoBLLocal; +import hola.modelo.Departamento; +import hola.modelo.Producto; +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import org.primefaces.util.LangUtils; + +/** + * + * @author eduar + */ +@Named(value = "demoBeanDepartamento") +@SessionScoped +public class DemoBeanDepartamento implements Serializable { + @EJB + private DepartamentoBLLocal departamentoBL; + /** + * Creates a new instance of DemoBeanDepartamento + */ + public DemoBeanDepartamento() { + } + + private Departamento departamento = new Departamento(); + private String titulo; + private boolean nuevo; + + private List filteredCustomers3; + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } +//BUSCADOR DE CADA CAMPO + Departamento customer = (Departamento) value; + return customer.getNombre().toLowerCase().contains(filterText) + || customer.getAnaquel().toLowerCase().contains(filterText); + } + + + + public String agregarDepartamento() { + + departamento.setStatus(1); + departamentoBL.agregar(departamento); + return "Departamento.xhtml"; + } + + public List getDepartamentos() { + return departamentoBL.buscarValidos(true); + } + + public Departamento getDepartamento() { + return departamento; + } + + public void setDepartamento(Departamento departamento) { + this.departamento = departamento; + } + + public void prepararEditar(Departamento departamento) { + nuevo = false; + titulo = "Editar Departamento"; + this.departamento = departamento; + + } + + public String getTitulo() { + return titulo; + } + + public boolean isNuevo() { + return nuevo; + } + + public void prepararNuevo() { + nuevo = true; + titulo = "Agregar departameto"; + departamento = new Departamento(); + } + + public void editarDepartamento() { + + departamentoBL.editar(departamento); + + } + + public void prepararEliminar(Departamento departamento) { + this.departamento = departamento; + } + + public void eliminarDepartamento() { + departamentoBL.eliminarId(departamento); + } + + +} diff --git a/si-war/src/java/hola/vista/DemoBeanMarca.java b/si-war/src/java/hola/vista/DemoBeanMarca.java new file mode 100644 index 0000000..175fca1 --- /dev/null +++ b/si-war/src/java/hola/vista/DemoBeanMarca.java @@ -0,0 +1,99 @@ +/* + * 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 hola.vista; + +import hola.BL.MarcaBLLocal; +import hola.modelo.Marca; +import hola.msg.Mensaje; +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import java.util.List; +import javax.ejb.EJB; + +/** + * + * @author Josue + */ +@Named(value = "demoBeanMarca") +@SessionScoped +public class DemoBeanMarca implements Serializable { + + @EJB + private MarcaBLLocal marcaBL; + + /** + * Creates a new instance of DemoBeanMarca + */ + public DemoBeanMarca() { + } + + private Marca marca = new Marca(); + private String titulo; + private boolean nuevo; + + public String agregarMarca() { + + marca.setStatus(1); + Mensaje m = marcaBL.agregar(marca); + switch (m) { + case ELEMENTO_DUPLICADO: + + return null; + case SIN_ERROR: + + return "Marca.xhtml"; + + default: + return null; + + } + + } + + public List getMarcas() { + return marcaBL.buscarValidos(true); + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public void prepararEditar(Marca marca) { + nuevo = false; + titulo = "Editando marca"; + this.marca = marca; + + } + + public boolean isNuevo() { + return nuevo; + } + + public void preparar() { + nuevo = true; + titulo = "Agregando marca"; + marca = new Marca(); + } + + public void editarMarca() { + + marcaBL.editar(marca); + + } + + public void prepararEliminar(Marca marca) { + this.marca = marca; + } + + public void eliminarTipo() { + marcaBL.eliminarId(marca); + } + +} diff --git a/si-war/src/java/hola/vista/DemoBeanProducto.java b/si-war/src/java/hola/vista/DemoBeanProducto.java new file mode 100644 index 0000000..84a263e --- /dev/null +++ b/si-war/src/java/hola/vista/DemoBeanProducto.java @@ -0,0 +1,121 @@ +/* + * 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 hola.vista; + +import hola.BL.ProductoBLLocal; +import hola.modelo.Producto; +import hola.modelo.Tipo; +import hola.modelo.Usuario; +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import org.primefaces.util.LangUtils; + +/** + * + * @author eduar + */ +@Named(value = "demoBeanProducto") +@SessionScoped +public class DemoBeanProducto implements Serializable { + + @EJB + private ProductoBLLocal productoBL; + + /** + * Creates a new instance of producto + */ + public DemoBeanProducto() { + } + + private Producto producto = new Producto(); + private String titulo; + private boolean nuevo; + + private List filteredCustomers3; + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } +//BUSCADOR DE CADA CAMPO + Producto customer = (Producto) value; + return customer.getNombre().toLowerCase().contains(filterText) + || customer.getCantidad().toLowerCase().contains(filterText) + || customer.getPrecio()<=0 + || customer.getCodigoBarras().toLowerCase().contains(filterText) + || customer.getMedida()<=0 + || customer.getLote().toLowerCase().contains(filterText); + } + + public String agregarProducto() { + + producto.setStatus(1); + productoBL.agregar(producto); + return "Producto.xhtml"; + } + + public List getProductos() { + return productoBL.buscarValidos(true); + } + +// public Producto getProducto() { +// return DemoBeanProducto; +// } + public Producto getProducto() { + return producto; + } + + public void setProducto(Producto producto) { + this.producto = producto; + } + + public void prepararEditar(Producto producto) { + nuevo = false; + titulo = "Editar de Producto"; + this.producto = producto; + + } + + public String getTitulo() { + return titulo; + } + + public boolean isNuevo() { + return nuevo; + } + + public void prepararNuevo() { + nuevo = true; + titulo = "Agregar Producto"; + producto = new Producto(); + } + + public void editarProducto() { + + productoBL.editar(producto); + + } + + public void prepararEliminar(Producto producto) { + this.producto = producto; + } + + public void eliminarProducto() { + productoBL.eliminarId(producto); + } +} diff --git a/si-war/src/java/hola/vista/DemoBeanProvedor.java b/si-war/src/java/hola/vista/DemoBeanProvedor.java new file mode 100644 index 0000000..5cbce57 --- /dev/null +++ b/si-war/src/java/hola/vista/DemoBeanProvedor.java @@ -0,0 +1,89 @@ +package hola.vista; + +import hola.BL.ProvedorBLLocal; +import hola.modelo.Provedor; + +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import javax.ejb.EJB; +import java.io.Serializable; +import java.util.List; + +@Named(value = "demoBeanProvedor") +@SessionScoped +public class DemoBeanProvedor implements Serializable { + + @EJB + private ProvedorBLLocal provedorBLLocal; + + private Provedor provedor = new Provedor(); // Proveedor actual en el formulario + private String titulo; // Título para mostrar en el formulario + private boolean nuevo; // Indicador de nuevo provedor o edición + + // Constructor por defecto + public DemoBeanProvedor() { + } + + // Método para agregar un nuevo provedor + public String agregarProveedor() { + // Configura el provedor con los datos del formulario + provedor.setStatus(1); // Estado activo por defecto (puedes cambiar esto según tu lógica) + provedorBLLocal.agregar(provedor); // Llama al método de la capa de negocio para agregar el provedor + limpiarFormulario(); // Limpia el formulario después de agregar + return "Provedor.xhtml"; // Navega de regreso a la página de proveedores + } + + // Método para obtener la lista de proveedores válidos + public List getProvedores() { + return provedorBLLocal.buscarValidos(true); // Busca y devuelve la lista de proveedores activos + } + + // Otros métodos de acceso y manipulación de proveedores... + + // Métodos para limpiar y preparar el formulario + private void limpiarFormulario() { + provedor = new Provedor(); // Crea un nuevo objeto provedor para limpiar el formulario + } + + // Getters y setters para los campos del formulario y propiedades del bean + public Provedor getProvedor() { + return provedor; + } + + public void setProvedor(Provedor provedor) { + this.provedor = provedor; + } + + public String getTitulo() { + return titulo; + } + + public boolean isNuevo() { + return nuevo; + } + + public void prepararNuevo() { + nuevo = true; + titulo = "Agregando provedor"; + limpiarFormulario(); // Limpia el formulario para agregar un nuevo provedor + } + + public void prepararEditar(Provedor provedor) { + nuevo = false; + titulo = "Editando provedor"; + this.provedor = provedor; // Establece el provedor seleccionado para editar + } + + public void prepararEliminar(Provedor provedor) { + this.provedor = provedor; + } + + public void editarProvedor() { + provedorBLLocal.editar(provedor); // Llama al método de la capa de negocio para editar el provedor + limpiarFormulario(); // Limpia el formulario después de editar + } + + public void eliminarProvedor() { + provedorBLLocal.eliminarId(provedor); // Llama al método de la capa de negocio para eliminar el provedor + } +} diff --git a/si-war/src/java/hola/vista/DemoBeanTipo.java b/si-war/src/java/hola/vista/DemoBeanTipo.java new file mode 100644 index 0000000..97164c1 --- /dev/null +++ b/si-war/src/java/hola/vista/DemoBeanTipo.java @@ -0,0 +1,114 @@ +/* + * 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 hola.vista; + +import hola.BL.TipoBLLocal; +import hola.modelo.Tipo; +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import static java.lang.Integer.getInteger; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import org.primefaces.util.LangUtils; + +/** + * + * @author chore + */ +@Named(value = "demoBeanTipo") +@SessionScoped + +public class DemoBeanTipo implements Serializable { + + @EJB + private TipoBLLocal tipoBL; + + /** + * Creates a new instance of DemoBeanTipo + */ + public DemoBeanTipo() { + } + + private Tipo tipo = new Tipo(); + private String titulo; + private boolean nuevo; + + private List filteredCustomers3; + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } + + Tipo customer = (Tipo) value; + return customer.getNombre().toLowerCase().contains(filterText); + } + + public String agregarTipo() { + + tipo.setStatus(1); + tipoBL.agregar(tipo); + return "Tipo.xhtml"; + } + + public List getTipos() { + return tipoBL.buscarValidos(true); + } + + public Tipo getTipo() { + return tipo; + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public void prepararEditar(Tipo tipo) { + nuevo = false; + titulo = "Editar Tipo"; + this.tipo = tipo; + + } + + public String getTitulo() { + return titulo; + } + + public boolean isNuevo() { + return nuevo; + } + + public void preparar() { + nuevo = true; + titulo = "Agregar Tipo"; + tipo = new Tipo(); + } + + public void editarTipo() { + + tipoBL.editar(tipo); + + } + + public void prepararEliminar(Tipo tipo) { + this.tipo = tipo; + } + + public void eliminarTipo() { + tipoBL.eliminarId(tipo); + } + +} diff --git a/si-war/src/java/hola/vista/DemoBeanUsuario.java b/si-war/src/java/hola/vista/DemoBeanUsuario.java new file mode 100644 index 0000000..46ea5db --- /dev/null +++ b/si-war/src/java/hola/vista/DemoBeanUsuario.java @@ -0,0 +1,130 @@ +/* + * 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 hola.vista; + +import hola.BL.UsuarioBLLocal; +import hola.modelo.Usuario; +import hola.msg.Mensaje; +import javax.inject.Named; +import javax.enterprise.context.SessionScoped; +import java.io.Serializable; +import java.util.List; +import java.util.Locale; +import javax.ejb.EJB; +import org.primefaces.util.LangUtils; + +/** + * + * @author chore + */ +@Named(value = "demoBeanUsuario") +@SessionScoped +public class DemoBeanUsuario implements Serializable { + + @EJB + private UsuarioBLLocal usuarioBL; + /** + * Creates a new instance of DemoBeanUsuario + */ + public DemoBeanUsuario() { + } + + private Usuario usuario = new Usuario(); + private String titulo; + private boolean nuevo; + + private List filteredCustomers3; + + public List getFilteredCustomers3() { + return filteredCustomers3; + } + + public void setFilteredCustomers3(List filteredCustomers3) { + this.filteredCustomers3 = filteredCustomers3; + } + + public boolean globalFilterFunction(Object value, Object filter, Locale locale) { + String filterText = (filter == null) ? null : filter.toString().trim().toLowerCase(); + if (LangUtils.isBlank(filterText)) { + return true; + } +//BUSCADOR DE CADA CAMPO + Usuario customer = (Usuario) value; + return customer.getNombre().toLowerCase().contains(filterText) + || customer.getTelefono().toLowerCase().contains(filterText) + || customer.getCorreo().toLowerCase().contains(filterText) + || customer.getDireccion().toLowerCase().contains(filterText); + } + + public String agregarUsuario() { + + usuario.setStatus(1); + // limpiarFormulario(); + Mensaje mensaje = usuarioBL.agregar(usuario); + + switch (mensaje) { + case SIN_ERROR: + usuario = new Usuario(); + return "Usuario.xhtml";//"productoLista?faces-redirect=true"; // Redirecciona a la lista de productos + case ELEMENTO_DUPLICADO: + return null; + case CAMPOS_INCOMPLETOS: + return null; + case DATOS_INCORRECTOS: + return null; + default: + return null; + } + + } + + public List getUsuarios() { + return usuarioBL.buscarValidos(true); + } + + public Usuario getTUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public void prepararEditar(Usuario usuario) { + nuevo = false; + titulo = "Editar usuario"; + this.usuario = usuario; + + } + + public String getTitulo() { + return titulo; + } + + public boolean isNuevo() { + return nuevo; + } + + public void preparar() { + nuevo = true; + titulo = "Agregar Usuario"; + usuario = new Usuario(); + } + + public void editarUsuario() { + + usuarioBL.editar(usuario); + + } + + public void prepararEliminar(Usuario usuario) { + this.usuario = usuario; + } + + public void eliminaUsuario() { + usuarioBL.eliminarId(usuario); + } + +} diff --git a/si-war/src/java/hola/vista/SelectOneButtonView.java b/si-war/src/java/hola/vista/SelectOneButtonView.java new file mode 100644 index 0000000..039d6fb --- /dev/null +++ b/si-war/src/java/hola/vista/SelectOneButtonView.java @@ -0,0 +1,38 @@ +/* + * 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 hola.vista; + +import java.io.IOException; +import javax.annotation.ManagedBean; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +@ManagedBean +@ViewScoped +public class SelectOneButtonView { + + private String option; + + public String getOption() { + return option; + } + + public void setOption(String option) { + this.option = option; + } + + public void navigateToPage() { + if (option != null) { + try { + FacesContext.getCurrentInstance().getExternalContext().redirect(option); + } catch (IOException e) { + FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Error al redireccionar a la página."); + FacesContext.getCurrentInstance().addMessage(null, message); + e.printStackTrace(); + } + } + } +} \ No newline at end of file diff --git a/si-war/src/java/hola/vista/SelectOneMenuConverter.java b/si-war/src/java/hola/vista/SelectOneMenuConverter.java new file mode 100644 index 0000000..9b1ff11 --- /dev/null +++ b/si-war/src/java/hola/vista/SelectOneMenuConverter.java @@ -0,0 +1,90 @@ +/* + * 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 hola.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; + +/** + * + * @author eduar + */ +@FacesConverter("selectOneMenuConverter") +public class SelectOneMenuConverter implements Converter { + + @Override + public Object getAsObject(final FacesContext arg0, final UIComponent arg1, final String objectString) { + if (objectString == null) { + return null; + } + + return fromSelect(arg1, objectString); + } + + /** + * Serialize. + * + * @param object + * the object + * @return the string + */ + private String serialize(final Object object) { + if (object == null) { + return null; + } + return object.getClass() + "@" + object.hashCode(); + } + + /** + * From select. + * + * @param currentcomponent + * the currentcomponent + * @param objectString + * the object string + * @return the object + */ + private Object fromSelect(final UIComponent currentcomponent, final String objectString) { + + if (currentcomponent.getClass() == UISelectItem.class) { + final UISelectItem item = (UISelectItem) currentcomponent; + final Object value = item.getValue(); + if (objectString.equals(serialize(value))) { + return value; + } + } + + if (currentcomponent.getClass() == UISelectItems.class) { + final UISelectItems items = (UISelectItems) currentcomponent; + final List elements = (List) items.getValue(); + for (final Object element : elements) { + if (objectString.equals(serialize(element))) { + return element; + } + } + } + + + if (!currentcomponent.getChildren().isEmpty()) { + for (final UIComponent component : currentcomponent.getChildren()) { + final Object result = fromSelect(component, objectString); + if (result != null) { + return result; + } + } + } + return null; + } + + @Override + public String getAsString(final FacesContext arg0, final UIComponent arg1, final Object object) { + return serialize(object); + } +} diff --git a/si-war/web/Departamento.xhtml b/si-war/web/Departamento.xhtml new file mode 100644 index 0000000..d0c4bed --- /dev/null +++ b/si-war/web/Departamento.xhtml @@ -0,0 +1,121 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + +

+ + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + +
+
+ + diff --git a/si-war/web/DepartamentoCrear.xhtml b/si-war/web/DepartamentoCrear.xhtml new file mode 100644 index 0000000..2831c9f --- /dev/null +++ b/si-war/web/DepartamentoCrear.xhtml @@ -0,0 +1,86 @@ + + + + + +
+ + + + + Sistemas de Inventario + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ + \ No newline at end of file diff --git a/si-war/web/DepartamentoEliminar.xhtml b/si-war/web/DepartamentoEliminar.xhtml new file mode 100644 index 0000000..702bb4f --- /dev/null +++ b/si-war/web/DepartamentoEliminar.xhtml @@ -0,0 +1,65 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + +
+
+ + + +
+ + + + + +
+
+ + diff --git a/si-war/web/Marca.xhtml b/si-war/web/Marca.xhtml new file mode 100644 index 0000000..ede51de --- /dev/null +++ b/si-war/web/Marca.xhtml @@ -0,0 +1,120 @@ + + + + + + + Marca + + + +
+ + + + + SISTEMA DE INVENTARIO + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + +
+ +
+
+ + + + + +

+ + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + +
+
+ + diff --git a/si-war/web/MarcaCrear.xhtml b/si-war/web/MarcaCrear.xhtml new file mode 100644 index 0000000..52e9d7c --- /dev/null +++ b/si-war/web/MarcaCrear.xhtml @@ -0,0 +1,80 @@ + + + + + +
+ + + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + +
+
+ +
+ + + + + +
+
+ + diff --git a/si-war/web/MarcaEliminar.xhtml b/si-war/web/MarcaEliminar.xhtml new file mode 100644 index 0000000..ac90e2b --- /dev/null +++ b/si-war/web/MarcaEliminar.xhtml @@ -0,0 +1,59 @@ + + + + + + + + + + top + + + + left + + + + right + + + + + + + +

+ + + + + + + + + + +
+
+ +
+ + + bottom + + +
+ + + diff --git a/si-war/web/Menu.xhtml b/si-war/web/Menu.xhtml new file mode 100644 index 0000000..a6ead46 --- /dev/null +++ b/si-war/web/Menu.xhtml @@ -0,0 +1,50 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+ + diff --git a/si-war/web/Producto.xhtml b/si-war/web/Producto.xhtml new file mode 100644 index 0000000..ac72343 --- /dev/null +++ b/si-war/web/Producto.xhtml @@ -0,0 +1,164 @@ + + + + + +
+ + + + Sistemas de Inventario + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +

+ + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + +
+
+ + \ No newline at end of file diff --git a/si-war/web/ProductoCrear.xhtml b/si-war/web/ProductoCrear.xhtml new file mode 100644 index 0000000..0b15305 --- /dev/null +++ b/si-war/web/ProductoCrear.xhtml @@ -0,0 +1,164 @@ + + + + + +
+ + + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +
+ + + + + +
+
+ + diff --git a/si-war/web/ProductoEliminar.xhtml b/si-war/web/ProductoEliminar.xhtml new file mode 100644 index 0000000..ff45244 --- /dev/null +++ b/si-war/web/ProductoEliminar.xhtml @@ -0,0 +1,85 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + +
+
+ + diff --git a/si-war/web/Provedor.xhtml b/si-war/web/Provedor.xhtml new file mode 100644 index 0000000..d48a6c3 --- /dev/null +++ b/si-war/web/Provedor.xhtml @@ -0,0 +1,96 @@ + + + + + + SISTEMA DE INVENTARIO + + + +
+ + + + SISTEMA DE INVENTARIO + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +

Proveedores

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
+ + diff --git a/si-war/web/ProvedorCrear.xhtml b/si-war/web/ProvedorCrear.xhtml new file mode 100644 index 0000000..8f0b0fa --- /dev/null +++ b/si-war/web/ProvedorCrear.xhtml @@ -0,0 +1,123 @@ + + + + + + Crear Proveedor + + + + +
+ + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+
+ diff --git a/si-war/web/ProvedorEliminar.xhtml b/si-war/web/ProvedorEliminar.xhtml new file mode 100644 index 0000000..b2a54f2 --- /dev/null +++ b/si-war/web/ProvedorEliminar.xhtml @@ -0,0 +1,82 @@ + + + + + + Eliminar Provedor + + + + +
+ + + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + + +
+
+ + + diff --git a/si-war/web/Tipo.xhtml b/si-war/web/Tipo.xhtml new file mode 100644 index 0000000..ac3b3f6 --- /dev/null +++ b/si-war/web/Tipo.xhtml @@ -0,0 +1,143 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+ + + + +
+
+ + + + + +

+ + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + +
+ +
+ + diff --git a/si-war/web/TipoCrear.xhtml b/si-war/web/TipoCrear.xhtml new file mode 100644 index 0000000..782af13 --- /dev/null +++ b/si-war/web/TipoCrear.xhtml @@ -0,0 +1,83 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + +
+
+ + + diff --git a/si-war/web/TipoEliminar.xhtml b/si-war/web/TipoEliminar.xhtml new file mode 100644 index 0000000..834f88a --- /dev/null +++ b/si-war/web/TipoEliminar.xhtml @@ -0,0 +1,57 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + +

+ + + + + + + + +
+
+ +
+ + + +
+
+ + diff --git a/si-war/web/Usuario.xhtml b/si-war/web/Usuario.xhtml new file mode 100644 index 0000000..7cfacff --- /dev/null +++ b/si-war/web/Usuario.xhtml @@ -0,0 +1,165 @@ + + + + + +
+ + + + Sistema de inventario + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +

+ + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + +
+ +
+ + diff --git a/si-war/web/UsuarioCrear.xhtml b/si-war/web/UsuarioCrear.xhtml new file mode 100644 index 0000000..155bd0b --- /dev/null +++ b/si-war/web/UsuarioCrear.xhtml @@ -0,0 +1,129 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + +
+
+ + diff --git a/si-war/web/UsuarioEliminar.xhtml b/si-war/web/UsuarioEliminar.xhtml new file mode 100644 index 0000000..81e9416 --- /dev/null +++ b/si-war/web/UsuarioEliminar.xhtml @@ -0,0 +1,69 @@ + + + + + +
+ + + + SISTEMA DE INVENTARIO + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + +
+
+ + diff --git a/si-war/web/WEB-INF/glassfish-web.xml b/si-war/web/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..584a477 --- /dev/null +++ b/si-war/web/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/si-war/web/WEB-INF/web.xml b/si-war/web/WEB-INF/web.xml new file mode 100644 index 0000000..0b9fa3c --- /dev/null +++ b/si-war/web/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/Menu.xhtml + + diff --git a/si-war/web/index.html b/si-war/web/index.html new file mode 100644 index 0000000..4cea0a0 --- /dev/null +++ b/si-war/web/index.html @@ -0,0 +1,15 @@ + + + + + TODO supply a title + + + + +
TODO write content
+ + diff --git a/si-war/web/resources/css/cssLayout.css b/si-war/web/resources/css/cssLayout.css new file mode 100644 index 0000000..e754a35 --- /dev/null +++ b/si-war/web/resources/css/cssLayout.css @@ -0,0 +1,35 @@ + +#top { + position: relative; + background-color: #043959; + color: white; + padding: 25px; + margin: 0px 0px 20px 0px; +} + + +.left_content { + background-color: #dddddd; + padding: 2px; + margin-left: 70px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 0px 0px 0px; +} + +#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; +} + + diff --git a/si-war/web/resources/css/default.css b/si-war/web/resources/css/default.css new file mode 100644 index 0000000..8cf56de --- /dev/null +++ b/si-war/web/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #f0f6fc; + font-size: 20px; + font-family: Verdana, "Verdana CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Verdana, "Verdana CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 20px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #000066; +} + +a:link, a:visited { + color: #f0f6fc; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #f0f6fc; + font-weight : bold; + text-decoration : underline; +} diff --git a/si-war/web/resources/css/defaultDepartamento.css b/si-war/web/resources/css/defaultDepartamento.css new file mode 100644 index 0000000..e31630b --- /dev/null +++ b/si-war/web/resources/css/defaultDepartamento.css @@ -0,0 +1,30 @@ + +body { + background-color: #ffffff; + font-size: 20px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 25px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/si-war/web/resources/css/defaultMenu.css b/si-war/web/resources/css/defaultMenu.css new file mode 100644 index 0000000..2c45f0f --- /dev/null +++ b/si-war/web/resources/css/defaultMenu.css @@ -0,0 +1,17 @@ +.bottomJ { + padding: 12px 24px; + font-size: 18px; + font-weight: bold; + color: #001f3f; + background-color: #fff; + border: 2px solid #9ec2e6; + border-radius: 8px; + cursor: pointer; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease; +} + +.bottomJ:hover { + transform: translateY(2px); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); +} \ No newline at end of file diff --git a/si-war/web/resources/css/defaultProvedor.css b/si-war/web/resources/css/defaultProvedor.css new file mode 100644 index 0000000..ddde07c --- /dev/null +++ b/si-war/web/resources/css/defaultProvedor.css @@ -0,0 +1,36 @@ +/* +Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/css.css to edit this template +*/ +/* + Created on : 17 abr 2024, 01:59:43 + Author : Josue +*/ + +body { + font-family: arial, helvetica; /* Utiliza las fuentes Arial o Helvetica */ + background: #e8e8e8; /* Establece el color de fondo del cuerpo */ + margin: 0; /* Elimina el margen predeterminado del cuerpo */ +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/si-war/web/resources/css/estiloProvedor.css b/si-war/web/resources/css/estiloProvedor.css new file mode 100644 index 0000000..f660320 --- /dev/null +++ b/si-war/web/resources/css/estiloProvedor.css @@ -0,0 +1,198 @@ +/* +Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/css.css to edit this template +*/ +/* + Created on : 16 abr 2024, 22:49:18 + Author : Josue +*/ + +/* Establecer la fuente y el fondo para el cuerpo del documento */ + +body { + font-family: arial, helvetica; /* Utiliza las fuentes Arial o Helvetica */ + background: #e8e8e8; /* Establece el color de fondo del cuerpo */ + margin: 0; /* Elimina el margen predeterminado del cuerpo */ +} + +/* Estilo para la lista en la parte izquierda */ +.left { + list-style: none; /* Elimina los marcadores de lista */ + padding: 0; /* Elimina el relleno interno de la lista */ + background: #092327; /* Establece el color de fondo de la lista */ + color: white; /* Establece el color del texto en la lista */ + width: 130px; /* Ancho fijo para la lista */ + margin: auto; /* Centra la lista horizontalmente */ +} + +/* Estilo para cada elemento de la lista */ +.left li { + text-align: center; /* Centra el texto dentro de cada elemento de la lista */ + padding: 5px 0; /* Agrega espacio interno vertical (arriba y abajo) */ + border-bottom: 1px solid white; /* Agrega borde inferior a cada elemento */ +} + +/* Estilo para el último elemento de la lista (sin borde inferior) */ +.left li:last-child { + border-bottom: none; /* Elimina el borde inferior del último elemento */ +} + +/* Estilo para los enlaces dentro de cada elemento de la lista */ +.left li a { + text-decoration: none; /* Elimina el subrayado predeterminado de los enlaces */ + color: white; /* Establece el color del texto de los enlaces */ + display: block; /* Hace que los enlaces ocupen todo el ancho del elemento li */ + padding: 8px; /* Agrega espacio interno alrededor del texto de los enlaces */ + font-size: 12px; /* Tamaño del texto */ +} +.left li a:hover{ + background: #ef8354 + +} + +.options-buttons { + display: flex; + justify-content: flex-end; + align-items: center; + margin-top: 20px; /* Espacio superior para separar del contenido */ +} + +/* Estilos para los botones dentro de options-buttons */ +.options-buttons .p-commandbutton { + margin-left: 1px; /* Espacio entre botones */ + padding: 2px 2px; /* Ajusta el padding para controlar el tamaño del botón */ + font-size: 12px; /* Tamaño de la fuente del texto en el botón */ + font-weight: bold; /* Texto en negrita */ + background-color: #17a2b8; /* Color de fondo del botón */ + color: #fff; /* Color del texto en el botón */ + border: none; /* Elimina el borde del botón */ + border-radius: 5px; /* Añade esquinas redondeadas al botón */ + cursor: pointer; /* Cambia el cursor al pasar sobre el botón */ + transition: background-color 0.3s ease; /* Transición suave para cambios en el color de fondo */ +} + +/* Estilos para el botón al pasar el cursor sobre él */ +.options-buttons .p-commandbutton:hover { + background-color: #0a7a8f; /* Cambia el color de fondo al pasar el cursor sobre el botón */ +} + +/* Estilo para la tabla de proveedores */ +.dataTable { + width: 100%; /* Ancho completo de la tabla */ + border-collapse: collapse; /* Fusionar bordes de celdas */ +} + +/* Estilo para todas las celdas de la tabla */ +.dataTable td, .dataTable th { + padding: 12px; /* Ajusta el espacio interno de las celdas */ + border: 1px solid #ddd; /* Borde delgada alrededor de las celdas */ +} + +/* Estilo para el encabezado de la tabla */ +.dataTable th { + background-color: #f2f2f2; /* Color de fondo para el encabezado */ + text-align: left; /* Alineación del texto en el encabezado */ +} + +/* Estilo para filas impares (alternar color de fondo) */ +.dataTable tr:nth-child(odd) { + background-color: #f9f9f9; /* Color de fondo para filas impares */ +} + +/* Estilo para las opciones en la última columna de la tabla */ +.dataTable .options-buttons { + display: flex; + justify-content: space-between; /* Distribuye uniformemente los botones */ +} + +/* Estilo para los botones en la columna de opciones */ +.dataTable .options-buttons .p-commandbutton { + margin-right: 10px; /* Margen derecho entre los botones */ +} + + +.bottomJ { + padding: 12px 24px; + font-size: 18px; + font-weight: bold; + color: #001f3f; + background-color: #fff; + border: 2px solid #9ec2e6; + border-radius: 8px; + cursor: pointer; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease; +} + +.bottomJ:hover { + transform: translateY(2px); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); +} + + /* Estilos para los botones dentro de la columna */ + .opcion .ui-button { + padding: 2px 8px; + font-size: 14px; + font-weight: bold; + cursor: pointer; + transition: transform 0.3s ease; + text-decoration: none; /* Para quitar el subrayado de los botones */ + } + +/* Estilo para el botón "Editar" + .opcioned { + color: #3366FF; + border: 2px solid #3366FF; + background-color: #fff; + } + + Estilo para el botón "Eliminar" + .opcione { + color: #990000; + border: 2px solid #FF0000; + background-color: #fff; + } + + Estilos adicionales al hacer hover sobre los botones + .opcion .ui-button:hover { + transform: translateY(-2px); Efecto de levantamiento + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); Sombra suave + }*/ + + /* Estilo para los botones de edición */ + .optioned { + padding: 2px 8px; + font-size: 14px; + font-weight: bold; + color: #3366FF; + background-color: #fff; + border: 2px solid #3366FF; + border-radius: 8px; + cursor: pointer; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease; + text-decoration: none; /* Para quitar el subrayado de los botones */ + } + + /* Estilo para los botones de eliminación */ + .optione { + padding: 2px 8px; + font-size: 14px; + font-weight: bold; + color: #990000; + background-color: #fff; + border: 2px solid #FF0000; + border-radius: 8px; + cursor: pointer; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + transition: transform 0.3s ease; + text-decoration: none; /* Para quitar el subrayado de los botones */ + } + + /* Estilos adicionales al hacer hover sobre los botones */ + .optioned:hover, + .optione:hover { + transform: translateY(-2px); /* Efecto de levantamiento */ + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Sombra suave */ + } + diff --git a/si-war/web/resources/css/layoutDepartamento.css b/si-war/web/resources/css/layoutDepartamento.css new file mode 100644 index 0000000..b15a961 --- /dev/null +++ b/si-war/web/resources/css/layoutDepartamento.css @@ -0,0 +1,59 @@ + +#top { + position: relative; + background-color: #000066; + color: white; + padding: 40px; + margin: 0px 0px 20px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} diff --git a/si-war/web/resources/css/layoutProvedor.css b/si-war/web/resources/css/layoutProvedor.css new file mode 100644 index 0000000..4545bd8 --- /dev/null +++ b/si-war/web/resources/css/layoutProvedor.css @@ -0,0 +1,62 @@ +/* +Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/css.css to edit this template +*/ +/* + Created on : 17 abr 2024, 00:04:39 + Author : Josue +*/ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + + +#left { + float: left; + background-color: #FFFFFF; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #FFFFFF; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + diff --git a/si-war/web/template/PlantillaProvedor.xhtml b/si-war/web/template/PlantillaProvedor.xhtml new file mode 100644 index 0000000..c0f24da --- /dev/null +++ b/si-war/web/template/PlantillaProvedor.xhtml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + Facelets Template + + + + +
+ Top +
+ + +
+ +
+ Content +
+
+ + + +
+ + \ No newline at end of file diff --git a/si-war/web/template/Principal.xhtml b/si-war/web/template/Principal.xhtml new file mode 100644 index 0000000..4082202 --- /dev/null +++ b/si-war/web/template/Principal.xhtml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + Facelets Template + + + + +
+ Top +
+
+
+ Left +
+
+ +
+ Content +
+
+
+
+ Bottom +
+ +
+ + diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +