From: Roland Haeder Date: Sat, 9 Apr 2016 18:32:17 +0000 (+0200) Subject: Turned master (EE)+ejb project into separate master (triangle) and EJB project X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=26a7be21e6b7edba3f3535198e6847d2785cb536;p=pizzaservice-ejb.git Turned master (EE)+ejb project into separate master (triangle) and EJB project --- diff --git a/INSTALL.txt b/INSTALL.txt deleted file mode 100644 index 5dce97b..0000000 --- a/INSTALL.txt +++ /dev/null @@ -1,46 +0,0 @@ -Installation instructions: -========================== - -0) Create an empty database and setup proper permissions - -1) (Import install/install.sql into your new database) Currently DROP+CREATE - -2) Setup a JDBC pool. I took the simple driver: - -Pool name: ShopPool -Resource type: java.sql.Driver -Driver: MySQL -Driver class: com.mysql.jdbc.Driver - -URL: jdbc:mysql://localhost/your_database -user: your_login -password: your_password - -3) Setup a JDBC resource: - -JNDI name: jdbc/shop -Pool name: ShopPool - -4) Setup a JMS connection factory: - -JNDI name: jms/shopConnectionFactory -Resource type: javax.jms.QueueConnectionFactory - -5) Setup a JMS destination resource: - -JNDI name: jms/shopCheckoutQueue -Physical destination name: checkout -Resource type: javax.jms.Queue - -You should be done now. And always try to give informative descriptions, not -just only "shop" or "factory". - -Of course, you need to build and deploy the EAR/WAR files. ;-) - -6) In juser-core project you will find a JAR named "commons-codec-1.10.jar" you - need to copy this to your $GLASSFISH_DOMAIN/lib/ path to make password - encryption working. Please setup sufficient access rights (CHMOD 0644 is - enough). - - If you forgot this file to copy and you have copied it now, please restart - the Glassfish server so the JAR can be found and loaded. diff --git a/PizzaService-ejb/build.xml b/PizzaService-ejb/build.xml deleted file mode 100644 index 0e24c24..0000000 --- a/PizzaService-ejb/build.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project PizzaService-ejb. - - - diff --git a/PizzaService-ejb/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar b/PizzaService-ejb/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar deleted file mode 100644 index eaf6790..0000000 Binary files a/PizzaService-ejb/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/cdi-api.jar b/PizzaService-ejb/lib/cdi-api.jar deleted file mode 100644 index 1fa239e..0000000 Binary files a/PizzaService-ejb/lib/cdi-api.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/eclipselink/eclipselink.jar b/PizzaService-ejb/lib/eclipselink/eclipselink.jar deleted file mode 100644 index 2b0a810..0000000 Binary files a/PizzaService-ejb/lib/eclipselink/eclipselink.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/eclipselink/javax.persistence_2.1.0.v201304241213.jar b/PizzaService-ejb/lib/eclipselink/javax.persistence_2.1.0.v201304241213.jar deleted file mode 100644 index 841d2e1..0000000 Binary files a/PizzaService-ejb/lib/eclipselink/javax.persistence_2.1.0.v201304241213.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/eclipselink/org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar b/PizzaService-ejb/lib/eclipselink/org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar deleted file mode 100644 index 001316b..0000000 Binary files a/PizzaService-ejb/lib/eclipselink/org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/eclipselinkmodelgen/org.eclipse.persistence.jpa.modelgen_2.5.2.v20140319-9ad6abd.jar b/PizzaService-ejb/lib/eclipselinkmodelgen/org.eclipse.persistence.jpa.modelgen_2.5.2.v20140319-9ad6abd.jar deleted file mode 100644 index 0135c65..0000000 Binary files a/PizzaService-ejb/lib/eclipselinkmodelgen/org.eclipse.persistence.jpa.modelgen_2.5.2.v20140319-9ad6abd.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jcontacts-core.jar b/PizzaService-ejb/lib/jcontacts-core.jar deleted file mode 100644 index 59559ef..0000000 Binary files a/PizzaService-ejb/lib/jcontacts-core.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jcore-logger-lib.jar b/PizzaService-ejb/lib/jcore-logger-lib.jar deleted file mode 100644 index 6203f5f..0000000 Binary files a/PizzaService-ejb/lib/jcore-logger-lib.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jcore.jar b/PizzaService-ejb/lib/jcore.jar deleted file mode 100644 index 478823b..0000000 Binary files a/PizzaService-ejb/lib/jcore.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jcoreee.jar b/PizzaService-ejb/lib/jcoreee.jar deleted file mode 100644 index 71d0e1c..0000000 Binary files a/PizzaService-ejb/lib/jcoreee.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jcountry-core.jar b/PizzaService-ejb/lib/jcountry-core.jar deleted file mode 100644 index 01a8041..0000000 Binary files a/PizzaService-ejb/lib/jcountry-core.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jcountry-lib.jar b/PizzaService-ejb/lib/jcountry-lib.jar deleted file mode 100644 index f8f305c..0000000 Binary files a/PizzaService-ejb/lib/jcountry-lib.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jphone-core.jar b/PizzaService-ejb/lib/jphone-core.jar deleted file mode 100644 index be67aae..0000000 Binary files a/PizzaService-ejb/lib/jphone-core.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jphone-lib.jar b/PizzaService-ejb/lib/jphone-lib.jar deleted file mode 100644 index bdeff31..0000000 Binary files a/PizzaService-ejb/lib/jphone-lib.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jshop-core.jar b/PizzaService-ejb/lib/jshop-core.jar deleted file mode 100644 index 95ea58c..0000000 Binary files a/PizzaService-ejb/lib/jshop-core.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/jshop-ee-lib.jar b/PizzaService-ejb/lib/jshop-ee-lib.jar deleted file mode 100644 index a209047..0000000 Binary files a/PizzaService-ejb/lib/jshop-ee-lib.jar and /dev/null differ diff --git a/PizzaService-ejb/lib/nblibraries.properties b/PizzaService-ejb/lib/nblibraries.properties deleted file mode 100644 index 1aac91b..0000000 --- a/PizzaService-ejb/lib/nblibraries.properties +++ /dev/null @@ -1,15 +0,0 @@ -libs.CopyLibs.classpath=\ - ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar -libs.CopyLibs.displayName=CopyLibs Task -libs.CopyLibs.prop-version=2.0 -libs.eclipselink.classpath=\ - ${base}/eclipselink/eclipselink.jar;\ - ${base}/eclipselink/javax.persistence_2.1.0.v201304241213.jar;\ - ${base}/eclipselink/org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar -libs.eclipselink.displayName=EclipseLink (JPA 2.1) -libs.eclipselink.javadoc= -libs.eclipselink.prop-maven-dependencies=\n org.eclipse.persistence:eclipselink:2.5.2:jar\n -libs.eclipselinkmodelgen.classpath=\ - ${base}/eclipselinkmodelgen/org.eclipse.persistence.jpa.modelgen_2.5.2.v20140319-9ad6abd.jar -libs.eclipselinkmodelgen.displayName=EclipseLink-ModelGen (JPA 2.1) -libs.eclipselinkmodelgen.prop-maven-dependencies=org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:2.5.2:jar diff --git a/PizzaService-ejb/nbproject/ant-deploy.xml b/PizzaService-ejb/nbproject/ant-deploy.xml deleted file mode 100644 index 2d5f877..0000000 --- a/PizzaService-ejb/nbproject/ant-deploy.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PizzaService-ejb/nbproject/build-impl.xml b/PizzaService-ejb/nbproject/build-impl.xml deleted file mode 100644 index b66085e..0000000 --- a/PizzaService-ejb/nbproject/build-impl.xml +++ /dev/null @@ -1,1278 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set build.generated.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - -The Java EE server classpath is not correctly set up - server home directory is missing. -Either open the project in the IDE and assign the server or setup the server classpath manually. -For example like this: - ant -Dj2ee.server.home=<app_server_installation_directory> - - -The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. -Either open the project in the IDE and assign the server or setup the server classpath manually. -For example like this: - ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) -or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The libs.CopyLibs.classpath property is not set up. -This property must point to -org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part -of NetBeans IDE installation and is usually located at -<netbeans_installation>/java<version>/ant/extra folder. -Either open the project in the IDE and make sure CopyLibs library -exists or setup the property manually. For example like this: - ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set main.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PizzaService-ejb/nbproject/genfiles.properties b/PizzaService-ejb/nbproject/genfiles.properties deleted file mode 100644 index 19eb5bc..0000000 --- a/PizzaService-ejb/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=0427eba4 -build.xml.script.CRC32=cabe2e92 -build.xml.stylesheet.CRC32=5910fda3@1.51.1 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=6890d152 -nbproject/build-impl.xml.script.CRC32=5087c2fa -nbproject/build-impl.xml.stylesheet.CRC32=6096d939@1.55.1 diff --git a/PizzaService-ejb/nbproject/project.properties b/PizzaService-ejb/nbproject/project.properties deleted file mode 100644 index d455a03..0000000 --- a/PizzaService-ejb/nbproject/project.properties +++ /dev/null @@ -1,108 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=true -annotation.processing.processor.options=-Aeclipselink.canonicalmodel.use_static_factory=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form,**/.nbattrs -build.dir=build -build.ear.classes.dir=${build.dir}/classes -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -debug.classpath=${javac.classpath}:${build.classes.dir} -debug.test.classpath=\ - ${run.test.classpath} -dist.dir=dist -dist.ear.jar=${dist.dir}/${jar.name} -dist.jar=${dist.dir}/${jar.name} -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.cdi-api.jar=lib/cdi-api.jar -file.reference.jcontacts-core.jar=lib/jcontacts-core.jar -file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar -file.reference.jcoreee.jar=lib/jcoreee.jar -file.reference.jcountry-core.jar=lib/jcountry-core.jar -file.reference.jcountry-lib.jar=lib/jcountry-lib.jar -file.reference.jphone-core.jar=lib/jphone-core.jar -file.reference.jphone-lib.jar=lib/jphone-lib.jar -file.reference.jshop-core.jar=lib/jshop-core.jar -file.reference.jshop-ee-lib.jar=lib/jshop-ee-lib.jar -includes=** -j2ee.compile.on.save=true -j2ee.deploy.on.save=true -j2ee.platform=1.7 -j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar -j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar -j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar -j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar -j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar -j2ee.platform.wsit.classpath= -j2ee.server.type=gfv3ee6 -jar.compress=false -jar.name=PizzaService-ejb.jar -jars.in.ejbjar=true -javac.classpath=\ - ${file.reference.jcountry-core.jar}:\ - ${file.reference.jcountry-lib.jar}:\ - ${file.reference.jcoreee.jar}:\ - ${file.reference.jcore-logger-lib.jar}:\ - ${reference.PizzaService-lib.jar}:\ - ${file.reference.jcontacts-core.jar}:\ - ${file.reference.jphone-core.jar}:\ - ${file.reference.jphone-lib.jar}:\ - ${file.reference.jshop-core.jar}:\ - ${file.reference.jshop-ee-lib.jar}:\ - ${file.reference.cdi-api.jar} -javac.debug=true -javac.deprecation=true -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=true -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.preview=true -javadoc.private=true -javadoc.splitindex=true -javadoc.use=true -javadoc.version=true -javadoc.windowtitle=Pizza-Service EJBs -meta.inf=${source.root}/conf -meta.inf.excludes=sun-cmp-mappings.xml -platform.active=default_platform -project.license=agpl30 -project.pizzaservice-lib=../../pizzaservice-lib -project.PizzaService-lib=../../../public_html/pizzaservice-lib -reference.PizzaService-lib.jar=${project.PizzaService-lib}/dist/PizzaService-lib.jar -resource.dir=setup -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -# Space-separated list of JVM arguments used when running a class with a main method or a unit test -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): -runmain.jvmargs= -source.encoding=UTF-8 -source.reference.jcontacts-core.jar=../jcontacts-core/src/ -source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/ -source.reference.jcoreee.jar=../../jcoreee/src/ -source.reference.jcountry-core.jar=../jcountry-core/src/ -source.reference.jcountry-lib.jar=../jcountry-lib/src/ -source.reference.jphone-core.jar=../jphone-core/src/ -source.reference.jphone-lib.jar=../jphone-lib/src/ -source.reference.jshop-core.jar=../../jshop-core/src/ -source.reference.jshop-ee-lib.jar=../../jshop-ee-lib/src/ -source.root=src -src.dir=${source.root}/java -test.src.dir=test diff --git a/PizzaService-ejb/nbproject/project.xml b/PizzaService-ejb/nbproject/project.xml deleted file mode 100644 index 3a5f797..0000000 --- a/PizzaService-ejb/nbproject/project.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - org.netbeans.modules.j2ee.ejbjarproject - - - PizzaService-ejb - 1.6.5 - file.reference.jcountry-core.jar - file.reference.jcountry-lib.jar - file.reference.jcoreee.jar - file.reference.jcore-logger-lib.jar - reference.PizzaService-lib.jar - file.reference.jcontacts-core.jar - file.reference.jphone-core.jar - file.reference.jphone-lib.jar - file.reference.jshop-core.jar - file.reference.jshop-ee-lib.jar - file.reference.cdi-api.jar - - - - - - - - - lib/nblibraries.properties - - - - PizzaService-lib - jar - - jar - clean - jar - - - - diff --git a/PizzaService-ejb/src/conf/MANIFEST.MF b/PizzaService-ejb/src/conf/MANIFEST.MF deleted file mode 100644 index 59499bc..0000000 --- a/PizzaService-ejb/src/conf/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/PizzaService-ejb/src/conf/persistence.xml b/PizzaService-ejb/src/conf/persistence.xml deleted file mode 100644 index ad81acb..0000000 --- a/PizzaService-ejb/src/conf/persistence.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - jdbc/shop - org.mxchange.jcontacts.contact.UserContact - org.mxchange.jcountry.data.CountryData - org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber - org.mxchange.jphone.phonenumbers.fax.FaxNumber - org.mxchange.jphone.phonenumbers.landline.LandLineNumber - org.mxchange.jphone.phonenumbers.smsprovider.CellphoneProvider - org.mxchange.jshopcore.model.basket.items.BasketItem - org.mxchange.jshopcore.model.category.ProductCategory - org.mxchange.jshopcore.model.customer.ShopCustomer - org.mxchange.jshopcore.model.order.ShopOrder - org.mxchange.jshopcore.model.order.items.OrderItem - org.mxchange.jshopcore.model.product.GenericProduct - false - - - - - diff --git a/PizzaService-ejb/src/java/log4j2.xml b/PizzaService-ejb/src/java/log4j2.xml deleted file mode 100644 index 8d9a645..0000000 --- a/PizzaService-ejb/src/java/log4j2.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - diff --git a/PizzaService-ejb/src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java b/PizzaService-ejb/src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java deleted file mode 100644 index c0d42e1..0000000 --- a/PizzaService-ejb/src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jcountry.data; - -import java.util.List; -import javax.ejb.Singleton; -import javax.ejb.Startup; -import javax.persistence.Query; -import org.mxchange.jcoreee.database.BaseDatabaseBean; - -/** - * A singleton bean for country informations - *

- * @author Roland Haeder - */ -@Startup -@Singleton (name = "country", mappedName = "ejb/pizzaservice-singleton-country", description = "A singleton session bean for country informations") -public class PizzaCountrySingletonBean extends BaseDatabaseBean implements CountrySingletonBeanRemote { - - /** - * Serial number - */ - private static final long serialVersionUID = 15_846_983_298_691_207L; - - @Override - @SuppressWarnings ("unchecked") - public List allCountries () { - // Init query - Query query = this.getEntityManager().createNamedQuery("AllCountries", List.class); //NOI18N - - // Return it - return query.getResultList(); - } - -} diff --git a/PizzaService-ejb/src/java/org/mxchange/jphone/phonenumbers/smsprovider/PizzaSmsProviderSingletonBean.java b/PizzaService-ejb/src/java/org/mxchange/jphone/phonenumbers/smsprovider/PizzaSmsProviderSingletonBean.java deleted file mode 100644 index c0d59e1..0000000 --- a/PizzaService-ejb/src/java/org/mxchange/jphone/phonenumbers/smsprovider/PizzaSmsProviderSingletonBean.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.phonenumbers.smsprovider; - -import java.util.List; -import javax.ejb.Singleton; -import javax.ejb.Startup; -import javax.persistence.Query; -import org.mxchange.jcoreee.database.BaseDatabaseBean; - -/** - * A singleton bean for SMS provider informations - *

- * @author Roland Haeder - */ -@Startup -@Singleton (name = "smsprovider", mappedName = "ejb/pizzaservice-singleton-smsprovider", description = "A singleton session bean for SMS provider informations") -public class PizzaSmsProviderSingletonBean extends BaseDatabaseBean implements SmsProviderSingletonBeanRemote { - - /** - * Serial number - */ - private static final long serialVersionUID = 15_846_983_298_691_207L; - - @Override - @SuppressWarnings ("unchecked") - public List allSmsProvider () { - // Init query - Query query = this.getEntityManager().createNamedQuery("AllSmsProvider", List.class); //NOI18N - - // Return it - return query.getResultList(); - } - -} diff --git a/build.xml b/build.xml index 85ea050..0e24c24 100644 --- a/build.xml +++ b/build.xml @@ -7,8 +7,8 @@ - - Builds, tests, and runs the project PizzaService. + + Builds, tests, and runs the project PizzaService-ejb. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set build.dir - Must set build.generated.dir - Must set dist.dir - Must set build.classes.excludes - Must set dist.jar - - - - The libs.CopyLibs.classpath property is not set up. - This property must point to - org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part - of NetBeans IDE installation and is usually located at + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at <netbeans_installation>/java<version>/ant/extra folder. - Either open the project in the IDE and make sure CopyLibs library - exists or setup the property manually. For example like this: - ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. - - - Launching ${browse.url} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set main.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index a23d1f8..73bdb0c 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=fdc75897 -build.xml.script.CRC32=8e3e9528 -build.xml.stylesheet.CRC32=a5d15b16@1.49.1 +build.xml.data.CRC32=0427eba4 +build.xml.script.CRC32=cabe2e92 +build.xml.stylesheet.CRC32=5910fda3@1.51.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=6fa7b0ea -nbproject/build-impl.xml.script.CRC32=82732cff -nbproject/build-impl.xml.stylesheet.CRC32=5eea63a6@1.49.1 +nbproject/build-impl.xml.data.CRC32=3b2a403d +nbproject/build-impl.xml.script.CRC32=eb9d30fc +nbproject/build-impl.xml.stylesheet.CRC32=6096d939@1.55.1 diff --git a/nbproject/project.properties b/nbproject/project.properties index 44851f1..3b9f031 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,13 +1,40 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processor.options=-Aeclipselink.canonicalmodel.use_static_factory=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form,**/.nbattrs build.dir=build +build.ear.classes.dir=${build.dir}/classes build.generated.dir=${build.dir}/generated -client.urlPart= -debug.classpath=${javac.classpath}::${jar.content.additional}:${run.classpath} -display.browser=true +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +debug.classpath=${javac.classpath}:${build.classes.dir} +debug.test.classpath=\ + ${run.test.classpath} dist.dir=dist +dist.ear.jar=${dist.dir}/${jar.name} dist.jar=${dist.dir}/${jar.name} +dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= -j2ee.appclient.mainclass.args=${j2ee.appclient.tool.args} +excludes= +file.reference.cdi-api.jar=lib/cdi-api.jar +file.reference.jcontacts-core.jar=lib/jcontacts-core.jar +file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar +file.reference.jcore.jar=lib/jcore.jar +file.reference.jcoreee.jar=lib/jcoreee.jar +file.reference.jcountry-core.jar=lib/jcountry-core.jar +file.reference.jcountry-lib.jar=lib/jcountry-lib.jar +file.reference.jphone-core.jar=lib/jphone-core.jar +file.reference.jphone-lib.jar=lib/jphone-lib.jar +file.reference.jshop-core.jar=lib/jshop-core.jar +file.reference.jshop-ee-lib.jar=lib/jshop-ee-lib.jar +file.reference.juser-core.jar=lib/juser-core.jar +file.reference.juser-lib.jar=lib/juser-lib.jar +includes=** j2ee.compile.on.save=true j2ee.deploy.on.save=true j2ee.platform=1.7 @@ -19,33 +46,72 @@ j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.ja j2ee.platform.wsit.classpath= j2ee.server.type=gfv3ee6 jar.compress=false -jar.content.additional=\ - ${reference.jcore-logger-ejb.dist-ear}:\ - ${reference.PizzaService-ejb.dist-ear}:\ - ${reference.jshop-receipt-ejb.dist-ear}:\ - ${reference.jcore-logger-ejb.dist-ear}:\ - ${reference.jshop-ejb.dist-ear}:\ - ${reference.jcountry-ejb.dist-ear} -jar.name=PizzaService.ear +jar.name=PizzaService-ejb.jar +jars.in.ejbjar=true +javac.classpath=\ + ${file.reference.jcore.jar}:\ + ${file.reference.jcoreee.jar}:\ + ${file.reference.jcountry-core.jar}:\ + ${file.reference.jcountry-lib.jar}:\ + ${file.reference.jcore-logger-lib.jar}:\ + ${reference.PizzaService-lib.jar}:\ + ${file.reference.jcontacts-core.jar}:\ + ${file.reference.juser-core.jar}:\ + ${file.reference.juser-lib.jar}:\ + ${file.reference.jphone-core.jar}:\ + ${file.reference.jphone-lib.jar}:\ + ${file.reference.jshop-core.jar}:\ + ${file.reference.jshop-ee-lib.jar}:\ + ${file.reference.cdi-api.jar} javac.debug=true -javac.deprecation=false -javac.source=1.6 -javac.target=1.6 -meta.inf=src/conf -no.dependencies=false +javac.deprecation=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=true +javadoc.splitindex=true +javadoc.use=true +javadoc.version=true +javadoc.windowtitle=Pizza-Service EJBs +meta.inf=${source.root}/conf +meta.inf.excludes=sun-cmp-mappings.xml platform.active=default_platform -project.jcore-logger-ejb=../jcore-logger-ejb -project.jcore-logger-ejb=../jcore-logger-ejb -project.jcountry-ejb=../../NetBeansProjects/jcountry-ejb -project.jshop-ejb=../jshop-ejb -project.jshop-receipt-ejb=../jshop-receipt-ejb -project.PizzaService-ejb=PizzaService-ejb -reference.jcore-logger-ejb.dist-ear=${project.jcore-logger-ejb}/dist/jcore-logger-ejb.jar -reference.jcore-logger-ejb.dist-ear=${project.jcore-logger-ejb}/dist/jcore-logger-ejb.jar -reference.jcountry-ejb.dist-ear=${project.jcountry-ejb}/dist/jcountry-ejb.jar -reference.jshop-ejb.dist-ear=${project.jshop-ejb}/dist/jshop-ejb.jar -reference.jshop-receipt-ejb.dist-ear=${project.jshop-receipt-ejb}/dist/jshop-receipt-ejb.jar -reference.PizzaService-ejb.dist-ear=${project.PizzaService-ejb}/dist/PizzaService-ejb.jar +project.license=agpl30 +project.pizzaservice-lib=../../pizzaservice-lib +project.PizzaService-lib=../../../public_html/pizzaservice-lib +reference.PizzaService-lib.jar=${project.PizzaService-lib}/dist/PizzaService-lib.jar resource.dir=setup -run.classpath= -source.root=. +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.reference.jcontacts-core.jar=../jcontacts-core/src/ +source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/ +source.reference.jcore.jar=../jcore/src/ +source.reference.jcoreee.jar=../../jcoreee/src/ +source.reference.jcountry-core.jar=../jcountry-core/src/ +source.reference.jcountry-lib.jar=../jcountry-lib/src/ +source.reference.jphone-core.jar=../jphone-core/src/ +source.reference.jphone-lib.jar=../jphone-lib/src/ +source.reference.jshop-core.jar=../../jshop-core/src/ +source.reference.jshop-ee-lib.jar=../../jshop-ee-lib/src/ +source.reference.juser-core.jar=../juser-core/src/ +source.reference.juser-lib.jar=../juser-lib/src/ +source.root=src +src.dir=${source.root}/java +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml index 764f761..61f3efe 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -1,81 +1,42 @@ - org.netbeans.modules.j2ee.earproject + org.netbeans.modules.j2ee.ejbjarproject - - PizzaService + + PizzaService-ejb 1.6.5 - - - - ${reference.jcore-logger-ejb.dist-ear} - / - - - ${reference.PizzaService-ejb.dist-ear} - / - - - ${reference.jshop-receipt-ejb.dist-ear} - / - - - ${reference.jcore-logger-ejb.dist-ear} - / - - - ${reference.jshop-ejb.dist-ear} - / - - - ${reference.jcountry-ejb.dist-ear} - / - - + file.reference.jcore.jar + file.reference.jcoreee.jar + file.reference.jcountry-core.jar + file.reference.jcountry-lib.jar + file.reference.jcore-logger-lib.jar + reference.PizzaService-lib.jar + file.reference.jcontacts-core.jar + file.reference.juser-core.jar + file.reference.juser-lib.jar + file.reference.jphone-core.jar + file.reference.jphone-lib.jar + file.reference.jshop-core.jar + file.reference.jshop-ee-lib.jar + file.reference.cdi-api.jar + + + + + + - .\lib\nblibraries.properties + lib/nblibraries.properties - + - PizzaService-ejb - j2ee_ear_archive - - dist-ear - clean-ear - dist-ear - - - jcore-logger-ejb - j2ee_ear_archive - - dist-ear - clean-ear - dist-ear - - - jcountry-ejb - j2ee_ear_archive - - dist-ear - clean-ear - dist-ear - - - jshop-ejb - j2ee_ear_archive - - dist-ear - clean-ear - dist-ear - - - jshop-receipt-ejb - j2ee_ear_archive - - dist-ear - clean-ear - dist-ear + PizzaService-lib + jar + + jar + clean + jar diff --git a/src/conf/persistence.xml b/src/conf/persistence.xml new file mode 100644 index 0000000..ce8f031 --- /dev/null +++ b/src/conf/persistence.xml @@ -0,0 +1,24 @@ + + + + jdbc/shop + org.mxchange.jcontacts.contact.UserContact + org.mxchange.jcountry.data.CountryData + org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber + org.mxchange.jphone.phonenumbers.fax.FaxNumber + org.mxchange.jphone.phonenumbers.landline.LandLineNumber + org.mxchange.jphone.phonenumbers.smsprovider.CellphoneProvider + org.mxchange.jshopcore.model.basket.items.BasketItem + org.mxchange.jshopcore.model.category.ProductCategory + org.mxchange.jshopcore.model.customer.ShopCustomer + org.mxchange.jshopcore.model.order.ShopOrder + org.mxchange.jshopcore.model.order.items.OrderItem + org.mxchange.jshopcore.model.product.GenericProduct + org.mxchange.jusercore.model.email_address.EmailAddressChange + org.mxchange.jusercore.model.user.LoginUser + false + + + + + diff --git a/src/java/log4j2.xml b/src/java/log4j2.xml index 12e0868..8d9a645 100644 --- a/src/java/log4j2.xml +++ b/src/java/log4j2.xml @@ -3,32 +3,27 @@ Copyright (C) 2016 Roland Haeder This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +GNU Affero General Public License for more details. -You should have received a copy of the GNU General Public License +You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> - + - - - + + - - - - diff --git a/src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java b/src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java new file mode 100644 index 0000000..c0d42e1 --- /dev/null +++ b/src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcountry.data; + +import java.util.List; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.persistence.Query; +import org.mxchange.jcoreee.database.BaseDatabaseBean; + +/** + * A singleton bean for country informations + *

+ * @author Roland Haeder + */ +@Startup +@Singleton (name = "country", mappedName = "ejb/pizzaservice-singleton-country", description = "A singleton session bean for country informations") +public class PizzaCountrySingletonBean extends BaseDatabaseBean implements CountrySingletonBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 15_846_983_298_691_207L; + + @Override + @SuppressWarnings ("unchecked") + public List allCountries () { + // Init query + Query query = this.getEntityManager().createNamedQuery("AllCountries", List.class); //NOI18N + + // Return it + return query.getResultList(); + } + +} diff --git a/src/java/org/mxchange/jphone/phonenumbers/smsprovider/PizzaSmsProviderSingletonBean.java b/src/java/org/mxchange/jphone/phonenumbers/smsprovider/PizzaSmsProviderSingletonBean.java new file mode 100644 index 0000000..c0d59e1 --- /dev/null +++ b/src/java/org/mxchange/jphone/phonenumbers/smsprovider/PizzaSmsProviderSingletonBean.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.phonenumbers.smsprovider; + +import java.util.List; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.persistence.Query; +import org.mxchange.jcoreee.database.BaseDatabaseBean; + +/** + * A singleton bean for SMS provider informations + *

+ * @author Roland Haeder + */ +@Startup +@Singleton (name = "smsprovider", mappedName = "ejb/pizzaservice-singleton-smsprovider", description = "A singleton session bean for SMS provider informations") +public class PizzaSmsProviderSingletonBean extends BaseDatabaseBean implements SmsProviderSingletonBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 15_846_983_298_691_207L; + + @Override + @SuppressWarnings ("unchecked") + public List allSmsProvider () { + // Init query + Query query = this.getEntityManager().createNamedQuery("AllSmsProvider", List.class); //NOI18N + + // Return it + return query.getResultList(); + } + +} diff --git a/src/java/org/mxchange/jusercore/model/login/PizzaUserLoginSessionBean.java b/src/java/org/mxchange/jusercore/model/login/PizzaUserLoginSessionBean.java new file mode 100644 index 0000000..482b0a8 --- /dev/null +++ b/src/java/org/mxchange/jusercore/model/login/PizzaUserLoginSessionBean.java @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jusercore.model.login; + +import java.text.MessageFormat; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import org.mxchange.jcoreee.database.BaseDatabaseBean; +import org.mxchange.jusercore.container.login.LoginContainer; +import org.mxchange.jusercore.exceptions.UserNotFoundException; +import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; +import org.mxchange.jusercore.exceptions.UserStatusLockedException; +import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; +import org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.UserSessionBeanRemote; +import org.mxchange.jusercore.model.user.UserUtils; +import org.mxchange.jusercore.model.user.status.UserAccountStatus; + +/** + * A session bean for user logins + *

+ * @author Roland Haeder + */ +@Stateless (name = "login", mappedName = "ejb/stateless-pizza-login", description = "A bean handling the user login") +public class PizzaUserLoginSessionBean extends BaseDatabaseBean implements UserLoginSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 21_785_978_127_581_965L; + + /** + * Registration bean + */ + @EJB + private UserRegistrationSessionBeanRemote registerBean; + + /** + * User bean + */ + @EJB + private UserSessionBeanRemote userBean; + + @Override + public User validateUserAccountStatus (final LoginContainer container) throws UserNotFoundException, UserStatusLockedException, UserStatusUnconfirmedException, UserPasswordMismatchException { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("loginUser: container={0} - CALLED!", container)); //NOI18N + + // Check some beans + assert(this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N + assert(this.registerBean instanceof UserRegistrationSessionBeanRemote) : "this.registerBean is not set"; //NOI18N + + // user should not be null + if (null == container) { + // Abort here + throw new NullPointerException("container is null"); //NOI18N + } else if (container.getUser() == null) { + // NPE again + throw new NullPointerException("container.user is null"); //NOI18N + } else if (container.getUserPassword() == null) { + // And yet again NPE + throw new NullPointerException("container.userPassword is null"); //NOI18N + } else if (container.getUserPassword().isEmpty()) { + // Empty password is not allowed, hardcoded. + throw new IllegalArgumentException("container.userPassword is empty"); //NOI18N + } + + // Is the account there? + if (!this.registerBean.isUserNameRegistered(container.getUser())) { + // Not registered + throw new UserNotFoundException(container.getUser()); + } + + // Get user instance from persistance + User updatedUser = this.userBean.fillUserData(container.getUser()); + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("loginUser: updatedUser={0}", updatedUser)); //NOI18N + + // Is the user account unconfirmed? + if (updatedUser.getUserAccountStatus().equals(UserAccountStatus.UNCONFIRMED)) { + // Is unconfirmed + throw new UserStatusUnconfirmedException(container.getUser()); + } else if (updatedUser.getUserAccountStatus().equals(UserAccountStatus.LOCKED)) { + // Is locked + throw new UserStatusLockedException(container.getUser()); + } else if (!this.isPasswordMatching(container, updatedUser)) { + // Not matcing passwords + throw new UserPasswordMismatchException(container.getUser()); + } + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("loginUser: updatedUser={0} - EXIT!", updatedUser)); //NOI18N + + // Return it + return updatedUser; + } + + /** + * Checks if password matches of both instances. Both user instances must + * not match, the first one is the one from the calling bean/controller, the + * second is the from database. + *

+ * @param container Container instance holding the user instance and + * unencrypted password + * @param updatedUser User instance found for given user name + *

+ * @return Whether the password matches + */ + private boolean isPasswordMatching (final LoginContainer container, final User updatedUser) { + // First math both instances + if (null == container) { + // Throw NPE + throw new NullPointerException("container is null"); //NOI18N + } else if (null == updatedUser) { + // Throw NPE + throw new NullPointerException("updatedUser is null"); //NOI18N + } else if (container.getUser().equals(updatedUser)) { + // Both same instance! + throw new IllegalArgumentException(MessageFormat.format("container.user matches updatedUser: {0}", container.getUser())); //NOI18N + } + + // Is it the same same password? + return UserUtils.ifPasswordMatches(container, updatedUser); + } + +} diff --git a/src/java/org/mxchange/jusercore/model/register/PizzaUserRegistrationSessionBean.java b/src/java/org/mxchange/jusercore/model/register/PizzaUserRegistrationSessionBean.java new file mode 100644 index 0000000..63c01d0 --- /dev/null +++ b/src/java/org/mxchange/jusercore/model/register/PizzaUserRegistrationSessionBean.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jusercore.model.register; + +import java.text.MessageFormat; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import org.mxchange.jcoreee.database.BaseDatabaseBean; +import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; +import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.UserSessionBeanRemote; + +/** + * A session bean for user registration + *

+ * @author Roland Haeder + */ +@Stateless (name = "register", mappedName = "ejb/stateless-pizza-register", description = "A bean handling the user registration") +public class PizzaUserRegistrationSessionBean extends BaseDatabaseBean implements UserRegistrationSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 12_348_958_986_818_627L; + + /** + * User bean + */ + @EJB + private UserSessionBeanRemote userBean; + + @Override + public boolean isEmailAddressRegistered (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressRegistered: user={0} - CALLED!", user)); //NOI18N + + // Check bean + assert(this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N + + // user should not be null + if (null == user) { + // Abort here + throw new NullPointerException("user is null"); //NOI18N + } + + // Call other bean + return this.userBean.isEmailAddressReqistered(user); + } + + @Override + public boolean isUserNameRegistered (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserNameRegistered: user={0} - CALLED!", user)); //NOI18N + + // Check bean + assert(this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N + + // user should not be null + if (null == user) { + // Abort here + throw new NullPointerException("user is null"); //NOI18N + } + + // Call other bean + return this.userBean.isUserNameReqistered(user); + } + + @Override + public User registerUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("registerUser: user={0} - CALLED!", user)); //NOI18N + + // user should not be null + if (null == user) { + // Abort here + throw new NullPointerException("user is null"); //NOI18N + } + + // Check if user is registered + if (this.isUserNameRegistered(user)) { + // Abort here + throw new UserNameAlreadyRegisteredException(user); + } else if (this.isEmailAddressRegistered(user)) { + // Abort here + throw new EmailAddressAlreadyRegisteredException(user); + } + + // Persist it + this.getEntityManager().persist(user); + + // Flush to get id back + this.getEntityManager().flush(); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("registerUser: user={0},user.id={1} - EXIT!", user, user.getUserId())); //NOI18N + + // Return it + return user; + } + +} diff --git a/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java new file mode 100644 index 0000000..772efa0 --- /dev/null +++ b/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java @@ -0,0 +1,487 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jusercore.model.user; + +import java.text.MessageFormat; +import java.util.GregorianCalendar; +import java.util.List; +import javax.ejb.EJBException; +import javax.ejb.Stateless; +import javax.persistence.NoResultException; +import javax.persistence.PersistenceException; +import javax.persistence.Query; +import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcoreee.database.BaseDatabaseBean; +import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; +import org.mxchange.jusercore.model.user.status.UserAccountStatus; + +/** + * A user bean + *

+ * @author Roland Haeder + */ +@Stateless (name = "user", mappedName = "ejb/stateless-pizza-user", description = "A bean handling the user data") +public class PizzaUserSessionBean extends BaseDatabaseBean implements UserSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 542_145_347_916L; + + /** + * Default constructor + */ + public PizzaUserSessionBean () { + } + + @Override + @SuppressWarnings ("unchecked") + public List allMemberPublicVisibleUsers () { + // Trace message + this.getLoggerBeanLocal().logTrace("allMemberPublicVisibleUsers: CALLED!"); //NOI18N + + // Get named query + Query query = this.getEntityManager().createNamedQuery("AllMemberPublicUsers", List.class); //NOI18N + + // Set parameters + query.setParameter("status", UserAccountStatus.CONFIRMED); //NOI18N + query.setParameter("members", ProfileMode.MEMBERS); //NOI18N + query.setParameter("public", ProfileMode.PUBLIC); //NOI18N + + // Get result + List users = query.getResultList(); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("allMemberPublicVisibleUsers: users.size()={0} - EXIT!", users.size())); //NOI18N + + // Return full list + return users; + } + + @Override + @SuppressWarnings ("unchecked") + public List allPublicUsers () { + // Trace message + this.getLoggerBeanLocal().logTrace("allPublicUsers: CALLED!"); //NOI18N + + // Get named query + Query query = this.getEntityManager().createNamedQuery("AllPublicUsers", List.class); //NOI18N + + // Set parameters + query.setParameter("status", UserAccountStatus.CONFIRMED); //NOI18N + query.setParameter("mode", ProfileMode.PUBLIC); //NOI18N + + // Get result + List users = query.getResultList(); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("allPublicUsers: users.size()={0} - EXIT!", users.size())); //NOI18N + + // Return full list + return users; + } + + @Override + public User fillUserData (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("fillUserData: user={0} - CALLED!", user)); //NOI18N + + // user should not be null + if (null == user) { + // Abort here + throw new NullPointerException("user is null"); //NOI18N + } + + // Try to locate it + Query query = this.getEntityManager().createNamedQuery("SearchUserName", LoginUser.class); //NOI18N + + // Set parameter + query.setParameter("param", user.getUserName()); //NOI18N + + // Initialize variable + User foundUser = null; + + // Try it + try { + // Try to get single result + foundUser = (User) query.getSingleResult(); + } catch (final NoResultException ex) { + // Log it + this.getLoggerBeanLocal().logException(ex); + } + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("fillUserData: foundUser={0} - EXIT!", foundUser)); //NOI18N + + // Return prepared instance + return foundUser; + } + + @Override + @SuppressWarnings ("unchecked") + public List getEmailAddressList () { + // Get query + Query query = this.getEntityManager().createNamedQuery("AllEmailAddresses", String.class); //NOI18N + + // Get result list + List emailAddressList = query.getResultList(); + + // Return it + return emailAddressList; + } + + @Override + @SuppressWarnings ("unchecked") + public List getUserNameList () { + // Get query + Query query = this.getEntityManager().createNamedQuery("AllUserNames", String.class); //NOI18N + + // Get result list + List userNameList = query.getResultList(); + + // Return it + return userNameList; + } + + @Override + public boolean ifUserExists (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserExists: user={0} - CALLED!", user)); //NOI18N + + // userId should not be null + if (null == user) { + // Abort here + throw new NullPointerException("user is null"); //NOI18N + } else if (user.getUserId() == null) { + // Abort here + throw new NullPointerException("user.userId is null"); //NOI18N + } else if (user.getUserId() < 1) { + // Invalid number + throw new IllegalArgumentException(MessageFormat.format("userId is not valid: {0}", user.getUserId())); //NOI18N + } + + // Generate query + Query query = this.getEntityManager().createNamedQuery("SearchUserId", LoginUser.class); //NOI18N + + // Set parameter + query.setParameter("id", user.getUserId()); //NOI18N + + // Try this + try { + User dummy = (User) query.getSingleResult(); + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserExists: dummy.id={0} found.", dummy.getUserId())); //NOI18N + } catch (final NoResultException ex) { + // Log it + this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserExists: getSingleResult() returned no result: {0}", ex)); //NOI18N + + // User name does not exist + return false; + } catch (final PersistenceException ex) { + // Something bad happened + this.getLoggerBeanLocal().logWarning(MessageFormat.format("More than one user {0} found.", user, ex)); //NOI18N + + // Throw again + throw ex; + } + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserExists: Found user {0} - EXIT!", user)); //NOI18N + + // Found it + return true; + } + + @Override + public boolean ifUserIdExists (final Long userId) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserIdExists: userId={0} - CALLED!", userId)); //NOI18N + + // userId should not be null + if (null == userId) { + // Abort here + throw new NullPointerException("userId is null"); //NOI18N + } else if (userId < 1) { + // Invalid number + throw new IllegalArgumentException(MessageFormat.format("userId is not valid: {0}", userId)); //NOI18N + } + + // Generate query + Query query = this.getEntityManager().createNamedQuery("SearchUserId", LoginUser.class); //NOI18N + + // Set parameter + query.setParameter("id", userId); //NOI18N + + // Try this + try { + User dummy = (User) query.getSingleResult(); + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserIdExists: dummy.id={0} found.", dummy.getUserId())); //NOI18N + } catch (final NoResultException ex) { + // Log it + this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserIdExists: getSingleResult() returned no result: {0}", ex)); //NOI18N + + // User name does not exist + return false; + } catch (final PersistenceException ex) { + // Something bad happened + this.getLoggerBeanLocal().logWarning(MessageFormat.format("More than one user id {0} found.", userId, ex)); //NOI18N + + // Throw again + throw ex; + } + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserIdExists: Found user id {0} - EXIT!", userId)); //NOI18N + + // Found it + return true; + } + + @Override + public boolean isEmailAddressReqistered (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressReqistered: user={0} - CALLED!", user)); //NOI18N + + // user should not be null + if (null == user) { + // Abort here + throw new NullPointerException("user is null"); //NOI18N + } + + // Generate query + Query query = this.getEntityManager().createNamedQuery("SearchEmailAddress", LoginUser.class); //NOI18N + + // Set parameter + query.setParameter("param", user.getUserContact().getContactEmailAddress()); //NOI18N + + // Search for it + try { + User dummy = (User) query.getSingleResult(); + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("isEmailAddressReqistered: dummy.id={0} found.", dummy.getUserId())); //NOI18N + } catch (final NoResultException ex) { + // Log it + this.getLoggerBeanLocal().logDebug(MessageFormat.format("isEmailAddressReqistered: getSingleResult() returned no result: {0}", ex)); //NOI18N + + // Email address does not exist + return false; + } catch (final PersistenceException ex) { + // Something bad happened + this.getLoggerBeanLocal().logWarning(MessageFormat.format("More than one email address {0} found.", user.getUserContact().getContactEmailAddress()), ex); //NOI18N + + // Throw again + throw ex; + } + + // Found it + return true; + } + + @Override + public boolean isUserNameReqistered (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserNameReqistered: user={0} - CALLED!", user)); //NOI18N + + // user should not be null + if (null == user) { + // Abort here + throw new NullPointerException("user is null"); //NOI18N + } + + // Generate query + Query query = this.getEntityManager().createNamedQuery("SearchUserName", LoginUser.class); //NOI18N + + // Set parameter + query.setParameter("param", user.getUserName()); //NOI18N + + // Try this + try { + User dummy = (User) query.getSingleResult(); + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserNameReqistered: dummy.id={0} found.", dummy.getUserId())); //NOI18N + } catch (final NoResultException ex) { + // Log it + this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserNameReqistered: getSingleResult() returned no result: {0}", ex)); //NOI18N + + // User name does not exist + return false; + } catch (final PersistenceException ex) { + // Something bad happened + this.getLoggerBeanLocal().logWarning(MessageFormat.format("More than one email address {0} found.", user.getUserContact().getContactEmailAddress()), ex); //NOI18N + + // Throw again + throw ex; + } + + // Found it + return true; + } + + @Override + public void updateUserPersonalData (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserPersonalData: user={0} - CALLED!", user)); + + // user should not be null + if (null == user) { + // Abort here + throw new NullPointerException("user is null"); //NOI18N + } else if (user.getUserId() == null) { + // Throw NPE again + throw new NullPointerException("user.userId is null"); //NOI18N + } else if (user.getUserId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid.", user.getUserId())); //NOI18N + } else if (user.getUserAccountStatus() == null) { + // Throw NPE again + throw new NullPointerException("user.userAccountStatus is null"); //NOI18N + } else if (!this.ifUserExists(user)) { + // User does not exist + throw new EJBException(MessageFormat.format("User with id {0} does not exist.", user.getUserId())); //NOI18N + } + + // Find the instance + User foundUser = this.getEntityManager().find(user.getClass(), user.getUserId()); + + // Should be found! + assert (foundUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N + + // Merge user + User detachedUser = this.getEntityManager().merge(foundUser); + + // Should be found! + assert (detachedUser instanceof User) : MessageFormat.format("User with id {0} not merged, but should be.", user.getUserId()); //NOI18N + + // Copy all data + detachedUser.copyAll(user); + + // Set as updated + detachedUser.setUserUpdated(new GregorianCalendar()); + detachedUser.getUserContact().setContactUpdated(new GregorianCalendar()); + + // Get contact from it and find it + Contact foundContact = this.getEntityManager().find(user.getUserContact().getClass(), user.getUserContact().getContactId()); + + // Should be found + assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", user.getUserContact().getContactId()); //NOI18N + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: contact.contactId={0}", foundContact.getContactId())); + + // Merge contact instance + Contact detachedContact = this.getEntityManager().merge(foundContact); + + // Copy all + detachedContact.copyAll(user.getUserContact()); + + // Set it back in user + user.setUserContact(detachedContact); + + // Should be found! + assert (detachedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not merged, but should be.", user.getUserContact().getContactId()); //NOI18N + + // Get cellphone instance + DialableCellphoneNumber cellphone = detachedContact.getContactCellphoneNumber(); + + // Is there a cellphone instance set? + if (cellphone instanceof DialableCellphoneNumber) { + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: cellphone.phoneId={0} is being updated ...", cellphone.getPhoneId())); + + // Then find it, too + DialableCellphoneNumber foundCellphone = this.getEntityManager().find(cellphone.getClass(), cellphone.getPhoneId()); + + // Should be there + assert (foundCellphone instanceof DialableCellphoneNumber) : MessageFormat.format("Cellphone number with id {0} not found but should be.", foundCellphone.getPhoneId()); + + // Then merge it, too + DialableCellphoneNumber detachedCellphone = this.getEntityManager().merge(foundCellphone); + + // Should be there + assert (detachedCellphone instanceof DialableCellphoneNumber) : MessageFormat.format("Cellphone number with id {0} not found but should be.", detachedCellphone.getPhoneId()); + + // Copy all + detachedCellphone.copyAll(user.getUserContact().getContactCellphoneNumber()); + + // Set it back + detachedContact.setContactCellphoneNumber(detachedCellphone); + } + + // Get cellphone instance + DialableFaxNumber fax = detachedContact.getContactFaxNumber(); + + // Is there a fax instance set? + if (fax instanceof DialableFaxNumber) { + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: fax.phoneId={0} is being updated ...", fax.getPhoneId())); + + // Then find it, too + DialableFaxNumber foundFax = this.getEntityManager().find(fax.getClass(), fax.getPhoneId()); + + // Should be there + assert (foundFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", foundFax.getPhoneId()); + + // Then merge it, too + DialableFaxNumber detachedFax = this.getEntityManager().merge(foundFax); + + // Should be there + assert (detachedFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", detachedFax.getPhoneId()); + + // Copy all + detachedFax.copyAll(user.getUserContact().getContactFaxNumber()); + + // Set it back + detachedContact.setContactFaxNumber(detachedFax); + } + + // Get cellphone instance + DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber(); + + // Is there a fax instance set? + if (landLine instanceof DialableLandLineNumber) { + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLine.phoneId={0} is being updated ...", landLine.getPhoneId())); + + // Then find it, too + DialableLandLineNumber foundLandLine = this.getEntityManager().find(landLine.getClass(), landLine.getPhoneId()); + + // Should be there + assert (foundLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", foundLandLine.getPhoneId()); + + // Then merge it, too + DialableLandLineNumber detachedLandLine = this.getEntityManager().merge(foundLandLine); + + // Should be there + assert (detachedLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", detachedLandLine.getPhoneId()); + + // Copy all + detachedLandLine.copyAll(user.getUserContact().getContactLandLineNumber()); + + // Set it back + detachedContact.setContactLandLineNumber(detachedLandLine); + } + } + +}