diff --git a/.classpath b/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..67e152c64e58bd31cf296a06194c6395d644214c --- /dev/null +++ b/.classpath @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"> + <attributes> + <attribute name="module" value="true"/> + </attributes> + </classpathentry> + <classpathentry combineaccessrules="false" kind="src" path="/practico1-data"/> + <classpathentry combineaccessrules="false" kind="src" path="/practico1-ejb"/> + <classpathentry combineaccessrules="false" kind="src" path="/practico1-web"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/.project b/.project new file mode 100644 index 0000000000000000000000000000000000000000..343ec87615d165597c9de1a33721e17dd0f2b2ad --- /dev/null +++ b/.project @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>practico1</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..99f26c0203a7844de00dbfc56e6a35d8ed3c022c --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..1e0cb16bbc76c98cc42fff6b95cc023b7eb74830 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=21 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=21 diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100644 index 0000000000000000000000000000000000000000..b196c64a3418b865f0476d2e21d11eae3dd4b2da --- /dev/null +++ b/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f897a7f1cb2389f85fe6381425d29f0a9866fb65 --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000000000000000000000000000000000000..c1a8d078bd887aff8c61cfc9dfbae3a677a4092c --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <installed facet="java" version="21"/> +</faceted-project> diff --git a/.settings/org.hibernate.eclipse.console.prefs b/.settings/org.hibernate.eclipse.console.prefs new file mode 100644 index 0000000000000000000000000000000000000000..21fefffa08128e5498aad2a16d7f2b4d0d8567b4 --- /dev/null +++ b/.settings/org.hibernate.eclipse.console.prefs @@ -0,0 +1,3 @@ +default.configuration= +eclipse.preferences.version=1 +hibernate3.enabled=false diff --git a/README.txt b/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..d46436305d86572f9f78d972e22f9678a9efd9ec --- /dev/null +++ b/README.txt @@ -0,0 +1,59 @@ +This project was created from the archetype "wildfly-jakartaee-ear-archetype". + +To deploy it: +Run the maven goals "install wildfly:deploy" + +To undeploy it: +Run the maven goals "wildfly:undeploy" + +========================== + +DataSource: +This sample includes a "persistence.xml" file in the EJB project. This file defines +a persistence unit "practico1PersistenceUnit" which uses the JakartaEE default database. + +In production environment, you should define a database in WildFly config and point to this database +in "persistence.xml". + +If you don't use entity beans, you can delete "persistence.xml". +========================== + +JSF: +The web application is prepared for JSF 4.0 by bundling an empty "faces-config.xml" in "src/main/webapp/WEB-INF". +In case you don't want to use JSF, simply delete this file and "src/main/webapp/beans.xml". +========================== + +Testing: +This sample is prepared for running JUnit5 unit tests with the Arquillian framework. + +The configuration can be found in "practico1/pom.xml": + +Three profiles are defined: +-"default": no integration tests are executed. +-"arq-remote": you have to start a WildFly server on your machine. The tests are executed by deploying + the application to this server. + Here the "maven-failsafe-plugin" is enabled so that integration tests can be run. + Run maven with these arguments: "clean verify -Parq-remote" +-"arq-managed": this requires the environment variable "JBOSS_HOME" to be set: + The server found in this path is started and the tests are executed by deploying the application to this server. + Instead of using this environment variable, you can also define the path in "arquillian.xml". + Here the "maven-failsafe-plugin" is enabled so that integration tests can be run. + Run maven with these arguments: "clean verify -Parq-managed" + +The Arquillian test runner is configured with the file "src/test/resources/arquillian.xml" +(duplicated in EJB and WEB project, depending where your tests are placed). +The profile "arq-remote" uses the container qualifier "remote" in this file. +The profile "arq-managed" uses the container qualifier "managed" in this file. + + +Unit tests can be added to EJB project and/or to Web project. + +The web project contains an integration test "SampleIT" which shows how to create the deployable EAR file using the ShrinkWrap API. +You can delete this test file if no tests are necessary. + +Why integration tests instead of the "maven-surefire-plugin" testrunner? +The Arquillian test runner deploys the EAR file to the WildFly server and thus you have to build it yourself with the ShrinkWrap API. +The goal "verify" (which triggers the maven-surefire-plugin) is executed later in the maven build lifecyle than the "test" goal so that the target +artifacts ("practico1-ejb.jar" and "practico1-web.war") are already built. You can build +the final EAR by including those files. The "maven-surefire-plugin" is executed before the JAR/WAR files +are created, so those JAR/WAR files would have to be built in the "@Deployment" method, too. diff --git a/bin/main/resources/META-INF/beans.xml b/bin/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..4054ce4a2b67e32c482db0ed870d1a806514a710 --- /dev/null +++ b/bin/main/resources/META-INF/beans.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" + bean-discovery-mode="all"> +</beans> \ No newline at end of file diff --git a/ear/.project b/ear/.project new file mode 100644 index 0000000000000000000000000000000000000000..b71fabad5b02457ef88a14e7aa56a4c49749d14c --- /dev/null +++ b/ear/.project @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>practico1-ear</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> + </natures> +</projectDescription> diff --git a/ear/.settings/org.eclipse.core.resources.prefs b/ear/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..99f26c0203a7844de00dbfc56e6a35d8ed3c022c --- /dev/null +++ b/ear/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/ear/.settings/org.eclipse.m2e.core.prefs b/ear/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f897a7f1cb2389f85fe6381425d29f0a9866fb65 --- /dev/null +++ b/ear/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/ear/.settings/org.eclipse.wst.common.component b/ear/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000000000000000000000000000000000000..c0c7dfccd10befa3fc53f2dce8a83b13f6f6c3b9 --- /dev/null +++ b/ear/.settings/org.eclipse.wst.common.component @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> + + + + + + + + + + + <wb-module deploy-name="practico1"> + + + + + + + + + + + <wb-resource deploy-path="/" source-path="/target/m2e-wtp/ear-resources"/> + + + + + + + + + + + <wb-resource deploy-path="/" source-path="/src/main/application" tag="defaultRootSource"/> + <dependent-module archiveName="practico1-ejb.jar" deploy-path="/" handle="module:/resource/practico1-ejb/practico1-ejb"> + <dependency-type>uses</dependency-type> + </dependent-module> + <dependent-module archiveName="practico1-web.war" deploy-path="/" handle="module:/resource/practico1-web/practico1-web"> + <dependency-type>uses</dependency-type> + </dependent-module> + + + + + + + + + + + </wb-module> + + + + + + + + + + +</project-modules> diff --git a/ear/.settings/org.eclipse.wst.common.project.facet.core.xml b/ear/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000000000000000000000000000000000000..dbc25daece70648c7b4049b2acf4dd5b1c32d86a --- /dev/null +++ b/ear/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <installed facet="jst.ear" version="10.0"/> +</faceted-project> diff --git a/ear/.settings/org.eclipse.wst.validation.prefs b/ear/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000000000000000000000000000000000000..04cad8cb752a9761c4e5167d0301d3a27674430f --- /dev/null +++ b/ear/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/ear/pom.xml b/ear/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..dce7e3d60ee20979091ae42bc264b1a72822fe99 --- /dev/null +++ b/ear/pom.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>tse</groupId> + <artifactId>practico1</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>practico1-ear</artifactId> + <packaging>ear</packaging> + <name>practico1 - ear</name> + <description>This is the EAR POM file</description> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-ejb</artifactId> + <type>ejb</type> + </dependency> + <!-- Depend on the EJB module and WAR so that we can package them --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-web</artifactId> + <type>war</type> + </dependency> + + + </dependencies> + + <build> + <finalName>${project.parent.artifactId}</finalName> + <plugins> + <!--EAR plugin: format of output file --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ear-plugin</artifactId> + <version>${version.ear.plugin}</version> + <configuration> + <!-- Tell Maven we are using Jakarta EE --> + <version>10</version> + <!-- Use Jakarta EE ear libraries as needed. Jakarta EE ear libraries + are in easy way to package any libraries needed in the ear, and automatically + have any modules (EJB-JARs and WARs) use them --> + <defaultLibBundleDir>lib</defaultLibBundleDir> + <modules> + <!-- Default context root of the web app is /practico1-web. + If a custom context root is needed, uncomment the following snippet to + register our War as a web module and set the contextRoot property --> + <!-- + <webModule> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-web</artifactId> + <contextRoot>/practico1</contextRoot> + </webModule> + --> + </modules> + <outputFileNameMapping>@{artifactId}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping> + </configuration> + </plugin> + <!-- The WildFly plug-in deploys your ear to a local WildFly / JBoss EAP container. + Due to Maven's lack of intelligence with EARs we need to configure + the WildFly Maven plug-in to skip deployment for all modules. We then enable + it specifically in the ear module. --> + <plugin> + <groupId>org.wildfly.plugins</groupId> + <artifactId>wildfly-maven-plugin</artifactId> + <configuration> + <skip>false</skip> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/ear/target/application.xml b/ear/target/application.xml new file mode 100644 index 0000000000000000000000000000000000000000..4bc2b035e5f774d5f08de3b13840cff7e6a03ce6 --- /dev/null +++ b/ear/target/application.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<application xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/application_10.xsd" version="10"> + <description>This is the EAR POM file</description> + <display-name>practico1-ear</display-name> + <module> + <ejb>practico1-ejb.jar</ejb> + </module> + <module> + <web> + <web-uri>practico1-web.war</web-uri> + <context-root>/practico1-web</context-root> + </web> + </module> + <library-directory>lib</library-directory> +</application> \ No newline at end of file diff --git a/ear/target/m2e-wtp/ear-resources/META-INF/MANIFEST.MF b/ear/target/m2e-wtp/ear-resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..9bdf3b1f360838ed2fb5b967e741c8fa187252b9 --- /dev/null +++ b/ear/target/m2e-wtp/ear-resources/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Build-Jdk-Spec: 21 +Created-By: Maven Integration for Eclipse + diff --git a/ear/target/m2e-wtp/ear-resources/META-INF/application.xml b/ear/target/m2e-wtp/ear-resources/META-INF/application.xml new file mode 100644 index 0000000000000000000000000000000000000000..4bc2b035e5f774d5f08de3b13840cff7e6a03ce6 --- /dev/null +++ b/ear/target/m2e-wtp/ear-resources/META-INF/application.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<application xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/application_10.xsd" version="10"> + <description>This is the EAR POM file</description> + <display-name>practico1-ear</display-name> + <module> + <ejb>practico1-ejb.jar</ejb> + </module> + <module> + <web> + <web-uri>practico1-web.war</web-uri> + <context-root>/practico1-web</context-root> + </web> + </module> + <library-directory>lib</library-directory> +</application> \ No newline at end of file diff --git a/ear/target/m2e-wtp/ear-resources/META-INF/maven/tse/practico1-ear/pom.properties b/ear/target/m2e-wtp/ear-resources/META-INF/maven/tse/practico1-ear/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..bc21c9261c258a93bd6d7ca504ce63417934cd0d --- /dev/null +++ b/ear/target/m2e-wtp/ear-resources/META-INF/maven/tse/practico1-ear/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Sun Sep 15 01:54:43 BRT 2024 +artifactId=practico1-ear +groupId=tse +m2e.projectLocation=C\:\\Users\\fedma\\eclipse-workspace\\practico1\\ear +m2e.projectName=practico1-ear +version=0.0.1-SNAPSHOT diff --git a/ear/target/m2e-wtp/ear-resources/META-INF/maven/tse/practico1-ear/pom.xml b/ear/target/m2e-wtp/ear-resources/META-INF/maven/tse/practico1-ear/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..dce7e3d60ee20979091ae42bc264b1a72822fe99 --- /dev/null +++ b/ear/target/m2e-wtp/ear-resources/META-INF/maven/tse/practico1-ear/pom.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>tse</groupId> + <artifactId>practico1</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>practico1-ear</artifactId> + <packaging>ear</packaging> + <name>practico1 - ear</name> + <description>This is the EAR POM file</description> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-ejb</artifactId> + <type>ejb</type> + </dependency> + <!-- Depend on the EJB module and WAR so that we can package them --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-web</artifactId> + <type>war</type> + </dependency> + + + </dependencies> + + <build> + <finalName>${project.parent.artifactId}</finalName> + <plugins> + <!--EAR plugin: format of output file --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ear-plugin</artifactId> + <version>${version.ear.plugin}</version> + <configuration> + <!-- Tell Maven we are using Jakarta EE --> + <version>10</version> + <!-- Use Jakarta EE ear libraries as needed. Jakarta EE ear libraries + are in easy way to package any libraries needed in the ear, and automatically + have any modules (EJB-JARs and WARs) use them --> + <defaultLibBundleDir>lib</defaultLibBundleDir> + <modules> + <!-- Default context root of the web app is /practico1-web. + If a custom context root is needed, uncomment the following snippet to + register our War as a web module and set the contextRoot property --> + <!-- + <webModule> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-web</artifactId> + <contextRoot>/practico1</contextRoot> + </webModule> + --> + </modules> + <outputFileNameMapping>@{artifactId}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping> + </configuration> + </plugin> + <!-- The WildFly plug-in deploys your ear to a local WildFly / JBoss EAP container. + Due to Maven's lack of intelligence with EARs we need to configure + the WildFly Maven plug-in to skip deployment for all modules. We then enable + it specifically in the ear module. --> + <plugin> + <groupId>org.wildfly.plugins</groupId> + <artifactId>wildfly-maven-plugin</artifactId> + <configuration> + <skip>false</skip> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/ear/target/maven-archiver/pom.properties b/ear/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..22bb6f7ba23142882cb5313b76f983efd7761cf9 --- /dev/null +++ b/ear/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=practico1-ear +groupId=tse +version=0.0.1-SNAPSHOT diff --git a/ear/target/practico1.ear b/ear/target/practico1.ear new file mode 100644 index 0000000000000000000000000000000000000000..7479b669c8db64aeb9ca6b7408201439723f73f5 Binary files /dev/null and b/ear/target/practico1.ear differ diff --git a/ear/target/practico1/META-INF/application.xml b/ear/target/practico1/META-INF/application.xml new file mode 100644 index 0000000000000000000000000000000000000000..4bc2b035e5f774d5f08de3b13840cff7e6a03ce6 --- /dev/null +++ b/ear/target/practico1/META-INF/application.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<application xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/application_10.xsd" version="10"> + <description>This is the EAR POM file</description> + <display-name>practico1-ear</display-name> + <module> + <ejb>practico1-ejb.jar</ejb> + </module> + <module> + <web> + <web-uri>practico1-web.war</web-uri> + <context-root>/practico1-web</context-root> + </web> + </module> + <library-directory>lib</library-directory> +</application> \ No newline at end of file diff --git a/ear/target/practico1/practico1-ejb.jar b/ear/target/practico1/practico1-ejb.jar new file mode 100644 index 0000000000000000000000000000000000000000..7e1934365231cedad12dc75eaef6c04d02657603 Binary files /dev/null and b/ear/target/practico1/practico1-ejb.jar differ diff --git a/ear/target/practico1/practico1-web.war b/ear/target/practico1/practico1-web.war new file mode 100644 index 0000000000000000000000000000000000000000..ddde1bf20149e0ae8f754d88dc0e1e8d28410ad8 Binary files /dev/null and b/ear/target/practico1/practico1-web.war differ diff --git a/ejb/.classpath b/ejb/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..ac3f859b1981d5beecc300665b17e389d6764aeb --- /dev/null +++ b/ejb/.classpath @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="optional" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + <attribute name="optional" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="org.eclipse.jst.component.nondependency" value=""/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/ejb/.project b/ejb/.project new file mode 100644 index 0000000000000000000000000000000000000000..0a6f729af3d120f545e5e66b3a0f0c3053866448 --- /dev/null +++ b/ejb/.project @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>practico1-ejb</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.jboss.tools.jst.web.kb.kbbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.jboss.tools.cdi.core.cdibuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.jboss.tools.jst.web.kb.kbnature</nature> + <nature>org.jboss.tools.cdi.core.cdinature</nature> + </natures> +</projectDescription> diff --git a/ejb/.settings/org.eclipse.core.resources.prefs b/ejb/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..29abf999564110a0d6aca109f55f439c72b7031c --- /dev/null +++ b/ejb/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/<project>=UTF-8 diff --git a/ejb/.settings/org.eclipse.jdt.core.prefs b/ejb/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..e8c450c015943b823974f5a58f9a38c5c357248e --- /dev/null +++ b/ejb/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/ejb/.settings/org.eclipse.jpt.core.prefs b/ejb/.settings/org.eclipse.jpt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..453e63838d799d4c8ec679960d8b9195ea428e27 --- /dev/null +++ b/ejb/.settings/org.eclipse.jpt.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +org.eclipse.jpt.core.platform=generic3_0 +org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true diff --git a/ejb/.settings/org.eclipse.m2e.core.prefs b/ejb/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f897a7f1cb2389f85fe6381425d29f0a9866fb65 --- /dev/null +++ b/ejb/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/ejb/.settings/org.eclipse.wst.common.component b/ejb/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000000000000000000000000000000000000..fb9e97d8bdff6c0651b2e52ee54af68749390e17 --- /dev/null +++ b/ejb/.settings/org.eclipse.wst.common.component @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> + + <wb-module deploy-name="practico1-ejb"> + + <wb-resource deploy-path="/" source-path="/src/main/resources" tag="defaultRootSource"/> + + <wb-resource deploy-path="/" source-path="/src/main/java"/> + + <property name="java-output-path" value="/practico1-ejb/target/classes"/> + + </wb-module> + +</project-modules> diff --git a/ejb/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/ejb/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000000000000000000000000000000000000..7961132fdf06ce0a5e43d683c300df67746f62fd --- /dev/null +++ b/ejb/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,7 @@ +<root> + <facet id="jpt.jpa"> + <node name="libprov"> + <attribute name="provider-id" value="jpa-no-op-library-provider"/> + </node> + </facet> +</root> diff --git a/ejb/.settings/org.eclipse.wst.common.project.facet.core.xml b/ejb/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000000000000000000000000000000000000..e9f0096ab86c08b6c21dcac1cfb8c430505f35e9 --- /dev/null +++ b/ejb/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <installed facet="java" version="11"/> + <installed facet="jst.ejb" version="4.0"/> + <installed facet="jpt.jpa" version="3.0"/> +</faceted-project> diff --git a/ejb/.settings/org.eclipse.wst.validation.prefs b/ejb/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000000000000000000000000000000000000..04cad8cb752a9761c4e5167d0301d3a27674430f --- /dev/null +++ b/ejb/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/ejb/pom.xml b/ejb/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..844935b22b5fcddfe1f08bdb1051527fb49e60a0 --- /dev/null +++ b/ejb/pom.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>tse</groupId> + <artifactId>practico1</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>practico1-ejb</artifactId> + <packaging>ejb</packaging> + <name>practico1 - ejb</name> + <description>This is the EJB POM file</description> + + <dependencies> + + <!-- Import the CDI API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.enterprise</groupId> + <artifactId>jakarta.enterprise.cdi-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Test scope dependencies --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + + <!-- Bean Validation Implementation + Provides portable constraints such as @Email + Hibernate Validator is shipped in WildFly / JBoss EAP --> + <dependency> + <groupId>org.hibernate.validator</groupId> + <artifactId>hibernate-validator</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Import the JPA API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.persistence</groupId> + <artifactId>jakarta.persistence-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Optional, but highly recommended --> + <!-- Arquillian allows you to test enterprise code such as EJBs and + Transactional(JTA) JPA from JUnit/TestNG --> + <dependency> + <groupId>org.jboss.arquillian.junit</groupId> + <artifactId>arquillian-junit-container</artifactId> + <scope>test</scope> + </dependency> + + <!-- Declare the APIs we depend on and need for compilation. All of + them are provided by WildFly / JBoss EAP --> + + <!-- Import the EJB API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.ejb</groupId> + <artifactId>jakarta.ejb-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.annotation</groupId> + <artifactId>jakarta.annotation-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>tse</groupId> + <artifactId>practico1-data</artifactId> + <version>0.0.1-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + </dependencies> + + <build> + <!-- Tell Maven that the resulting file should not have a file name containing the version - + a non versioned name is required e.g. when building a deployable artifact using the ShrinkWrap API --> + <finalName>${project.artifactId}</finalName> + + <plugins> + <!--Configure the EJB plugin: we create EJB 4.0. If not specified, an error will arise because the plugin expects an Ejb-jar by default. --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ejb-plugin</artifactId> + <version>${version.ejb.plugin}</version> + <configuration> + <!-- Tell Maven we are using EJB 4.0 --> + <ejbVersion>4.0</ejbVersion> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/ejb/src/main/java/tse/practico1/MySingleton.java b/ejb/src/main/java/tse/practico1/MySingleton.java new file mode 100644 index 0000000000000000000000000000000000000000..23fd35dc34172311f16a11750fa30cbbe4bac908 --- /dev/null +++ b/ejb/src/main/java/tse/practico1/MySingleton.java @@ -0,0 +1,46 @@ +package tse.practico1; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +import jakarta.ejb.Local; +import jakarta.ejb.Remote; +import jakarta.ejb.Singleton; + +/** + * Session Bean implementation class MySingleton + */ +@Remote(MySingletonRemote.class) +@Local(MySingletonLocal.class) +@Singleton +public class MySingleton implements MySingletonRemote, MySingletonLocal { + private List<Usuario> usuarios = new ArrayList<Usuario>(); + + /** + * Default constructor. + */ + public MySingleton() { + // TODO Auto-generated constructor stub + } + + public Usuario altaUsuario(String nombre, Integer añoNacimiento, LocalDate fechaRegistro) { + Usuario nuevoUsuario = new Usuario(nombre, añoNacimiento, fechaRegistro); + usuarios.add(nuevoUsuario); + return nuevoUsuario; + } + + public Usuario buscarUsuario(String nombreBuscado) { + for(Integer i = 0; i<usuarios.size(); i++) { + if (usuarios.get(i).getNombre().equals(nombreBuscado)) { + return usuarios.get(i); + }; + } + return null; + } + + public List<Usuario> listaUsuarios(){ + return new ArrayList<>(usuarios); + } + +} diff --git a/ejb/src/main/java/tse/practico1/MySingletonLocal.java b/ejb/src/main/java/tse/practico1/MySingletonLocal.java new file mode 100644 index 0000000000000000000000000000000000000000..d165682f3f68e982688ccef022d010d39236b5ac --- /dev/null +++ b/ejb/src/main/java/tse/practico1/MySingletonLocal.java @@ -0,0 +1,14 @@ +package tse.practico1; + +import java.time.LocalDate; + +import java.util.List; + +import jakarta.ejb.Local; + +@Local +public interface MySingletonLocal { + public List<Usuario> listaUsuarios(); + public Usuario altaUsuario(String nombre, Integer añoNacimiento, LocalDate fechaRegistro); + public Usuario buscarUsuario(String nombre); +} diff --git a/ejb/src/main/java/tse/practico1/MySingletonRemote.java b/ejb/src/main/java/tse/practico1/MySingletonRemote.java new file mode 100644 index 0000000000000000000000000000000000000000..7cb07bc6dd8595773aff6fca7b2bd2eb305dda4c --- /dev/null +++ b/ejb/src/main/java/tse/practico1/MySingletonRemote.java @@ -0,0 +1,13 @@ +package tse.practico1; + +import java.time.LocalDate; +import java.util.List; + +import jakarta.ejb.Remote; + +@Remote +public interface MySingletonRemote { + public List<Usuario> listaUsuarios(); + public Usuario altaUsuario(String nombre, Integer año, LocalDate fecha); + public Usuario buscarUsuario(String nombreBuscado); +} diff --git a/ejb/src/main/java/tse/practico1/Usuario.java b/ejb/src/main/java/tse/practico1/Usuario.java new file mode 100644 index 0000000000000000000000000000000000000000..574db2c1875416d3cc0ca5b10249429a99fe9198 --- /dev/null +++ b/ejb/src/main/java/tse/practico1/Usuario.java @@ -0,0 +1,46 @@ +package tse.practico1; + +import java.io.Serializable; +import java.time.LocalDate; + +public class Usuario implements Serializable { + private static final long serialVersionUID = 1L; + + private String nombre; + private Integer añoNacimiento; + private LocalDate fechaRegistro; + + public Usuario() { + } + + public Usuario(String nombre, Integer año, LocalDate fecha) { + this.nombre = nombre; + this.añoNacimiento = año; + this.fechaRegistro = fecha; + } + + // Getters y Setters + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public Integer getAñoNacimiento() { + return añoNacimiento; + } + + public void setAñoNacimiento(Integer añoNacimiento) { + this.añoNacimiento = añoNacimiento; + } + + public String getFechaRegistro() { + return fechaRegistro.getDayOfMonth() + "/" + fechaRegistro.getMonth() + "/" + fechaRegistro.getYear(); + } + + public void setFechaRegistro(LocalDate fechaRegistro) { + this.fechaRegistro = fechaRegistro; + } +} diff --git a/ejb/src/main/java/tse/practico1/UsuarioBean.java b/ejb/src/main/java/tse/practico1/UsuarioBean.java new file mode 100644 index 0000000000000000000000000000000000000000..523306d6e835a2b651a438692e03a265d8079a81 --- /dev/null +++ b/ejb/src/main/java/tse/practico1/UsuarioBean.java @@ -0,0 +1,40 @@ +package tse.practico1; + +import java.time.LocalDate; +import java.util.List; + +import jakarta.ejb.EJB; +import jakarta.ejb.Local; +import jakarta.ejb.Remote; +import jakarta.ejb.Stateless; + +/** + * Session Bean implementation class Usuario + */ +@Remote(UsuarioRemote.class) +@Local(UsuarioLocal.class) +@Stateless +public class UsuarioBean implements UsuarioLocal, UsuarioRemote { + + @EJB + private MySingletonRemote singleton; + + /** + * Default constructor. + */ + public UsuarioBean() { + // TODO Auto-generated constructor stub + } + + public List<Usuario> listaUsuarios(){ + return singleton.listaUsuarios(); + } + + public Usuario altaUsuario(String nombre, Integer añoNacimiento, LocalDate fechaRegistro){ + return singleton.altaUsuario(nombre, añoNacimiento, fechaRegistro); + } + + public Usuario buscarUsuario(String nombre){ + return singleton.buscarUsuario(nombre); + } +} diff --git a/ejb/src/main/java/tse/practico1/UsuarioLocal.java b/ejb/src/main/java/tse/practico1/UsuarioLocal.java new file mode 100644 index 0000000000000000000000000000000000000000..06c3c1ab08a7a72824bf192f2443497b94e0cd17 --- /dev/null +++ b/ejb/src/main/java/tse/practico1/UsuarioLocal.java @@ -0,0 +1,13 @@ +package tse.practico1; + +import java.time.LocalDate; +import java.util.List; + +import jakarta.ejb.Local; + +@Local +public interface UsuarioLocal { + public List<Usuario> listaUsuarios(); + public Usuario altaUsuario(String nombre, Integer añoNacimiento, LocalDate fechaRegistro); + public Usuario buscarUsuario(String nombre); +} diff --git a/ejb/src/main/java/tse/practico1/UsuarioRemote.java b/ejb/src/main/java/tse/practico1/UsuarioRemote.java new file mode 100644 index 0000000000000000000000000000000000000000..62347913989d75aecf373e5159787132eea40255 --- /dev/null +++ b/ejb/src/main/java/tse/practico1/UsuarioRemote.java @@ -0,0 +1,13 @@ +package tse.practico1; + +import java.time.LocalDate; +import java.util.List; + +import jakarta.ejb.Remote; + +@Remote +public interface UsuarioRemote { + public List<Usuario> listaUsuarios(); + public Usuario altaUsuario(String nombre, Integer añoNacimiento, LocalDate fechaRegistro); + public Usuario buscarUsuario(String nombre); +} diff --git a/ejb/src/main/resources/META-INF/persistence.xml b/ejb/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000000000000000000000000000000000..c2dc918fa4b0e75ee6ed77783a35fd8e36f8be39 --- /dev/null +++ b/ejb/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<persistence version="3.0" + xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + https://jakarta.ee/xml/ns/persistence + https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"> + <persistence-unit name="practico1PersistenceUnit"> + <!-- If you are running in a production environment, add a managed + data source, this configuration uses the JakartaEE default data source is just for development and testing! --> + <jta-data-source>java:comp/DefaultDataSource</jta-data-source> + <exclude-unlisted-classes>false</exclude-unlisted-classes> + <properties> + <!--The database schema is auto created on deployment and dropped before redeploy. + Note: the following configuration does not drop the tables on undeploy. If you prefer this, use this + Hibernate property instead: + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> + --> + <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> + <property name="javax.persistence.schema-generation.create-source" value="metadata"/> + <property name="javax.persistence.schema-generation.drop-source" value="metadata"/> + + <!-- Properties for Hibernate --> + <property name="hibernate.show_sql" value="false" /> + </properties> + </persistence-unit> +</persistence> diff --git a/ejb/src/test/resources/arquillian.xml b/ejb/src/test/resources/arquillian.xml new file mode 100644 index 0000000000000000000000000000000000000000..b547af1c69b9ce5c94ec7d7c949ace03d2b97542 --- /dev/null +++ b/ejb/src/test/resources/arquillian.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2017, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://jboss.org/schema/arquillian + http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> + + <!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature --> + <defaultProtocol type="Servlet 3.0" /> + + <!-- Uncomment to have test archives exported to the file system for inspection --> + <!--<engine> + <property name="deploymentExportPath">target/</property> + </engine>--> + + <!-- Example configuration for a managed WildFly / JBoss EAP instance --> + <container qualifier="managed"> + <!-- By default, Arquillian will use the JBOSS_HOME environment variable to find the WildFly / JBoss EAP installation. + If you prefer not to define the JBOSS_HOME environment variable, alternatively you can uncomment the + following `jbossHome` property and replace EAP_HOME with the path to your WildFly / JBoss EAP installation. --> + <!--<configuration> + <property name="jbossHome">EAP_HOME</property> + </configuration> --> + </container> + + <!-- Example configuration for a remote WildFly / JBoss EAP instance --> + <container qualifier="remote"> + <!-- Arquillian will deploy to this WildFly server. --> + <configuration> + <property name="managementAddress">127.0.0.1</property> + <property name="managementPort">9990</property> + <!-- If deploying to a remote server, you have to specify username/password here --> + <!-- <property name="username">admin</property> + <property name="password">admin</property> --> + </configuration> + </container> +</arquillian> diff --git a/ejb/target/classes/META-INF/MANIFEST.MF b/ejb/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..9bdf3b1f360838ed2fb5b967e741c8fa187252b9 --- /dev/null +++ b/ejb/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Build-Jdk-Spec: 21 +Created-By: Maven Integration for Eclipse + diff --git a/ejb/target/classes/META-INF/maven/tse/practico1-ejb/pom.properties b/ejb/target/classes/META-INF/maven/tse/practico1-ejb/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..9c29a28623139147bc3d52248a3297689fd86ac3 --- /dev/null +++ b/ejb/target/classes/META-INF/maven/tse/practico1-ejb/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Sun Sep 15 01:54:44 BRT 2024 +artifactId=practico1-ejb +groupId=tse +m2e.projectLocation=C\:\\Users\\fedma\\eclipse-workspace\\practico1\\ejb +m2e.projectName=practico1-ejb +version=0.0.1-SNAPSHOT diff --git a/ejb/target/classes/META-INF/maven/tse/practico1-ejb/pom.xml b/ejb/target/classes/META-INF/maven/tse/practico1-ejb/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..844935b22b5fcddfe1f08bdb1051527fb49e60a0 --- /dev/null +++ b/ejb/target/classes/META-INF/maven/tse/practico1-ejb/pom.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>tse</groupId> + <artifactId>practico1</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>practico1-ejb</artifactId> + <packaging>ejb</packaging> + <name>practico1 - ejb</name> + <description>This is the EJB POM file</description> + + <dependencies> + + <!-- Import the CDI API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.enterprise</groupId> + <artifactId>jakarta.enterprise.cdi-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Test scope dependencies --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + + <!-- Bean Validation Implementation + Provides portable constraints such as @Email + Hibernate Validator is shipped in WildFly / JBoss EAP --> + <dependency> + <groupId>org.hibernate.validator</groupId> + <artifactId>hibernate-validator</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Import the JPA API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.persistence</groupId> + <artifactId>jakarta.persistence-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Optional, but highly recommended --> + <!-- Arquillian allows you to test enterprise code such as EJBs and + Transactional(JTA) JPA from JUnit/TestNG --> + <dependency> + <groupId>org.jboss.arquillian.junit</groupId> + <artifactId>arquillian-junit-container</artifactId> + <scope>test</scope> + </dependency> + + <!-- Declare the APIs we depend on and need for compilation. All of + them are provided by WildFly / JBoss EAP --> + + <!-- Import the EJB API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.ejb</groupId> + <artifactId>jakarta.ejb-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.annotation</groupId> + <artifactId>jakarta.annotation-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>tse</groupId> + <artifactId>practico1-data</artifactId> + <version>0.0.1-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + </dependencies> + + <build> + <!-- Tell Maven that the resulting file should not have a file name containing the version - + a non versioned name is required e.g. when building a deployable artifact using the ShrinkWrap API --> + <finalName>${project.artifactId}</finalName> + + <plugins> + <!--Configure the EJB plugin: we create EJB 4.0. If not specified, an error will arise because the plugin expects an Ejb-jar by default. --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ejb-plugin</artifactId> + <version>${version.ejb.plugin}</version> + <configuration> + <!-- Tell Maven we are using EJB 4.0 --> + <ejbVersion>4.0</ejbVersion> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/ejb/target/classes/META-INF/persistence.xml b/ejb/target/classes/META-INF/persistence.xml new file mode 100644 index 0000000000000000000000000000000000000000..c2dc918fa4b0e75ee6ed77783a35fd8e36f8be39 --- /dev/null +++ b/ejb/target/classes/META-INF/persistence.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<persistence version="3.0" + xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + https://jakarta.ee/xml/ns/persistence + https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"> + <persistence-unit name="practico1PersistenceUnit"> + <!-- If you are running in a production environment, add a managed + data source, this configuration uses the JakartaEE default data source is just for development and testing! --> + <jta-data-source>java:comp/DefaultDataSource</jta-data-source> + <exclude-unlisted-classes>false</exclude-unlisted-classes> + <properties> + <!--The database schema is auto created on deployment and dropped before redeploy. + Note: the following configuration does not drop the tables on undeploy. If you prefer this, use this + Hibernate property instead: + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> + --> + <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> + <property name="javax.persistence.schema-generation.create-source" value="metadata"/> + <property name="javax.persistence.schema-generation.drop-source" value="metadata"/> + + <!-- Properties for Hibernate --> + <property name="hibernate.show_sql" value="false" /> + </properties> + </persistence-unit> +</persistence> diff --git a/ejb/target/classes/tse/practico1/MySingleton.class b/ejb/target/classes/tse/practico1/MySingleton.class new file mode 100644 index 0000000000000000000000000000000000000000..8defe2219d14da01d4ed54b48dac80e9738e3fdc Binary files /dev/null and b/ejb/target/classes/tse/practico1/MySingleton.class differ diff --git a/ejb/target/classes/tse/practico1/MySingletonLocal.class b/ejb/target/classes/tse/practico1/MySingletonLocal.class new file mode 100644 index 0000000000000000000000000000000000000000..837880ff0c669e2b701c4c8d5380adef070f12ab Binary files /dev/null and b/ejb/target/classes/tse/practico1/MySingletonLocal.class differ diff --git a/ejb/target/classes/tse/practico1/MySingletonRemote.class b/ejb/target/classes/tse/practico1/MySingletonRemote.class new file mode 100644 index 0000000000000000000000000000000000000000..14bbe9feacedee18dae8ceee458853e347413d4e Binary files /dev/null and b/ejb/target/classes/tse/practico1/MySingletonRemote.class differ diff --git a/ejb/target/classes/tse/practico1/Usuario.class b/ejb/target/classes/tse/practico1/Usuario.class new file mode 100644 index 0000000000000000000000000000000000000000..65de1855f35d00283f340a3c392252c0a68dea41 Binary files /dev/null and b/ejb/target/classes/tse/practico1/Usuario.class differ diff --git a/ejb/target/classes/tse/practico1/UsuarioBean.class b/ejb/target/classes/tse/practico1/UsuarioBean.class new file mode 100644 index 0000000000000000000000000000000000000000..3d24fcd06558813cafaec7f25f6e3ad658140bde Binary files /dev/null and b/ejb/target/classes/tse/practico1/UsuarioBean.class differ diff --git a/ejb/target/classes/tse/practico1/UsuarioLocal.class b/ejb/target/classes/tse/practico1/UsuarioLocal.class new file mode 100644 index 0000000000000000000000000000000000000000..3ddd2b835a00c8cf29cb3be9af2867bd0af990f7 Binary files /dev/null and b/ejb/target/classes/tse/practico1/UsuarioLocal.class differ diff --git a/ejb/target/classes/tse/practico1/UsuarioRemote.class b/ejb/target/classes/tse/practico1/UsuarioRemote.class new file mode 100644 index 0000000000000000000000000000000000000000..59dd41d6cf30ddcf6e479255584a3b0b544bc90c Binary files /dev/null and b/ejb/target/classes/tse/practico1/UsuarioRemote.class differ diff --git a/ejb/target/maven-archiver/pom.properties b/ejb/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..b72234fd43d82468da7866da748959b6cfb354c1 --- /dev/null +++ b/ejb/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=practico1-ejb +groupId=tse +version=0.0.1-SNAPSHOT diff --git a/ejb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/ejb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..c7cf63fdbc8e659aa0d2e8341325f31c220cfbf6 --- /dev/null +++ b/ejb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,7 @@ +tse\practico1\MySingletonLocal.class +tse\practico1\MySingletonRemote.class +tse\practico1\Usuario.class +tse\practico1\UsuarioBean.class +tse\practico1\UsuarioRemote.class +tse\practico1\UsuarioLocal.class +tse\practico1\MySingleton.class diff --git a/ejb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/ejb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..7990b1db4343e21a4189fbbc75564fb82d2d25ad --- /dev/null +++ b/ejb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,7 @@ +C:\Users\fedma\eclipse-workspace\practico1\ejb\src\main\java\tse\practico1\MySingleton.java +C:\Users\fedma\eclipse-workspace\practico1\ejb\src\main\java\tse\practico1\MySingletonLocal.java +C:\Users\fedma\eclipse-workspace\practico1\ejb\src\main\java\tse\practico1\MySingletonRemote.java +C:\Users\fedma\eclipse-workspace\practico1\ejb\src\main\java\tse\practico1\Usuario.java +C:\Users\fedma\eclipse-workspace\practico1\ejb\src\main\java\tse\practico1\UsuarioBean.java +C:\Users\fedma\eclipse-workspace\practico1\ejb\src\main\java\tse\practico1\UsuarioLocal.java +C:\Users\fedma\eclipse-workspace\practico1\ejb\src\main\java\tse\practico1\UsuarioRemote.java diff --git a/ejb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/ejb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/ejb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/ejb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/ejb/target/practico1-ejb.jar b/ejb/target/practico1-ejb.jar new file mode 100644 index 0000000000000000000000000000000000000000..53e5226a6c8d026081bba0b2431aefdbce028e8b Binary files /dev/null and b/ejb/target/practico1-ejb.jar differ diff --git a/ejb/target/test-classes/arquillian.xml b/ejb/target/test-classes/arquillian.xml new file mode 100644 index 0000000000000000000000000000000000000000..b547af1c69b9ce5c94ec7d7c949ace03d2b97542 --- /dev/null +++ b/ejb/target/test-classes/arquillian.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2017, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://jboss.org/schema/arquillian + http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> + + <!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature --> + <defaultProtocol type="Servlet 3.0" /> + + <!-- Uncomment to have test archives exported to the file system for inspection --> + <!--<engine> + <property name="deploymentExportPath">target/</property> + </engine>--> + + <!-- Example configuration for a managed WildFly / JBoss EAP instance --> + <container qualifier="managed"> + <!-- By default, Arquillian will use the JBOSS_HOME environment variable to find the WildFly / JBoss EAP installation. + If you prefer not to define the JBOSS_HOME environment variable, alternatively you can uncomment the + following `jbossHome` property and replace EAP_HOME with the path to your WildFly / JBoss EAP installation. --> + <!--<configuration> + <property name="jbossHome">EAP_HOME</property> + </configuration> --> + </container> + + <!-- Example configuration for a remote WildFly / JBoss EAP instance --> + <container qualifier="remote"> + <!-- Arquillian will deploy to this WildFly server. --> + <configuration> + <property name="managementAddress">127.0.0.1</property> + <property name="managementPort">9990</property> + <!-- If deploying to a remote server, you have to specify username/password here --> + <!-- <property name="username">admin</property> + <property name="password">admin</property> --> + </configuration> + </container> +</arquillian> diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..38237413fda7bdec6b345277c71c11567cd80123 --- /dev/null +++ b/pom.xml @@ -0,0 +1,1440 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + + + + + + + <modelVersion>4.0.0</modelVersion> + + + <groupId>tse</groupId> + + + <artifactId>practico1</artifactId> + + + <version>0.0.1-SNAPSHOT</version> + + + <packaging>pom</packaging> + + + <name>practico1</name> + + + <description>Insert description for your project here.</description> + + + <modules> + + + <module>ejb</module> + + + <module>web</module> + + + <module>ear</module> + + <module>practico1-data</module> + </modules> + + + <properties> + + + <!-- Explicitly declaring the source encoding eliminates the following + message: --> + + + <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered + resources, i.e. build is platform dependent! --> + + + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + + + <!-- JBoss dependency versions --> + + + <version.wildfly.maven.plugin>5.0.0.Final</version.wildfly.maven.plugin> + + + <!-- Define the version of the JBoss BOMs we want to import to specify tested stacks. --> + + + <version.wildfly.bom>33.0.1.Final</version.wildfly.bom> + + + <!--Use JUnit 5 here - the WildFly bom still brings 4.x --> + + + <version.junit5>5.10.1</version.junit5> + + + <!-- other plugin versions --> + + + <version.compiler.plugin>3.13.0</version.compiler.plugin> + + + <version.ear.plugin>3.3.0</version.ear.plugin> + + + <version.ejb.plugin>3.2.1</version.ejb.plugin> + + + <version.surefire.plugin>3.0.0</version.surefire.plugin> + + + <version.failsafe.plugin>3.4.0</version.failsafe.plugin> + + + <version.war.plugin>3.4.0</version.war.plugin> + + + <!-- maven-compiler-plugin --> + + + <maven.compiler.release>11</maven.compiler.release> + + + </properties> + + + <!-- + Repositories are defined in the order that they should be used. + (1) Maven central, (2) JBoss community + By default maven central is used last, so it is redefined here to + force it to be used first. + --> + + + <repositories> + + + <repository> + + + <id>central</id> + + + <name>Main Apache Maven Repository</name> + + + <url>https://repo.maven.apache.org/maven2/</url> + + + <layout>default</layout> + + + <releases> + + + <enabled>true</enabled> + + + <updatePolicy>never</updatePolicy> + + + </releases> + + + <snapshots> + + + <enabled>false</enabled> + + + <updatePolicy>never</updatePolicy> + + + </snapshots> + + + </repository> + + + <repository> + + + <releases> + + + + + + + + <enabled>true</enabled> + + + + + + + + <updatePolicy>never</updatePolicy> + + + + + + + + </releases> + + + + + + + + <snapshots> + + + + + + + + <enabled>true</enabled> + + + + + + + + <updatePolicy>never</updatePolicy> + + + + + + + + </snapshots> + + + + + + + + <id>jboss-public-repository-group</id> + + + + + + + + <name>JBoss Public Repository Group</name> + + + + + + + + <url>https://repository.jboss.org/nexus/content/groups/public/</url> + + + + + + + + <layout>default</layout> + + + + + + + + </repository> + + + + + + + + </repositories> + + + + + + + + <pluginRepositories> + + + + + + + + <pluginRepository> + + + + + + + + <id>central</id> + + + + + + + + <name>Main Apache Maven Repository</name> + + + + + + + + <url>https://repo.maven.apache.org/maven2/</url> + + + + + + + + <releases> + + + + + + + + <enabled>true</enabled> + + + + + + + + <updatePolicy>never</updatePolicy> + + + + + + + + </releases> + + + + + + + + <snapshots> + + + + + + + + <enabled>false</enabled> + + + + + + + + <updatePolicy>never</updatePolicy> + + + + + + + + </snapshots> + + + + + + + + </pluginRepository> + + + + + + + + <pluginRepository> + + + + + + + + <releases> + + + + + + + + <enabled>true</enabled> + + + + + + + + </releases> + + + + + + + + <snapshots> + + + + + + + + <enabled>true</enabled> + + + + + + + + </snapshots> + + + + + + + + <id>jboss-public-repository-group</id> + + + + + + + + <name>JBoss Public Repository Group</name> + + + + + + + + <url>https://repository.jboss.org/nexus/content/groups/public/</url> + + + + + + + + </pluginRepository> + + + + + + + + </pluginRepositories> + + + + + + + + <dependencyManagement> + + + + + + + + <dependencies> + + + + + + + + <!-- Define the version of the EJB jar so that we don't need + to repeat ourselves in every module --> + + + + + + + + <dependency> + + + + + + + + <groupId>${project.groupId}</groupId> + + + + + + + + <artifactId>practico1-ejb</artifactId> + + + + + + + + <version>${project.version}</version> + + + + + + + + <type>ejb</type> + + + + + + + + </dependency> + + + + + + + + <!-- Define the version of the WAR so that we don't need to repeat + ourselves in every module --> + + + + + + + + <dependency> + + + + + + + + <groupId>${project.groupId}</groupId> + + + + + + + + <artifactId>practico1-web</artifactId> + + + + + + + + <version>${project.version}</version> + + + + + + + + <type>war</type> + + + + + + + + <scope>compile</scope> + + + + + + + + </dependency> + + + + + + + + <!-- JBoss distributes a complete set of Jakarta EE 8 APIs including + a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or + a collection) of artifacts. We use this here so that we always get the correct + versions of artifacts. Here we use the wildfly-jakartaee-8.0-with-tools stack + (you can read this as the WildFly stack of the Jakarta EE 8 APIs --> + + + + + + + + <dependency> + + + + + + + + <groupId>org.wildfly.bom</groupId> + + + + + + + + <artifactId>wildfly-ee-with-tools</artifactId> + + + + + + + + <version>${version.wildfly.bom}</version> + + + + + + + + <type>pom</type> + + + + + + + + <scope>import</scope> + + + + + + + + </dependency> + + + + + + + + <!--Define the JUnit5 bom. WildFly BOM still contains JUnit4, so we have to declare a version here --> + + + + + + + + <dependency> + + + + + + + + <groupId>org.junit</groupId> + + + + + + + + <artifactId>junit-bom</artifactId> + + + + + + + + <version>${version.junit5}</version> + + + + + + + + <type>pom</type> + + + + + + + + <scope>import</scope> + + + + + + + + </dependency> + + + + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-data</artifactId> + <version>${project.version}</version> + <type>ejb</type> + <scope>provided</scope> + </dependency> + + + <dependency> + + + + + + + + + + <groupId>org.jboss.arquillian.protocol</groupId> + + + + + + + + <artifactId>arquillian-protocol-servlet-jakarta</artifactId> + + + + + + + + <!-- temporary overriding as the 1.9.1.Final version pulled by + WildFly BOM does not exist. + --> + + + + + + + + <version>10.0.0.Final</version> + + + + + + + + <scope>test</scope> + + + + + + + + </dependency> + + + + + + + + </dependencies> + + + + + + + + </dependencyManagement> + + + + + + + + <build> + + + + + + + + <plugins> + + + + + + + + <!--Configuration of the maven-compiler-plugin --> + + + + + + + + <plugin> + + + + + + + + <groupId>org.apache.maven.plugins</groupId> + + + + + + + + <artifactId>maven-compiler-plugin</artifactId> + + + + + + + + <version>${version.compiler.plugin}</version> + + + + + + + + <configuration> + + + + + + + + <!-- put your configurations here --> + + + + + + + + </configuration> + + + + + + + + </plugin> + + + + + + + + <!-- The WildFly plugin deploys your ear to a local JBoss AS container --> + + + + + + + + <!-- Due to Maven's lack of intelligence with EARs we need + to configure the wildfly maven plugin to skip deployment for all modules. + We then enable it specifically in the ear module. --> + + + + + + + + <plugin> + + + + + + + + <groupId>org.wildfly.plugins</groupId> + + + + + + + + <artifactId>wildfly-maven-plugin</artifactId> + + + + + + + + <version>${version.wildfly.maven.plugin}</version> + + + + + + + + <inherited>true</inherited> + + + + + + + + <configuration> + + + + + + + + <skip>true</skip> + + + + + + + + </configuration> + + + + + + + + </plugin> + + + + + + + + </plugins> + + + + + + + + </build> + + + + + + + + <profiles> + + + + + + + + <profile> + + + + + + + + <!-- All the modules that require nothing but WildFly /JBoss EAP --> + + + + + + + + <id>default</id> + + + + + + + + <activation> + + + + + + + + <activeByDefault>true</activeByDefault> + + + + + + + + </activation> + + + + + + + + </profile> + + + + + + + + <profile> + + + + + + + + <!-- An optional Arquillian testing profile that executes tests in your WildFly / JBoss EAP instance. + This profile will start a new WildFly / JBoss EAP instance, and execute the test, shutting it down when done. + Run with: mvn clean verify -Parq-managed --> + + + + + + + + <id>arq-managed</id> + + + + + + + + <dependencies> + + + + + + + + <dependency> + + + + + + + + <groupId>org.wildfly.arquillian</groupId> + + + + + + + + <artifactId>wildfly-arquillian-container-managed</artifactId> + + + + + + + + <scope>test</scope> + + + + + + + + </dependency> + + </dependencies> + + + + + + + + <build> + + + + + + + + <plugins> + + + + + + + + <plugin> + + + + + + + + <groupId>org.apache.maven.plugins</groupId> + + + + + + + + <artifactId>maven-failsafe-plugin</artifactId> + + + + + + + + <version>${version.failsafe.plugin}</version> + + + + + + + + <executions> + + + + + + + + <execution> + + + + + + + + <goals> + + + + + + + + <goal>integration-test</goal> + + + + + + + + <goal>verify</goal> + + + + + + + + </goals> + + + + + + + + </execution> + + + + + + + + </executions> + + + + + + + + <configuration> + + + + + + + + <!-- Configuration for Arquillian: --> + + + + + + + + <systemPropertyVariables> + + + + + + + + <!-- Defines the container qualifier in "arquillian.xml" --> + + + + + + + + <arquillian.launch>managed</arquillian.launch> + + + + + + + + </systemPropertyVariables> + + + + + + + + </configuration> + + + + + + + + </plugin> + + + + + + + + </plugins> + + </build> + + </profile> + + <profile> + + <!-- An optional Arquillian testing profile that executes tests in a remote WildFly / JBoss EAP instance. + Run with: mvn clean verify -Parq-remote --> + + <id>arq-remote</id> + + <dependencies> + + <dependency> + + <groupId>org.wildfly.arquillian</groupId> + + <artifactId>wildfly-arquillian-container-remote</artifactId> + + <scope>test</scope> + + </dependency> + + </dependencies> + + <build> + + <plugins> + + <plugin> + + <groupId>org.apache.maven.plugins</groupId> + + <artifactId>maven-failsafe-plugin</artifactId> + + <version>${version.failsafe.plugin}</version> + + <executions> + + <execution> + + <goals> + + <goal>integration-test</goal> + + <goal>verify</goal> + + </goals> + + </execution> + + </executions> + + <configuration> + + <!-- Configuration for Arquillian: --> + + <systemPropertyVariables> + + <!-- Defines the container qualifier in "arquillian.xml" --> + + <arquillian.launch>remote</arquillian.launch> + + </systemPropertyVariables> + + </configuration> + + </plugin> + + </plugins> + + </build> + + </profile> + + </profiles> + +</project> diff --git a/practico1-data/.classpath b/practico1-data/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..ac3f859b1981d5beecc300665b17e389d6764aeb --- /dev/null +++ b/practico1-data/.classpath @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="optional" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + <attribute name="optional" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="org.eclipse.jst.component.nondependency" value=""/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/practico1-data/.project b/practico1-data/.project new file mode 100644 index 0000000000000000000000000000000000000000..d0eb322ef9ee8486c73ebcedb6d1201365d62ebf --- /dev/null +++ b/practico1-data/.project @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>practico1-data</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.jboss.tools.jst.web.kb.kbbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.jboss.tools.cdi.core.cdibuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.jboss.tools.jst.web.kb.kbnature</nature> + <nature>org.jboss.tools.cdi.core.cdinature</nature> + </natures> +</projectDescription> diff --git a/practico1-data/.settings/org.eclipse.core.resources.prefs b/practico1-data/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..29abf999564110a0d6aca109f55f439c72b7031c --- /dev/null +++ b/practico1-data/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/<project>=UTF-8 diff --git a/practico1-data/.settings/org.eclipse.jdt.core.prefs b/practico1-data/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..e8c450c015943b823974f5a58f9a38c5c357248e --- /dev/null +++ b/practico1-data/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/practico1-data/.settings/org.eclipse.m2e.core.prefs b/practico1-data/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f897a7f1cb2389f85fe6381425d29f0a9866fb65 --- /dev/null +++ b/practico1-data/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/practico1-data/.settings/org.eclipse.wst.common.component b/practico1-data/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000000000000000000000000000000000000..e1e158f130ed4c6251da018a30b47d5fd271eaeb --- /dev/null +++ b/practico1-data/.settings/org.eclipse.wst.common.component @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> + <wb-module deploy-name="practico1-data"> + <wb-resource deploy-path="/" source-path="/src/main/java"/> + <wb-resource deploy-path="/" source-path="/src/main/resources" tag="defaultRootSource"/> + <wb-resource deploy-path="/" source-path="/ejbModule"/> + <property name="java-output-path" value="/practico1-data/target/classes"/> + </wb-module> +</project-modules> diff --git a/practico1-data/.settings/org.eclipse.wst.common.project.facet.core.xml b/practico1-data/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000000000000000000000000000000000000..d2a1e37ed0f4e5e968c203adc5ff142dd2190ceb --- /dev/null +++ b/practico1-data/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <installed facet="java" version="11"/> + <installed facet="jst.ejb" version="4.0"/> +</faceted-project> diff --git a/practico1-data/.settings/org.eclipse.wst.validation.prefs b/practico1-data/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000000000000000000000000000000000000..04cad8cb752a9761c4e5167d0301d3a27674430f --- /dev/null +++ b/practico1-data/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/practico1-data/ejbModule/META-INF/MANIFEST.MF b/practico1-data/ejbModule/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..254272e1c0740423e25eb40be9a98ce1556474b1 --- /dev/null +++ b/practico1-data/ejbModule/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/practico1-data/pom.xml b/practico1-data/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ec73921f0fefeb54cebed11efd5058a86cb07bf5 --- /dev/null +++ b/practico1-data/pom.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>tse</groupId> + <artifactId>practico1</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>practico1-data</artifactId> + <packaging>ejb</packaging> + <name>practico1 - data</name> + <description>This is the EJB POM file</description> + + <dependencies> + + <!-- Import the CDI API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.enterprise</groupId> + <artifactId>jakarta.enterprise.cdi-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Test scope dependencies --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + + <!-- Bean Validation Implementation + Provides portable constraints such as @Email + Hibernate Validator is shipped in WildFly / JBoss EAP --> + <dependency> + <groupId>org.hibernate.validator</groupId> + <artifactId>hibernate-validator</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Import the JPA API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.persistence</groupId> + <artifactId>jakarta.persistence-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Optional, but highly recommended --> + <!-- Arquillian allows you to test enterprise code such as EJBs and + Transactional(JTA) JPA from JUnit/TestNG --> + <dependency> + <groupId>org.jboss.arquillian.junit</groupId> + <artifactId>arquillian-junit-container</artifactId> + <scope>test</scope> + </dependency> + + <!-- Declare the APIs we depend on and need for compilation. All of + them are provided by WildFly / JBoss EAP --> + + <!-- Import the EJB API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.ejb</groupId> + <artifactId>jakarta.ejb-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.annotation</groupId> + <artifactId>jakarta.annotation-api</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <!-- Tell Maven that the resulting file should not have a file name containing the version - + a non versioned name is required e.g. when building a deployable artifact using the ShrinkWrap API --> + <finalName>${project.artifactId}</finalName> + + <plugins> + <!--Configure the EJB plugin: we create EJB 4.0. If not specified, an error will arise because the plugin expects an Ejb-jar by default. --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ejb-plugin</artifactId> + <version>${version.ejb.plugin}</version> + <configuration> + <!-- Tell Maven we are using EJB 4.0 --> + <ejbVersion>4.0</ejbVersion> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/practico1-data/src/main/java/tse/practico1/data/Usuario.java b/practico1-data/src/main/java/tse/practico1/data/Usuario.java new file mode 100644 index 0000000000000000000000000000000000000000..8b645ca3f4b2236d3783e2a78de033b640bbbb21 --- /dev/null +++ b/practico1-data/src/main/java/tse/practico1/data/Usuario.java @@ -0,0 +1,46 @@ +package tse.practico1.data; + +import java.io.Serializable; +import java.time.LocalDate; + +public class Usuario implements Serializable { + private static final long serialVersionUID = 1L; + + private String nombre; + private Integer añoNacimiento; + private LocalDate fechaRegistro; + + public Usuario() { + } + + public Usuario(String nombre, Integer año, LocalDate fecha) { + this.nombre = nombre; + this.añoNacimiento = año; + this.fechaRegistro = fecha; + } + + // Getters y Setters + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public Integer getAñoNacimiento() { + return añoNacimiento; + } + + public void setAñoNacimiento(Integer añoNacimiento) { + this.añoNacimiento = añoNacimiento; + } + + public String getFechaRegistro() { + return fechaRegistro.getDayOfMonth() + "/" + fechaRegistro.getMonth() + "/" + fechaRegistro.getYear(); + } + + public void setFechaRegistro(LocalDate fechaRegistro) { + this.fechaRegistro = fechaRegistro; + } +} diff --git a/practico1-data/target/classes/META-INF/MANIFEST.MF b/practico1-data/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..9bdf3b1f360838ed2fb5b967e741c8fa187252b9 --- /dev/null +++ b/practico1-data/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Build-Jdk-Spec: 21 +Created-By: Maven Integration for Eclipse + diff --git a/practico1-data/target/classes/META-INF/maven/tse/practico1-data/pom.properties b/practico1-data/target/classes/META-INF/maven/tse/practico1-data/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..eccb2dde50894b6b5e502f9d791e1becd18ffc55 --- /dev/null +++ b/practico1-data/target/classes/META-INF/maven/tse/practico1-data/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Sun Sep 15 01:54:43 BRT 2024 +artifactId=practico1-data +groupId=tse +m2e.projectLocation=C\:\\Users\\fedma\\eclipse-workspace\\practico1\\practico1-data +m2e.projectName=practico1-data +version=0.0.1-SNAPSHOT diff --git a/practico1-data/target/classes/META-INF/maven/tse/practico1-data/pom.xml b/practico1-data/target/classes/META-INF/maven/tse/practico1-data/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ec73921f0fefeb54cebed11efd5058a86cb07bf5 --- /dev/null +++ b/practico1-data/target/classes/META-INF/maven/tse/practico1-data/pom.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>tse</groupId> + <artifactId>practico1</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>practico1-data</artifactId> + <packaging>ejb</packaging> + <name>practico1 - data</name> + <description>This is the EJB POM file</description> + + <dependencies> + + <!-- Import the CDI API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.enterprise</groupId> + <artifactId>jakarta.enterprise.cdi-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Test scope dependencies --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + + <!-- Bean Validation Implementation + Provides portable constraints such as @Email + Hibernate Validator is shipped in WildFly / JBoss EAP --> + <dependency> + <groupId>org.hibernate.validator</groupId> + <artifactId>hibernate-validator</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Import the JPA API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.persistence</groupId> + <artifactId>jakarta.persistence-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Optional, but highly recommended --> + <!-- Arquillian allows you to test enterprise code such as EJBs and + Transactional(JTA) JPA from JUnit/TestNG --> + <dependency> + <groupId>org.jboss.arquillian.junit</groupId> + <artifactId>arquillian-junit-container</artifactId> + <scope>test</scope> + </dependency> + + <!-- Declare the APIs we depend on and need for compilation. All of + them are provided by WildFly / JBoss EAP --> + + <!-- Import the EJB API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.ejb</groupId> + <artifactId>jakarta.ejb-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.annotation</groupId> + <artifactId>jakarta.annotation-api</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <!-- Tell Maven that the resulting file should not have a file name containing the version - + a non versioned name is required e.g. when building a deployable artifact using the ShrinkWrap API --> + <finalName>${project.artifactId}</finalName> + + <plugins> + <!--Configure the EJB plugin: we create EJB 4.0. If not specified, an error will arise because the plugin expects an Ejb-jar by default. --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ejb-plugin</artifactId> + <version>${version.ejb.plugin}</version> + <configuration> + <!-- Tell Maven we are using EJB 4.0 --> + <ejbVersion>4.0</ejbVersion> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/practico1-data/target/classes/tse/practico1/data/Usuario.class b/practico1-data/target/classes/tse/practico1/data/Usuario.class new file mode 100644 index 0000000000000000000000000000000000000000..e519da7f22a63eb97e813c0f6187bca782a3fec9 Binary files /dev/null and b/practico1-data/target/classes/tse/practico1/data/Usuario.class differ diff --git a/practico1-data/target/maven-archiver/pom.properties b/practico1-data/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..fe4be3131b1df3681ceaea6509dbf9b1e76e06d0 --- /dev/null +++ b/practico1-data/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=practico1-data +groupId=tse +version=0.0.1-SNAPSHOT diff --git a/practico1-data/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/practico1-data/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..2d79f0c7588c605e4ad3995a6e0cf7609489edc9 --- /dev/null +++ b/practico1-data/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +tse\practico1\data\Usuario.class diff --git a/practico1-data/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/practico1-data/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..52bf7bc582ef9cacd277b65950c7b5959ae36811 --- /dev/null +++ b/practico1-data/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +C:\Users\fedma\eclipse-workspace\practico1\practico1-data\src\main\java\tse\practico1\data\Usuario.java diff --git a/practico1-data/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/practico1-data/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/practico1-data/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/practico1-data/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/practico1-data/target/practico1-data.jar b/practico1-data/target/practico1-data.jar new file mode 100644 index 0000000000000000000000000000000000000000..ffbb212d2aa73526f614999f8e2c34c586ee7cc6 Binary files /dev/null and b/practico1-data/target/practico1-data.jar differ diff --git a/web/.classpath b/web/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..cc2a1ff3031227edbfb66f17acfc904797016d70 --- /dev/null +++ b/web/.classpath @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="optional" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + <attribute name="optional" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/web/.project b/web/.project new file mode 100644 index 0000000000000000000000000000000000000000..0b5340d3ccf089f74f9777f00deab9021a6adec3 --- /dev/null +++ b/web/.project @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>practico1-web</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.jboss.tools.jst.web.kb.kbbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.jboss.tools.cdi.core.cdibuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.jboss.tools.jst.web.kb.kbnature</nature> + <nature>org.jboss.tools.cdi.core.cdinature</nature> + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> + </natures> +</projectDescription> diff --git a/web/.settings/.jsdtscope b/web/.settings/.jsdtscope new file mode 100644 index 0000000000000000000000000000000000000000..1ef54aba0b57a252f296a2f17336c400dc173223 --- /dev/null +++ b/web/.settings/.jsdtscope @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry excluding="**/node_modules/*|**/*.min.js|**/bower_components/*" kind="src" path="src/main/webapp"/> + <classpathentry kind="src" path="target/m2e-wtp/web-resources"/> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> + <attributes> + <attribute name="hide" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> + <classpathentry kind="output" path=""/> +</classpath> diff --git a/web/.settings/org.eclipse.core.resources.prefs b/web/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..c86ef7319135a1cebff5b09d96c60334ed2c79c1 --- /dev/null +++ b/web/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/<project>=UTF-8 diff --git a/web/.settings/org.eclipse.jdt.core.prefs b/web/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..e8c450c015943b823974f5a58f9a38c5c357248e --- /dev/null +++ b/web/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/web/.settings/org.eclipse.m2e.core.prefs b/web/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f897a7f1cb2389f85fe6381425d29f0a9866fb65 --- /dev/null +++ b/web/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/web/.settings/org.eclipse.wst.common.component b/web/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000000000000000000000000000000000000..7c51789a17204c443a8bdc8a760e25da6a1d6ad5 --- /dev/null +++ b/web/.settings/org.eclipse.wst.common.component @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> + + + <wb-module deploy-name="practico1-web"> + + + <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> + + + <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> + + + <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> + <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> + + + <property name="java-output-path" value="/practico1-web/target/classes"/> + <property name="context-root" value="practico1-web"/> + + + </wb-module> + + +</project-modules> diff --git a/web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000000000000000000000000000000000000..6d59853d98b151cf856bb9c3a2c2d2d151db3c35 --- /dev/null +++ b/web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,12 @@ +<root> + <facet id="jst.jsf"> + <node name="libprov"> + <attribute name="provider-id" value="jsf-no-op-library-provider"/> + </node> + </facet> + <facet id="jst.jaxrs"> + <node name="libprov"> + <attribute name="provider-id" value="jaxrs-no-op-library-provider"/> + </node> + </facet> +</root> diff --git a/web/.settings/org.eclipse.wst.common.project.facet.core.xml b/web/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000000000000000000000000000000000000..2ffcbeb426e72bd5e4210026ed85fdbddf7f75aa --- /dev/null +++ b/web/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <fixed facet="wst.jsdt.web"/> + <installed facet="java" version="11"/> + <installed facet="jst.web" version="6.0"/> + <installed facet="jst.cdi" version="2.0"/> + <installed facet="jboss.m2" version="1.0"/> + <installed facet="jst.jsf" version="2.3"/> + <installed facet="wst.jsdt.web" version="1.0"/> + <installed facet="jst.jaxrs" version="2.1"/> +</faceted-project> diff --git a/web/.settings/org.eclipse.wst.jsdt.ui.superType.container b/web/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000000000000000000000000000000000000..3bd5d0a4803967bc0bf72a7dd66d7e292ed2e586 --- /dev/null +++ b/web/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/web/.settings/org.eclipse.wst.jsdt.ui.superType.name b/web/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000000000000000000000000000000000000..05bd71b6ec2c1982d1e8a5653073281994564ae8 --- /dev/null +++ b/web/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/web/.settings/org.eclipse.wst.validation.prefs b/web/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000000000000000000000000000000000000..04cad8cb752a9761c4e5167d0301d3a27674430f --- /dev/null +++ b/web/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/web/pom.xml b/web/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..43e242722ba105639803be9e3579044b75011925 --- /dev/null +++ b/web/pom.xml @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>tse</groupId> + <artifactId>practico1</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>practico1-web</artifactId> + <packaging>war</packaging> + <name>practico1 - web</name> + <description>This is the web POM file</description> + + <dependencies> + + <!-- Import the CDI API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.enterprise</groupId> + <artifactId>jakarta.enterprise.cdi-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Bean Validation Implementation + Provides portable constraints such as @Email + Hibernate Validator is shipped in WildFly / JBoss EAP --> + <dependency> + <groupId>org.hibernate.validator</groupId> + <artifactId>hibernate-validator</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Import the JPA API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.persistence</groupId> + <artifactId>jakarta.persistence-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Dependency on the EJB module so we can use it's services if needed --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-ejb</artifactId> + <type>ejb</type> + <scope>provided</scope> + </dependency> + + <!-- Import the JSF API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.faces</groupId> + <artifactId>jakarta.faces-api</artifactId> + <scope>provided</scope> + + </dependency> + + <!-- Import the JAX-RS API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.ws.rs</groupId> + <artifactId>jakarta.ws.rs-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Servlet API --> + <dependency> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Import the EJB API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.ejb</groupId> + <artifactId>jakarta.ejb-api</artifactId> + <scope>provided</scope> + </dependency> + <!-- Required for e.g. "javax.annotation.PostConstruct" --> + <dependency> + <groupId>jakarta.annotation</groupId> + <artifactId>jakarta.annotation-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Test scope dependencies --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + + <!-- Optional, but highly recommended --> + <!-- Arquillian allows you to test enterprise code such as EJBs and + Transactional(JTA) JPA from JUnit/TestNG --> + <dependency> + <groupId>org.jboss.arquillian.junit5</groupId> + <artifactId>arquillian-junit5-container</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <!-- Tell Maven that the resulting file should not have a file name containing the version - + a non versioned name is required e.g. when building a deployable artifact using the ShrinkWrap API --> + <finalName>${project.artifactId}</finalName> + + <plugins> + <!--Build configuration for the WAR plugin: --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>${version.war.plugin}</version> + <configuration> + <!-- Jakarta EE doesn't require web.xml, Maven needs to catch up! --> + <failOnMissingWebXml>false</failOnMissingWebXml> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/web/src/main/java/DetalleUsuario.java b/web/src/main/java/DetalleUsuario.java new file mode 100644 index 0000000000000000000000000000000000000000..738d8684c820ffbefd4387469de52e25102197db --- /dev/null +++ b/web/src/main/java/DetalleUsuario.java @@ -0,0 +1,57 @@ + + +import jakarta.ejb.EJB; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import tse.practico1.Usuario; + +/** + * Servlet implementation class Usuario + */ +@WebServlet("/DetalleUsuario") +public class DetalleUsuario extends HttpServlet { + private static final long serialVersionUID = 1L; + + @EJB + private tse.practico1.UsuarioRemote usuarioRemote; + + /** + * @see HttpServlet#HttpServlet() + */ + public DetalleUsuario() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String nombreBuscado = request.getParameter("nombreBuscado"); + Usuario usuario = usuarioRemote.buscarUsuario(nombreBuscado); + + // Almacenar la instancia en el request + request.setAttribute("usuario", usuario); + + // Reenviar a la página JSP + request.getRequestDispatcher("detalle_usuario.jsp").forward(request, response); + //response.sendRedirect("confirmacion.jsp"); + + + // TODO Auto-generated method stub + // response.getWriter().append("Served at: ").append(request.getContextPath()); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + doGet(request, response); + } + +} diff --git a/web/src/main/java/Inicio.java b/web/src/main/java/Inicio.java new file mode 100644 index 0000000000000000000000000000000000000000..c6a7159afdc3bebd157310c698991084ff018298 --- /dev/null +++ b/web/src/main/java/Inicio.java @@ -0,0 +1,49 @@ + + +import jakarta.ejb.EJB; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Servlet implementation class Usuario + */ +@WebServlet("/") +public class Inicio extends HttpServlet { + private static final long serialVersionUID = 1L; + + @EJB + tse.practico1.UsuarioRemote usuario; + + /** + * @see HttpServlet#HttpServlet() + */ + public Inicio() { + super(); + // TODO Auto-generated constructor stub + } + + public Inicio(String string, int i) { + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + request.getRequestDispatcher("index.jsp").forward(request, response); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + doGet(request, response); + } + +} diff --git a/web/src/main/java/ListaUsuarios.java b/web/src/main/java/ListaUsuarios.java new file mode 100644 index 0000000000000000000000000000000000000000..c8d5e672a1f0a448fa883f0faa5dc8509f3be9af --- /dev/null +++ b/web/src/main/java/ListaUsuarios.java @@ -0,0 +1,62 @@ + + +import jakarta.ejb.EJB; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; + +import tse.practico1.Usuario; + +/** + * Servlet implementation class Usuario + */ +@WebServlet("/ListaUsuarios") +public class ListaUsuarios extends HttpServlet { + private static final long serialVersionUID = 1L; + + @EJB + private tse.practico1.UsuarioRemote usuarioRemote; + + /** + * @see HttpServlet#HttpServlet() + */ + public ListaUsuarios() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + /*List<Usuario> usuarios = new ArrayList<>(); + usuarios.add(usuario1); + usuarios.add(usuario2);*/ + List<Usuario> usuarios = usuarioRemote.listaUsuarios(); + + // Almacenar la instancia en el request + request.setAttribute("usuarios", usuarios); + + // Reenviar a la página JSP + request.getRequestDispatcher("lista_usuarios.jsp").forward(request, response); + //response.sendRedirect("confirmacion.jsp"); + + + // TODO Auto-generated method stub + // response.getWriter().append("Served at: ").append(request.getContextPath()); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + doGet(request, response); + } + +} diff --git a/web/src/main/java/UsuarioCreado.java b/web/src/main/java/UsuarioCreado.java new file mode 100644 index 0000000000000000000000000000000000000000..c286643bfce4f29d6d7ed3efefff2f0dcda81e04 --- /dev/null +++ b/web/src/main/java/UsuarioCreado.java @@ -0,0 +1,56 @@ + + +import jakarta.ejb.EJB; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import tse.practico1.Usuario; + +import java.io.IOException; +import java.time.LocalDate; + +/** + * Servlet implementation class Usuario + */ +@WebServlet("/UsuarioCreado") +public class UsuarioCreado extends HttpServlet { + private static final long serialVersionUID = 1L; + + @EJB + tse.practico1.UsuarioRemote usuarioRemote; + + /** + * @see HttpServlet#HttpServlet() + */ + public UsuarioCreado() { + super(); + // TODO Auto-generated constructor stub + } + + public UsuarioCreado(String string, int i) { + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String nombre = request.getParameter("nombre"); + Integer añoNacimiento = Integer.parseInt(request.getParameter("añoNacimiento")); + LocalDate fechaRegistro = LocalDate.parse(request.getParameter("fechaRegistro")); + Usuario res = usuarioRemote.altaUsuario(nombre, añoNacimiento, fechaRegistro); + request.setAttribute("usuario", res); + request.getRequestDispatcher("usuario_creado.jsp").forward(request, response); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + // TODO Auto-generated method stub + doGet(request, response); + } + +} diff --git a/web/src/main/java/beans/InicioBean.java b/web/src/main/java/beans/InicioBean.java new file mode 100644 index 0000000000000000000000000000000000000000..3366d14f8085c97dfa6c94e1df8c2127a315d604 --- /dev/null +++ b/web/src/main/java/beans/InicioBean.java @@ -0,0 +1,74 @@ +package beans; + +import jakarta.annotation.PostConstruct; +import jakarta.ejb.EJB; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.view.ViewScoped; +import jakarta.inject.Named; +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; + +import tse.practico1.Usuario; + +@Named("inicioBean") +@ViewScoped +public class InicioBean implements Serializable { + + + private static final long serialVersionUID = 1L; + + @EJB + tse.practico1.UsuarioRemote usuarioRemote; + + private String nombreBuscado; + private Usuario usuarioBuscado; + + private String nombre; + private String anioNacimiento; + private String fechaRegistro; + + private List<Usuario> usuarios; + + + public InicioBean() { + } + + @PostConstruct + public void init() { + this.usuarios = usuarioRemote.listaUsuarios(); + } + + public String getNombreBuscado() { return this.nombreBuscado; } + public void setNombreBuscado(String nombreBuscado) { this.nombreBuscado = nombreBuscado; } + public Usuario getUsuarioBuscado() { return this.usuarioBuscado; } + public void setUsuarioBuscado(Usuario usuarioBuscado) { this.usuarioBuscado = usuarioBuscado; } + + public String getNombre() { return this.nombre; } + public void setNombre(String nombre) { this.nombre = nombre; } + public String getAnioNacimiento() { return this.anioNacimiento; } + public void setAnioNacimiento(String anioNacimiento) { this.anioNacimiento = anioNacimiento; } + public String getFechaRegistro() { return this.fechaRegistro; } + public void setFechaRegistro(String fechaRegistro) { this.fechaRegistro = fechaRegistro; } + + public List<Usuario> getUsuarios() { return this.usuarios; } + public void setUsuarios(List<Usuario> usuarios) { this.usuarios = usuarios; } + + public String buscarUsuario() { + this.usuarioBuscado = usuarioRemote.buscarUsuario(nombreBuscado); + return "buscarUsuario"; + } + + public String listarUsuarios() { + return "listaUsuarios"; + } + + public String crearUsuario() { + usuarioRemote.altaUsuario(nombre, Integer.parseInt(anioNacimiento), LocalDate.parse(fechaRegistro)); + return "crearUsuario"; + } + + public String volverAlInicio() { + return "volverAlInicio"; + } +} diff --git a/web/src/main/webapp/WEB-INF/beans.xml b/web/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..31098cbdd3a902ac979f6257560d3f90c1322e92 --- /dev/null +++ b/web/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans version="4.0" + xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + https://jakarta.ee/xml/ns/jakartaee + https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd" + bean-discovery-mode="annotated"> + + <!-- This descriptor configures Context and Dependeny Injection. + Actually, CDI 1.1 does not require this file. But the archetype contains it anyway to avoid deloyment errors for blank projects (WFLY-13306) --> + +</beans> \ No newline at end of file diff --git a/web/src/main/webapp/WEB-INF/faces-config.xml b/web/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..a54fa96156d999a9d72d5275574b923b52d087bd --- /dev/null +++ b/web/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,50 @@ +<?xml version="1.0"?> +<!-- This file is not required if you don't need any extra configuration. --> +<faces-config version="4.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + https://jakarta.ee/xml/ns/jakartaee + https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd"> + + <!-- This descriptor activates the JSF Servlet --> + <navigation-rule> + <from-view-id>/index.xhtml</from-view-id> + <navigation-case> + <from-outcome>crearUsuario</from-outcome> + <to-view-id>/usuario_creado.xhtml</to-view-id> + </navigation-case> + <navigation-case> + <from-outcome>listaUsuarios</from-outcome> + <to-view-id>/lista_usuarios.xhtml</to-view-id> + </navigation-case> + <navigation-case> + <from-outcome>buscarUsuario</from-outcome> + <to-view-id>/detalle_usuario.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> + <from-view-id>/usuario_creado.xhtml</from-view-id> + <navigation-case> + <from-outcome>volverAlInicio</from-outcome> + <to-view-id>/index.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> + <from-view-id>/detalle_usuario.xhtml</from-view-id> + <navigation-case> + <from-outcome>volverAlInicio</from-outcome> + <to-view-id>/index.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> + <from-view-id>/lista_usuarios.xhtml</from-view-id> + <navigation-case> + <from-outcome>volverAlInicio</from-outcome> + <to-view-id>/index.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + + <!-- Write your navigation rules here. You are encouraged to use CDI for + creating @Named managed beans. --> + +</faces-config> diff --git a/web/src/main/webapp/WEB-INF/web.xml b/web/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..af9dd6cf1f7165bef28b1e9f4407ac14f3a878f0 --- /dev/null +++ b/web/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://jakarta.ee/xml/ns/jakartaee" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" version="6.0"> + <display-name>practico1-web</display-name> + <servlet-mapping> + <servlet-name>Inicio</servlet-name> + <url-pattern>/</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>UsuarioCreado</servlet-name> + <url-pattern>/usuario_creado</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>DetalleUsuario</servlet-name> + <url-pattern>/detalle_usuario</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>ListaUsuarios</servlet-name> + <url-pattern>/lista_usuarios</url-pattern> + </servlet-mapping> +</web-app> \ No newline at end of file diff --git a/web/src/main/webapp/detalle_usuario.jsp b/web/src/main/webapp/detalle_usuario.jsp new file mode 100644 index 0000000000000000000000000000000000000000..b0262eee6c8c2b568dfae2d9797f5e3018ccaddb --- /dev/null +++ b/web/src/main/webapp/detalle_usuario.jsp @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<%@ page import="tse.practico1.Usuario" %> +<html> +<head> +<meta charset="UTF-8"> +<title>Práctico 1</title> +</head> +<body> +<% + Usuario usuario = (Usuario) request.getAttribute("usuario"); + if (usuario != null) { +%> +<h2>Datos del Usuario: </h2> +<p>Nombre: ${usuario.getNombre()}</p> +<p>Año de nacimiento: ${usuario.getAñoNacimiento()}</p> +<p>Ingresado el: ${usuario.getFechaRegistro()}</p> +<% + } else { +%> +<h2>No existe un usuario con el nombre ingresado. </h2> +<% + } +%> +</body> +</html> \ No newline at end of file diff --git a/web/src/main/webapp/detalle_usuario.xhtml b/web/src/main/webapp/detalle_usuario.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..fc6471a28c7e74bdebe3e550530b6711e3a06f56 --- /dev/null +++ b/web/src/main/webapp/detalle_usuario.xhtml @@ -0,0 +1,21 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html"> + + <body> + <h:panelGroup rendered="#{inicioBean.usuarioBuscado != null}"> + <h:outputLabel value="Datos del usuario: " /> + <h:outputLabel value="Nombre: #{inicioBean.nombre}" for="nombre" /> + <h:outputLabel value="Año de nacimiento: #{inicioBean.anioNacimiento}" for="nombre" /> + <h:outputLabel value="Ingresado el: #{inicioBean.fechaRegistro}" for="nombre" /> + </h:panelGroup> + <h:panelGroup rendered="#{inicioBean.usuarioBuscado == null}"> + <h:outputLabel value="Usuario no encontrado" /> + </h:panelGroup> + <h:form method="POST"> + <h:commandButton value="Volver al inicio" action="#{inicioBean.volverAlInicio}"/> + </h:form> + </body> +</html> \ No newline at end of file diff --git a/web/src/main/webapp/index.jsp b/web/src/main/webapp/index.jsp new file mode 100644 index 0000000000000000000000000000000000000000..2c0f8a2a5b0154b50eecf5f65fa4fdf5711bf070 --- /dev/null +++ b/web/src/main/webapp/index.jsp @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="UTF-8"> +<title>Inicio</title> +</head> +<body> +<form action="detalle_usuario" method="POST"> + <h3>Buscar Usuario</h3> + Ingrese el nombre del Usuario: <input name="nombreBuscado" required/> + <button type="submit">Buscar Usuario</button> +</form> +<form action="usuario_creado" method="POST"> + <h3>Crear Usuario</h3> + <label>Nombre: <input name="nombre" required/></label> + <label>Año de Nacimiento: <input name="añoNacimiento" required/></label> + <label>Fecha de Registro: <input name="fechaRegistro" required/></label> + <button type="submit">Crear nuevo Usuario</button> +</form> +<form action="lista_usuarios" method="POST"> + <button type="submit">Listar Usuarios</button> +</form> +</body> +</html> \ No newline at end of file diff --git a/web/src/main/webapp/index.xhtml b/web/src/main/webapp/index.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..bf0cf123be50685f47185269ac07f38af75eac2e --- /dev/null +++ b/web/src/main/webapp/index.xhtml @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:p="http://primefaces.org/ui"> + + <body> + <h:form method="POST"> + <h3>Buscar Usuario</h3> + <p:outputLabel value="Ingrese el nombre del Usuario:" for="nombre" /> + <h:inputText id="nombreBuscado" value="#{inicioBean.nombreBuscado}" required="true" requiredMessage="Ingrese un nombre."/> + <h:commandButton value="Buscar Usuario" action="#{inicioBean.buscarUsuario}"/> + <h:message for="nombreBuscado" style="color:red"/> + </h:form> + <h:form method="POST"> + <h3>Crear Usuario</h3> + <h:outputLabel value="Nombre:"/> <h:inputText id="nombre" value="#{inicioBean.nombre}" required="true" requiredMessage="Ingrese un nombre. "/> + <h:outputLabel value="Año de Nacimiento:"/> <h:inputText id="anioNacimiento" value="#{inicioBean.anioNacimiento}" required="true" requiredMessage="Ingrese un año. "/> + <h:outputLabel value="Fecha de Registro:"/> <h:inputText id="fechaRegistro" value="#{inicioBean.fechaRegistro}" required="true" requiredMessage="Ingrese una fecha."/> + <h:commandButton value="Crear nuevo Usuario" action="#{inicioBean.crearUsuario}"/> + <h:message for="nombre" style="color:red"/> + <h:message for="anioNacimiento" style="color:red"/> + <h:message for="fechaRegistro" style="color:red"/> + </h:form> + <h:form method="POST"> + <h3>Listar Usuarios</h3> + <h:commandButton value="Listar Usuarios" action="#{inicioBean.listarUsuarios}"/> + </h:form> + </body> +</html> \ No newline at end of file diff --git a/web/src/main/webapp/lista_usuarios.jsp b/web/src/main/webapp/lista_usuarios.jsp new file mode 100644 index 0000000000000000000000000000000000000000..f848f3116f0ef7efdc45a6ee1a8a84ea345091b5 --- /dev/null +++ b/web/src/main/webapp/lista_usuarios.jsp @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<%@ page import="java.util.List" %> +<%@ page import="tse.practico1.Usuario" %> +<html> +<head> +<meta charset="UTF-8"> +<title>Práctico 1</title> +</head> +<body> +<h2>Usuarios:</h3> + +<% + // Recuperamos el array enviado desde el servlet + List<Usuario> usuarios = (List<Usuario>) request.getAttribute("usuarios"); + + // Recorremos el array y mostramos los elementos en una lista + if (usuarios != null){ + for (Usuario item : usuarios) { + %> + <h3>Datos del Usuario: </h2> + <li>Nombre: <%= item.getNombre() %></li> + <li>Año de nacimiento: <%= item.getAñoNacimiento() %></li> + <li>Fecha de registro: <%= item.getFechaRegistro() %></li> + <% + } + } + %> +</body> +</html> \ No newline at end of file diff --git a/web/src/main/webapp/lista_usuarios.xhtml b/web/src/main/webapp/lista_usuarios.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..b9f81efed4f64e8825d2d038abffe5c8a07481be --- /dev/null +++ b/web/src/main/webapp/lista_usuarios.xhtml @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html"> + + <ui:composition> + <body> + <h2>Usuarios:</h2> + <div class="card"> + <h:dataTable value="#{inicioBean.usuarios}" var="usuario" paginator="true" rows="10"> + <h:column headerText="Nombre"> + <h:outputText value="#{usuario.nombre}" /> + </h:column> + <h:column headerText="Año de Nacimiento"> + <h:outputText value="#{usuario.añoNacimiento}" /> + </h:column> + <h:column headerText="Fecha de ingreso"> + <h:outputText value="#{usuario.fechaRegistro}" /> + </h:column> + </h:dataTable> + </div> + <h:panelGroup rendered="#{inicioBean.usuarios.size() == 0}"> + <h:outputLabel>No existen Usuarios ingresados en el sistema.</h:outputLabel> + </h:panelGroup> + <h:form method="POST"> + <h:commandButton value="Volver al inicio" action="#{inicioBean.volverAlInicio}"/> + </h:form> + </body> + </ui:composition> +</html> \ No newline at end of file diff --git a/web/src/main/webapp/usuario_creado.jsp b/web/src/main/webapp/usuario_creado.jsp new file mode 100644 index 0000000000000000000000000000000000000000..da6176df9cf924521925d9093bcb24c6f63b31d2 --- /dev/null +++ b/web/src/main/webapp/usuario_creado.jsp @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="UTF-8"> +<title>Práctico 1</title> +</head> +<body> +<h2>Usuario creado: </h2> +<p>Nombre: ${usuario.getNombre()}</p> +<p>Año de nacimiento: ${usuario.getAñoNacimiento()}</p> +<p>Ingresado el: ${usuario.getFechaRegistro()}</p> +<form action="Inicio" method="POST"> + <button type="submit">Volver al inicio</button> +</form> +</body> +</html> \ No newline at end of file diff --git a/web/src/main/webapp/usuario_creado.xhtml b/web/src/main/webapp/usuario_creado.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..56ee4c6da6a1604d9eb68c42c8152546a8451a07 --- /dev/null +++ b/web/src/main/webapp/usuario_creado.xhtml @@ -0,0 +1,18 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html"> + + <ui:composition> + <body> + <h:outputLabel value="Usuario creado" /> + <h:outputLabel value="Nombre: #{inicioBean.nombre}" for="nombre" /> + <h:outputLabel value="Año de nacimiento: #{inicioBean.anioNacimiento}" for="nombre" /> + <h:outputLabel value="Ingresado el: #{inicioBean.fechaRegistro}" for="nombre" /> + <h:form method="POST"> + <h:commandButton value="Volver al inicio" action="#{inicioBean.volverAlInicio}"/> + </h:form> + </body> + </ui:composition> +</html> \ No newline at end of file diff --git a/web/src/test/resources/arquillian.xml b/web/src/test/resources/arquillian.xml new file mode 100644 index 0000000000000000000000000000000000000000..984d4c04c1507fd18215dfdb9a1e6df2fbb01330 --- /dev/null +++ b/web/src/test/resources/arquillian.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2017, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://jboss.org/schema/arquillian + http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> + + <!-- Force the use of the Servlet 5.0 protocol with all containers - it is the only supported version here --> + <defaultProtocol type="Servlet 5.0" /> + + <!-- Uncomment to have test archives exported to the file system for inspection --> + <!--<engine> + <property name="deploymentExportPath">target/</property> + </engine>--> + + <!-- Example configuration for a managed WildFly / JBoss EAP instance --> + <container qualifier="managed"> + <!-- By default, Arquillian will use the JBOSS_HOME environment variable to find the WildFly / JBoss EAP installation. + If you prefer not to define the JBOSS_HOME environment variable, alternatively you can uncomment the + following `jbossHome` property and replace EAP_HOME with the path to your WildFly / JBoss EAP installation. --> + <!--<configuration> + <property name="jbossHome">EAP_HOME</property> + </configuration> --> + </container> + + <!-- Example configuration for a remote WildFly / JBoss EAP instance --> + <container qualifier="remote"> + <!-- Arquillian will deploy to this WildFly server. --> + <configuration> + <property name="managementAddress">127.0.0.1</property> + <property name="managementPort">9990</property> + <!-- If deploying to a remote server, you have to specify username/password here --> + <!-- <property name="username">admin</property> + <property name="password">admin</property> --> + </configuration> + </container> +</arquillian> diff --git a/web/target/classes/DetalleUsuario.class b/web/target/classes/DetalleUsuario.class new file mode 100644 index 0000000000000000000000000000000000000000..6925335aecc7d0452c5622da3bd138f971d59727 Binary files /dev/null and b/web/target/classes/DetalleUsuario.class differ diff --git a/web/target/classes/Inicio.class b/web/target/classes/Inicio.class new file mode 100644 index 0000000000000000000000000000000000000000..badaba5a5b32144b91630d004beab726cc899e7f Binary files /dev/null and b/web/target/classes/Inicio.class differ diff --git a/web/target/classes/ListaUsuarios.class b/web/target/classes/ListaUsuarios.class new file mode 100644 index 0000000000000000000000000000000000000000..3697d8208ca556393cd5f246843cb8ce0380c867 Binary files /dev/null and b/web/target/classes/ListaUsuarios.class differ diff --git a/web/target/classes/UsuarioCreado.class b/web/target/classes/UsuarioCreado.class new file mode 100644 index 0000000000000000000000000000000000000000..7655d979944a49f75c340ce8aa725fa0e94b0c6e Binary files /dev/null and b/web/target/classes/UsuarioCreado.class differ diff --git a/web/target/classes/beans/InicioBean.class b/web/target/classes/beans/InicioBean.class new file mode 100644 index 0000000000000000000000000000000000000000..127d624b49150905846ca27fea50f25c3c92d639 Binary files /dev/null and b/web/target/classes/beans/InicioBean.class differ diff --git a/web/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF b/web/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..9bdf3b1f360838ed2fb5b967e741c8fa187252b9 --- /dev/null +++ b/web/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Build-Jdk-Spec: 21 +Created-By: Maven Integration for Eclipse + diff --git a/web/target/m2e-wtp/web-resources/META-INF/maven/tse/practico1-web/pom.properties b/web/target/m2e-wtp/web-resources/META-INF/maven/tse/practico1-web/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..ff569806ed25947bbae98d16563f7060702cdde9 --- /dev/null +++ b/web/target/m2e-wtp/web-resources/META-INF/maven/tse/practico1-web/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Sun Sep 15 01:57:47 BRT 2024 +artifactId=practico1-web +groupId=tse +m2e.projectLocation=C\:\\Users\\fedma\\eclipse-workspace\\practico1\\web +m2e.projectName=practico1-web +version=0.0.1-SNAPSHOT diff --git a/web/target/m2e-wtp/web-resources/META-INF/maven/tse/practico1-web/pom.xml b/web/target/m2e-wtp/web-resources/META-INF/maven/tse/practico1-web/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..43e242722ba105639803be9e3579044b75011925 --- /dev/null +++ b/web/target/m2e-wtp/web-resources/META-INF/maven/tse/practico1-web/pom.xml @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>tse</groupId> + <artifactId>practico1</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>practico1-web</artifactId> + <packaging>war</packaging> + <name>practico1 - web</name> + <description>This is the web POM file</description> + + <dependencies> + + <!-- Import the CDI API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.enterprise</groupId> + <artifactId>jakarta.enterprise.cdi-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Bean Validation Implementation + Provides portable constraints such as @Email + Hibernate Validator is shipped in WildFly / JBoss EAP --> + <dependency> + <groupId>org.hibernate.validator</groupId> + <artifactId>hibernate-validator</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Import the JPA API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.persistence</groupId> + <artifactId>jakarta.persistence-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Dependency on the EJB module so we can use it's services if needed --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>practico1-ejb</artifactId> + <type>ejb</type> + <scope>provided</scope> + </dependency> + + <!-- Import the JSF API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.faces</groupId> + <artifactId>jakarta.faces-api</artifactId> + <scope>provided</scope> + + </dependency> + + <!-- Import the JAX-RS API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.ws.rs</groupId> + <artifactId>jakarta.ws.rs-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Servlet API --> + <dependency> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Import the EJB API, we use provided scope as the API is included in WildFly / JBoss EAP --> + <dependency> + <groupId>jakarta.ejb</groupId> + <artifactId>jakarta.ejb-api</artifactId> + <scope>provided</scope> + </dependency> + <!-- Required for e.g. "javax.annotation.PostConstruct" --> + <dependency> + <groupId>jakarta.annotation</groupId> + <artifactId>jakarta.annotation-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- Test scope dependencies --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + + <!-- Optional, but highly recommended --> + <!-- Arquillian allows you to test enterprise code such as EJBs and + Transactional(JTA) JPA from JUnit/TestNG --> + <dependency> + <groupId>org.jboss.arquillian.junit5</groupId> + <artifactId>arquillian-junit5-container</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <!-- Tell Maven that the resulting file should not have a file name containing the version - + a non versioned name is required e.g. when building a deployable artifact using the ShrinkWrap API --> + <finalName>${project.artifactId}</finalName> + + <plugins> + <!--Build configuration for the WAR plugin: --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>${version.war.plugin}</version> + <configuration> + <!-- Jakarta EE doesn't require web.xml, Maven needs to catch up! --> + <failOnMissingWebXml>false</failOnMissingWebXml> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/web/target/maven-archiver/pom.properties b/web/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..b4497c3d0a7482fa4b5cf7ec0eff3b04d71e107f --- /dev/null +++ b/web/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=practico1-web +groupId=tse +version=0.0.1-SNAPSHOT diff --git a/web/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/web/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..309eeb938604211d5780e058c2e45b59174a38d6 --- /dev/null +++ b/web/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,5 @@ +Inicio.class +beans\InicioBean.class +DetalleUsuario.class +UsuarioCreado.class +ListaUsuarios.class diff --git a/web/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/web/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..36ee0acb9502d7a867242fb25ef54da10fe95aed --- /dev/null +++ b/web/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,5 @@ +C:\Users\fedma\eclipse-workspace\practico1\web\src\main\java\beans\InicioBean.java +C:\Users\fedma\eclipse-workspace\practico1\web\src\main\java\DetalleUsuario.java +C:\Users\fedma\eclipse-workspace\practico1\web\src\main\java\Inicio.java +C:\Users\fedma\eclipse-workspace\practico1\web\src\main\java\ListaUsuarios.java +C:\Users\fedma\eclipse-workspace\practico1\web\src\main\java\UsuarioCreado.java diff --git a/web/target/practico1-web.war b/web/target/practico1-web.war new file mode 100644 index 0000000000000000000000000000000000000000..ddde1bf20149e0ae8f754d88dc0e1e8d28410ad8 Binary files /dev/null and b/web/target/practico1-web.war differ diff --git a/web/target/practico1-web/WEB-INF/beans.xml b/web/target/practico1-web/WEB-INF/beans.xml new file mode 100644 index 0000000000000000000000000000000000000000..31098cbdd3a902ac979f6257560d3f90c1322e92 --- /dev/null +++ b/web/target/practico1-web/WEB-INF/beans.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans version="4.0" + xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + https://jakarta.ee/xml/ns/jakartaee + https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd" + bean-discovery-mode="annotated"> + + <!-- This descriptor configures Context and Dependeny Injection. + Actually, CDI 1.1 does not require this file. But the archetype contains it anyway to avoid deloyment errors for blank projects (WFLY-13306) --> + +</beans> \ No newline at end of file diff --git a/web/target/practico1-web/WEB-INF/classes/DetalleUsuario.class b/web/target/practico1-web/WEB-INF/classes/DetalleUsuario.class new file mode 100644 index 0000000000000000000000000000000000000000..4990ee85b5222d72e2dd0068008ad0ebf7a7d5ed Binary files /dev/null and b/web/target/practico1-web/WEB-INF/classes/DetalleUsuario.class differ diff --git a/web/target/practico1-web/WEB-INF/classes/Inicio.class b/web/target/practico1-web/WEB-INF/classes/Inicio.class new file mode 100644 index 0000000000000000000000000000000000000000..23d80edf2207c0acb8fc9409166cf99ddb7df35c Binary files /dev/null and b/web/target/practico1-web/WEB-INF/classes/Inicio.class differ diff --git a/web/target/practico1-web/WEB-INF/classes/ListaUsuarios.class b/web/target/practico1-web/WEB-INF/classes/ListaUsuarios.class new file mode 100644 index 0000000000000000000000000000000000000000..b34c4777be6570e904b74a029f31de27a7c4a4fb Binary files /dev/null and b/web/target/practico1-web/WEB-INF/classes/ListaUsuarios.class differ diff --git a/web/target/practico1-web/WEB-INF/classes/UsuarioCreado.class b/web/target/practico1-web/WEB-INF/classes/UsuarioCreado.class new file mode 100644 index 0000000000000000000000000000000000000000..2ac77edd739da34d230b064d9076813e602a454d Binary files /dev/null and b/web/target/practico1-web/WEB-INF/classes/UsuarioCreado.class differ diff --git a/web/target/practico1-web/WEB-INF/classes/beans/InicioBean.class b/web/target/practico1-web/WEB-INF/classes/beans/InicioBean.class new file mode 100644 index 0000000000000000000000000000000000000000..39b4ea2042464682b6ccecfbec3bda69367c051f Binary files /dev/null and b/web/target/practico1-web/WEB-INF/classes/beans/InicioBean.class differ diff --git a/web/target/practico1-web/WEB-INF/faces-config.xml b/web/target/practico1-web/WEB-INF/faces-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..a54fa96156d999a9d72d5275574b923b52d087bd --- /dev/null +++ b/web/target/practico1-web/WEB-INF/faces-config.xml @@ -0,0 +1,50 @@ +<?xml version="1.0"?> +<!-- This file is not required if you don't need any extra configuration. --> +<faces-config version="4.0" xmlns="https://jakarta.ee/xml/ns/jakartaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + https://jakarta.ee/xml/ns/jakartaee + https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd"> + + <!-- This descriptor activates the JSF Servlet --> + <navigation-rule> + <from-view-id>/index.xhtml</from-view-id> + <navigation-case> + <from-outcome>crearUsuario</from-outcome> + <to-view-id>/usuario_creado.xhtml</to-view-id> + </navigation-case> + <navigation-case> + <from-outcome>listaUsuarios</from-outcome> + <to-view-id>/lista_usuarios.xhtml</to-view-id> + </navigation-case> + <navigation-case> + <from-outcome>buscarUsuario</from-outcome> + <to-view-id>/detalle_usuario.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> + <from-view-id>/usuario_creado.xhtml</from-view-id> + <navigation-case> + <from-outcome>volverAlInicio</from-outcome> + <to-view-id>/index.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> + <from-view-id>/detalle_usuario.xhtml</from-view-id> + <navigation-case> + <from-outcome>volverAlInicio</from-outcome> + <to-view-id>/index.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> + <from-view-id>/lista_usuarios.xhtml</from-view-id> + <navigation-case> + <from-outcome>volverAlInicio</from-outcome> + <to-view-id>/index.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + + <!-- Write your navigation rules here. You are encouraged to use CDI for + creating @Named managed beans. --> + +</faces-config> diff --git a/web/target/practico1-web/WEB-INF/lib/jakarta.faces-4.1.1.jar b/web/target/practico1-web/WEB-INF/lib/jakarta.faces-4.1.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..f2a9e35dbc86e9e0a5b00e1250d255e771d9c35c Binary files /dev/null and b/web/target/practico1-web/WEB-INF/lib/jakarta.faces-4.1.1.jar differ diff --git a/web/target/practico1-web/WEB-INF/lib/primefaces-14.0.5.jar b/web/target/practico1-web/WEB-INF/lib/primefaces-14.0.5.jar new file mode 100644 index 0000000000000000000000000000000000000000..fef9471abcd63e2bdee560b58c01c908619fcd38 Binary files /dev/null and b/web/target/practico1-web/WEB-INF/lib/primefaces-14.0.5.jar differ diff --git a/web/target/practico1-web/WEB-INF/web.xml b/web/target/practico1-web/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..af9dd6cf1f7165bef28b1e9f4407ac14f3a878f0 --- /dev/null +++ b/web/target/practico1-web/WEB-INF/web.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://jakarta.ee/xml/ns/jakartaee" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" version="6.0"> + <display-name>practico1-web</display-name> + <servlet-mapping> + <servlet-name>Inicio</servlet-name> + <url-pattern>/</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>UsuarioCreado</servlet-name> + <url-pattern>/usuario_creado</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>DetalleUsuario</servlet-name> + <url-pattern>/detalle_usuario</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>ListaUsuarios</servlet-name> + <url-pattern>/lista_usuarios</url-pattern> + </servlet-mapping> +</web-app> \ No newline at end of file diff --git a/web/target/practico1-web/detalle_usuario.jsp b/web/target/practico1-web/detalle_usuario.jsp new file mode 100644 index 0000000000000000000000000000000000000000..b0262eee6c8c2b568dfae2d9797f5e3018ccaddb --- /dev/null +++ b/web/target/practico1-web/detalle_usuario.jsp @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<%@ page import="tse.practico1.Usuario" %> +<html> +<head> +<meta charset="UTF-8"> +<title>Práctico 1</title> +</head> +<body> +<% + Usuario usuario = (Usuario) request.getAttribute("usuario"); + if (usuario != null) { +%> +<h2>Datos del Usuario: </h2> +<p>Nombre: ${usuario.getNombre()}</p> +<p>Año de nacimiento: ${usuario.getAñoNacimiento()}</p> +<p>Ingresado el: ${usuario.getFechaRegistro()}</p> +<% + } else { +%> +<h2>No existe un usuario con el nombre ingresado. </h2> +<% + } +%> +</body> +</html> \ No newline at end of file diff --git a/web/target/practico1-web/detalle_usuario.xhtml b/web/target/practico1-web/detalle_usuario.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..fc6471a28c7e74bdebe3e550530b6711e3a06f56 --- /dev/null +++ b/web/target/practico1-web/detalle_usuario.xhtml @@ -0,0 +1,21 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html"> + + <body> + <h:panelGroup rendered="#{inicioBean.usuarioBuscado != null}"> + <h:outputLabel value="Datos del usuario: " /> + <h:outputLabel value="Nombre: #{inicioBean.nombre}" for="nombre" /> + <h:outputLabel value="Año de nacimiento: #{inicioBean.anioNacimiento}" for="nombre" /> + <h:outputLabel value="Ingresado el: #{inicioBean.fechaRegistro}" for="nombre" /> + </h:panelGroup> + <h:panelGroup rendered="#{inicioBean.usuarioBuscado == null}"> + <h:outputLabel value="Usuario no encontrado" /> + </h:panelGroup> + <h:form method="POST"> + <h:commandButton value="Volver al inicio" action="#{inicioBean.volverAlInicio}"/> + </h:form> + </body> +</html> \ No newline at end of file diff --git a/web/target/practico1-web/index.jsp b/web/target/practico1-web/index.jsp new file mode 100644 index 0000000000000000000000000000000000000000..2c0f8a2a5b0154b50eecf5f65fa4fdf5711bf070 --- /dev/null +++ b/web/target/practico1-web/index.jsp @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="UTF-8"> +<title>Inicio</title> +</head> +<body> +<form action="detalle_usuario" method="POST"> + <h3>Buscar Usuario</h3> + Ingrese el nombre del Usuario: <input name="nombreBuscado" required/> + <button type="submit">Buscar Usuario</button> +</form> +<form action="usuario_creado" method="POST"> + <h3>Crear Usuario</h3> + <label>Nombre: <input name="nombre" required/></label> + <label>Año de Nacimiento: <input name="añoNacimiento" required/></label> + <label>Fecha de Registro: <input name="fechaRegistro" required/></label> + <button type="submit">Crear nuevo Usuario</button> +</form> +<form action="lista_usuarios" method="POST"> + <button type="submit">Listar Usuarios</button> +</form> +</body> +</html> \ No newline at end of file diff --git a/web/target/practico1-web/index.xhtml b/web/target/practico1-web/index.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..bf0cf123be50685f47185269ac07f38af75eac2e --- /dev/null +++ b/web/target/practico1-web/index.xhtml @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:p="http://primefaces.org/ui"> + + <body> + <h:form method="POST"> + <h3>Buscar Usuario</h3> + <p:outputLabel value="Ingrese el nombre del Usuario:" for="nombre" /> + <h:inputText id="nombreBuscado" value="#{inicioBean.nombreBuscado}" required="true" requiredMessage="Ingrese un nombre."/> + <h:commandButton value="Buscar Usuario" action="#{inicioBean.buscarUsuario}"/> + <h:message for="nombreBuscado" style="color:red"/> + </h:form> + <h:form method="POST"> + <h3>Crear Usuario</h3> + <h:outputLabel value="Nombre:"/> <h:inputText id="nombre" value="#{inicioBean.nombre}" required="true" requiredMessage="Ingrese un nombre. "/> + <h:outputLabel value="Año de Nacimiento:"/> <h:inputText id="anioNacimiento" value="#{inicioBean.anioNacimiento}" required="true" requiredMessage="Ingrese un año. "/> + <h:outputLabel value="Fecha de Registro:"/> <h:inputText id="fechaRegistro" value="#{inicioBean.fechaRegistro}" required="true" requiredMessage="Ingrese una fecha."/> + <h:commandButton value="Crear nuevo Usuario" action="#{inicioBean.crearUsuario}"/> + <h:message for="nombre" style="color:red"/> + <h:message for="anioNacimiento" style="color:red"/> + <h:message for="fechaRegistro" style="color:red"/> + </h:form> + <h:form method="POST"> + <h3>Listar Usuarios</h3> + <h:commandButton value="Listar Usuarios" action="#{inicioBean.listarUsuarios}"/> + </h:form> + </body> +</html> \ No newline at end of file diff --git a/web/target/practico1-web/lista_usuarios.jsp b/web/target/practico1-web/lista_usuarios.jsp new file mode 100644 index 0000000000000000000000000000000000000000..f848f3116f0ef7efdc45a6ee1a8a84ea345091b5 --- /dev/null +++ b/web/target/practico1-web/lista_usuarios.jsp @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<%@ page import="java.util.List" %> +<%@ page import="tse.practico1.Usuario" %> +<html> +<head> +<meta charset="UTF-8"> +<title>Práctico 1</title> +</head> +<body> +<h2>Usuarios:</h3> + +<% + // Recuperamos el array enviado desde el servlet + List<Usuario> usuarios = (List<Usuario>) request.getAttribute("usuarios"); + + // Recorremos el array y mostramos los elementos en una lista + if (usuarios != null){ + for (Usuario item : usuarios) { + %> + <h3>Datos del Usuario: </h2> + <li>Nombre: <%= item.getNombre() %></li> + <li>Año de nacimiento: <%= item.getAñoNacimiento() %></li> + <li>Fecha de registro: <%= item.getFechaRegistro() %></li> + <% + } + } + %> +</body> +</html> \ No newline at end of file diff --git a/web/target/practico1-web/lista_usuarios.xhtml b/web/target/practico1-web/lista_usuarios.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..b9f81efed4f64e8825d2d038abffe5c8a07481be --- /dev/null +++ b/web/target/practico1-web/lista_usuarios.xhtml @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html"> + + <ui:composition> + <body> + <h2>Usuarios:</h2> + <div class="card"> + <h:dataTable value="#{inicioBean.usuarios}" var="usuario" paginator="true" rows="10"> + <h:column headerText="Nombre"> + <h:outputText value="#{usuario.nombre}" /> + </h:column> + <h:column headerText="Año de Nacimiento"> + <h:outputText value="#{usuario.añoNacimiento}" /> + </h:column> + <h:column headerText="Fecha de ingreso"> + <h:outputText value="#{usuario.fechaRegistro}" /> + </h:column> + </h:dataTable> + </div> + <h:panelGroup rendered="#{inicioBean.usuarios.size() == 0}"> + <h:outputLabel>No existen Usuarios ingresados en el sistema.</h:outputLabel> + </h:panelGroup> + <h:form method="POST"> + <h:commandButton value="Volver al inicio" action="#{inicioBean.volverAlInicio}"/> + </h:form> + </body> + </ui:composition> +</html> \ No newline at end of file diff --git a/web/target/practico1-web/usuario_creado.jsp b/web/target/practico1-web/usuario_creado.jsp new file mode 100644 index 0000000000000000000000000000000000000000..da6176df9cf924521925d9093bcb24c6f63b31d2 --- /dev/null +++ b/web/target/practico1-web/usuario_creado.jsp @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="UTF-8"> +<title>Práctico 1</title> +</head> +<body> +<h2>Usuario creado: </h2> +<p>Nombre: ${usuario.getNombre()}</p> +<p>Año de nacimiento: ${usuario.getAñoNacimiento()}</p> +<p>Ingresado el: ${usuario.getFechaRegistro()}</p> +<form action="Inicio" method="POST"> + <button type="submit">Volver al inicio</button> +</form> +</body> +</html> \ No newline at end of file diff --git a/web/target/practico1-web/usuario_creado.xhtml b/web/target/practico1-web/usuario_creado.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..56ee4c6da6a1604d9eb68c42c8152546a8451a07 --- /dev/null +++ b/web/target/practico1-web/usuario_creado.xhtml @@ -0,0 +1,18 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html"> + + <ui:composition> + <body> + <h:outputLabel value="Usuario creado" /> + <h:outputLabel value="Nombre: #{inicioBean.nombre}" for="nombre" /> + <h:outputLabel value="Año de nacimiento: #{inicioBean.anioNacimiento}" for="nombre" /> + <h:outputLabel value="Ingresado el: #{inicioBean.fechaRegistro}" for="nombre" /> + <h:form method="POST"> + <h:commandButton value="Volver al inicio" action="#{inicioBean.volverAlInicio}"/> + </h:form> + </body> + </ui:composition> +</html> \ No newline at end of file diff --git a/web/target/test-classes/arquillian.xml b/web/target/test-classes/arquillian.xml new file mode 100644 index 0000000000000000000000000000000000000000..984d4c04c1507fd18215dfdb9a1e6df2fbb01330 --- /dev/null +++ b/web/target/test-classes/arquillian.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + JBoss, Home of Professional Open Source + Copyright 2017, Red Hat, Inc. and/or its affiliates, and individual + contributors by the @authors tag. See the copyright.txt in the + distribution for a full listing of individual contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://jboss.org/schema/arquillian + http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> + + <!-- Force the use of the Servlet 5.0 protocol with all containers - it is the only supported version here --> + <defaultProtocol type="Servlet 5.0" /> + + <!-- Uncomment to have test archives exported to the file system for inspection --> + <!--<engine> + <property name="deploymentExportPath">target/</property> + </engine>--> + + <!-- Example configuration for a managed WildFly / JBoss EAP instance --> + <container qualifier="managed"> + <!-- By default, Arquillian will use the JBOSS_HOME environment variable to find the WildFly / JBoss EAP installation. + If you prefer not to define the JBOSS_HOME environment variable, alternatively you can uncomment the + following `jbossHome` property and replace EAP_HOME with the path to your WildFly / JBoss EAP installation. --> + <!--<configuration> + <property name="jbossHome">EAP_HOME</property> + </configuration> --> + </container> + + <!-- Example configuration for a remote WildFly / JBoss EAP instance --> + <container qualifier="remote"> + <!-- Arquillian will deploy to this WildFly server. --> + <configuration> + <property name="managementAddress">127.0.0.1</property> + <property name="managementPort">9990</property> + <!-- If deploying to a remote server, you have to specify username/password here --> + <!-- <property name="username">admin</property> + <property name="password">admin</property> --> + </configuration> + </container> +</arquillian>