From: Roland Häder Date: Mon, 2 May 2016 08:49:40 +0000 (+0200) Subject: opps, messed up addressbook-lib and jaddressbook-lib. The first one is a sub-project... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1e03aa57abc4c4a748141f4487c7c8969f8fc26d;p=jaddressbook-share-lib.git opps, messed up addressbook-lib and jaddressbook-lib. The first one is a sub-project of addreassbook which should hold project-specific remote interfaces. jaddressbook-lib is "generic" and therefore should only contain generic remote interfaces. --- diff --git a/README.txt b/README.txt index 22e086e..3c00eb7 100644 --- a/README.txt +++ b/README.txt @@ -4,5 +4,4 @@ README.txt 1) What is this? --------------- -This is a library for the addressbook application. It should be linked as -NetBeans project in all applications (Console, Swing, JSF, ...). +This is a library containing remote interfaces for EJBs handling addressbooks. diff --git a/build.xml b/build.xml index 904c98d..e5608b3 100644 --- a/build.xml +++ b/build.xml @@ -1,73 +1,73 @@ - - - - - - - - - - - Builds, tests, and runs the project addressbook-lib. - - - + + + + + + + + + + + Builds, tests, and runs the project jaddressbook-lib. + + + diff --git a/lib/jaddressbook-lib.jar b/lib/jaddressbook-lib.jar deleted file mode 100644 index d052669..0000000 Binary files a/lib/jaddressbook-lib.jar and /dev/null differ diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 18c6523..d791c28 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -1,1444 +1,1444 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 8bb6f02..7f3b68f 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=5c7b88c5 -build.xml.script.CRC32=3172ff94 -build.xml.stylesheet.CRC32=8064a381@1.75.2.48 -# 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=5c7b88c5 -nbproject/build-impl.xml.script.CRC32=8c3ff88c -nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 +build.xml.data.CRC32=5c7b88c5 +build.xml.script.CRC32=3172ff94 +build.xml.stylesheet.CRC32=8064a381@1.75.2.48 +# 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=3b4d6f8c +nbproject/build-impl.xml.script.CRC32=6d99fbcb +nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 diff --git a/nbproject/project.properties b/nbproject/project.properties index 28093aa..a84cc1b 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,126 +1,123 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=true -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=addressbook-lib -application.vendor=Roland Haeder -auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/addressbook-lib.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.addressbook-core.jar=lib/addressbook-core.jar -file.reference.jaddressbook-core.jar=lib/jaddressbook-core.jar -file.reference.jaddressbook-lib.jar=lib/jaddressbook-lib.jar -file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.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.jphone-core.jar=lib/jphone-core.jar -file.reference.juser-core.jar=lib/juser-core.jar -file.reference.juser-lib.jar=lib/juser-lib.jar -includes=** -jar.archive.disabled=${jnlp.enabled} -jar.compress=false -jar.index=${jnlp.enabled} -javac.classpath=\ - ${file.reference.jcore.jar}:\ - ${file.reference.jcoreee.jar}:\ - ${file.reference.jcore-logger-lib.jar}:\ - ${file.reference.jcountry-core.jar}:\ - ${file.reference.jphone-core.jar}:\ - ${file.reference.jcontacts-core.jar}:\ - ${file.reference.jcontacts-business-core.jar}:\ - ${file.reference.juser-core.jar}:\ - ${file.reference.juser-lib.jar}:\ - ${file.reference.jaddressbook-core.jar}:\ - ${file.reference.jaddressbook-lib.jar}:\ - ${file.reference.addressbook-core.jar}:\ - ${libs.javaee-api-7.0.classpath}:\ - ${libs.jpa20-persistence.classpath} -# Space-separated list of extra javac options -javac.compilerargs=-Xlint:unchecked -Xlint:deprecation -javac.deprecation=true -javac.external.vm=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.7 -javac.target=1.7 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=true -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=true -javadoc.splitindex=true -javadoc.use=true -javadoc.version=true -javadoc.windowtitle=Addressbook Library -jnlp.codebase.type=no.codebase -jnlp.descriptor=application -jnlp.enabled=false -jnlp.mixed.code=default -jnlp.offline-allowed=false -jnlp.signed=false -jnlp.signing= -jnlp.signing.alias= -jnlp.signing.keystore= -# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed -manifest.custom.codebase= -# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) -manifest.custom.permissions= -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=true -platform.active=default_platform -project.license=gpl30 -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -source.reference.addressbook-core.jar=../addressbook-core/src/ -source.reference.jaddressbook-core.jar=../jaddressbook-core/src/ -source.reference.jaddressbook-lib.jar=../jaddressbook-lib/src/ -source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/ -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.jphone-core.jar=../jphone-core/src/ -source.reference.juser-core.jar=../juser-core/src/ -source.reference.juser-lib.jar=../juser-lib/src/ -src.dir=src -test.src.dir=test +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=jaddressbook-lib +application.vendor=Roland Haeder +auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/jaddressbook-lib.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.addressbook-core.jar=lib/addressbook-core.jar +file.reference.jaddressbook-core.jar=lib/jaddressbook-core.jar +file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.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.jphone-core.jar=lib/jphone-core.jar +file.reference.juser-core.jar=lib/juser-core.jar +file.reference.juser-lib.jar=lib/juser-lib.jar +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=false +jar.index=${jnlp.enabled} +javac.classpath=\ + ${file.reference.jcore.jar}:\ + ${file.reference.jcoreee.jar}:\ + ${file.reference.jcore-logger-lib.jar}:\ + ${file.reference.jcountry-core.jar}:\ + ${file.reference.jphone-core.jar}:\ + ${file.reference.jcontacts-core.jar}:\ + ${file.reference.jcontacts-business-core.jar}:\ + ${file.reference.juser-core.jar}:\ + ${file.reference.juser-lib.jar}:\ + ${file.reference.jaddressbook-core.jar}:\ + ${file.reference.addressbook-core.jar}:\ + ${libs.javaee-api-7.0.classpath}:\ + ${libs.jpa20-persistence.classpath} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint:unchecked -Xlint:deprecation +javac.deprecation=true +javac.external.vm=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=true +javadoc.splitindex=true +javadoc.use=true +javadoc.version=true +javadoc.windowtitle=Addressbook Library +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= +# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed +manifest.custom.codebase= +# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) +manifest.custom.permissions= +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=true +platform.active=default_platform +project.license=gpl30 +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +source.reference.addressbook-core.jar=../addressbook-core/src/ +source.reference.jaddressbook-core.jar=../jaddressbook-core/src/ +source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/ +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.jphone-core.jar=../jphone-core/src/ +source.reference.juser-core.jar=../juser-core/src/ +source.reference.juser-lib.jar=../juser-lib/src/ +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml index c001750..934f9ab 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -1,18 +1,18 @@ - - - org.netbeans.modules.java.j2seproject - - - addressbook-lib - - - - - - - - - .\lib\nblibraries.properties - - - + + + org.netbeans.modules.java.j2seproject + + + jaddressbook-lib + + + + + + + + + .\lib\nblibraries.properties + + + diff --git a/src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java b/src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java new file mode 100644 index 0000000..bfc99a4 --- /dev/null +++ b/src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java @@ -0,0 +1,121 @@ +/* + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.addressbook.model.addressbook; + +import java.io.Serializable; +import java.util.List; +import javax.ejb.Remote; +import org.mxchange.jaddressbookcore.exceptions.AddressbookNameAlreadyUsedException; +import org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException; +import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; +import org.mxchange.jaddressbookcore.model.addressbook.entry.AddressbookEntry; +import org.mxchange.jusercore.model.user.User; + +/** + * A remote session interface for addressbook handling + *

+ * @author Roland Haeder + */ +@Remote +public interface AddressbookSessionBeanRemote extends Serializable { + + /** + * Retrieves a list of all users this user is not sharing the given address + * book with. + *

+ * @param user User instance + * @param addressbook Address book instance + *

+ * @return List of users + */ + List allUsersNotSharing (final User user, final Addressbook addressbook); + + /** + * Count all shared address books by given user + *

+ * @param user User instance + *

+ * @return Count of all user's shared address books + */ + Integer countAllUserSharedAddressbooks (final User user); + + /** + * Some getter for an address book instance from given id number. If the + * address book is not found, an exception is thrown. + *

+ * @param addressbookId Id number for address book instance + *

+ * @return Address book instance + *

+ * @throws org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException + * If the address book cannot be found by given id number + * @throws NullPointerException If addressbookId is null + * @throws IllegalArgumentException If the id number is below 1 + */ + Addressbook getAddressbookById (final Long addressbookId) throws AddressbookNotFoundException; + + /** + * Returns a list of all entries of given address book, whether the assigned + * user is the "owner" or "sharer" of the entry. + *

+ * @param addressbook Address book instance + *

+ * @return List of all entries + */ + List allEntries (final Addressbook addressbook); + + /** + * Some "getter" for a list of address books the logged-in user has created + *

+ * @param loggedInUser Logged-in user + *

+ * @return List of all address books + */ + List getUsersAddressbookList (final User loggedInUser); + + /** + * Creates given address book by persisting it. A User instance must be set, + * else an exception is thrown. + *

+ * @param addressbook Address book instance to create + *

+ * @return Updated address book instance + *

+ * @throws + * org.mxchange.jaddressbookcore.exceptions.AddressbookNameAlreadyUsedException + * If the address book's name has already been used by the user. + */ + Addressbook createAddressbook (final Addressbook addressbook) throws AddressbookNameAlreadyUsedException; + + /** + * Checks whether the given address book id is used (means available). + *

+ * @param addressbookId Address book id to check + *

+ * @return Whether the id is valid + */ + boolean isAddressbookIdUsed (final Long addressbookId); + + /** + * Checks if the given address book's name is already used by the user. + *

+ * @param addressbook Address bok instance to check + *

+ * @return Whether the name has already been used by the user + */ + boolean isAddressbookNameUsed (final Addressbook addressbook); +} diff --git a/src/org/mxchange/addressbook/model/shared/SharedAddressbooksSessionBeanRemote.java b/src/org/mxchange/addressbook/model/shared/SharedAddressbooksSessionBeanRemote.java new file mode 100644 index 0000000..c0e0bc0 --- /dev/null +++ b/src/org/mxchange/addressbook/model/shared/SharedAddressbooksSessionBeanRemote.java @@ -0,0 +1,71 @@ +/* + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.addressbook.model.shared; + +import java.io.Serializable; +import java.util.List; +import javax.ejb.Remote; +import org.mxchange.jaddressbookcore.exceptions.UserAlreadySharingAddressbookException; +import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; +import org.mxchange.jaddressbookcore.model.addressbook.shared.ShareableAddressbook; +import org.mxchange.jusercore.model.user.User; + +/** + * A remote interface for sharing address books + *

+ * @author Roland Haeder + */ +@Remote +public interface SharedAddressbooksSessionBeanRemote extends Serializable { + + /** + * Retrieves a list of all user's shared address books. The list contains + * only the shares. But the address books and sharee can be easily + * extracted. + *

+ * @param user User instance to get list of shared address books (shares) + * from + * + * @return List of shares (= shared address book entries) + */ + List allSharedAddressbooks (final User user); + + /** + * Starts an address book share between currently logged-in user and + * assigned user for current address book. + *

+ * @param sharee User sharee instance + * @param addressbook Address book instance + * + * @return Updated share instance + * + * @throws + * org.mxchange.addressbook.exceptions.UserAlreadySharingAddressbookException + * When the user is already sharing the address book + */ + ShareableAddressbook startSharing (final User sharee, final Addressbook addressbook) throws UserAlreadySharingAddressbookException; + + /** + * Checks if the given user is sharing address books with others + *

+ * @param user User instance + * + * @return Whether the user is sharing address books + */ + Boolean isUserSharingAddressbooks (final User user); + +} diff --git a/src/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java b/src/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java deleted file mode 100644 index 8cc496a..0000000 --- a/src/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java +++ /dev/null @@ -1,120 +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 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.addressbook.validator.addressbook; - -import java.text.MessageFormat; -import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.validator.FacesValidator; -import javax.faces.validator.ValidatorException; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote; -import org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException; -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; -import org.mxchange.jcoreee.validator.number.BaseLongValidator; -import org.mxchange.jcoreeelogger.beans.local.logger.Log; -import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; - -/** - * A validator for address book id verification - *

- * @author Roland Haeder - */ -@FacesValidator (value = "AddressbookIdValidator") -public class AddressbookIdValidator extends BaseLongValidator { - - /** - * Serial number - */ - private static final long serialVersionUID = 158_768_467_186_951_809L; - - /** - * Remote bean - */ - private AddressbookSessionBeanRemote addressbookBean; - - /** - * Logger instance - */ - @Log - private LoggerBeanLocal loggerBeanLocal; - - /** - * Public consutructor - */ - public AddressbookIdValidator () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // Lookup logger - this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N - - // ... and user controller - this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N - } - } - - @Override - public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { - // Trace message - this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N - - // All accepted, required fields - String[] requiredFields = {"addressbookId"}; //NOI18N - - // Pre-validation (example: not null, not a string, empty string ...) - super.preValidate(context, component, value, requiredFields, false); - - // Cast to long - Long addressbookId = (Long) value; - - // Is the address book id valid? - if (!this.addressbookBean.isAddressbookIdUsed(addressbookId)) { - // Is not valid - throw new ValidatorException(new FacesMessage(MessageFormat.format("No address book found with id {0}. Please check your link.", addressbookId))); //NOI18N - } - - // Init variable - Addressbook addressbook; - - // Try it - try { - // Get full data - addressbook = this.addressbookBean.getAddressbookById(addressbookId); - - // Is it set? - if (null == addressbook) { - // Is null?! - throw new NullPointerException(MessageFormat.format("addressbook for id={0} is null", addressbookId)); //NOI18N - } - } catch (final AddressbookNotFoundException ex) { - // Continue to throw - throw new ValidatorException(new FacesMessage(MessageFormat.format("Cannot find address book with id {0}", addressbookId)), ex); //NOI18N - } - - // Trace message - this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N - } -} diff --git a/src/org/mxchange/addressbook/validator/booleans/UserProfileVisibilityValidator.java b/src/org/mxchange/addressbook/validator/booleans/UserProfileVisibilityValidator.java deleted file mode 100644 index e044289..0000000 --- a/src/org/mxchange/addressbook/validator/booleans/UserProfileVisibilityValidator.java +++ /dev/null @@ -1,54 +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 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.addressbook.validator.booleans; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; -import org.mxchange.jcoreee.validator.bool.BaseBooleanValidator; - -/** - * A validator for user profile visibility - *

- * @author Roland Haeder - */ -@FacesValidator (value = "UserProfileVisibilityValidator") -public class UserProfileVisibilityValidator extends BaseBooleanValidator implements Validator { - - /** - * Serial number - */ - private static final long serialVersionUID = 185_768_717_676_910_450L; - - @Override - public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { - // Trace message - //this.getLogger().logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N - - // All accepted, required fields - String[] requiredFields = {"publicUserProfileFlag"}; //NOI18N - - // Pre-validation (example: not null, not a string, empty string ...) - super.preValidate(context, component, value, requiredFields, false); - - // Trace message - //this.getLogger().logTrace("validate: EXIT!"); //NOI18N - } - -} diff --git a/src/org/mxchange/addressbook/validator/names/AddressbookNameValidator.java b/src/org/mxchange/addressbook/validator/names/AddressbookNameValidator.java deleted file mode 100644 index 0f88381..0000000 --- a/src/org/mxchange/addressbook/validator/names/AddressbookNameValidator.java +++ /dev/null @@ -1,53 +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 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.addressbook.validator.names; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; -import org.mxchange.jcoreee.validator.string.BaseStringValidator; - -/** - * A validation class for addressbook names, such as first name or family name. - *

- * @author Roland Haeder - */ -@FacesValidator (value = "AddressbookNameValidator") -public class AddressbookNameValidator extends BaseStringValidator implements Validator { - - /** - * Serial number - */ - private static final long serialVersionUID = 27_587_896_710_689_451L; - - @Override - public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { - // Trace message - //this.getLogger().logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N - - // All accepted, required fields - String[] requiredFields = {"addressbookName"}; //NOI18N - - // Pre-validation (example: not null, not a string, empty string ...) - super.preValidate(context, component, value, requiredFields, false); - - // Trace message - //this.getLogger().logTrace("validate: EXIT!"); //NOI18N - } -} diff --git a/src/org/mxchange/addressbook/validator/user/UserIdValidator.java b/src/org/mxchange/addressbook/validator/user/UserIdValidator.java deleted file mode 100644 index d273aca..0000000 --- a/src/org/mxchange/addressbook/validator/user/UserIdValidator.java +++ /dev/null @@ -1,164 +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 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.addressbook.validator.user; - -import java.text.MessageFormat; -import java.util.Set; -import java.util.TreeSet; -import javax.enterprise.event.Observes; -import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import org.mxchange.jcoreee.validator.number.BaseLongValidator; -import org.mxchange.jcoreeelogger.beans.local.logger.Log; -import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; -import org.mxchange.jusercore.events.registration.UserRegisteredEvent; -import org.mxchange.jusercore.model.user.User; -import org.mxchange.jusercore.model.user.UserSessionBeanRemote; - -/** - * A validator for user ids - *

- * @author Roland Haeder - */ -@FacesValidator (value = "UserIdValidator") -public class UserIdValidator extends BaseLongValidator implements Validator { - - /** - * Cached user status - */ - private static final Set cachedStatus = new TreeSet<>(); - - /** - * Serial number - */ - private static final long serialVersionUID = 12_869_569_314_764_690L; - - /** - * Logger instance - */ - @Log - private LoggerBeanLocal loggerBeanLocal; - - /** - * Remote bean - */ - private UserSessionBeanRemote userBean; - - /** - * Initialization of this converter - */ - public UserIdValidator () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // Lookup logger - this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N - - // ... and user controller - this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N - } - } - - /** - * Event fired when the user registration is complete - *

- * @param event User registration event - */ - public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) { - // Trace message - this.loggerBeanLocal.logTrace(MessageFormat.format("UserIdValidator:afterRegistrationEvent: event={0} - CALLED!", event)); //NOI18N - - // event should not be null - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getRegisteredUser() == null) { - // Throw NPE again - throw new NullPointerException("event.user is null"); //NOI18N - } else if (event.getRegisteredUser().getUserId() == null) { - // userId is null - throw new NullPointerException("event.user.userId is null"); //NOI18N - } else if (event.getRegisteredUser().getUserId() < 1) { - // Not avalid id - throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N - } - - // Get user instance - User registeredUser = event.getRegisteredUser(); - - // Debug message - this.loggerBeanLocal.logDebug(MessageFormat.format("UserIdValidator:afterRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N - - // Update cache - UserIdValidator.cachedStatus.add(registeredUser.getUserId()); - - // Trace message - this.loggerBeanLocal.logTrace("UserIdValidator:afterRegistrationEvent: EXIT!"); //NOI18N - } - - @Override - public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { - // Trace message - this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N - - // All accepted, required fields - String[] requiredFields = {"userId"}; //NOI18N - - // Pre-validation (example: not null, not a string, empty string ...) - super.preValidate(context, component, value, requiredFields, false); - - // Cast value - Long userId = (Long) value; - - // Define variable - Boolean ifUserExists; - - // Is a map entry there? - if (UserIdValidator.cachedStatus.contains(userId)) { - // Get from cache - ifUserExists = Boolean.TRUE; - } else { - // Get status - ifUserExists = this.userBean.ifUserIdExists(userId); - } - - // Is the user id valid? - if (!ifUserExists) { - // Is not valid - throw new ValidatorException(new FacesMessage(MessageFormat.format("No user found with id {0}. Please check your link.", userId))); //NOI18N - } - - // Add to cache if valid - UserIdValidator.cachedStatus.add(userId); - - // Trace message - this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N - } - -}