]> git.mxchange.org Git - addressbook-mailer-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sat, 8 Jul 2017 17:16:55 +0000 (19:16 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 8 Jul 2017 17:22:14 +0000 (19:22 +0200)
- new project 'addressbook-mailer-ejb' initialized from addressbook-ejb
- this includes one message-driven bean and a singleton bean
- the message-driven bean accepts "wrapper" objects per JMS from outside EJB
- the singleton bean is then the "backend" which loads templates and delivers
  the mail
- this split from general EJB project has the benefit of easier distributing
  (cluster) load
- a lot libs were no longer needed
- added velocity engine (from addressbook-mailer) as library

Signed-off-by: Roland Häder <roland@mxchange.org>
63 files changed:
build.xml
lib/jaddressbook-core.jar [deleted file]
lib/jaddressbook-lib.jar [deleted file]
lib/jaddressbook-share-core.jar [deleted file]
lib/jaddressbook-share-lib.jar [deleted file]
lib/jcontacts-business-core.jar [deleted file]
lib/jcontacts-core.jar [deleted file]
lib/jcontacts-lib.jar [deleted file]
lib/jcountry-core.jar [deleted file]
lib/jcountry-lib.jar [deleted file]
lib/jphone-core.jar [deleted file]
lib/jphone-lib.jar [deleted file]
lib/juser-activity-core.jar [deleted file]
lib/juser-activity-lib.jar [deleted file]
lib/juser-core.jar [deleted file]
lib/juser-lib.jar [deleted file]
lib/nblibraries.properties
lib/velocity/velocity-1.7-dep.jar [new file with mode: 0644]
lib/velocity/velocity-1.7-dep.jar-LICENSE.txt [new file with mode: 0644]
lib/velocity/velocity-1.7.jar [new file with mode: 0644]
lib/velocity/velocity-1.7.jar-LICENSE.txt [new file with mode: 0644]
nbproject/build-impl.xml
nbproject/project.properties
nbproject/project.xml
src/conf/persistence.xml [deleted file]
src/java/org/mxchange/addressbook/database/BaseAddressbookDatabaseBean.java [deleted file]
src/java/org/mxchange/addressbook/mailer/model/delivery/AddressbookEmailDeliveryMessageBean.java
src/java/org/mxchange/addressbook/mailer/model/delivery/AddressbookMailerSingletonBean.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java [deleted file]
src/java/org/mxchange/addressbook/model/addressbook/share/SharedAddressbooksSessionBean.java [deleted file]
src/java/org/mxchange/jcontacts/contact/AddressbookAdminContactSessionBean.java [deleted file]
src/java/org/mxchange/jcontacts/contact/AddressbookContactSessionBean.java [deleted file]
src/java/org/mxchange/jcontacts/phone/AddressbookAdminContactPhoneSessionBean.java [deleted file]
src/java/org/mxchange/jcountry/data/AddressbookCountrySingletonBean.java [deleted file]
src/java/org/mxchange/jphone/phonenumbers/mobileprovider/AddressbookAdminMobileProviderSessionBean.java [deleted file]
src/java/org/mxchange/jphone/phonenumbers/mobileprovider/AddressbookMobileProviderSingletonBean.java [deleted file]
src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java [deleted file]
src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookPhoneSessionBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/AddressbookAdminUserSessionBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/activity/AddressbookUserActivityLogMessageBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/activity/AddressbookUserActivitySessionBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/email_address/AddressbookUserEmailChangeSessionBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/login/FinancialsUserLoginSessionBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/password_history/AddressbookUserPasswordHistorySessionBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/register/AddressbookUserRegistrationSessionBean.java [deleted file]
src/java/org/mxchange/jusercore/model/user/resendlink/AddressbookResendLinkSessionBean.java [deleted file]
src/java/templates/de/account_confirmed.vm [new file with mode: 0644]
src/java/templates/de/account_confirmed_1.vm [new file with mode: 0644]
src/java/templates/de/registration.vm [new file with mode: 0644]
src/java/templates/de/registration_1.vm [new file with mode: 0644]
src/java/templates/de/resend_confirmation_link.vm [new file with mode: 0644]
src/java/templates/de/resend_confirmation_link_1.vm [new file with mode: 0644]
src/java/templates/de/user_password_change.vm [new file with mode: 0644]
src/java/templates/de/user_password_change_1.vm [new file with mode: 0644]
src/java/templates/en/user_account_confirmed.vm [new file with mode: 0644]
src/java/templates/en/user_account_confirmed_1.vm [new file with mode: 0644]
src/java/templates/en/user_password_change.vm [new file with mode: 0644]
src/java/templates/en/user_password_change_1.vm [new file with mode: 0644]
src/java/templates/en/user_registration.vm [new file with mode: 0644]
src/java/templates/en/user_registration_1.vm [new file with mode: 0644]
src/java/templates/en/user_resend_confirmation_link.vm [new file with mode: 0644]
src/java/templates/en/user_resend_confirmation_link_1.vm [new file with mode: 0644]

index cb14d30485ddec49b466419671a54cd055e21282..9ec25cf6e9822b467dd8d87075268f4a4ae53c12 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -7,8 +7,8 @@
 <!-- the Compile on Save feature is turned off for the project. -->
 <!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
 <!-- in the project's Project Properties dialog box.-->
-<project name="addressbook-ejb" default="default" basedir="." xmlns:ejbjarproject="http://www.netbeans.org/ns/j2ee-ejbjarproject/3">
-    <description>Builds, tests, and runs the project addressbook-ejb.</description>
+<project name="addressbook-mailer-ejb" default="default" basedir="." xmlns:ejbjarproject="http://www.netbeans.org/ns/j2ee-mailer-ejbjarproject/3">
+    <description>Builds, tests, and runs the project addressbook-mailer-ejb.</description>
     <import file="nbproject/build-impl.xml"/>
     <!--
 
diff --git a/lib/jaddressbook-core.jar b/lib/jaddressbook-core.jar
deleted file mode 100644 (file)
index 800f61a..0000000
Binary files a/lib/jaddressbook-core.jar and /dev/null differ
diff --git a/lib/jaddressbook-lib.jar b/lib/jaddressbook-lib.jar
deleted file mode 100644 (file)
index 4fa0607..0000000
Binary files a/lib/jaddressbook-lib.jar and /dev/null differ
diff --git a/lib/jaddressbook-share-core.jar b/lib/jaddressbook-share-core.jar
deleted file mode 100644 (file)
index fc9e7d7..0000000
Binary files a/lib/jaddressbook-share-core.jar and /dev/null differ
diff --git a/lib/jaddressbook-share-lib.jar b/lib/jaddressbook-share-lib.jar
deleted file mode 100644 (file)
index db5880c..0000000
Binary files a/lib/jaddressbook-share-lib.jar and /dev/null differ
diff --git a/lib/jcontacts-business-core.jar b/lib/jcontacts-business-core.jar
deleted file mode 100644 (file)
index 2f4509c..0000000
Binary files a/lib/jcontacts-business-core.jar and /dev/null differ
diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar
deleted file mode 100644 (file)
index 08f3f0d..0000000
Binary files a/lib/jcontacts-core.jar and /dev/null differ
diff --git a/lib/jcontacts-lib.jar b/lib/jcontacts-lib.jar
deleted file mode 100644 (file)
index 8486a4b..0000000
Binary files a/lib/jcontacts-lib.jar and /dev/null differ
diff --git a/lib/jcountry-core.jar b/lib/jcountry-core.jar
deleted file mode 100644 (file)
index e91ed0a..0000000
Binary files a/lib/jcountry-core.jar and /dev/null differ
diff --git a/lib/jcountry-lib.jar b/lib/jcountry-lib.jar
deleted file mode 100644 (file)
index 329243d..0000000
Binary files a/lib/jcountry-lib.jar and /dev/null differ
diff --git a/lib/jphone-core.jar b/lib/jphone-core.jar
deleted file mode 100644 (file)
index ff2723d..0000000
Binary files a/lib/jphone-core.jar and /dev/null differ
diff --git a/lib/jphone-lib.jar b/lib/jphone-lib.jar
deleted file mode 100644 (file)
index 03b5bc6..0000000
Binary files a/lib/jphone-lib.jar and /dev/null differ
diff --git a/lib/juser-activity-core.jar b/lib/juser-activity-core.jar
deleted file mode 100644 (file)
index e3ddfc3..0000000
Binary files a/lib/juser-activity-core.jar and /dev/null differ
diff --git a/lib/juser-activity-lib.jar b/lib/juser-activity-lib.jar
deleted file mode 100644 (file)
index ccebfa7..0000000
Binary files a/lib/juser-activity-lib.jar and /dev/null differ
diff --git a/lib/juser-core.jar b/lib/juser-core.jar
deleted file mode 100644 (file)
index 988c425..0000000
Binary files a/lib/juser-core.jar and /dev/null differ
diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar
deleted file mode 100644 (file)
index 9f6189e..0000000
Binary files a/lib/juser-lib.jar and /dev/null differ
index 1aac91b5ad352c0ac9d8ed75040aeb0ba50fc6d4..82f74cca98b0d06e6e77c35ace52542714ed87a0 100644 (file)
@@ -1,3 +1,7 @@
+libs.velocity.classpath=\
+    ${base}/velocity/velocity-1.7-dep.jar:\
+    ${base}/velocity/velocity-1.7.jar
+libs.velocity.displayName=Apache Velocity 1.7
 libs.CopyLibs.classpath=\
     ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
 libs.CopyLibs.displayName=CopyLibs Task
diff --git a/lib/velocity/velocity-1.7-dep.jar b/lib/velocity/velocity-1.7-dep.jar
new file mode 100644 (file)
index 0000000..c99aecf
Binary files /dev/null and b/lib/velocity/velocity-1.7-dep.jar differ
diff --git a/lib/velocity/velocity-1.7-dep.jar-LICENSE.txt b/lib/velocity/velocity-1.7-dep.jar-LICENSE.txt
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/lib/velocity/velocity-1.7.jar b/lib/velocity/velocity-1.7.jar
new file mode 100644 (file)
index 0000000..ae936d3
Binary files /dev/null and b/lib/velocity/velocity-1.7.jar differ
diff --git a/lib/velocity/velocity-1.7.jar-LICENSE.txt b/lib/velocity/velocity-1.7.jar-LICENSE.txt
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
index 693651abd9588d98624f3bb30b2e8cd1caf2d4c5..5e73ec177aa6c1137d40828eafc07df83b9e839f 100644 (file)
@@ -15,7 +15,7 @@ is divided into following sections:
   - cleanup
 
         -->
-<project xmlns:ejbjarproject1="http://www.netbeans.org/ns/j2ee-ejbjarproject/1" xmlns:ejbjarproject2="http://www.netbeans.org/ns/j2ee-ejbjarproject/2" xmlns:ejbjarproject3="http://www.netbeans.org/ns/j2ee-ejbjarproject/3" basedir=".." default="default" name="addressbook-ejb-impl">
+<project xmlns:ejbjarproject1="http://www.netbeans.org/ns/j2ee-ejbjarproject/1" xmlns:ejbjarproject2="http://www.netbeans.org/ns/j2ee-ejbjarproject/2" xmlns:ejbjarproject3="http://www.netbeans.org/ns/j2ee-ejbjarproject/3" basedir=".." default="default" name="addressbook-mailer-ejb-impl">
     <import file="ant-deploy.xml"/>
     <fail message="Please build using Ant 1.7.1 or higher.">
         <condition>
@@ -433,7 +433,7 @@ or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties f
                     </fileset>
                 </union>
                 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
-                <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="addressbook-ejb" testname="TestNG tests" workingDir="${basedir}">
+                <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="addressbook-mailer-ejb" testname="TestNG tests" workingDir="${basedir}">
                     <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
                     <propertyset>
                         <propertyref prefix="test-sys-prop."/>
@@ -585,7 +585,7 @@ or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties f
                 <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
                     <isset property="test.method"/>
                 </condition>
-                <condition else="-suitename addressbook-ejb -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
+                <condition else="-suitename addressbook-mailer-ejb -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
                     <matches pattern=".*\.xml" string="@{testClass}"/>
                 </condition>
                 <delete dir="${build.test.results.dir}" quiet="true"/>
@@ -806,13 +806,7 @@ exists or setup the property manually. For example like this:
                 COMPILATION SECTION
             -->
     <target depends="init" if="no.dist.ear.dir" name="-deps-module-jar" unless="no.deps">
-        <ant antfile="${project.addressbook-core}/build.xml" inheritall="false" target="jar">
-            <property name="deploy.on.save" value="false"/>
-        </ant>
-        <ant antfile="${project.addressbook-lib}/build.xml" inheritall="false" target="jar">
-            <property name="deploy.on.save" value="false"/>
-        </ant>
-        <ant antfile="${project.addressbook-mailer}/build.xml" inheritall="false" target="jar">
+        <ant antfile="${project.addressbook-mailer-lib}/build.xml" inheritall="false" target="jar">
             <property name="deploy.on.save" value="false"/>
         </ant>
         <ant antfile="${project.juser-core}/build.xml" inheritall="false" target="jar">
@@ -820,13 +814,7 @@ exists or setup the property manually. For example like this:
         </ant>
     </target>
     <target depends="init" if="dist.ear.dir" name="-deps-ear-jar" unless="no.deps">
-        <ant antfile="${project.addressbook-core}/build.xml" inheritall="false" target="jar">
-            <property name="deploy.on.save" value="false"/>
-        </ant>
-        <ant antfile="${project.addressbook-lib}/build.xml" inheritall="false" target="jar">
-            <property name="deploy.on.save" value="false"/>
-        </ant>
-        <ant antfile="${project.addressbook-mailer}/build.xml" inheritall="false" target="jar">
+        <ant antfile="${project.addressbook-mailer-lib}/build.xml" inheritall="false" target="jar">
             <property name="deploy.on.save" value="false"/>
         </ant>
         <ant antfile="${project.juser-core}/build.xml" inheritall="false" target="jar">
@@ -846,95 +834,35 @@ exists or setup the property manually. For example like this:
     <target if="is.jars.in.ejbjar" name="-library-inclusion-in-archive-by-user">
         <copyfiles files="${file.reference.jcoreee.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jcore-logger-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jcountry-core.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jcountry-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jphone-core.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jphone-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jcontacts-core.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jcontacts-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.juser-core.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.juser-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.juser-activity-core.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.juser-activity-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jmailer-ee.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jaddressbook-core.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jaddressbook-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jaddressbook-share-core.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jaddressbook-share-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${reference.addressbook-core.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${reference.addressbook-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${reference.addressbook-mailer.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.cdi-api.jar}" todir="${build.classes.dir}"/>
+        <copyfiles files="${reference.addressbook-mailer-lib.jar}" todir="${build.classes.dir}"/>
+        <copyfiles files="${libs.velocity.classpath}" todir="${build.classes.dir}"/>
     </target>
     <target if="is.server.weblogic" name="-library-inclusion-in-archive-weblogic">
         <basename file="${file.reference.jcoreee.jar}" property="manifest.file.reference.jcoreee.jar"/>
         <basename file="${file.reference.jcore-logger-lib.jar}" property="manifest.file.reference.jcore-logger-lib.jar"/>
-        <basename file="${file.reference.jcountry-core.jar}" property="manifest.file.reference.jcountry-core.jar"/>
-        <basename file="${file.reference.jcountry-lib.jar}" property="manifest.file.reference.jcountry-lib.jar"/>
-        <basename file="${file.reference.jphone-core.jar}" property="manifest.file.reference.jphone-core.jar"/>
-        <basename file="${file.reference.jphone-lib.jar}" property="manifest.file.reference.jphone-lib.jar"/>
-        <basename file="${file.reference.jcontacts-core.jar}" property="manifest.file.reference.jcontacts-core.jar"/>
-        <basename file="${file.reference.jcontacts-lib.jar}" property="manifest.file.reference.jcontacts-lib.jar"/>
-        <basename file="${file.reference.juser-core.jar}" property="manifest.file.reference.juser-core.jar"/>
-        <basename file="${file.reference.juser-lib.jar}" property="manifest.file.reference.juser-lib.jar"/>
-        <basename file="${file.reference.juser-activity-core.jar}" property="manifest.file.reference.juser-activity-core.jar"/>
-        <basename file="${file.reference.juser-activity-lib.jar}" property="manifest.file.reference.juser-activity-lib.jar"/>
         <basename file="${file.reference.jmailer-ee.jar}" property="manifest.file.reference.jmailer-ee.jar"/>
-        <basename file="${file.reference.jaddressbook-core.jar}" property="manifest.file.reference.jaddressbook-core.jar"/>
-        <basename file="${file.reference.jaddressbook-lib.jar}" property="manifest.file.reference.jaddressbook-lib.jar"/>
-        <basename file="${file.reference.jaddressbook-share-core.jar}" property="manifest.file.reference.jaddressbook-share-core.jar"/>
-        <basename file="${file.reference.jaddressbook-share-lib.jar}" property="manifest.file.reference.jaddressbook-share-lib.jar"/>
-        <basename file="${reference.addressbook-core.jar}" property="manifest.reference.addressbook-core.jar"/>
-        <basename file="${reference.addressbook-lib.jar}" property="manifest.reference.addressbook-lib.jar"/>
-        <basename file="${reference.addressbook-mailer.jar}" property="manifest.reference.addressbook-mailer.jar"/>
         <basename file="${file.reference.cdi-api.jar}" property="manifest.file.reference.cdi-api.jar"/>
+        <basename file="${reference.addressbook-mailer-lib.jar}" property="manifest.reference.addressbook-mailer-lib.jar"/>
+        <basename file="${libs.velocity.classpath}" property="manifest.libs.velocity.classpath"/>
         <manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update">
-            <attribute name="Extension-List" value="jar-1 jar-2 jar-3 jar-4 jar-5 jar-6 jar-7 jar-8 jar-9 jar-10 jar-11 jar-12 jar-13 jar-14 jar-15 jar-16 jar-17 jar-18 jar-19 jar-20 jar-21 "/>
+            <attribute name="Extension-List" value="jar-1 jar-2 jar-3 jar-4 jar-5 jar-6 "/>
             <attribute name="jar-1-Extension-Name" value="${manifest.file.reference.jcoreee.jar}"/>
             <attribute name="jar-2-Extension-Name" value="${manifest.file.reference.jcore-logger-lib.jar}"/>
-            <attribute name="jar-3-Extension-Name" value="${manifest.file.reference.jcountry-core.jar}"/>
-            <attribute name="jar-4-Extension-Name" value="${manifest.file.reference.jcountry-lib.jar}"/>
-            <attribute name="jar-5-Extension-Name" value="${manifest.file.reference.jphone-core.jar}"/>
-            <attribute name="jar-6-Extension-Name" value="${manifest.file.reference.jphone-lib.jar}"/>
-            <attribute name="jar-7-Extension-Name" value="${manifest.file.reference.jcontacts-core.jar}"/>
-            <attribute name="jar-8-Extension-Name" value="${manifest.file.reference.jcontacts-lib.jar}"/>
-            <attribute name="jar-9-Extension-Name" value="${manifest.file.reference.juser-core.jar}"/>
-            <attribute name="jar-10-Extension-Name" value="${manifest.file.reference.juser-lib.jar}"/>
-            <attribute name="jar-11-Extension-Name" value="${manifest.file.reference.juser-activity-core.jar}"/>
-            <attribute name="jar-12-Extension-Name" value="${manifest.file.reference.juser-activity-lib.jar}"/>
-            <attribute name="jar-13-Extension-Name" value="${manifest.file.reference.jmailer-ee.jar}"/>
-            <attribute name="jar-14-Extension-Name" value="${manifest.file.reference.jaddressbook-core.jar}"/>
-            <attribute name="jar-15-Extension-Name" value="${manifest.file.reference.jaddressbook-lib.jar}"/>
-            <attribute name="jar-16-Extension-Name" value="${manifest.file.reference.jaddressbook-share-core.jar}"/>
-            <attribute name="jar-17-Extension-Name" value="${manifest.file.reference.jaddressbook-share-lib.jar}"/>
-            <attribute name="jar-18-Extension-Name" value="${manifest.reference.addressbook-core.jar}"/>
-            <attribute name="jar-19-Extension-Name" value="${manifest.reference.addressbook-lib.jar}"/>
-            <attribute name="jar-20-Extension-Name" value="${manifest.reference.addressbook-mailer.jar}"/>
-            <attribute name="jar-21-Extension-Name" value="${manifest.file.reference.cdi-api.jar}"/>
+            <attribute name="jar-3-Extension-Name" value="${manifest.file.reference.jmailer-ee.jar}"/>
+            <attribute name="jar-4-Extension-Name" value="${manifest.file.reference.cdi-api.jar}"/>
+            <attribute name="jar-5-Extension-Name" value="${manifest.reference.addressbook-mailer-lib.jar}"/>
+            <attribute name="jar-6-Extension-Name" value="${manifest.libs.velocity.classpath}"/>
         </manifest>
     </target>
     <target depends="compile" name="library-inclusion-in-manifest">
         <copyfiles files="${file.reference.jcoreee.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jcore-logger-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jcountry-core.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jcountry-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jphone-core.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jphone-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jcontacts-core.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jcontacts-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.juser-core.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.juser-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.juser-activity-core.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.juser-activity-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jmailer-ee.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jaddressbook-core.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jaddressbook-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jaddressbook-share-core.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jaddressbook-share-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${reference.addressbook-core.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${reference.addressbook-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${reference.addressbook-mailer.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.cdi-api.jar}" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${reference.addressbook-mailer-lib.jar}" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${libs.velocity.classpath}" todir="${dist.ear.dir}/lib"/>
         <manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update"/>
     </target>
     <target name="-copy-meta-inf">
@@ -1318,9 +1246,7 @@ exists or setup the property manually. For example like this:
                 CLEANUP SECTION
             -->
     <target depends="init" name="deps-clean" unless="no.deps">
-        <ant antfile="${project.addressbook-core}/build.xml" inheritall="false" target="clean"/>
-        <ant antfile="${project.addressbook-lib}/build.xml" inheritall="false" target="clean"/>
-        <ant antfile="${project.addressbook-mailer}/build.xml" inheritall="false" target="clean"/>
+        <ant antfile="${project.addressbook-mailer-lib}/build.xml" inheritall="false" target="clean"/>
         <ant antfile="${project.juser-core}/build.xml" inheritall="false" target="clean"/>
     </target>
     <target depends="init" name="-do-clean">
index 09f240a288a87540177f58ae91cb03f035db2106..da964c7b7262eb8024378d3cc0c0be811109aed4 100644 (file)
@@ -23,23 +23,9 @@ endorsed.classpath=
 excludes=
 file.reference.addressbook-mailer.jar=lib/addressbook-mailer.jar
 file.reference.cdi-api.jar=lib/cdi-api.jar
-file.reference.jaddressbook-core.jar=lib/jaddressbook-core.jar
-file.reference.jaddressbook-lib.jar=lib/jaddressbook-lib.jar
-file.reference.jaddressbook-share-core.jar=lib/jaddressbook-share-core.jar
-file.reference.jaddressbook-share-lib.jar=lib/jaddressbook-share-lib.jar
-file.reference.jcontacts-core.jar=lib/jcontacts-core.jar
-file.reference.jcontacts-lib.jar=lib/jcontacts-lib.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.jmailer-ee.jar=lib/jmailer-ee.jar
-file.reference.jphone-core.jar=lib/jphone-core.jar
-file.reference.jphone-lib.jar=lib/jphone-lib.jar
-file.reference.juser-activity-core.jar=lib/juser-activity-core.jar
-file.reference.juser-activity-lib.jar=lib/juser-activity-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
@@ -52,30 +38,15 @@ j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.ja
 j2ee.platform.wsit.classpath=
 j2ee.server.type=gfv3ee6
 jar.compress=false
-jar.name=addressbook-ejb.jar
+jar.name=addressbook-mailer-ejb.jar
 jars.in.ejbjar=false
 javac.classpath=\
     ${file.reference.jcoreee.jar}:\
     ${file.reference.jcore-logger-lib.jar}:\
-    ${file.reference.jcountry-core.jar}:\
-    ${file.reference.jcountry-lib.jar}:\
-    ${file.reference.jphone-core.jar}:\
-    ${file.reference.jphone-lib.jar}:\
-    ${file.reference.jcontacts-core.jar}:\
-    ${file.reference.jcontacts-lib.jar}:\
-    ${file.reference.juser-core.jar}:\
-    ${file.reference.juser-lib.jar}:\
-    ${file.reference.juser-activity-core.jar}:\
-    ${file.reference.juser-activity-lib.jar}:\
     ${file.reference.jmailer-ee.jar}:\
-    ${file.reference.jaddressbook-core.jar}:\
-    ${file.reference.jaddressbook-lib.jar}:\
-    ${file.reference.jaddressbook-share-core.jar}:\
-    ${file.reference.jaddressbook-share-lib.jar}:\
-    ${reference.addressbook-core.jar}:\
-    ${reference.addressbook-lib.jar}:\
-    ${reference.addressbook-mailer.jar}:\
-    ${file.reference.cdi-api.jar}
+    ${file.reference.cdi-api.jar}:\
+    ${reference.addressbook-mailer-lib.jar}:\
+    ${libs.velocity.classpath}
 javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
 javac.debug=true
 javac.deprecation=true
@@ -102,15 +73,11 @@ javadoc.windowtitle=addressbook EJBs
 meta.inf=${source.root}/conf
 meta.inf.excludes=sun-cmp-mappings.xml
 platform.active=default_platform
-project.addressbook-core=../../NetBeansProjects/addressbook-core
-project.addressbook-lib=../addressbook-lib
-project.addressbook-mailer=../addressbook-mailer
+project.addressbook-mailer-lib=../../NetBeansProjects/addressbook-mailer-lib
 project.juser-core=../juser-core
 project.license=agpl30
 project.serviceLocator.class=de.chotime.landingpage.mailer.model.delivery.LandingMailer
-reference.addressbook-core.jar=${project.addressbook-core}/dist/addressbook-core.jar
-reference.addressbook-lib.jar=${project.addressbook-lib}/dist/addressbook-lib.jar
-reference.addressbook-mailer.jar=${project.addressbook-mailer}/dist/addressbook-mailer.jar
+reference.addressbook-mailer-lib.jar=${project.addressbook-mailer-lib}/dist/addressbook-mailer-lib.jar
 resource.dir=setup
 run.test.classpath=\
     ${javac.test.classpath}:\
@@ -120,23 +87,9 @@ run.test.classpath=\
 runmain.jvmargs=
 source.encoding=UTF-8
 source.reference.addressbook-mailer.jar=../addressbook-mailer/src/
-source.reference.jaddressbook-core.jar=../jaddressbook-core/src
-source.reference.jaddressbook-lib.jar=../jaddressbook-lib/src
-source.reference.jaddressbook-share-core.jar=../jaddressbook-share-core/src
-source.reference.jaddressbook-share-lib.jar=../jaddressbook-share-lib/src
-source.reference.jcontacts-core.jar=../jcontacts-core/src/
-source.reference.jcontacts-lib.jar=../jcontacts-lib/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.jmailer-ee.jar=../jmailer-ee/src/
-source.reference.jphone-core.jar=../jphone-core/src/
-source.reference.jphone-lib.jar=../jphone-lib/src/
-source.reference.juser-activity-core.jar=../juser-activity-core/src/
-source.reference.juser-activity-lib.jar=../juser-activity-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
index 4dcbc09cd6f68abf610cf2d1bfa6eb08db48446b..0ee8b8e2c120d488487c7298c49d08794ce91d9a 100644 (file)
@@ -3,29 +3,14 @@
     <type>org.netbeans.modules.j2ee.ejbjarproject</type>
     <configuration>
         <data xmlns="http://www.netbeans.org/ns/j2ee-ejbjarproject/3">
-            <name>addressbook-ejb</name>
+            <name>addressbook-mailer-ejb</name>
             <minimum-ant-version>1.6.5</minimum-ant-version>
             <included-library dirs="200">file.reference.jcoreee.jar</included-library>
             <included-library dirs="200">file.reference.jcore-logger-lib.jar</included-library>
-            <included-library dirs="200">file.reference.jcountry-core.jar</included-library>
-            <included-library dirs="200">file.reference.jcountry-lib.jar</included-library>
-            <included-library dirs="200">file.reference.jphone-core.jar</included-library>
-            <included-library dirs="200">file.reference.jphone-lib.jar</included-library>
-            <included-library dirs="200">file.reference.jcontacts-core.jar</included-library>
-            <included-library dirs="200">file.reference.jcontacts-lib.jar</included-library>
-            <included-library dirs="200">file.reference.juser-core.jar</included-library>
-            <included-library dirs="200">file.reference.juser-lib.jar</included-library>
-            <included-library dirs="200">file.reference.juser-activity-core.jar</included-library>
-            <included-library dirs="200">file.reference.juser-activity-lib.jar</included-library>
             <included-library dirs="200">file.reference.jmailer-ee.jar</included-library>
-            <included-library dirs="200">file.reference.jaddressbook-core.jar</included-library>
-            <included-library dirs="200">file.reference.jaddressbook-lib.jar</included-library>
-            <included-library dirs="200">file.reference.jaddressbook-share-core.jar</included-library>
-            <included-library dirs="200">file.reference.jaddressbook-share-lib.jar</included-library>
-            <included-library dirs="200">reference.addressbook-core.jar</included-library>
-            <included-library dirs="200">reference.addressbook-lib.jar</included-library>
-            <included-library dirs="200">reference.addressbook-mailer.jar</included-library>
             <included-library dirs="200">file.reference.cdi-api.jar</included-library>
+            <included-library dirs="200">reference.addressbook-mailer-lib.jar</included-library>
+            <included-library dirs="200">libs.velocity.classpath</included-library>
             <source-roots>
                 <root id="src.dir"/>
             </source-roots>
         </libraries>
         <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
             <reference>
-                <foreign-project>addressbook-core</foreign-project>
-                <artifact-type>jar</artifact-type>
-                <script>build.xml</script>
-                <target>jar</target>
-                <clean-target>clean</clean-target>
-                <id>jar</id>
-            </reference>
-            <reference>
-                <foreign-project>addressbook-lib</foreign-project>
-                <artifact-type>jar</artifact-type>
-                <script>build.xml</script>
-                <target>jar</target>
-                <clean-target>clean</clean-target>
-                <id>jar</id>
-            </reference>
-            <reference>
-                <foreign-project>addressbook-mailer</foreign-project>
+                <foreign-project>addressbook-mailer-lib</foreign-project>
                 <artifact-type>jar</artifact-type>
                 <script>build.xml</script>
                 <target>jar</target>
diff --git a/src/conf/persistence.xml b/src/conf/persistence.xml
deleted file mode 100644 (file)
index b5a4906..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
-  <persistence-unit name="addressbook-ejbPU" transaction-type="JTA">
-    <jta-data-source>jdbc/addressbook</jta-data-source>
-    <class>org.mxchange.jaddressbook.model.addressbook.UserAddressbook</class>
-    <class>org.mxchange.jaddressbook.model.addressbook.entry.UserAddressbookEntry</class>
-    <class>org.mxchange.jaddressbookshare.model.addressbook.shared.AddressbookShare</class>
-    <class>org.mxchange.jcontacts.contact.UserContact</class>
-    <class>org.mxchange.jcountry.data.CountryData</class>
-    <class>org.mxchange.jphone.phonenumbers.fax.FaxNumber</class>
-    <class>org.mxchange.jphone.phonenumbers.landline.LandLineNumber</class>
-    <class>org.mxchange.jphone.phonenumbers.mobile.MobileNumber</class>
-    <class>org.mxchange.jphone.phonenumbers.mobileprovider.CellphoneProvider</class>
-    <class>org.mxchange.jusercore.model.email_address.EmailAddressChange</class>
-    <class>org.mxchange.jusercore.model.user.LoginUser</class>
-    <class>org.mxchange.jusercore.model.user.activity.UserActivityLog</class>
-    <class>org.mxchange.jusercore.model.user.password_history.UserPasswordHistory</class>
-    <exclude-unlisted-classes>false</exclude-unlisted-classes>
-    <properties>
-      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
-    </properties>
-  </persistence-unit>
-</persistence>
diff --git a/src/java/org/mxchange/addressbook/database/BaseAddressbookDatabaseBean.java b/src/java/org/mxchange/addressbook/database/BaseAddressbookDatabaseBean.java
deleted file mode 100644 (file)
index b74a841..0000000
+++ /dev/null
@@ -1,734 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.addressbook.database;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import java.util.Objects;
-import java.util.Properties;
-import javax.ejb.EJBException;
-import javax.jms.JMSException;
-import javax.jms.ObjectMessage;
-import javax.mail.Address;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.ContactUtils;
-import org.mxchange.jcoreee.database.BaseDatabaseBean;
-import org.mxchange.jmailee.model.delivery.wrapper.EmailDeliveryWrapper;
-import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumbers;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumbers;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.phonenumbers.mobile.MobileNumbers;
-import org.mxchange.jphone.utils.PhoneUtils;
-import org.mxchange.jusercore.model.user.LoginUser;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jusercore.model.user.UserUtils;
-
-/**
- * A helper class for beans that access the database.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 12_895_410_275_811_963L;
-
-       /**
-        * Protected constructor
-        */
-       protected BaseAddressbookDatabaseBean () {
-               // Call super constructor
-               super();
-       }
-
-       /**
-        * Constructor with queue factory JNDI and queue JNDI names
-        * <p>
-        * @param factoryJndi JNDI name for queue factory
-        * @param queueJndi   JNDI name for email queue
-        */
-       protected BaseAddressbookDatabaseBean (final String factoryJndi, final String queueJndi) {
-               // Call super constructor
-               super(factoryJndi, queueJndi);
-       }
-
-       /**
-        * Updates all contact's phone entry's created timestamps
-        * <p>
-        * @param contact Contact instance to update
-        */
-       protected void setAllContactPhoneEntriesCreated (final Contact contact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == contact) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact is null"); //NOI18N
-               }
-
-               // Get all phone instances
-               DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
-               DialableFaxNumber faxNumber = contact.getContactFaxNumber();
-               DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: landLineNumber={1},faxNumber={2},mobileNumber={3}", this.getClass().getSimpleName(), landLineNumber, faxNumber, mobileNumber)); //NOI18N
-
-               // Is a phone number instance set?
-               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       landLineNumber.setPhoneEntryCreated(new GregorianCalendar());
-               }
-
-               // Is a fax number instance set?
-               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       faxNumber.setPhoneEntryCreated(new GregorianCalendar());
-               }
-
-               // Is a mobile number instance set?
-               if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for cellphone number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       mobileNumber.setPhoneEntryCreated(new GregorianCalendar());
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-       /**
-        * Returns a managed instance from given mobile number
-        * <p>
-        * @param mobileNumber  Mobile instance
-        * @param fetchedNumber Found mobile number in database
-        * <p>
-        * @return Managed instance
-        */
-       protected DialableMobileNumber getManaged (final DialableMobileNumber mobileNumber, final DialableMobileNumber fetchedNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: mobileNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), mobileNumber, fetchedNumber)); //NOI18N
-
-               // Should be valid
-               if (null == mobileNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (null == fetchedNumber) {
-                       // Throw NPE again
-                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.getDetached: fetchedNumber.phoneId={1}", this.getClass().getSimpleName(), fetchedNumber.getPhoneId())); //NOI18N
-
-               // Default is null
-               DialableMobileNumber managedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameMobileNumber(mobileNumber, fetchedNumber)) {
-                       // Merge this entry
-                       managedNumber = this.getEntityManager().merge(fetchedNumber);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-       /**
-        * Returns a managed instance from given land-line number
-        * <p>
-        * @param landLineNumber Land-line instance
-        * @param fetchedNumber  Found land-line number in database
-        * <p>
-        * @return Managed instance
-        */
-       protected DialableLandLineNumber getManaged (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: landLineNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), landLineNumber, fetchedNumber)); //NOI18N
-
-               // Should be valid
-               if (null == landLineNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (null == fetchedNumber) {
-                       // Throw NPE again
-                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.getDetached: fetchedNumber.phoneId={1}", this.getClass().getSimpleName(), fetchedNumber.getPhoneId())); //NOI18N
-
-               // Default is null
-               DialableLandLineNumber managedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameLandLineNumber(landLineNumber, fetchedNumber)) {
-                       // Merge this entry
-                       managedNumber = this.getEntityManager().merge(fetchedNumber);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-       /**
-        * Returns a managed instance from given fax number
-        * <p>
-        * @param faxNumber     Fax instance
-        * @param fetchedNumber Found fax number in database
-        * <p>
-        * @return Managed instance
-        */
-       protected DialableFaxNumber getManaged (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: faxNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), faxNumber, fetchedNumber)); //NOI18N
-
-               // Should be valid
-               if (null == faxNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (null == fetchedNumber) {
-                       // Throw NPE again
-                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.getDetached: fetchedNumber.phoneId={1}", this.getClass().getSimpleName(), fetchedNumber.getPhoneId())); //NOI18N
-
-               // Default is null
-               DialableFaxNumber managedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameFaxNumber(faxNumber, fetchedNumber)) {
-                       // Merge this entry
-                       managedNumber = this.getEntityManager().merge(fetchedNumber);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-       /**
-        * Get back a managed instance from given user
-        * <p>
-        * @param user Unmanaged/detached user instance
-        * <p>
-        * @return Managed user instance
-        */
-       protected User getManagedUser (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Id is set
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is null", user.getUserId())); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N#
-               }
-
-               // Try to find it (should be there)
-               User managedUser = this.getEntityManager().find(LoginUser.class, user.getUserId());
-
-               // Should be there
-               assert (managedUser instanceof User) : "managedUser is null"; //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N
-
-               // Return it
-               return managedUser;
-       }
-
-       /**
-        * Merges given (detached) contact's data
-        * <p>
-        * @param detachedContact Contact instance to merge
-        * <p>
-        * @return Detached contact instance
-        */
-       protected Contact mergeContactData (final Contact detachedContact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactData: detachedContact={1} - CALLED!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == detachedContact) {
-                       // Throw NPE again
-                       throw new NullPointerException("detachedContact is null"); //NOI18N
-               } else if (detachedContact.getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
-               } else if (detachedContact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N
-               }
-
-               // Get contact from it and find it
-               Contact managedContact = this.getEntityManager().find(detachedContact.getClass(), detachedContact.getContactId());
-
-               // Should be found
-               assert (managedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", detachedContact.getContactId()); //NOI18N
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateUserPersonalData: managedContact.contactId={1}", this.getClass().getSimpleName(), managedContact.getContactId())); //NOI18N
-
-               // Is a fax number set?
-               if (detachedContact.getContactFaxNumber() instanceof DialableFaxNumber) {
-                       // Make fax numbers managed
-                       managedContact.setContactFaxNumber(this.getManaged(detachedContact.getContactFaxNumber(), detachedContact.getContactFaxNumber()));
-               }
-
-               // Is a land-line number set?
-               if (detachedContact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
-                       // Make land-line numbers managed
-                       managedContact.setContactLandLineNumber(this.getManaged(detachedContact.getContactLandLineNumber(), detachedContact.getContactLandLineNumber()));
-               }
-
-               // Is a mobile number set?
-               if (detachedContact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       // Make mobile numbers managed
-                       managedContact.setContactMobileNumber(this.getManaged(detachedContact.getContactMobileNumber(), detachedContact.getContactMobileNumber()));
-               }
-
-               // Set updated timestamp
-               managedContact.setContactUpdated(new GregorianCalendar());
-
-               // Copy all
-               ContactUtils.copyAll(detachedContact, managedContact);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactData: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return detached contact
-               return managedContact;
-       }
-
-       /**
-        * Merges given (detached) contact's cellphone, land-line and fax numbers
-        * <p>
-        * @param detachedContact Detached contact instance
-        */
-       protected void mergeContactsMobileLandLineFaxNumbers (final Contact detachedContact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactsMobileLandLineFaxNumbers: detachedContact={1} - CALLED!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == detachedContact) {
-                       // Throw NPE again
-                       throw new NullPointerException("detachedContact is null"); //NOI18N
-               } else if (detachedContact.getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
-               } else if (detachedContact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N
-               }
-
-               // Get all instances
-               DialableMobileNumber cellphone = detachedContact.getContactMobileNumber();
-               DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber();
-               DialableFaxNumber fax = detachedContact.getContactFaxNumber();
-
-               // Is there a  cellphone instance set?
-               if (cellphone instanceof DialableMobileNumber) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: cellphone.phoneId={0} is being updated ...", cellphone.getPhoneId())); //NOI18N
-
-                       // Then find it, too
-                       DialableMobileNumber foundMobile = this.getEntityManager().find(cellphone.getClass(), cellphone.getPhoneId());
-
-                       // Should be there
-                       assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N
-
-                       // Then merge it, too
-                       DialableMobileNumber managedMobile = this.getEntityManager().merge(foundMobile);
-
-                       // Should be there
-                       assert (managedMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", managedMobile.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       MobileNumbers.copyAll(detachedContact.getContactMobileNumber(), managedMobile);
-
-                       // Set it back
-                       detachedContact.setContactMobileNumber(managedMobile);
-               }
-
-               // 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())); //NOI18N
-
-                       // 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()); //NOI18N
-
-                       // Then merge it, too
-                       DialableFaxNumber managedFax = this.getEntityManager().merge(foundFax);
-
-                       // Should be there
-                       assert (managedFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", managedFax.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       FaxNumbers.copyAll(detachedContact.getContactFaxNumber(), managedFax);
-
-                       // Set it back
-                       detachedContact.setContactFaxNumber(managedFax);
-               }
-
-               // 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())); //NOI18N
-
-                       // 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()); //NOI18N
-
-                       // Then merge it, too
-                       DialableLandLineNumber managedLandLine = this.getEntityManager().merge(foundLandLine);
-
-                       // Should be there
-                       assert (managedLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", managedLandLine.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       LandLineNumbers.copyAll(detachedContact.getContactLandLineNumber(), managedLandLine);
-
-                       // Set it back
-                       detachedContact.setContactLandLineNumber(managedLandLine);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace("mergeContactsMobileLandLineFaxNumbers: EXIT!"); //NOI18N
-       }
-
-       /**
-        * Sends an email with given subject line, template name to given recipient
-        * and user data
-        * <p>
-        * @param subjectLine    Subject line
-        * @param templateName   Template name
-        * @param user           User instance
-        * @param baseUrl        Base URL
-        * @param randomPassword A randomly-generated password or NULL if user had
-        *                       to enter it.
-        */
-       protected void sendEmail (final String subjectLine, final String templateName, final User user, final String baseUrl, final String randomPassword) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("sendEmail: subjectLine={0},templateName={1},user={2},baseUrl={3} - CALLED!", subjectLine, templateName, user, baseUrl)); //NOI18N
-
-               // All should be set
-               if (null == subjectLine) {
-                       // Throw NPE
-                       throw new NullPointerException("subjectLine is null"); //NOI18N
-               } else if (subjectLine.isEmpty()) {
-                       // No subject line
-                       throw new IllegalArgumentException("subjectLine is empty"); //NOI18N
-               } else if (null == templateName) {
-                       // Throw NPE
-                       throw new NullPointerException("templateName is null"); //NOI18N
-               } else if (templateName.isEmpty()) {
-                       // No template name
-                       throw new IllegalArgumentException("templateName is empty"); //NOI18N
-               } else if (null == user) {
-                       // Throw NPE
-                       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 number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid.", user.getUserId())); //NOI18N
-               } else if (user.getUserName() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userName is null"); //NOI18N
-               } else if (user.getUserName().isEmpty()) {
-                       // Empty string
-                       throw new IllegalArgumentException("user.userName is empty"); //NOI18N
-               } else if (user.getUserAccountStatus() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw it again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // .. and again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is invalid", user.getUserContact().getContactId())); //NOI18N
-               } else if (user.getUserContact().getContactPersonalTitle() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactPersonalTitle is null"); //NOI18N
-               } else if (user.getUserLocale() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userLocale is null"); //NOI18N
-               } else if (this.getSession() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.session is not set. Have you forgotten to call super(String, String) and called only super() ?"); //NOI18N
-               }
-
-               // Set all values
-               Properties variables = UserUtils.getAllUserFields(user);
-
-               // Set base URL and random password
-               variables.put("baseUrl", baseUrl); //NOI18N
-               variables.put("randomPassword", ""); //NOI18N
-
-               // Is the random password set?
-               if ((randomPassword instanceof String) && (!randomPassword.isEmpty())) {
-                       variables.put("randomPassword", randomPassword); //NOI18N
-               }
-
-               // Init addresss
-               Address recipientAddress;
-
-               try {
-                       // Create email address and set
-                       recipientAddress = new InternetAddress(user.getUserContact().getContactEmailAddress());
-               } catch (final AddressException ex) {
-                       // Throw again
-                       throw new EJBException(ex);
-               }
-
-               // Prepare mail wrapper
-               // @TODO Language from message bundle
-               WrapableEmailDelivery emailWrapper = new EmailDeliveryWrapper(recipientAddress, subjectLine, templateName, variables, user.getUserLocale());
-
-               try {
-                       // Send out email change
-                       ObjectMessage message = this.getSession().createObjectMessage();
-                       message.setObject(emailWrapper);
-
-                       // Send message
-                       this.sendMessage(message);
-               } catch (final JMSException ex) {
-                       // Throw again
-                       throw new EJBException(ex);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace("sendEmail: EXIT!"); //NOI18N
-       }
-
-       /**
-        * Updates all contact's phone instances from other contact, both contacts
-        * should be the same.
-        * <p>
-        * @param contact Contact to set instances
-        * @param other   Other contact to get instances from
-        */
-       protected void setAllContactPhoneEntries (final Contact contact, final Contact other) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntries: contact={1},other={2} - CALLED!", this.getClass().getSimpleName(), contact, other)); //NOI18N
-
-               // Both must be the same and not null
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (null == other) {
-                       // Throw NPE
-                       throw new NullPointerException("other is null"); //NOI18N
-               } else if (!Objects.equals(contact, other)) {
-                       // Not same instances
-                       throw new IllegalArgumentException(MessageFormat.format("contact={0} and other={1} are not equal!", contact, other)); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactMobileNumber={0}", other.getContactMobileNumber())); //NOI18N
-
-               // Is other cellphone not set?
-               if ((other.getContactMobileNumber() == null) || (PhoneUtils.isSameMobileNumber(contact.getContactMobileNumber(), other.getContactMobileNumber()))) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying cellphone entry ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Is the fax number set?
-                       if (other.getContactMobileNumber() instanceof DialableMobileNumber) {
-                               // Copy cellphone number
-                               contact.setContactMobileNumber(this.getManaged(other.getContactMobileNumber(), contact.getContactMobileNumber()));
-                       } else {
-                               // Null it
-                               contact.setContactMobileNumber(null);
-                       }
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactLandLineNumber={0}", other.getContactLandLineNumber())); //NOI18N
-
-               // Is other cellphone not set?
-               if ((other.getContactLandLineNumber() == null) || (PhoneUtils.isSameLandLineNumber(contact.getContactLandLineNumber(), other.getContactLandLineNumber()))) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying land-line entry ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Is the land-line number set?
-                       if (other.getContactLandLineNumber() instanceof DialableLandLineNumber) {
-                               // Copy land-line number
-                               contact.setContactLandLineNumber(this.getManaged(other.getContactLandLineNumber(), contact.getContactLandLineNumber()));
-                       } else {
-                               // Null it
-                               contact.setContactLandLineNumber(null);
-                       }
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactFaxNumber={1}", this.getClass().getSimpleName(), other.getContactFaxNumber())); //NOI18N
-
-               // Is other cellphone not set?
-               if ((other.getContactFaxNumber() == null) || (PhoneUtils.isSameFaxNumber(contact.getContactFaxNumber(), other.getContactFaxNumber()))) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying fax entry ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Is the fax number set?
-                       if (other.getContactFaxNumber() instanceof DialableFaxNumber) {
-                               // Copy fax number
-                               contact.setContactFaxNumber(this.getManaged(other.getContactFaxNumber(), contact.getContactFaxNumber()));
-                       } else {
-                               // Null it
-                               contact.setContactFaxNumber(null);
-                       }
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntries: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-       /**
-        * Updates all contact's phone entry's updated timestamps
-        * <p>
-        * @param contact            Contact instance to update
-        * @param isMobileUnlinked   Whether a mobile entry has been unlinked in
-        *                           contact instance
-        * @param isLandlineUnlinked Whether a land-line entry has been unlinked in
-        *                           contact instance
-        * @param isFaxUnlinked      Whether a fax entry has been unlinked in
-        *                           contact instance
-        */
-       protected void setAllContactPhoneEntriesUpdated (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: contact={1},isMobileUnlinked={2},isLandlineUnlinked={3},isFaxUnlinked={4} - CALLED", this.getClass().getSimpleName(), contact, isMobileUnlinked, isLandlineUnlinked, isFaxUnlinked)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == contact) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               }
-
-               // Get all phone instances
-               DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
-               DialableFaxNumber faxNumber = contact.getContactFaxNumber();
-               DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
-
-               // Flags and instances must be constistent
-               if (isMobileUnlinked && mobileNumber instanceof DialableMobileNumber) {
-                       // Bad state
-                       throw new IllegalStateException("isCellPhoneUnlinked is TRUE, but mobileNumber is set."); //NOI18N
-               } else if (isLandlineUnlinked && landLineNumber instanceof DialableLandLineNumber) {
-                       // Bad state
-                       throw new IllegalStateException("isLandlineUnlinked is TRUE, but landLineNumber is set."); //NOI18N
-               } else if (isFaxUnlinked && faxNumber instanceof DialableFaxNumber) {
-                       // Bad state
-                       throw new IllegalStateException("isFaxUnlinked is TRUE, but faxNumber is set."); //NOI18N
-               }
-
-               // Is a phone number instance set?
-               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() instanceof Long) && (landLineNumber.getPhoneId() > 0)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       landLineNumber.setPhoneEntryUpdated(new GregorianCalendar());
-               }
-
-               // Is a fax number instance set?
-               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() instanceof Long) && (faxNumber.getPhoneId() > 0)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       faxNumber.setPhoneEntryUpdated(new GregorianCalendar());
-               }
-
-               // Is a mobile number instance set?
-               if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() instanceof Long) && (mobileNumber.getPhoneId() > 0)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for cellphone number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       mobileNumber.setPhoneEntryUpdated(new GregorianCalendar());
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-}
index 044b3029b8988d0f853ee380b74ff8c3052c423a..31b6e0ab319c69b6d348e6bec471ee7459de1b6c 100644 (file)
@@ -18,10 +18,8 @@ package org.mxchange.addressbook.mailer.model.delivery;
 
 import java.io.Serializable;
 import java.text.MessageFormat;
-import java.util.Properties;
-import java.util.ResourceBundle;
-import javax.annotation.PostConstruct;
 import javax.ejb.ActivationConfigProperty;
+import javax.ejb.EJB;
 import javax.ejb.MessageDriven;
 import javax.jms.JMSException;
 import javax.jms.Message;
@@ -29,11 +27,11 @@ import javax.jms.MessageListener;
 import javax.jms.ObjectMessage;
 import javax.mail.MessagingException;
 import javax.naming.NamingException;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.jcoreee.database.BaseDatabaseBean;
 import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
 
 /**
- * A message-driven bean for sending out emails
+ * A message-driven bean for sending out mails
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
@@ -44,22 +42,18 @@ import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
                        @ActivationConfigProperty (propertyName = "destinationLookup", propertyValue = "jms/addressbook-email-queue"),
                        @ActivationConfigProperty (propertyName = "destinationType", propertyValue = "javax.jms.Queue")
                })
-public class AddressbookEmailDeliveryMessageBean extends BaseAddressbookDatabaseBean implements MessageListener {
+public class AddressbookEmailDeliveryMessageBean extends BaseDatabaseBean implements MessageListener {
 
        /**
         * Serial number
         */
        private static final long serialVersionUID = 75_638_176_619_024L;
 
-       /**
-        * Configuration file
-        */
-       private final String configFile = "org.mxchange.jmailer.config"; //NOI18N//NOI18N
-
        /**
         * Mailer instance
         */
-       private final DeliverableAddressbookEmail mailer;
+       @EJB
+       private DeliverableAddressbookEmailLocal mailerBean;
 
        /**
         * Default constructor
@@ -69,51 +63,6 @@ public class AddressbookEmailDeliveryMessageBean extends BaseAddressbookDatabase
        public AddressbookEmailDeliveryMessageBean () throws NamingException {
                // Call super constructor
                super();
-
-               // Init mailer instance
-               this.mailer = new AddressbookMailer();
-       }
-
-       /**
-        * Post-construction
-        */
-       @PostConstruct
-       public void init () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.init: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Try to load bundle
-               ResourceBundle bundle = ResourceBundle.getBundle(this.configFile);
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.init: bundle={1}", this.getClass().getSimpleName(), bundle)); //NOI18N
-
-               // The bunble should be valid
-               if (null == bundle) {
-                       // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("bundle is null, maybe file {0} does not exist?", this.configFile)); //NOI18N
-               }
-
-               // Init Properties
-               Properties properties = new Properties();
-
-               // Is the bundle not empty?
-               if (!bundle.keySet().isEmpty()) {
-                       // Loop through all
-                       for (final String key : bundle.keySet()) {
-                               // Log debug message
-                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.init: key={1}", this.getClass().getSimpleName(), key)); //NOI18N
-
-                               // Get string from bundle and set it in properties
-                               properties.put(key, bundle.getString(key));
-                       }
-               }
-
-               // Handle it over to the mailer
-               this.mailer.init(properties);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.init: EXIT!", this.getClass().getSimpleName())); //NOI18N
        }
 
        @Override
@@ -164,7 +113,7 @@ public class AddressbookEmailDeliveryMessageBean extends BaseAddressbookDatabase
                if (wrapper.getLocale() == null) {
                        // Throw NPE
                        throw new NullPointerException("wrapper.locale is null"); //NOI18N
-               } else if (wrapper.getRecipientAddress()== null) {
+               } else if (wrapper.getRecipientAddress() == null) {
                        // Throw again ...
                        throw new NullPointerException("wrapper.recipientAddress is null"); //NOI18N
                } else if (wrapper.getSubjectLine() == null) {
@@ -183,7 +132,7 @@ public class AddressbookEmailDeliveryMessageBean extends BaseAddressbookDatabase
 
                try {
                        // Send email out
-                       this.mailer.sendDeliverableMail(wrapper);
+                       this.mailerBean.sendDeliverableMail(wrapper);
                } catch (final MessagingException ex) {
                        // Opps, something went wrong
                        this.getLoggerBeanLocal().logException(ex);
diff --git a/src/java/org/mxchange/addressbook/mailer/model/delivery/AddressbookMailerSingletonBean.java b/src/java/org/mxchange/addressbook/mailer/model/delivery/AddressbookMailerSingletonBean.java
new file mode 100644 (file)
index 0000000..895fbcd
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.mailer.model.delivery;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.Singleton;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.mxchange.jmailee.model.delivery.BaseMailerBean;
+import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
+
+/**
+ * A singleton mailer EJB
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Singleton
+public class AddressbookMailerSingletonBean extends BaseMailerBean implements DeliverableAddressbookEmailLocal {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 17_857_816_596_030_918L;
+
+       /**
+        * Configuration file
+        */
+       private final String configFile = "org.mxchange.jmailer.config"; //NOI18N//NOI18N
+
+       /**
+        * Email session
+        */
+       @Resource (name = "addressbookSmtpSession", description = "A Java Mail session")
+       private Session mailSession;
+
+       /**
+        * Default constructor
+        * <p>
+        */
+       public AddressbookMailerSingletonBean () {
+       }
+
+       /**
+        * Post-construction
+        */
+       @PostConstruct
+       public void init () {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.init: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
+               // Try to load bundle
+               ResourceBundle bundle = ResourceBundle.getBundle(this.configFile);
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.init: bundle={1}", this.getClass().getSimpleName(), bundle)); //NOI18N
+
+               // The bunble should be valid
+               if (null == bundle) {
+                       // Throw NPE
+                       throw new NullPointerException(MessageFormat.format("bundle is null, maybe file {0} does not exist?", this.configFile)); //NOI18N
+               }
+
+               // Init Properties
+               Properties properties = new Properties();
+
+               // Is the bundle not empty?
+               if (!bundle.keySet().isEmpty()) {
+                       // Loop through all
+                       for (final String key : bundle.keySet()) {
+                               // Log debug message
+                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.init: key={1}", this.getClass().getSimpleName(), key)); //NOI18N
+
+                               // Get string from bundle and set it in properties
+                               properties.put(key, bundle.getString(key));
+                       }
+               }
+
+               // Handle it over to the mailer
+               this.setProperties(properties);
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.init: EXIT!", this.getClass().getSimpleName())); //NOI18N
+       }
+
+       @Override
+       public void sendDeliverableMail (final WrapableEmailDelivery emailWrapper) throws MessagingException {
+               // Log trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("sendDeliverableMail: emailWrapper={0} - CALLED!", emailWrapper)); //NOI18N
+
+               // The parameter must be valid
+               if (null == emailWrapper) {
+                       // Throw NPE
+                       throw new NullPointerException("emailWrapper is null"); //NOI18N
+               } else if (emailWrapper.getRecipientAddress() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("emailWrapper.recipientAddress is null"); //NOI18N
+               } else if (emailWrapper.getSubjectLine() == null) {
+                       // ... and again
+                       throw new NullPointerException("emailWrapper.subjectLine is null"); //NOI18N
+               } else if (emailWrapper.getSubjectLine().isEmpty()) {
+                       // Is empty
+                       throw new IllegalArgumentException("emailWrapper.subjectLine is empty"); //NOI18N
+               } else if (emailWrapper.getTemplateName() == null) {
+                       // ... and again
+                       throw new NullPointerException("emailWrapper.templateName is null"); //NOI18N
+               } else if (emailWrapper.getTemplateName().isEmpty()) {
+                       // Is empty
+                       throw new IllegalArgumentException("emailWrapper.templateName is empty"); //NOI18N
+               } else if (emailWrapper.getLocale() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("emailWrapper.locale is null"); //NOI18N
+               } else if (!emailWrapper.getTemplateVariables().containsKey("baseUrl")) { //NOI18N
+                       // Not set
+                       throw new IllegalArgumentException("emailWrapper.templateVariables.baseUrl is not set"); //NOI18N
+               }
+
+               // All required data is set, load template
+               Template template = this.getTemplateEngine().getTemplate(String.format("templates/%s/%s.vm", emailWrapper.getLocale().getLanguage().toLowerCase(), emailWrapper.getTemplateName())); //NOI18N
+
+               // Init context
+               VelocityContext context = new VelocityContext();
+
+               // Are some variables set?
+               if ((emailWrapper.getTemplateVariables() != null) && (!emailWrapper.getTemplateVariables().isEmpty())) {
+                       // Add all variables
+                       for (Map.Entry<Object, Object> entry : emailWrapper.getTemplateVariables().entrySet()) {
+                               // Get key/value
+                               String key = (String) entry.getKey();
+                               String value = (String) entry.getValue();
+
+                               // Both should not be empty
+                               if (null == key) {
+                                       // Throw NPE
+                                       throw new NullPointerException("key is null"); //NOI18N
+                               } else if (null == value) {
+                                       // Throw NPE again
+                                       throw new NullPointerException(MessageFormat.format("value for key={0} is null", key)); //NOI18N
+                               }
+
+                               // Set it
+                               context.put(key, value);
+                       }
+               }
+
+               // Send the email
+               this.deliverMailWithTemplate(template, context, emailWrapper, this.mailSession);
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace("sendDeliverableMail: EXIT!"); //NOI18N
+       }
+
+}
diff --git a/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java b/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java
deleted file mode 100644 (file)
index 95e5045..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.addressbook.model.addressbook;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jaddressbook.exceptions.AddressbookNameAlreadyUsedException;
-import org.mxchange.jaddressbook.exceptions.AddressbookNotFoundException;
-import org.mxchange.jaddressbook.model.addressbook.Addressbook;
-import org.mxchange.jaddressbook.model.addressbook.UserAddressbook;
-import org.mxchange.jaddressbook.model.addressbook.entry.AddressbookEntry;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A stateless bean handling address books
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "addressbook", description = "A stateless bean for handling Addressbook addressbooks")
-public class AddressbookSessionBean extends BaseAddressbookDatabaseBean implements AddressbookSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 129_857_871_287_691L;
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<AddressbookEntry> allEntries (final Addressbook addressbook) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("allEntries: addressbook={0} - CALLED!", addressbook)); //NOI18N
-
-               // Validate parameter
-               if (null == addressbook) {
-                       // Throw NPE
-                       throw new NullPointerException("addressbook is null");
-               } else if (addressbook.getAddressbookId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("addressbook.addressbookId is null");
-               } else if (addressbook.getAddressbookId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("addressbook.addressbookId={0} is invalid.", addressbook.getAddressbookId()));
-               } else if (addressbook.getAddressbookUser() == null) {
-                       // Throw again NPE
-                       throw new NullPointerException("addressbook.addressbookUser is null");
-               } else if (addressbook.getAddressbookUser().getUserId() == null) {
-                       // Throw again NPE
-                       throw new NullPointerException("addressbook.addressbookUser.userId is null");
-               } else if (addressbook.getAddressbookUser().getUserId() < 1) {
-                       // Invalid id number again
-                       throw new IllegalArgumentException(MessageFormat.format("addressbook.addressbookUser.userId={0} is invalid", addressbook.getAddressbookUser().getUserId()));
-               }
-
-               // Generate query
-               Query query = this.getEntityManager().createNamedQuery("SearchUsersAddressbookEntries", List.class); //NOI18N
-
-               // Set parameters
-               query.setParameter("addressbook", addressbook); //NOI18N
-               query.setParameter("owner", addressbook.getAddressbookUser()); //NOI18N
-
-               // Return it
-               return query.getResultList();
-       }
-
-       @Override
-       public Addressbook createAddressbook (final Addressbook addressbook) throws AddressbookNameAlreadyUsedException {
-               // Is it not null?
-               if (null == addressbook) {
-                       // Abort here
-                       throw new NullPointerException("addressbook is null"); //NOI18N
-               } else if (addressbook.getAddressbookUser() == null) {
-                       // User instance is null
-                       throw new NullPointerException("addressbook.user should not be null."); //NOI18N
-               } else if (addressbook.getAddressbookName() == null) {
-                       // Address book name not set
-                       throw new NullPointerException("addressbook.addressbookName should not be null"); //NOI18N
-               } else if (addressbook.getAddressbookName().isEmpty()) {
-                       // Address book name not set
-                       throw new IllegalArgumentException("addressbook.addressbookName should not be empty"); //NOI18N
-               } else if (this.isAddressbookNameUsed(addressbook)) {
-                       // The assigned user already used that name
-                       throw new AddressbookNameAlreadyUsedException(addressbook);
-               }
-
-               // Add timestamp of creation
-               addressbook.setAddressbookCreated(new GregorianCalendar());
-
-               // Persist it now
-               this.getEntityManager().persist(addressbook);
-
-               // Flush it to get all data
-               this.getEntityManager().flush();
-
-               // Return it updated
-               return addressbook;
-       }
-
-       @Override
-       public Addressbook getAddressbookById (final Long addressbookId) throws AddressbookNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getAddressbookById: addressbookId={0} - CALLED!", addressbookId)); //NOI18N
-
-               // addressbookId should not be null or below 1
-               if (null == addressbookId) {
-                       // Throw NPE
-                       throw new NullPointerException("addressbookId is null"); //NOI18N
-               } else if (addressbookId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("addressbookId is not valid: {0}", addressbookId)); //NOI18N
-               } else if (!this.isAddressbookIdUsed(addressbookId)) {
-                       // No address book found
-                       throw new AddressbookNotFoundException(addressbookId);
-               }
-
-               // Get named query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchAddressbookById", UserAddressbook.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("id", addressbookId); //NOI18N
-
-               // Return it
-               return (Addressbook) query.getSingleResult();
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<Addressbook> getUsersAddressbookList (final User loggedInUser) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getUsersList: loggedInUser={0} - CALLED!", loggedInUser)); //NOI18N
-
-               // Is the user instance null?
-               if (null == loggedInUser) {
-                       // Abort here
-                       throw new NullPointerException("loggedInUser is null"); //NOI18N
-               }
-
-               // Get query instance
-               Query query = this.getEntityManager().createNamedQuery("AllUsersAddressbooks", List.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("param", loggedInUser); //NOI18N
-
-               // Get full list from JPA
-               List<Addressbook> addressbooks = query.getResultList();
-
-               // Return it
-               return addressbooks;
-       }
-
-       @Override
-       public boolean isAddressbookIdUsed (final Long addressbookId) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isAddressbookIdUsed: addressbookId={0} - CALLED!", addressbookId)); //NOI18N
-
-               // Is it null or zero?
-               if (null == addressbookId) {
-                       // Throw NPE
-                       throw new NullPointerException("addressbookId is null"); //NOI18N
-               } else if (addressbookId < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("addressbookId is not valid: {0}", addressbookId)); //NOI18N
-               }
-
-               // Get query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchAddressbookById", UserAddressbook.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("id", addressbookId); //NOI18N
-
-               // Default is not valid
-               boolean isValid = false;
-
-               // Try it again, yes no other way
-               try {
-                       // Get single result
-                       Addressbook addressbook = (Addressbook) query.getSingleResult();
-
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isAddressbookIdUsed: addressbook={0} - FOUND!", addressbook)); //NOI18N
-
-                       // Found one!
-                       isValid = true;
-               } catch (final NoResultException ex) {
-                       // Debug log only, maybe out-dated link followed
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isAddressbookIdUsed: addressbookId={0} is not valid: {1}", addressbookId, ex)); //NOI18N
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isAddressbookIdUsed: isValid={0} - EXIT!", isValid)); //NOI18N
-
-               // Return result
-               return isValid;
-       }
-
-       @Override
-       public boolean isAddressbookNameUsed (final Addressbook addressbook) {
-               // Is it not null?
-               if (null == addressbook) {
-                       // Abort here
-                       throw new NullPointerException("addressbook is null"); //NOI18N
-               } else if (addressbook.getAddressbookUser() == null) {
-                       // User instance is null
-                       throw new NullPointerException("addressbook.addressbookUser is null."); //NOI18N
-               } else if (addressbook.getAddressbookUser().getUserId() == null) {
-                       // User instance is null
-                       throw new NullPointerException("addressbook.addressbookUser.userId is null."); //NOI18N
-               } else if (addressbook.getAddressbookUser().getUserId() < 1) {
-                       // User instance is null
-                       throw new NullPointerException(MessageFormat.format("addressbook.addressbookUser.userId={0} is invalid.", addressbook.getAddressbookUser().getUserId())); //NOI18N
-               } else if (addressbook.getAddressbookName() == null) {
-                       // Address book name not set
-                       throw new NullPointerException("addressbook.addressbookName should not be null"); //NOI18N
-               } else if (addressbook.getAddressbookName().isEmpty()) {
-                       // Address book name not set
-                       throw new IllegalArgumentException("addressbook.addressbookName should not be empty"); //NOI18N
-               }
-
-               // Get query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchUserAddressbookName", Addressbook.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("user", addressbook.getAddressbookUser()); //NOI18N
-               query.setParameter("name", addressbook.getAddressbookName()); //NOI18N
-
-               // Default is not found
-               boolean isUsed = false;
-
-               // Try it
-               try {
-                       // Get a single result
-                       Addressbook dummy = (Addressbook) query.getSingleResult();
-
-                       // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isAddressbookNameUsed: Found an address book: {0}", dummy)); //NOI18N
-
-                       // Found one
-                       isUsed = true;
-               } catch (final NoResultException ex) {
-                       // No result found, so log it away
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isAddressbookNameUsed: getSingleResult() did not return a result: {0}", ex)); //NOI18N
-               }
-
-               // Return result
-               return isUsed;
-       }
-}
diff --git a/src/java/org/mxchange/addressbook/model/addressbook/share/SharedAddressbooksSessionBean.java b/src/java/org/mxchange/addressbook/model/addressbook/share/SharedAddressbooksSessionBean.java
deleted file mode 100644 (file)
index 9a90c99..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.addressbook.model.addressbook.share;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.addressbook.model.shared.AddressbookShareSessionBeanRemote;
-import org.mxchange.jaddressbook.model.addressbook.Addressbook;
-import org.mxchange.jaddressbookshare.exceptions.UserAlreadySharingAddressbookException;
-import org.mxchange.jaddressbookshare.model.addressbook.shared.AddressbookShare;
-import org.mxchange.jaddressbookshare.model.addressbook.shared.ShareableAddressbook;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A stateless bean for handling address book sharing
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "share", description = "A stateless bean for handling shared addressbooks")
-public class SharedAddressbooksSessionBean extends BaseAddressbookDatabaseBean implements AddressbookShareSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 136_984_697_285_694_710L;
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<ShareableAddressbook> allSharedAddressbooks (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("allSharedAddressbooks: user={0} - CALLED!", user)); //NOI18N
-
-               // Is user null?
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Null userId is not allowed
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Not allowed value
-                       throw new IllegalArgumentException(MessageFormat.format("user.UserId={0} is an invalid value", user.getUserId())); //NOI18N
-               }
-
-               // Get named query
-               Query query = this.getEntityManager().createNamedQuery("SearchUserSharedAddressbooks", List.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("user", user); //NOI18N
-
-               // Return full list
-               List<ShareableAddressbook> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("allSharedAddressbooks: list.size()={0} - EXIT!", list.size()));
-
-               // Return list
-               return list;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<User> allUsersNotSharing (final User user, final Addressbook addressbook) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("allUsersNotSharing: user={0},addressbook={1} - CALLED!", user, addressbook)); //NOI18N
-
-               // Test parameter
-               if (null == user) {
-                       // Throw NPE
-                       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) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
-               } else if (null == addressbook) {
-                       // Again NPE
-                       throw new NullPointerException("addressbook is null"); //NOI18N
-               } else if (addressbook.getAddressbookId() == null) {
-                       // Again NPE
-                       throw new NullPointerException("addressbook.addressbookId is null"); //NOI18N
-               } else if (addressbook.getAddressbookId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("addressbook.getAddressbookId={0} is invalid", addressbook.getAddressbookId())); //NOI18N
-               }
-
-               // Get named query for a user list without given user
-               Query allUsersExceptQuery = this.getEntityManager().createNamedQuery("SearchAllUsersExcept", List.class); //NOI18N
-
-               // Set parameter
-               allUsersExceptQuery.setParameter("user", user); //NOI18N
-
-               // Get full list
-               List<User> allUsersExcept = allUsersExceptQuery.getResultList();
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: allUsersExcept.size()={0}", allUsersExcept.size())); //NOI18N
-
-               // Now get all shares this user has created
-               Query allSharesQuery = this.getEntityManager().createNamedQuery("SearchUserSharedAddressbooks", List.class); //NOI18N
-
-               // Set parameter
-               allSharesQuery.setParameter("user", user); //NOI18N
-
-               // Get full list again
-               List<ShareableAddressbook> allShares = allSharesQuery.getResultList();
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: allShares.size()={0}", allShares.size())); //NOI18N
-
-               // List for users aharing with given
-               List<User> sharingUsers = new ArrayList<>(allShares.size());
-
-               // Check all entries
-               for (final ShareableAddressbook share : allShares) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: share.shareUserSharee={0}", share.getShareUserSharee())); //NOI18N
-
-                       // Add it
-                       sharingUsers.add(share.getShareUserSharee());
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: sharingUsers.size()={0}", sharingUsers.size())); //NOI18N
-
-               // Init final user list
-               List<User> userList = new LinkedList<>();
-
-               // Walk through all users
-               for (final User foundUser : allUsersExcept) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: foundUser={0}", foundUser)); //NOI18N
-
-                       // Does the list contain it ?
-                       if (!sharingUsers.contains(foundUser)) {
-                               // Found one to add
-                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: foundUser={0} - ADDING!", foundUser)); //NOI18N
-
-                               // Add it
-                               userList.add(foundUser);
-                       }
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("allUsersNotSharing: userList.size()={0} - EXIT!", userList.size())); //NOI18N
-
-               // Return it
-               return userList;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public Integer countAllUserSharedAddressbooks (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("countAllUserSharedAddressbooks: user={0} - CALLED!", user)); //NOI18N
-
-               // user should be valid
-               if (null == user) {
-                       // Throw NPE
-                       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) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
-               }
-
-               // Get named query
-               Query query = this.getEntityManager().createNamedQuery("SearchUserSharedAddressbooks", List.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("user", user); //NOI18N
-
-               // Default is zero
-               Integer count = 0;
-
-               // Try it
-               try {
-                       // Get whole list
-                       List<ShareableAddressbook> dummy = query.getResultList();
-
-                       // Set size
-                       count = dummy.size();
-               } catch (final NoResultException ex) {
-                       // Need to catch this, so log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("countAllUserSharedAddressbooks: getResultList() failed: {0}", ex)); //NOI18N
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("countAllUserSharedAddressbooks: count={0} - EXIT!", count)); //NOI18N
-
-               // Return count
-               return count;
-       }
-
-       @Override
-       public Boolean isUserSharingAddressbooks (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserSharingAddressbooks: user={0} - CALLED!", user)); //NOI18N
-
-               // Is user null?
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Null userId is not allowed
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Not allowed value
-                       throw new IllegalArgumentException(MessageFormat.format("user.UserId={0} is an invalid value", user.getUserId())); //NOI18N
-               }
-
-               // Get results
-               List<ShareableAddressbook> list = this.allSharedAddressbooks(user);
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserSharingAddressbooks: list.size()={0}", list.size())); //NOI18N
-
-               // Is it not empty?
-               Boolean isSharing = (!list.isEmpty());
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserSharingAddressbooks: iSharing={0} - EXIT!", isSharing)); //NOI18N
-
-               // Return it
-               return isSharing;
-       }
-
-       @Override
-       public ShareableAddressbook startSharing (final User sharee, final Addressbook addressbook) throws UserAlreadySharingAddressbookException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("startSharing: sharee={0},addressbook={1} - CALLED!", sharee, addressbook)); //NOI18N
-
-               // Check all conditions
-               if (null == sharee) {
-                       // Throw NPE
-                       throw new NullPointerException("sharee is null"); //NOI18N
-               } else if (sharee.getUserId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("sharee.userId is null"); //NOI18N
-               } else if (sharee.getUserId() < 1) {
-                       // Invalid id number
-                       throw new IllegalStateException(MessageFormat.format("sharee.userId={0} is invalid", sharee.getUserId())); //NOI18N
-               } else if (null == addressbook) {
-                       // Throw NPE again
-                       throw new NullPointerException("addressbook is null"); //NOI18N
-               } else if (addressbook.getAddressbookId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("addressbook.addressbookId is null"); //NOI18N
-               } else if (addressbook.getAddressbookId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("addressbook.addressbookId={0} is invalid.", addressbook.getAddressbookId())); //NOI18N
-               } else if (Objects.equals(addressbook.getAddressbookUser(), sharee)) {
-                       // Sharing with yourself!
-                       throw new IllegalStateException("User tries to share with himself."); //NOI18N
-               }
-
-               // Is the entry already there?
-               if (this.isUserAlreadySharingAddressbook(addressbook, sharee)) {
-                       // Abort here
-                       throw new UserAlreadySharingAddressbookException(addressbook, sharee);
-               }
-
-               // All fine so far, then create the instance
-               ShareableAddressbook share = new AddressbookShare(addressbook, sharee);
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("startSharing: share={0}", share)); //NOI18N
-
-               // Persist it
-               this.getEntityManager().persist(share);
-
-               // Flush to get id number
-               this.getEntityManager().flush();
-
-               // Return updated instance
-               return share;
-       }
-
-       /**
-        * Checks whether the owner of the given address book is already sharing it
-        * with the sharee.
-        * <p>
-        * @param addressbook Address book to be shared with
-        * @param sharee      User sharee instance
-        * <p>
-        * @return Wether the address book is already shared with the sharee
-        */
-       private boolean isUserAlreadySharingAddressbook (final Addressbook addressbook, final User sharee) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserAlreadySharingAddressbook: addressbook={0},sharee={1} - CALLED!", addressbook, sharee)); //NOI18N
-
-               // Get named query
-               Query query = this.getEntityManager().createNamedQuery("SearchShareeAddressbookShare", AddressbookShare.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("addressbook", addressbook); //NOI18N
-               query.setParameter("sharee", sharee); //NOI18N
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Try it
-               try {
-                       // Get single instance
-                       ShareableAddressbook share = (ShareableAddressbook) query.getSingleResult();
-
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserAlreadySharingAddressbook: share={0} - FOUND!", share)); //NOI18N
-
-                       // Set found
-                       isFound = true;
-               } catch (final NoResultException ex) {
-                       // Not found, log exception
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserAlreadySharingAddressbook: Notfound. Exception: {0}", ex)); //NOI18N
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserAlreadySharingAddressbook: isFound={0} - EXIT!", isFound)); //NOI18N
-
-               // Return it
-               return isFound;
-       }
-}
diff --git a/src/java/org/mxchange/jcontacts/contact/AddressbookAdminContactSessionBean.java b/src/java/org/mxchange/jcontacts/contact/AddressbookAdminContactSessionBean.java
deleted file mode 100644 (file)
index baff654..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontacts.contact;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
-
-/**
- * An administrative contact EJB
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "adminContact", description = "An administrative contact EJB")
-public class AddressbookAdminContactSessionBean extends BaseAddressbookDatabaseBean implements AdminContactSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_916L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookAdminContactSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public Contact addContact (final Contact contact) throws ContactAlreadyAddedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addContact: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // Is the instance set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() != null) {
-                       // Should be null
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} - is not null", contact.getContactId())); //NOI18N
-               }
-
-               // Set created timestamp
-               contact.setContactCreated(new GregorianCalendar());
-
-               // Set all created timestamps, if instance is there
-               this.setAllContactPhoneEntriesCreated(contact);
-
-               // Persist it
-               this.getEntityManager().persist(contact);
-
-               // Flush it to get contactId set
-               this.getEntityManager().flush();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addContact: contact.contactId={1} after persisting - EXIT!", this.getClass().getSimpleName(), contact.getContactId())); //NOI18N
-
-               // Return it
-               return contact;
-       }
-
-       @Override
-       public void deleteContactData (final Contact contact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteContactData: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // Is the instance set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Should not be null
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
-               }
-
-               // Merge it to get a managed entity back
-               Contact managedContact = this.getEntityManager().getReference(contact.getClass(), contact.getContactId());
-
-               // Remove it from database
-               this.getEntityManager().remove(managedContact);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteContactData: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-}
diff --git a/src/java/org/mxchange/jcontacts/contact/AddressbookContactSessionBean.java b/src/java/org/mxchange/jcontacts/contact/AddressbookContactSessionBean.java
deleted file mode 100644 (file)
index 2610872..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontacts.contact;
-
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Objects;
-import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
-
-/**
- * A contact EJB
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "contact", description = "A bean handling contact data")
-public class AddressbookContactSessionBean extends BaseAddressbookDatabaseBean implements ContactSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_916L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookContactSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public Contact findContactByEmailAddress (final String emailAddress) throws ContactNotFoundException {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactByEmailAddress: emailAddress={1} - CALLED!", this.getClass().getSimpleName(), emailAddress)); //NOI18N
-
-               // The parameter must be valid
-               if (null == emailAddress) {
-                       // Throw NPE
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.isEmpty()) {
-                       // Not valid
-                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
-               }
-
-               // Get query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchContactByEmailAddress", UserContact.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("emailAddress", emailAddress); //NOI18N
-
-               // Init contact instance
-               Contact contact;
-
-               // Try to find a result
-               try {
-                       // Find a single result
-                       contact = (Contact) query.getSingleResult();
-
-                       // Log trace message
-                       this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactByEmailAddress: Found contact={1}", this.getClass().getSimpleName(), contact)); //NOI18N
-               } catch (final NoResultException ex) {
-                       // No result found
-                       throw new ContactNotFoundException(emailAddress, ex);
-               }
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactByEmailAddress: contact={1} - EXIT!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // Return found instance
-               return contact;
-       }
-
-       @Override
-       public Contact findContactById (final Long contactId) throws ContactNotFoundException {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactById: contactId={1} - CALLED!", this.getClass().getSimpleName(), contactId)); //NOI18N
-
-               // The parameter must be valid
-               if (null == contactId) {
-                       // Throw NPE
-                       throw new NullPointerException("contactId is null"); //NOI18N
-               } else if (contactId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("contactId={0} is not valid", contactId)); //NOI18N
-               }
-
-               // Get query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchContactById", UserContact.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("contactId", contactId); //NOI18N
-
-               // Init contact instance
-               Contact contact;
-
-               // Try to find a result
-               try {
-                       // Find a single result
-                       contact = (Contact) query.getSingleResult();
-
-                       // Log trace message
-                       this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactById: Found contact={1}", this.getClass().getSimpleName(), contact)); //NOI18N
-               } catch (final NoResultException ex) {
-                       // No result found
-                       throw new ContactNotFoundException(contactId, ex);
-               }
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findContactById: contact={1} - EXIT!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // Return found instance
-               return contact;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<Contact> getAllContacts () {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getAllContacts - CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Create query instance
-               Query query = this.getEntityManager().createNamedQuery("AllContacts"); //NOI18N
-
-               // Get list
-               List<Contact> contacts = query.getResultList();
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getAllContacts: contacts.size()={1} - EXIT!", this.getClass().getSimpleName(), contacts.size())); //NOI18N
-
-               // Return it
-               return contacts;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<String> getEmailAddressList () {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList - CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Create query instance
-               Query query = this.getEntityManager().createNamedQuery("AllContactEmailAddresses"); //NOI18N
-
-               // Get list
-               List<String> emailAddresses = query.getResultList();
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList: emailAddresses.size()={1} - EXIT!", this.getClass().getSimpleName(), emailAddresses.size())); //NOI18N
-
-               // Return it
-               return emailAddresses;
-       }
-
-       @Override
-       public boolean isEmailAddressRegistered (final String emailAddress) {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: emailAddress={1} - CALLED!", this.getClass().getSimpleName(), emailAddress)); //NOI18N
-
-               // The email address should be valid
-               if (null == emailAddress) {
-                       // Is null
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.isEmpty()) {
-                       // Is empty
-                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               try {
-                       // Ask other method for contact instance
-                       Contact contact = this.findContactByEmailAddress(emailAddress);
-
-                       // Log debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isEmailAddressRegistered: Found contact={1} for emailAddress={2}", this.getClass().getSimpleName(), contact, emailAddress)); //NOI18N
-
-                       // It is found ...
-                       isFound = true;
-               } catch (final ContactNotFoundException ex) {
-                       // @TODO Was not found, log exception for spam check?
-               }
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: isFound={1} - EXIT!", this.getClass().getSimpleName(), isFound)); //NOI18N
-
-               // Return status
-               return isFound;
-       }
-
-       @Override
-       public Contact lookupContact (final Contact contact) {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isContactFound: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // Parameter should be valid
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() > 0) {
-                       try {
-                               // Id set, ask other method
-                               return this.findContactById(contact.getContactId());
-                       } catch (final ContactNotFoundException ex) {
-                               // Not found, should not happen
-                               throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is set, but not found.", contact.getContactId()), ex); //NOI18N
-                       }
-               }
-
-               // Default is not found
-               Contact foundContact = null;
-
-               // Get whole list
-               List<Contact> contacts = this.getAllContacts();
-
-               // Is the list empty?
-               if (contacts.isEmpty()) {
-                       // Then abort here
-                       this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isContactFound: No contacts registered, returning NULL ...", this.getClass().getSimpleName())); //NOI18N
-                       return null;
-               }
-
-               // Get iterator
-               Iterator<Contact> iterator = contacts.iterator();
-
-               // Loop through all
-               while (iterator.hasNext()) {
-                       // Get contact
-                       Contact next = iterator.next();
-
-                       // Is same contact?
-                       if ((Objects.equals(contact, next)) || (ContactUtils.isSameContact(contact, next))) {
-                               // Debug message
-                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isContactFound: Found same contact: contactId={1}", this.getClass().getSimpleName(), next.getContactId())); //NOI18N
-
-                               // Found it
-                               foundContact = next;
-                               break;
-                       }
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isContactFound: foundContact={1} - EXIT!", this.getClass().getSimpleName(), foundContact)); //NOI18N
-
-               // Return found contact
-               return foundContact;
-       }
-
-       @Override
-       public Contact updateContactData (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked) {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateContactData: contact={1},isMobileUnlinked={2},isLandlineUnlinked={3},isFaxUnlinked={4} - CALLED!", this.getClass().getSimpleName(), contact, isMobileUnlinked, isLandlineUnlinked, isFaxUnlinked)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == contact) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               }
-
-               // Merge cellphone, land-line and fix
-               Contact managedContact = this.mergeContactData(contact);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateContactData: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact updateContactData (final Contact contact) {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateContactData: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == contact) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               }
-
-               // Is cell phone/land-line/fax number unlinked?
-               boolean isMobileUnlinked = (contact.getContactMobileNumber() == null);
-               boolean isLandLineUnlinked = (contact.getContactLandLineNumber() == null);
-               boolean isFaxUnlinked = (contact.getContactFaxNumber() == null);
-
-               // Call other Method
-               Contact managedContact = this.updateContactData(contact, isMobileUnlinked, isLandLineUnlinked, isFaxUnlinked);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateContactData: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-}
diff --git a/src/java/org/mxchange/jcontacts/phone/AddressbookAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jcontacts/phone/AddressbookAdminContactPhoneSessionBean.java
deleted file mode 100644 (file)
index 8ef28c2..0000000
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontacts.phone;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import java.util.Objects;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
-import org.mxchange.jcontacts.contact.UserContact;
-import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException;
-import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-
-/**
- * A session EJB for administrative contact's phone number purposes
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "adminContactPhone", description = "An administrative bean handling contact's phone data")
-public class AddressbookAdminContactPhoneSessionBean extends BaseAddressbookDatabaseBean implements AdminContactsPhoneSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 189_217_561_460_237_108L;
-
-       /**
-        * Contact EJB
-        */
-       @EJB
-       private ContactSessionBeanRemote contactBean;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookAdminContactPhoneSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public Contact linkExistingFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingFaxNumberWithContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberAlreadyLinkedException(faxNumber);
-               } else if (null == faxNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId())); //NOI18N
-               } else if (faxNumber.getPhoneCountry() == null) {
-                       // ... and again
-                       throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18N
-               } else if (faxNumber.getPhoneAreaCode() == null) {
-                       // Throw it again
-                       throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18N
-               } else if (faxNumber.getPhoneAreaCode() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is not valid", faxNumber.getPhoneAreaCode())); //NOI18N
-               } else if (faxNumber.getPhoneNumber() == null) {
-                       // Throw it again
-                       throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneNumber() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is not valid", faxNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Merge phone number
-               DialableFaxNumber managedNumber = this.getEntityManager().merge(faxNumber);
-
-               // Set fax number in contact
-               managedContact.setContactFaxNumber(managedNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingFaxNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact linkExistingLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingLandLineNumberWithContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberAlreadyLinkedException(landLineNumber);
-               } else if (null == landLineNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId())); //NOI18N
-               } else if (landLineNumber.getPhoneCountry() == null) {
-                       // ... and again
-                       throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18N
-               } else if (landLineNumber.getPhoneAreaCode() == null) {
-                       // Throw it again
-                       throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18N
-               } else if (landLineNumber.getPhoneAreaCode() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is not valid", landLineNumber.getPhoneAreaCode())); //NOI18N
-               } else if (landLineNumber.getPhoneNumber() == null) {
-                       // Throw it again
-                       throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneNumber() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneNumber={0} is not valid", landLineNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Merge phone number
-               DialableLandLineNumber managedNumber = this.getEntityManager().merge(landLineNumber);
-
-               // Set fax number in contact
-               managedContact.setContactLandLineNumber(managedNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingLandLineNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact linkExistingMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingMobileNumberWithContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberAlreadyLinkedException(mobileNumber);
-               } else if (null == mobileNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
-               } else if (mobileNumber.getMobileProvider() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
-               } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
-               } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
-                       // Throw NPE again
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
-               }
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Merge phone number
-               DialableMobileNumber managedNumber = this.getEntityManager().merge(mobileNumber);
-
-               // Set fax number in contact
-               managedContact.setContactMobileNumber(managedNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingMobileNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact linkNewFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewFaxNumberWithContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberAlreadyLinkedException(faxNumber);
-               } else if (null == faxNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() instanceof Long) {
-                       // Throw it again
-                       throw new IllegalStateException(MessageFormat.format("faxNumber.phoneId={0} is not null", faxNumber.getPhoneId())); //NOI18N
-               } else if (faxNumber.getPhoneCountry() == null) {
-                       // ... and again
-                       throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18N
-               } else if (faxNumber.getPhoneAreaCode() == null) {
-                       // Throw it again
-                       throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18N
-               } else if (faxNumber.getPhoneAreaCode() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is not valid", faxNumber.getPhoneAreaCode())); //NOI18N
-               } else if (faxNumber.getPhoneNumber() == null) {
-                       // Throw it again
-                       throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneNumber() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is not valid", faxNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Set created instance
-               faxNumber.setPhoneEntryCreated(new GregorianCalendar());
-
-               // Persist it
-               this.getEntityManager().persist(faxNumber);
-
-               // Flush it
-               this.getEntityManager().flush();
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Set fax number in contact
-               managedContact.setContactFaxNumber(faxNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewFaxNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact linkNewLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewLandLineNumberWithContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberAlreadyLinkedException(landLineNumber);
-               } else if (null == landLineNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() instanceof Long) {
-                       // Throw it again
-                       throw new IllegalStateException(MessageFormat.format("landLineNumber.phoneId={0} is not null", landLineNumber.getPhoneId())); //NOI18N
-               } else if (landLineNumber.getPhoneCountry() == null) {
-                       // ... and again
-                       throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18N
-               } else if (landLineNumber.getPhoneAreaCode() == null) {
-                       // Throw it again
-                       throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18N
-               } else if (landLineNumber.getPhoneAreaCode() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is not valid", landLineNumber.getPhoneAreaCode())); //NOI18N
-               } else if (landLineNumber.getPhoneNumber() == null) {
-                       // Throw it again
-                       throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneNumber() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneNumber={0} is not valid", landLineNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Set created instance
-               landLineNumber.setPhoneEntryCreated(new GregorianCalendar());
-
-               // Persist it
-               this.getEntityManager().persist(landLineNumber);
-
-               // Flush it
-               this.getEntityManager().flush();
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Set land-line number in contact
-               managedContact.setContactLandLineNumber(landLineNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewLandLineNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact linkNewMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewMobileNumberWithContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberAlreadyLinkedException(mobileNumber);
-               } else if (null == mobileNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() instanceof Long) {
-                       // Throw it again
-                       throw new IllegalStateException(MessageFormat.format("mobileNumber.phoneId={0} is not null", mobileNumber.getPhoneId())); //NOI18N
-               } else if (mobileNumber.getMobileProvider() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
-               } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
-               } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
-                       // Throw NPE again
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
-               }
-
-               // Set created instance
-               mobileNumber.setPhoneEntryCreated(new GregorianCalendar());
-
-               // Persist it
-               this.getEntityManager().persist(mobileNumber);
-
-               // Flush it
-               this.getEntityManager().flush();
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Set land-line number in contact
-               managedContact.setContactMobileNumber(mobileNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewMobileNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact unlinkFaxDataFromContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberNotLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkFaxDataFromContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactFaxNumber() == null) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberNotLinkedException(faxNumber);
-               } else if (contact.getContactFaxNumber().getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact.contactFaxNumber.phoneId is null"); //NOI18N
-               } else if (contact.getContactFaxNumber().getPhoneId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactFaxNumber.phoneId={0} is invalid.", contact.getContactFaxNumber().getPhoneId())); //NOI18N
-               } else if (!Objects.equals(faxNumber.getPhoneId(), contact.getContactFaxNumber().getPhoneId())) {
-                       // Not same object
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactFaxNumber.phoneId={0} and faxNumber.phoneId={1} are not the same.", contact.getContactFaxNumber().getPhoneId(), faxNumber.getPhoneId())); //NOI18N
-               }
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Remove it from contact
-               managedContact.setContactFaxNumber(null);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkFaxDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact unlinkLandLineDataFromContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberNotLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkLandLineDataFromContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactLandLineNumber() == null) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberNotLinkedException(landLineNumber);
-               } else if (contact.getContactLandLineNumber().getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact.contactLandLineNumber.phoneId is null"); //NOI18N
-               } else if (contact.getContactLandLineNumber().getPhoneId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactLandLineNumber.phoneId={0} is invalid.", contact.getContactLandLineNumber().getPhoneId())); //NOI18N
-               } else if (!Objects.equals(landLineNumber.getPhoneId(), contact.getContactLandLineNumber().getPhoneId())) {
-                       // Not same object
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactLandLineNumber.phoneId={0} and landLineNumber.phoneId={1} are not the same.", contact.getContactLandLineNumber().getPhoneId(), landLineNumber.getPhoneId())); //NOI18N
-               }
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Remove it from contact
-               managedContact.setContactLandLineNumber(null);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkLandLineDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       @Override
-       public Contact unlinkMobileDataFromContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberNotLinkedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkMobileDataFromContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
-
-               // Is the contact set?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               } else if (contact.getContactMobileNumber() == null) {
-                       // Not set cell phone instance
-                       throw new PhoneNumberNotLinkedException(mobileNumber);
-               } else if (contact.getContactMobileNumber().getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact.contactMobileNumber.phoneId is null"); //NOI18N
-               } else if (contact.getContactMobileNumber().getPhoneId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactMobileNumber.phoneId={0} is invalid.", contact.getContactMobileNumber().getPhoneId())); //NOI18N
-               } else if (!Objects.equals(mobileNumber.getPhoneId(), contact.getContactMobileNumber().getPhoneId())) {
-                       // Not same object
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactMobileNumber.phoneId={0} and mobileNumber.phoneId={1} are not the same.", contact.getContactMobileNumber().getPhoneId(), mobileNumber.getPhoneId())); //NOI18N
-               }
-
-               // Find contact
-               Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Remove it from contact
-               managedContact.setContactMobileNumber(null);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkMobileDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-}
diff --git a/src/java/org/mxchange/jcountry/data/AddressbookCountrySingletonBean.java b/src/java/org/mxchange/jcountry/data/AddressbookCountrySingletonBean.java
deleted file mode 100644 (file)
index 8d1f5a4..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
-*/
-package org.mxchange.jcountry.data;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import java.util.List;
-import javax.ejb.Singleton;
-import javax.ejb.Startup;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
-
-/**
- * A singleton EJB for country informations
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Startup
-@Singleton (name = "country", description = "A singleton session-scoped bean for country informations")
-public class AddressbookCountrySingletonBean extends BaseAddressbookDatabaseBean implements CountrySingletonBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 15_846_983_298_691_207L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookCountrySingletonBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public Country addCountry (final Country country) throws CountryAlreadyAddedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addCountry: country={1} - CALLED!", this.getClass().getSimpleName(), country)); //NOI18N
-
-               // Is it already there?
-               if (null == country) {
-                       // Throw NPE
-                       throw new NullPointerException("country is null"); //NOI18N
-               } else if (country.getCountryCode().isEmpty()) {
-                       // Code is not set
-                       throw new IllegalArgumentException("country.countryCode is empty"); //NOI18N
-               } else if (country.getCountryI18nKey().isEmpty()) {
-                       // I18n key is not set
-                       throw new IllegalArgumentException("country.countryI18nKey is empty"); //NOI18N
-               } else if (country.getCountryId() != null) {
-                       // Should be null
-                       throw new IllegalArgumentException(MessageFormat.format("country.countryId is not null ({0})", country.getCountryId())); //NOI18N
-               } else if (this.isCountryAdded(country)) {
-                       // Yes, then abort here
-                       throw new CountryAlreadyAddedException(country);
-               }
-
-               // Add timestamp
-               country.setCountryEntryCreated(new GregorianCalendar());
-
-               // It is not added, so persist it
-               this.getEntityManager().persist(country);
-
-               // Flush it to get id number back, maybe it is directly needed?
-               this.getEntityManager().flush();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addCountry: country={1} - EXIT!", this.getClass().getSimpleName(), country)); //NOI18N
-
-               // Return updated instance
-               return country;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<Country> allCountries () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCountries: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Init query
-               Query query = this.getEntityManager().createNamedQuery("AllCountries", CountryData.class); //NOI18N
-
-               // Get list
-               List<Country> countries = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCountries: countries.size()={1} - EXIT!", this.getClass().getSimpleName(), countries.size())); //NOI18N
-
-               // Return it
-               return countries;
-       }
-
-       /**
-        * Checks whether given country is already added by i18n key or country
-        * code, what comes first.
-        * <p>
-        * @param country Country instance to check
-        * <p>
-        * @return Whether the country was found
-        */
-       private boolean isCountryAdded (final Country country) {
-               if (null == country) {
-                       // Throw NPE
-                       throw new NullPointerException("country is null"); //NOI18N
-               } else if (country.getCountryCode().isEmpty()) {
-                       // Code is not set
-                       throw new IllegalArgumentException("country.countryCode is empty"); //NOI18N
-               } else if (country.getCountryI18nKey().isEmpty()) {
-                       // I18n key is not set
-                       throw new IllegalArgumentException("country.countryI18nKey is empty"); //NOI18N
-               } else if (country.getCountryId() != null) {
-                       // Should be null
-                       throw new IllegalArgumentException(MessageFormat.format("country.countryId is not null ({0})", country.getCountryId())); //NOI18N
-               }
-
-               // Default is not found
-               boolean isAdded = false;
-
-               // Get query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchCountryByCodeI18nKey", CountryData.class); //NOI18N
-
-               // Assign all parameters
-               query.setParameter("code", country.getCountryCode()); //NOI18N
-               query.setParameter("key", country.getCountryI18nKey()); //NOI18N
-
-               // Try to get a single result
-               try {
-                       // Get single result
-                       Country foundCountry = (Country) query.getSingleResult();
-
-                       // Found it?
-                       isAdded = (foundCountry instanceof Country);
-               } catch (final NoResultException ex) {
-                       // Not found, don't log this
-               }
-
-               // Return result
-               return isAdded;
-       }
-
-}
diff --git a/src/java/org/mxchange/jphone/phonenumbers/mobileprovider/AddressbookAdminMobileProviderSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/mobileprovider/AddressbookAdminMobileProviderSessionBean.java
deleted file mode 100644 (file)
index 923ad7f..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jphone.phonenumbers.mobileprovider;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException;
-
-/**
- * An administrative singleton EJB for mobile provider informations
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "adminMobileProvider", description = "A singleton session-scoped bean for mobile provider informations, admin-edition")
-public class AddressbookAdminMobileProviderSessionBean extends BaseAddressbookDatabaseBean implements AdminMobileProviderSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 15_846_983_298_691_207L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookAdminMobileProviderSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public MobileProvider addMobileProvider (final MobileProvider mobileProvider) throws MobileProviderAlreadyAddedException {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addMobileProvider: mobileProvider={1} - CALLED!", this.getClass().getSimpleName(), mobileProvider)); //NOI18N
-
-               // Is the instance valid?
-               if (null == mobileProvider) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileProvider is null"); //NOI18N
-               } else if (mobileProvider.getProviderDialPrefix() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileProvider.providerDialPrefix is null"); //NOI18N
-               } else if (mobileProvider.getProviderDialPrefix() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("mobileProvider.providerDialPrefix={0} is not valid.", mobileProvider.getProviderDialPrefix())); //NOI18N
-               } else if (mobileProvider.getProviderCountry() == null) {
-                       // Throw again a NPE
-                       throw new NullPointerException("mobileProvider.providerCountry is null"); //NOI18N
-               } else if (mobileProvider.getProviderMailPattern() == null) {
-                       // ... and again ...
-                       throw new NullPointerException("mobileProvider.providerMailPattern is null"); //NOI18N
-               } else if (mobileProvider.getProviderMailPattern().isEmpty()) {
-                       // Empty pattern set (not allowed)
-                       throw new IllegalArgumentException("mobileProvider.providerMailPattern is empty."); //NOI18N
-               } else if (!mobileProvider.getProviderMailPattern().contains("%s")) { //NOI18N
-                       // No place-holder found
-                       throw new IllegalArgumentException(MessageFormat.format("mobileProvider.providerMailPattern={0} does not contain '%s' which is need to be replaced with the full mobile number.", mobileProvider.getProviderMailPattern())); //NOI18N
-               } else if (mobileProvider.getProviderName() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileProvider.providerName is null"); //NOI18N
-               } else if (mobileProvider.getProviderName().isEmpty()) {
-                       // Empty name is not allowed
-                       throw new IllegalArgumentException("mobileProvider.providerName is empty"); //NOI18N
-               }
-
-               // Set creation timestamp
-               mobileProvider.setProviderEntryCreated(new GregorianCalendar());
-
-               // Persist it
-               this.getEntityManager().persist(mobileProvider);
-
-               // ... and flush it to get id back
-               this.getEntityManager().flush();
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addMobileProvider: mobileProvider.providerId={1} - EXIT!", this.getClass().getSimpleName(), mobileProvider.getProviderId())); //NOI18N
-
-               // Return updated
-               return mobileProvider;
-       }
-
-}
diff --git a/src/java/org/mxchange/jphone/phonenumbers/mobileprovider/AddressbookMobileProviderSingletonBean.java b/src/java/org/mxchange/jphone/phonenumbers/mobileprovider/AddressbookMobileProviderSingletonBean.java
deleted file mode 100644 (file)
index 3de7139..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jphone.phonenumbers.mobileprovider;
-
-import java.text.MessageFormat;
-import java.util.List;
-import javax.ejb.Singleton;
-import javax.ejb.Startup;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-
-/**
- * A singleton EJB for mobile provider informations
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Startup
-@Singleton (name = "mobileprovider", description = "A singleton session-scoped bean for SMS provider informations")
-public class AddressbookMobileProviderSingletonBean extends BaseAddressbookDatabaseBean implements MobileProviderSingletonBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 15_846_983_298_691_207L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookMobileProviderSingletonBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<MobileProvider> allMobileProvider () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileProvider: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Init query
-               Query query = this.getEntityManager().createNamedQuery("AllMobileProvider", CellphoneProvider.class); //NOI18N
-
-               // Get list from it
-               List<MobileProvider> mobileProviders = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileProvider: mobileProviders.size()={1} - EXIT!", this.getClass().getSimpleName(), mobileProviders.size())); //NOI18N
-
-               // Return it
-               return mobileProviders;
-       }
-
-}
diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java
deleted file mode 100644 (file)
index 1d63242..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jphone.phonenumbers.phone;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumbers;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumbers;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.phonenumbers.mobile.MobileNumbers;
-
-/**
- * An EJB for administrative phone purposes
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "adminPhone", description = "An administrative bean handling phone data")
-public class AddressbookAdminPhoneSessionBean extends BaseAddressbookDatabaseBean implements AdminPhoneSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 18_597_165_817_401_853L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookAdminPhoneSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public void deleteFaxData (final DialableFaxNumber faxNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteFaxData: faxNumber={1} - CALLED!", this.getClass().getSimpleName(), faxNumber));
-
-               // Is all data set
-               if (faxNumber == null) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId())); //NOI18N
-               } else if (faxNumber.getPhoneCountry() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18N
-               } else if (faxNumber.getPhoneCountry().getCountryId() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber.phoneCountry.countryId is null"); //NOI18N
-               } else if (faxNumber.getPhoneCountry().getCountryId() < 1) {
-                       // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("faxNumber.phoneCountry.countryId={0} is not valid", faxNumber.getPhoneCountry().getCountryId())); //NOI18N
-               } else if (faxNumber.getPhoneAreaCode() == null) {
-                       // ... throw again
-                       throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18N
-               } else if (faxNumber.getPhoneAreaCode() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is not valid.", faxNumber.getPhoneAreaCode())); //NOI18N
-               } else if (faxNumber.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneNumber() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("faxNumber.phoneNumber={0} is not valid.", faxNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Get a managed instance
-               DialableFaxNumber managedNumber = this.getEntityManager().getReference(faxNumber.getClass(), faxNumber.getPhoneId());
-
-               // Remove it from database
-               this.getEntityManager().remove(managedNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: EXIT!", this.getClass().getSimpleName()));
-       }
-
-       @Override
-       public void deleteLandLineData (final DialableLandLineNumber landLineNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteLandLineData: landLineNumber={1} - CALLED!", this.getClass().getSimpleName(), landLineNumber));
-
-               // Is all data set
-               if (landLineNumber == null) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId())); //NOI18N
-               } else if (landLineNumber.getPhoneCountry() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18N
-               } else if (landLineNumber.getPhoneCountry().getCountryId() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber.phoneCountry.countryId is null"); //NOI18N
-               } else if (landLineNumber.getPhoneCountry().getCountryId() < 1) {
-                       // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("landLineNumber.phoneCountry.countryId={0} is not valid", landLineNumber.getPhoneCountry().getCountryId())); //NOI18N
-               } else if (landLineNumber.getPhoneAreaCode() == null) {
-                       // ... throw again
-                       throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18N
-               } else if (landLineNumber.getPhoneAreaCode() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is not valid.", landLineNumber.getPhoneAreaCode())); //NOI18N
-               } else if (landLineNumber.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneNumber() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("landLineNumber.phoneNumber={0} is not valid.", landLineNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Get a managed instance
-               DialableLandLineNumber managedNumber = this.getEntityManager().getReference(landLineNumber.getClass(), landLineNumber.getPhoneId());
-
-               // Remove it from database
-               this.getEntityManager().remove(managedNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: EXIT!", this.getClass().getSimpleName()));
-       }
-
-       @Override
-       public void deleteMobileData (final DialableMobileNumber mobileNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber));
-
-               // Is all data set
-               if (null == mobileNumber) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
-               } else if (mobileNumber.getMobileProvider() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber.cellphoneProvider is null"); //NOI18N
-               } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("mobileNumber.cellphoneProvider.providerId is null"); //NOI18N
-               } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.cellphoneProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
-               } else if (mobileNumber.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N
-               } else if (mobileNumber.getPhoneNumber() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneNumber={0} is not valid.", mobileNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Get a managed instance
-               DialableMobileNumber managedNumber = this.getEntityManager().getReference(mobileNumber.getClass(), mobileNumber.getPhoneId());
-
-               // Remove it from database
-               this.getEntityManager().remove(managedNumber);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: EXIT!", this.getClass().getSimpleName()));
-       }
-
-       @Override
-       public DialableFaxNumber updateFaxData (final DialableFaxNumber faxNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateFaxData: faxNumber={1} - CALLED!", this.getClass().getSimpleName(), faxNumber));
-
-               // Is all data set
-               if (faxNumber == null) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId())); //NOI18N
-               } else if (faxNumber.getPhoneCountry() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18N
-               } else if (faxNumber.getPhoneCountry().getCountryId() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber.phoneCountry.countryId is null"); //NOI18N
-               } else if (faxNumber.getPhoneCountry().getCountryId() < 1) {
-                       // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("faxNumber.phoneCountry.countryId={0} is not valid", faxNumber.getPhoneCountry().getCountryId())); //NOI18N
-               } else if (faxNumber.getPhoneAreaCode() == null) {
-                       // ... throw again
-                       throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18N
-               } else if (faxNumber.getPhoneAreaCode() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is not valid.", faxNumber.getPhoneAreaCode())); //NOI18N
-               } else if (faxNumber.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneNumber() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("faxNumber.phoneNumber={0} is not valid.", faxNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Get contact from it and find it
-               DialableFaxNumber managedNumber = this.getEntityManager().find(faxNumber.getClass(), faxNumber.getPhoneId());
-
-               // Should be found
-               assert (managedNumber instanceof DialableFaxNumber) : MessageFormat.format("Cell phone number with id {0} not found, but should be.", faxNumber.getPhoneId()); //NOI18N
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateFaxData: managedNumber.phoneId={1}", this.getClass().getSimpleName(), managedNumber.getPhoneId())); //NOI18N
-
-               // Set updated timestamp
-               FaxNumbers.copyAll(faxNumber, managedNumber);
-               managedNumber.setPhoneEntryUpdated(new GregorianCalendar());
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateFaxData: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-       @Override
-       public DialableLandLineNumber updateLandLineData (final DialableLandLineNumber landLineNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateLandLineData: landLineNumber={1} - CALLED!", this.getClass().getSimpleName(), landLineNumber));
-
-               // Is all data set
-               if (landLineNumber == null) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId())); //NOI18N
-               } else if (landLineNumber.getPhoneCountry() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18N
-               } else if (landLineNumber.getPhoneCountry().getCountryId() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber.phoneCountry.countryId is null"); //NOI18N
-               } else if (landLineNumber.getPhoneCountry().getCountryId() < 1) {
-                       // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("landLineNumber.phoneCountry.countryId={0} is not valid", landLineNumber.getPhoneCountry().getCountryId())); //NOI18N
-               } else if (landLineNumber.getPhoneAreaCode() == null) {
-                       // ... throw again
-                       throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18N
-               } else if (landLineNumber.getPhoneAreaCode() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is not valid.", landLineNumber.getPhoneAreaCode())); //NOI18N
-               } else if (landLineNumber.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneNumber() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("landLineNumber.phoneNumber={0} is not valid.", landLineNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Get contact from it and find it
-               DialableLandLineNumber managedNumber = this.getEntityManager().find(landLineNumber.getClass(), landLineNumber.getPhoneId());
-
-               // Should be found
-               assert (managedNumber instanceof DialableLandLineNumber) : MessageFormat.format("Cell phone number with id {0} not found, but should be.", landLineNumber.getPhoneId()); //NOI18N
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateLandLineData: managedNumber.phoneId={1}", this.getClass().getSimpleName(), managedNumber.getPhoneId())); //NOI18N
-
-               // Set updated timestamp
-               LandLineNumbers.copyAll(landLineNumber, managedNumber);
-               managedNumber.setPhoneEntryUpdated(new GregorianCalendar());
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateLandLineData: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-       @Override
-       public DialableMobileNumber updateMobileData (final DialableMobileNumber mobileNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber));
-
-               // Is all data set
-               if (null == mobileNumber) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
-               } else if (mobileNumber.getMobileProvider() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber.cellphoneProvider is null"); //NOI18N
-               } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("mobileNumber.cellphoneProvider.providerId is null"); //NOI18N
-               } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.cellphoneProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
-               } else if (mobileNumber.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N
-               } else if (mobileNumber.getPhoneNumber() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneNumber={0} is not valid.", mobileNumber.getPhoneNumber())); //NOI18N
-               }
-
-               // Get contact from it and find it
-               DialableMobileNumber managedNumber = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getPhoneId());
-
-               // Should be found
-               assert (managedNumber instanceof DialableMobileNumber) : MessageFormat.format("Cell phone number with id {0} not found, but should be.", mobileNumber.getPhoneId()); //NOI18N
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateMobileData: managedNumber.phoneId={1}", this.getClass().getSimpleName(), managedNumber.getPhoneId())); //NOI18N
-
-               // Set updated timestamp
-               MobileNumbers.copyAll(mobileNumber, managedNumber);
-               managedNumber.setPhoneEntryUpdated(new GregorianCalendar());
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateMobileData: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-}
diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookPhoneSessionBean.java
deleted file mode 100644 (file)
index 63084f5..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jphone.phonenumbers.phone;
-
-import java.text.MessageFormat;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
-
-/**
- * A general phone EJB
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "phone", description = "A bean handling phone data")
-public class AddressbookPhoneSessionBean extends BaseAddressbookDatabaseBean implements PhoneSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 134_945_698_127_601L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookPhoneSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @SuppressWarnings ("unchecked")
-       @Override
-       public List<DialableFaxNumber> allFaxNumbers () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allFaxNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get query
-               Query query = this.getEntityManager().createNamedQuery("AllFaxNumbers", FaxNumber.class); //NOI18N
-
-               // Get list from it
-               List<DialableFaxNumber> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allFaxNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-               // Return it
-               return list;
-       }
-
-       @SuppressWarnings ("unchecked")
-       @Override
-       public List<DialableLandLineNumber> allLandLineNumbers () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allLandLineNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get query
-               Query query = this.getEntityManager().createNamedQuery("AllLandLineNumbers", LandLineNumber.class); //NOI18N
-
-               // Get list from it
-               List<DialableLandLineNumber> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allLandLineNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-               // Return it
-               return list;
-       }
-
-       @SuppressWarnings ("unchecked")
-       @Override
-       public List<DialableMobileNumber> allMobileNumbers () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get query
-               Query query = this.getEntityManager().createNamedQuery("AllMobileNumbers", MobileNumber.class); //NOI18N
-
-               // Get list from it
-               List<DialableMobileNumber> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       public DialableFaxNumber findFaxNumberById (final Long faxNumberId) throws PhoneEntityNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findFaxNumberById: mobileNumberId={1} - CALLED!", this.getClass().getSimpleName(), faxNumberId)); //NOI18N
-
-               // The id number should be valid
-               if (null == faxNumberId) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumberId is null"); //NOI18N
-               } else if (faxNumberId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumberId={0} is not valid.", faxNumberId)); //NOI18N
-               }
-
-               // Now find it
-               Query query = this.getEntityManager().createNamedQuery("SearchFaxNumberId", FaxNumber.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("faxNumberId", faxNumberId); //NOI18N
-
-               // Init instance
-               DialableFaxNumber faxNumber = null;
-
-               // Try to get a result
-               try {
-                       // Get a single result
-                       faxNumber = (DialableFaxNumber) query.getSingleResult();
-               } catch (NoResultException ex) {
-                       // The entry was not found, so throw it again
-                       throw new PhoneEntityNotFoundException(faxNumberId, ex);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findFaxNumberById: cellphone={1} - EXIT!", this.getClass().getSimpleName(), faxNumber)); //NOI18N
-
-               // Return found instance
-               return faxNumber;
-       }
-
-       @Override
-       public DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findLandLineNumberById: mobileNumberId={1} - CALLED!", this.getClass().getSimpleName(), landLineNumberId)); //NOI18N
-
-               // The id number should be valid
-               if (null == landLineNumberId) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumberId is null"); //NOI18N
-               } else if (landLineNumberId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumberId={0} is not valid.", landLineNumberId)); //NOI18N
-               }
-
-               // Now find it
-               Query query = this.getEntityManager().createNamedQuery("SearchLandLineNumberId", LandLineNumber.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("landLineNumberId", landLineNumberId); //NOI18N
-
-               // Init instance
-               DialableLandLineNumber landLineNumber = null;
-
-               // Try to get a result
-               try {
-                       // Get a single result
-                       landLineNumber = (DialableLandLineNumber) query.getSingleResult();
-               } catch (NoResultException ex) {
-                       // The entry was not found, so throw it again
-                       throw new PhoneEntityNotFoundException(landLineNumberId, ex);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findLandLineNumberById: cellphone={1} - EXIT!", this.getClass().getSimpleName(), landLineNumber)); //NOI18N
-
-               // Return found instance
-               return landLineNumber;
-       }
-
-       @Override
-       public DialableMobileNumber findMobileNumberById (final Long mobileNumberId) throws PhoneEntityNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findMobileNumberById: mobileNumberId={1} - CALLED!", this.getClass().getSimpleName(), mobileNumberId)); //NOI18N
-
-               // The id number should be valid
-               if (null == mobileNumberId) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumberId is null"); //NOI18N
-               } else if (mobileNumberId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumberId={0} is not valid.", mobileNumberId)); //NOI18N
-               }
-
-               // Now find it
-               Query query = this.getEntityManager().createNamedQuery("SearchMobileNumberId", MobileNumber.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("mobileNumberId", mobileNumberId); //NOI18N
-
-               // Init instance
-               DialableMobileNumber cellphone = null;
-
-               // Try to get a result
-               try {
-                       // Get a single result
-                       cellphone = (DialableMobileNumber) query.getSingleResult();
-               } catch (NoResultException ex) {
-                       // The entry was not found, so throw it again
-                       throw new PhoneEntityNotFoundException(mobileNumberId, ex);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findMobileNumberById: cellphone={1} - EXIT!", this.getClass().getSimpleName(), cellphone)); //NOI18N
-
-               // Return found instance
-               return cellphone;
-       }
-
-}
diff --git a/src/java/org/mxchange/jusercore/model/user/AddressbookAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/AddressbookAdminUserSessionBean.java
deleted file mode 100644 (file)
index 1dc8927..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
-import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
-import org.mxchange.jusercore.exceptions.UserStatusLockedException;
-import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
-import org.mxchange.jusercore.model.user.register.UserRegistrationSessionBeanRemote;
-import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-
-/**
- * An administrative user EJB
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "adminUser", description = "A bean handling the user data")
-public class AddressbookAdminUserSessionBean extends BaseAddressbookDatabaseBean implements AdminUserSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_916L;
-
-       /**
-        * Registration EJB
-        */
-       @EJB
-       private UserRegistrationSessionBeanRemote registerBean;
-
-       /**
-        * Regular user bean
-        */
-       @EJB
-       private UserSessionBeanRemote userBean;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookAdminUserSessionBean () {
-               // Call super constructor
-               super("jms/addressbook-queue-factory", "jms/addressbook-email-queue"); //NOI18N
-       }
-
-       @Override
-       public User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addUser: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() instanceof Long) {
-                       // Not allowed here
-                       throw new IllegalStateException(MessageFormat.format("user.userId must be null, is: {0}", user.getUserId())); //NOI18N
-               }
-
-               // Check if user is registered
-               if (this.registerBean.isUserNameRegistered(user)) {
-                       // Abort here
-                       throw new UserNameAlreadyRegisteredException(user);
-               } else if (this.registerBean.isEmailAddressRegistered(user)) {
-                       // Abort here
-                       throw new EmailAddressAlreadyRegisteredException(user);
-               }
-
-               // Set created timestamp
-               user.setUserCreated(new GregorianCalendar());
-               user.getUserContact().setContactCreated(new GregorianCalendar());
-
-               // Update cellphone, land-line and fax instance
-               this.setAllContactPhoneEntriesCreated(user.getUserContact());
-
-               // Persist it
-               this.getEntityManager().persist(user);
-
-               // Flush to get id back
-               this.getEntityManager().flush();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addUser: user={1},user.userId={2} - EXIT!", this.getClass().getSimpleName(), user, user.getUserId())); //NOI18N
-
-               // Return it
-               return user;
-       }
-
-       @Override
-       public void deleteUser (final User user, final String userDeleteReason) throws UserNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteUser: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Id is set
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N
-               } else if (user.getUserAccountStatus() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
-               } else if (!this.userBean.ifUserExists(user)) {
-                       // Name already found
-                       throw new UserNotFoundException(user);
-               }
-
-               // Get a managed instance
-               User managedUser = this.getManagedUser(user);
-
-               // Should be found!
-               assert (managedUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N
-
-               // Delete it
-               this.getEntityManager().remove(managedUser);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteUser: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-       @Override
-       public User linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkUser: user={0} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() instanceof Long) {
-                       // Id is set
-                       throw new IllegalArgumentException("user.userId is not null"); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N
-               } else if (user.getUserAccountStatus() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
-               } else if (this.userBean.ifUserNameExists(user.getUserName())) {
-                       // Name already found
-                       throw new UserNameAlreadyRegisteredException(user.getUserName());
-               }
-
-               // Try to find the contact
-               Contact managedContact = this.getEntityManager().find(user.getUserContact().getClass(), user.getUserContact().getContactId());
-
-               // Should be found!
-               assert (managedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", user.getUserContact().getContactId()); //NOI18N
-
-               // Set detached object in rexcruiter instance
-               user.setUserContact(managedContact);
-
-               // Set timestamp
-               user.setUserCreated(new GregorianCalendar());
-
-               // Perist it
-               this.getEntityManager().persist(user);
-
-               // Flush it to get updated instance back
-               this.getEntityManager().flush();
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkUser: user={1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // Return updated instanc
-               return user;
-       }
-
-       @Override
-       public User lockUserAccount (final User user, final String userLockReason, final String baseUrl) throws UserStatusLockedException, UserStatusUnconfirmedException, UserNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.lockUserAccount: user={1},userLockReason={2},baseUrl={3} - CALLED!", this.getClass().getSimpleName(), user, userLockReason, baseUrl)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Id is set
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is null", user.getUserId())); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N
-               } else if (user.getUserAccountStatus() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
-               } else if (!this.userBean.ifUserExists(user)) {
-                       // Name already found
-                       throw new UserNotFoundException(user);
-               } else if (user.getUserAccountStatus() == UserAccountStatus.LOCKED) {
-                       // Account is locked
-                       throw new UserStatusLockedException(user);
-               } else if (user.getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) {
-                       // Account is unconfirmed
-                       throw new UserStatusUnconfirmedException(user);
-               } else if (null == userLockReason) {
-                       // Throw NPE again
-                       throw new NullPointerException("userLockReason is null"); //NOI18N
-               } else if (userLockReason.isEmpty()) {
-                       // Is empty
-                       throw new IllegalArgumentException("userLockReason is empty"); //NOI18N
-               }
-
-               // Remove contact instance as this is not updated
-               user.setUserContact(null);
-
-               // Set as locked, set timestamp and lock reason
-               user.setUserAccountStatus(UserAccountStatus.LOCKED);
-               user.setUserLastLocked(new GregorianCalendar());
-               user.setUserLastLockedReason(userLockReason);
-
-               // Update user
-               User managedUser = this.userBean.updateUserData(user);
-
-               // @TODO Create user lock history entry
-
-               // Send out email
-               // @TODO externalize subject line
-               this.sendEmail("User account locked", "user_account_locked", managedUser, baseUrl, null); //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.lockUserAccount: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N
-
-               // Return detached (and updated) user
-               return managedUser;
-       }
-
-       @Override
-       public User unlockUserAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusUnconfirmedException, UserNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.lockUserAccount: user={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), user, baseUrl)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Id is set
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is null", user.getUserId())); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N
-               } else if (user.getUserAccountStatus() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
-               } else if (!this.userBean.ifUserExists(user)) {
-                       // Name already found
-                       throw new UserNotFoundException(user);
-               } else if (user.getUserAccountStatus() == UserAccountStatus.CONFIRMED) {
-                       // Account is confirmed
-                       throw new UserStatusConfirmedException(user);
-               } else if (user.getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) {
-                       // Account is unconfirmed
-                       throw new UserStatusUnconfirmedException(user);
-               }
-
-               // Remove contact instance as this is not updated
-               user.setUserContact(null);
-
-               // Unlock account
-               user.setUserAccountStatus(UserAccountStatus.CONFIRMED);
-
-               // Update user
-               User managedUser = this.userBean.updateUserData(user);
-
-               // @TODO Create user lock history entry
-
-               // Send out email
-               // @TODO externalize subject line
-               this.sendEmail("User account unlocked", "user_account_unlocked", managedUser, baseUrl, null); //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.lockUserAccount: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N
-
-               // Return changed account
-               return managedUser;
-       }
-
-}
diff --git a/src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java
deleted file mode 100644 (file)
index 9cdc6a7..0000000
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import java.util.List;
-import javax.ejb.EJB;
-import javax.ejb.EJBException;
-import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
-import javax.persistence.PersistenceException;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.ContactUtils;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumbers;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumbers;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.phonenumbers.mobile.MobileNumbers;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
-import org.mxchange.jusercore.exceptions.UserStatusLockedException;
-import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
-import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
-import org.mxchange.jusercore.model.user.password_history.UserPasswordHistory;
-import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
-import org.mxchange.jusercore.model.user.register.UserRegistrationSessionBeanRemote;
-import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-
-/**
- * A user EJB
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "user", description = "A bean handling the user data")
-public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean implements UserSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_916L;
-
-       /**
-        * Registration EJB
-        */
-       @EJB
-       private UserRegistrationSessionBeanRemote registerBean;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookUserSessionBean () {
-               // Call super constructor
-               super("jms/addressbook-queue-factory", "jms/addressbook-email-queue"); //NOI18N
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<User> allMemberPublicVisibleUsers () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMemberPublicVisibleUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get named query
-               Query query = this.getEntityManager().createNamedQuery("AllMemberPublicUsers", LoginUser.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<User> users = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMemberPublicVisibleUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
-
-               // Return full list
-               return users;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<User> allPublicUsers () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allPublicUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get named query
-               Query query = this.getEntityManager().createNamedQuery("AllPublicUsers", LoginUser.class); //NOI18N
-
-               // Set parameters
-               query.setParameter("status", UserAccountStatus.CONFIRMED); //NOI18N
-               query.setParameter("mode", ProfileMode.PUBLIC); //NOI18N
-
-               // Get result
-               List<User> users = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allPublicUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
-
-               // Return full list
-               return users;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<User> allUsers () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get named query
-               Query query = this.getEntityManager().createNamedQuery("AllUsers", LoginUser.class); //NOI18N
-
-               // Get result
-               List<User> users = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
-
-               // Return full list
-               return users;
-       }
-
-       @Override
-       public User confirmAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusLockedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.confirmAccount: user={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), user, baseUrl)); //NOI18N
-
-               // Parameter must be valid
-               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
-               } else if (user.getUserAccountStatus() == UserAccountStatus.CONFIRMED) {
-                       // Account is already confirmed
-                       throw new UserStatusConfirmedException(user);
-               } else if (user.getUserAccountStatus() == UserAccountStatus.LOCKED) {
-                       // Account is already confirmed
-                       throw new UserStatusLockedException(user);
-               } else if (user.getUserConfirmKey() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
-               } else if (null == baseUrl) {
-                       // Throw it again
-                       throw new NullPointerException("baseUrl is null"); //NOI18N
-               } else if (baseUrl.isEmpty()) {
-                       // Invalid parameter
-                       throw new IllegalArgumentException("baseUrl is empty"); //NOI18N
-               }
-
-               // Update user status and remove confirmation key
-               user.setUserAccountStatus(UserAccountStatus.CONFIRMED);
-               user.setUserConfirmKey(null);
-               user.setUserUpdated(new GregorianCalendar());
-
-               // Update user account
-               User updatedUser = this.updateUserData(user);
-
-               // Send out email
-               this.sendEmail("User account confirmed", "user_account_confirmed", updatedUser, baseUrl, null); //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.confirmAccount: updatedUser={1} - EXIT!", this.getClass().getSimpleName(), updatedUser)); //NOI18N
-
-               // Return updated instance
-               return updatedUser;
-       }
-
-       @Override
-       public User fillUserData (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fillUserData: user={1} - CALLED!", this.getClass().getSimpleName(), 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("SearchUserByName", LoginUser.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("userName", 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("{0}.fillUserData: foundUser={1} - EXIT!", this.getClass().getSimpleName(), foundUser)); //NOI18N
-
-               // Return prepared instance
-               return foundUser;
-       }
-
-       @Override
-       public User findUserById (final Long userId) throws UserNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findUserById: userId={1} - CALLED!", this.getClass().getSimpleName(), userId)); //NOI18N
-
-               // Is the parameter valid?
-               if (null == userId) {
-                       // Throw NPE
-                       throw new NullPointerException("userId is null"); //NOI18N
-               } else if (userId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("userId={0} is not valid.", userId)); //NOI18N
-               } else if (!this.ifUserIdExists(userId)) {
-                       // Does not exist
-                       throw new UserNotFoundException(userId);
-               }
-
-               // Create query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchUserById", LoginUser.class); //NOI18N
-
-               // Set user id
-               query.setParameter("id", userId); //NOI18N
-
-               // Fetch the result, it should be there by now
-               User user = (User) query.getSingleResult();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findUserById: user={1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // Return found user
-               return user;
-       }
-
-       @Override
-       public String generateRandomUserName () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateRandomUserName - CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get full list
-               List<String> userList = this.getUserNameList();
-
-               // Init variable
-               String userName = null;
-
-               // Loop until a user name is found
-               while ((userName == null) || (userList.contains(userName))) {
-                       // Generate random name
-                       userName = UserUtils.generateRandomUserName();
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateRandomUserName: userName={1} - EXIT!", this.getClass().getSimpleName(), userName)); //NOI18N
-
-               // Found one, so return it
-               return userName;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<String> getEmailAddressList () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get query
-               Query query = this.getEntityManager().createNamedQuery("AllEmailAddresses", String.class); //NOI18N
-
-               // Get result list
-               List<String> emailAddressList = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList: emailAddressList.size()={1} - EXIT!", this.getClass().getSimpleName(), emailAddressList.size())); //NOI18N
-
-               // Return it
-               return emailAddressList;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<String> getUserNameList () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserNameList: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get query
-               Query query = this.getEntityManager().createNamedQuery("AllUserNames", String.class); //NOI18N
-
-               // Get result list
-               List<String> userNameList = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserNameList: userNameList.size()={1} - EXIT!", this.getClass().getSimpleName(), userNameList.size())); //NOI18N
-
-               // Return it
-               return userNameList;
-       }
-
-       @Override
-       public boolean ifUserExists (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserExists: user={1} - CALLED!", this.getClass().getSimpleName(), 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("SearchUserById", 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("{0}.ifUserExists: Found user {1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // Found it
-               return true;
-       }
-
-       @Override
-       public boolean ifUserIdExists (final Long userId) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserIdExists: userId={1} - CALLED!", this.getClass().getSimpleName(), 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("SearchUserById", 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("{0}.ifUserIdExists: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
-               } catch (final NoResultException ex) {
-                       // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserIdExists: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), 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("{0}.ifUserIdExists: Found userId={1} - EXIT!", this.getClass().getSimpleName(), userId)); //NOI18N
-
-               // Found it
-               return true;
-       }
-
-       @Override
-       public boolean ifUserNameExists (final String userName) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserNameExists: userName={1} - CALLED!", this.getClass().getSimpleName(), userName)); //NOI18N
-
-               // userId should not be null
-               if (null == userName) {
-                       // Abort here
-                       throw new NullPointerException("userName is null"); //NOI18N
-               } else if (userName.isEmpty()) {
-                       // Abort here
-                       throw new NullPointerException("userName is empty"); //NOI18N
-               }
-
-               // Generate query
-               Query query = this.getEntityManager().createNamedQuery("SearchUserByName", LoginUser.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("userName", userName); //NOI18N
-
-               // Try this
-               try {
-                       User dummy = (User) query.getSingleResult();
-
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserNameExists: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
-               } catch (final NoResultException ex) {
-                       // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserNameExists: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
-
-                       // User name does not exist
-                       return false;
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserNameExists: Found userName={1} - EXIT!", this.getClass().getSimpleName(), userName)); //NOI18N
-
-               // Found it
-               return true;
-       }
-
-       @Override
-       public boolean isEmailAddressRegistered (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), 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("SearchUserByEmailAddress", LoginUser.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("emailAddress", user.getUserContact().getContactEmailAddress()); //NOI18N
-
-               // Search for it
-               try {
-                       User dummy = (User) query.getSingleResult();
-
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isEmailAddressRegistered: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
-               } catch (final NoResultException ex) {
-                       // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isEmailAddressRegistered: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), 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;
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: Returning true ... - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
-               // Found it
-               return true;
-       }
-
-       @Override
-       public boolean isUserNameRegistered (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), 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("SearchUserByName", LoginUser.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("userName", user.getUserName()); //NOI18N
-
-               // Try this
-               try {
-                       User dummy = (User) query.getSingleResult();
-
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isUserNameRegistered: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
-               } catch (final NoResultException ex) {
-                       // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isUserNameRegistered: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), 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;
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: Returning true ... - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
-               // Found it
-               return true;
-       }
-
-       @Override
-       public User updateUserData (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // 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
-               }
-
-               // Remove contact instance as this is not updated
-               user.setUserContact(null);
-
-               // Find the instance
-               User managedUser = this.getEntityManager().find(user.getClass(), user.getUserId());
-
-               // Should be found!
-               assert (managedUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N
-
-               // Copy all data
-               UserUtils.copyAll(user, managedUser);
-
-               // Set as updated
-               managedUser.setUserUpdated(new GregorianCalendar());
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: managedUser={1} - CALLED!", this.getClass().getSimpleName(), managedUser)); //NOI18N
-
-               // Return updated instance
-               return managedUser;
-       }
-
-       @Override
-       public PasswordHistory updateUserPassword (final User user, final String baseUrl) throws UserNotFoundException, UserStatusUnconfirmedException, UserStatusLockedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPassword: user={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), user, baseUrl)); //NOI18N
-
-               // 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
-                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw it again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // .. and again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is invalid", user.getUserContact().getContactId())); //NOI18N
-               } else if (user.getUserContact().getContactPersonalTitle() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactPersonalTitle 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
-               } else if (null == baseUrl) {
-                       // Throw it again
-                       throw new NullPointerException("baseUrl is null"); //NOI18N
-               } else if (baseUrl.isEmpty()) {
-                       // Invalid parameter
-                       throw new IllegalArgumentException("baseUrl is empty"); //NOI18N
-               }
-
-               // Call other method
-               User updatedUser = this.updateUserData(user);
-
-               // Create history entry
-               PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), updatedUser);
-
-               // Set created timestamp
-               entry.setUserPasswordHistoryCreated(new GregorianCalendar());
-
-               // Persist it
-               this.getEntityManager().persist(entry);
-
-               // Flush it to get id number back
-               this.getEntityManager().flush();
-
-               // Send email to user
-               this.sendEmail("User password change", "user_password_change", user, baseUrl, null); //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPassword: entry.userPasswordHistoryId={1} - EXIT!", this.getClass().getSimpleName(), entry.getUserPasswordHistoryId())); //NOI18N
-
-               // Return it
-               return entry;
-       }
-
-       @Override
-       public User updateUserPersonalData (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPersonalData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // 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 managedUser = this.getEntityManager().find(user.getClass(), user.getUserId());
-
-               // Should be found!
-               assert (managedUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N
-
-               // Copy all data
-               UserUtils.copyAll(user, managedUser);
-
-               // Set as updated
-               managedUser.setUserUpdated(new GregorianCalendar());
-               managedUser.getUserContact().setContactUpdated(new GregorianCalendar());
-
-               // Get contact from it and find it
-               Contact managedContact = this.getEntityManager().find(user.getUserContact().getClass(), user.getUserContact().getContactId());
-
-               // Should be found
-               assert (managedContact 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: managedContact.contactId={0}", managedContact.getContactId())); //NOI18N
-
-               // Copy all
-               ContactUtils.copyAll(user.getUserContact(), managedContact);
-
-               // Set it back in user
-               user.setUserContact(managedContact);
-
-               // Should be found!
-               assert (managedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not merged, but should be.", user.getUserContact().getContactId()); //NOI18N
-
-               // Get mobile instance
-               DialableMobileNumber mobileNumber = managedContact.getContactMobileNumber();
-
-               // Is there a  mobile instance set?
-               if (mobileNumber instanceof DialableMobileNumber) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: mobile.phoneId={0} is being updated ...", mobileNumber.getPhoneId())); //NOI18N
-
-                       // Then find it, too
-                       DialableMobileNumber foundMobile = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getPhoneId());
-
-                       // Should be there
-                       assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N
-
-                       // Then merge it, too
-                       DialableMobileNumber managedMobile = this.getEntityManager().merge(foundMobile);
-
-                       // Should be there
-                       assert (managedMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", managedMobile.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       MobileNumbers.copyAll(managedUser.getUserContact().getContactMobileNumber(), managedMobile);
-
-                       // Set it back
-                       managedContact.setContactMobileNumber(this.getManaged(mobileNumber, mobileNumber));
-               }
-
-               // Get mobile instance
-               DialableFaxNumber faxNumber = managedContact.getContactFaxNumber();
-
-               // Is there a  fax instance set?
-               if (faxNumber instanceof DialableFaxNumber) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: faxNumber.phoneId={0} is being updated ...", faxNumber.getPhoneId())); //NOI18N
-
-                       // Then find it, too
-                       DialableFaxNumber foundFax = this.getEntityManager().find(faxNumber.getClass(), faxNumber.getPhoneId());
-
-                       // Should be there
-                       assert (foundFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", foundFax.getPhoneId()); //NOI18N
-
-                       // Then merge it, too
-                       DialableFaxNumber managedFax = this.getEntityManager().merge(foundFax);
-
-                       // Should be there
-                       assert (managedFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", managedFax.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       FaxNumbers.copyAll(managedUser.getUserContact().getContactFaxNumber(), managedFax);
-
-                       // Set it back
-                       managedContact.setContactFaxNumber(managedFax);
-               }
-
-               // Get mobile instance
-               DialableLandLineNumber landLineNumber = managedContact.getContactLandLineNumber();
-
-               // Is there a  fax instance set?
-               if (landLineNumber instanceof DialableLandLineNumber) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLineNumber.phoneId={0} is being updated ...", landLineNumber.getPhoneId())); //NOI18N
-
-                       // Then find it, too
-                       DialableLandLineNumber foundLandLine = this.getEntityManager().find(landLineNumber.getClass(), landLineNumber.getPhoneId());
-
-                       // Should be there
-                       assert (foundLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", foundLandLine.getPhoneId()); //NOI18N
-
-                       // Then merge it, too
-                       DialableLandLineNumber managedLandLine = this.getEntityManager().merge(foundLandLine);
-
-                       // Should be there
-                       assert (managedLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", managedLandLine.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       LandLineNumbers.copyAll(managedUser.getUserContact().getContactLandLineNumber(), managedLandLine);
-
-                       // Set it back
-                       managedContact.setContactLandLineNumber(managedLandLine);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPersonalData: entry.managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N
-
-               // Return updated user instance
-               return managedUser;
-       }
-
-}
diff --git a/src/java/org/mxchange/jusercore/model/user/activity/AddressbookUserActivityLogMessageBean.java b/src/java/org/mxchange/jusercore/model/user/activity/AddressbookUserActivityLogMessageBean.java
deleted file mode 100644 (file)
index 4d8b70e..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user.activity;
-
-import java.io.Serializable;
-import java.text.MessageFormat;
-import javax.ejb.ActivationConfigProperty;
-import javax.ejb.MessageDriven;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.ObjectMessage;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A message-driven bean for adding user activity log
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@MessageDriven (
-               name = "userActivityLog",
-               description = "A message-driven bean for adding user activity log",
-               activationConfig = {
-                       @ActivationConfigProperty (
-                                       propertyName = "destinationLookup",
-                                       propertyValue = "jms/addressbook-user-activity-log"
-                       ),
-                       @ActivationConfigProperty (
-                                       propertyName = "destinationType",
-                                       propertyValue = "javax.jms.Queue"
-                       )
-               }
-)
-public class AddressbookUserActivityLogMessageBean extends BaseAddressbookDatabaseBean implements MessageListener {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 14_920_686_785_732_054L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookUserActivityLogMessageBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public void onMessage (final Message message) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.onMessage: message={1} - CALLED!", this.getClass().getSimpleName(), message)); //NOI18N
-
-               // The parameter should be valid
-               if (null == message) {
-                       // Throw NPE
-                       throw new NullPointerException("message is null"); //NOI18N
-               } else if (!(message instanceof ObjectMessage)) {
-                       // Not implementing right interface
-                       throw new IllegalArgumentException(MessageFormat.format("message={0} does not implemented ObjectMessage", message)); //NOI18N
-               }
-
-               // Securely cast it
-               ObjectMessage objectMessage = (ObjectMessage) message;
-
-               // Init variable
-               Serializable serializable;
-
-               try {
-                       // Get object from message
-                       serializable = objectMessage.getObject();
-               } catch (final JMSException ex) {
-                       // Log it and don't continue any further
-                       this.getLoggerBeanLocal().logException(ex);
-                       return;
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.onMessage: serializable={1}", this.getClass().getSimpleName(), serializable)); //NOI18N
-
-               // Okay, is it the right interface?
-               if (null == serializable) {
-                       // Throw NPE
-                       throw new NullPointerException("serializable is null"); //NOI18N
-               } else if (!(serializable instanceof LogableUserActivity)) {
-                       // Not correct object send
-                       throw new IllegalArgumentException(MessageFormat.format("serializable={0} does not implement LogableUserActivity", serializable)); //NOI18N
-               }
-
-               // Securely cast it
-               LogableUserActivity userActivity = (LogableUserActivity) serializable;
-
-               // Should be valid
-               if (null == userActivity) {
-                       // Throw NPE
-                       throw new NullPointerException("userActivity is null"); //NOI18N
-               } else if (userActivity.getActivityId() instanceof Long) {
-                       // Id number should not be set
-                       throw new IllegalArgumentException(MessageFormat.format("userActivity.activityId={0} should be null", userActivity.getActivityId())); //NOI18N
-               } else if (userActivity.getActivityUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("userActivity.activityUser is null"); //NOI18N
-               } else if (userActivity.getActivityUser().getUserId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("userActivity.activityUser.userId is null"); //NOI18N
-               } else if (userActivity.getActivityUser().getUserId() < 1) {
-                       // Throw NPE again
-                       throw new IllegalArgumentException(MessageFormat.format("userActivity.activityUser.userId={0}  is not valid", userActivity.getActivityUser().getUserId())); //NOI18N
-               } else if (userActivity.getActivityType() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("userActivity.activityType is null"); //NOI18N
-               } else if (userActivity.getActivityType().isEmpty()) {
-                       // Empty type
-                       throw new IllegalArgumentException("userActivity.activityType is empty"); //NOI18N
-               } else if ((userActivity.getActivityMessage() instanceof String) && (userActivity.getActivityMessage().isEmpty())) {
-                       // Set but empty message
-                       throw new IllegalArgumentException("userActivity.activityMessage is empty"); //NOI18N
-               } else if (userActivity.getActivityTimestamp() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("userActivity.activityTimestamp is null"); //NOI18N
-               }
-
-               // Make user instance managed
-               User managedUser = this.getManagedUser(userActivity.getActivityUser());
-
-               // Set it back
-               userActivity.setActivityUser(managedUser);
-
-               // All fine, persist it
-               this.getEntityManager().persist(userActivity);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.onMessage: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-}
diff --git a/src/java/org/mxchange/jusercore/model/user/activity/AddressbookUserActivitySessionBean.java b/src/java/org/mxchange/jusercore/model/user/activity/AddressbookUserActivitySessionBean.java
deleted file mode 100644 (file)
index f883689..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user.activity;
-
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.List;
-import javax.ejb.EJBException;
-import javax.ejb.Stateless;
-import javax.jms.JMSException;
-import javax.jms.ObjectMessage;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * An EJB for user activity log. This class extends BaseDatabaseBean and not
- * project-specific "base class". The simple reason is that this class requires
- * no email queue as no emails are ever being sent from this class.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "userActivity", description = "A bean handling the user data")
-public class AddressbookUserActivitySessionBean extends BaseAddressbookDatabaseBean implements UserActivityLogSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 219_568_677_671_054L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookUserActivitySessionBean () {
-               // Call super constructor
-               super("jms/jjobs-queue-factory", "jms/jjobs-user-activity-log"); //NOI18N
-       }
-
-       @Override
-       public void addUserActivityLog (final LogableUserActivity userActivity) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addUserActivityLog: userActivity={1} CALLED!", this.getClass().getSimpleName(), userActivity)); //NOI18N
-
-               // Should be valid
-               if (null == userActivity) {
-                       // Throw NPE
-                       throw new NullPointerException("userActivity is null"); //NOI18N
-               } else if (userActivity.getActivityId() instanceof Long) {
-                       // Id number should not be set
-                       throw new IllegalArgumentException(MessageFormat.format("userActivity.activityId={0} should be null", userActivity.getActivityId())); //NOI18N
-               } else if (userActivity.getActivityUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("userActivity.activityUser is null"); //NOI18N
-               } else if (userActivity.getActivityType() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("userActivity.activityType is null"); //NOI18N
-               } else if (userActivity.getActivityType().isEmpty()) {
-                       // Empty type
-                       throw new NullPointerException("userActivity.activityType is empty"); //NOI18N
-               } else if ((userActivity.getActivityMessage() instanceof String) && (userActivity.getActivityMessage().isEmpty())) {
-                       // Set but empty message
-                       throw new NullPointerException("userActivity.activityMessage is empty"); //NOI18N
-               } else if (userActivity.getActivityTimestamp() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("userActivity.activityTimestamp is null"); //NOI18N
-               }
-
-               try {
-                       // Send out email change
-                       ObjectMessage message = this.getSession().createObjectMessage();
-                       message.setObject(userActivity);
-
-                       // Send message
-                       this.sendMessage(message);
-               } catch (final JMSException ex) {
-                       // Throw again
-                       throw new EJBException(ex);
-               }
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<LogableUserActivity> fetchAllUserActivityLog () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUserActivityLog: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Search for user's activity
-               Query query = this.getEntityManager().createNamedQuery("AllUserActivityLog", UserActivityLog.class); //NOI18N
-
-               // Get list
-               List<LogableUserActivity> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUserActivityLog: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<LogableUserActivity> fetchAllUsersActivityLog (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLog: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // Is user valid?
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Throw again
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId{0} is not valid", user.getUserId())); //NOI18N
-               }
-
-               // Search for user's activity
-               Query query = this.getEntityManager().createNamedQuery("FindAllUsersActivity", UserActivityLog.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("activityUser", user); //NOI18N
-
-               // Get list
-               List<LogableUserActivity> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLog: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<LogableUserActivity> fetchAllUsersActivityLogByMultipleType (final User user, final String[] activityTypes) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLogByType: user={1},activityTypes={2} - CALLED!", this.getClass().getSimpleName(), user, Arrays.toString(activityTypes))); //NOI18N
-
-               // Is user valid?
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Throw again
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId{0} is not valid", user.getUserId())); //NOI18N
-               } else if (null == activityTypes) {
-                       // Throw NPE again
-                       throw new NullPointerException("activityTypes is null"); //NOI18N
-               } else if (activityTypes.length == 0) {
-                       // Should not be empty
-                       throw new IllegalArgumentException("activityTypes is empty"); //NOI18N
-               }
-
-               // Search for user's activity
-               Query query = this.getEntityManager().createNamedQuery("FindUsersActivityByMultipleTypes", UserActivityLog.class); //NOI18N
-
-               // Set parameters
-               query.setParameter("activityUser", user); //NOI18N
-               query.setParameter("activityTypes", Arrays.asList(activityTypes)); //NOI18N
-
-               // Get list
-               List<LogableUserActivity> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLogByType: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<LogableUserActivity> fetchAllUsersActivityLogByType (final User user, final String activityType) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLogByType: user={1},activityType={2} - CALLED!", this.getClass().getSimpleName(), user, activityType)); //NOI18N
-
-               // Is user valid?
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Throw again
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId{0} is not valid", user.getUserId())); //NOI18N
-               } else if (null == activityType) {
-                       // Throw NPE again
-                       throw new NullPointerException("activityType is null"); //NOI18N
-               } else if (activityType.isEmpty()) {
-                       // Should not be empty
-                       throw new IllegalArgumentException("activityType is empty"); //NOI18N
-               }
-
-               // Search for user's activity
-               Query query = this.getEntityManager().createNamedQuery("FindUsersActivityByType", UserActivityLog.class); //NOI18N
-
-               // Set parameters
-               query.setParameter("activityUser", user); //NOI18N
-               query.setParameter("activityType", activityType); //NOI18N
-
-               // Get list
-               List<LogableUserActivity> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fetchAllUsersActivityLogByType: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-               // Return it
-               return list;
-       }
-
-}
diff --git a/src/java/org/mxchange/jusercore/model/user/email_address/AddressbookUserEmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/user/email_address/AddressbookUserEmailChangeSessionBean.java
deleted file mode 100644 (file)
index c035310..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user.email_address;
-
-import java.text.MessageFormat;
-import java.util.GregorianCalendar;
-import java.util.List;
-import javax.ejb.EJB;
-import javax.ejb.EJBException;
-import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
-import org.mxchange.jusercore.model.email_address.EmailAddressChange;
-import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
-import org.mxchange.jusercore.model.user.UserUtils;
-
-/**
- * A session-scoped bean for changing email addresses
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "userEmailChange", description = "A bean handling user email changes")
-public class AddressbookUserEmailChangeSessionBean extends BaseAddressbookDatabaseBean implements UserEmailChangeSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 182_698_165_971_548L;
-
-       /**
-        * User bean
-        */
-       @EJB
-       private UserSessionBeanRemote userBean;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookUserEmailChangeSessionBean () {
-               // Call super constructor
-               super("jms/addressbook-queue-factory", "jms/addressbook-email-queue"); //NOI18N
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<String> allQueuedAddresses () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allQueuedAddresses: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get named query
-               Query query = this.getEntityManager().createNamedQuery("AllEmailAddressChanges", String.class); //NOI18N
-
-               // Get all entries
-               List<String> emailAddresses = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allQueuedAddresses: emailAddresses.size()={1} - EXIT!", this.getClass().getSimpleName(), emailAddresses.size())); //NOI18N
-
-               // Return it
-               return emailAddresses;
-       }
-
-       @Override
-       public void enqueueEmailAddressForChange (final ChangeableEmailAddress emailChange, final String baseUrl) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.enqueueEmailAddressForChange: emailChange={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), emailChange, baseUrl)); //NOI18N
-
-               // Email address change should be valid
-               if (null == emailChange) {
-                       // Abort here
-                       throw new NullPointerException("emailChange is null"); //NOI18N
-               } else if (emailChange.getEmailChangeUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("emailChange.emailChangeUser is null"); //NOI18N
-               } else if (emailChange.getEmailChangeUser().getUserId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("emailChange.emailChangeUser.userId is null"); //NOI18N
-               } else if (emailChange.getEmailChangeUser().getUserId() < 1) {
-                       // Not valid id
-                       throw new IllegalArgumentException(MessageFormat.format("emailChange.emailChangeUser.userId={0} is invalid.", emailChange.getEmailChangeUser().getUserId())); //NOI18N
-               } else if (!this.userBean.ifUserExists(emailChange.getEmailChangeUser())) {
-                       // User does not exist
-                       throw new EJBException(MessageFormat.format("Email change with id {0} does not exist.", emailChange.getEmailChangeId())); //NOI18N
-               } else if (emailChange.getEmailAddress().trim().isEmpty()) {
-                       // Email address is empty
-                       throw new IllegalArgumentException("emailChange.emaiLAddress is empty."); //NOI18N
-               } else if (this.isEmailAddressEnqueued(emailChange.getEmailAddress())) {
-                       // Email address is already enqueued
-                       throw new EJBException(MessageFormat.format("Email address {0} is already enqueued.", emailChange.getEmailAddress())); //NOI18N
-               }
-
-               // The email change is not (yet) there, add secure hash and "created" timestamp
-               emailChange.setEmailChangeCreated(new GregorianCalendar());
-               this.generateSecureHash(emailChange);
-
-               // Persist it
-               //@TODO Fix email delivery then allow this: this.getEntityManager().persist(emailChange);
-
-               // Send email
-               this.sendEmail("User email change", "user_email_change", emailChange.getEmailChangeUser(), baseUrl, null); //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.enqueueEmailAddressForChange - EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-       @Override
-       public boolean isEmailAddressEnqueued (final String emailAddress) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressEnqueued: emailAddress={1} - CALLED!", this.getClass().getSimpleName(), emailAddress)); //NOI18N
-
-               // Create query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchEmailChangeByEmail"); //NOI18N
-
-               // Add email address as parameter
-               query.setParameter("email", emailAddress); //NOI18N
-
-               // Initialize variable
-               boolean isFound = false;
-
-               // Try it
-               try {
-                       // Try to get single result
-                       ChangeableEmailAddress dummy = (ChangeableEmailAddress) query.getSingleResult();
-
-                       // Found it
-                       isFound = true;
-               } catch (final NoResultException ex) {
-                       // Log it
-                       this.getLoggerBeanLocal().logException(ex);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressEnqueued: isFound={1} - EXIT!", this.getClass().getSimpleName(), isFound)); //NOI18N
-
-               // Return it
-               return isFound;
-       }
-
-       @Override
-       public void updateEmailAddress (final ChangeableEmailAddress emailAddress) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateEmailAddress: emailAddress={1} - CALLED!", this.getClass().getSimpleName(), emailAddress)); //NOI18N
-
-               // Email address change should be valid
-               if (null == emailAddress) {
-                       // Abort here
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.getEmailChangeId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("emailAddress.emailChangeId is null"); //NOI18N
-               } else if (emailAddress.getEmailChangeId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("emailAddress.emailChangeId={0} is not valid.", emailAddress.getEmailChangeId())); //NOI18N
-               } else if (emailAddress.getEmailAddress().trim().isEmpty()) {
-                       // Email address is empty
-                       throw new IllegalArgumentException("emailAddress.emaiLAddress is empty."); //NOI18N
-               } else if (!this.userBean.ifUserExists(emailAddress.getEmailChangeUser())) {
-                       // User does not exist
-                       throw new EJBException(MessageFormat.format("Email change with id {0} does not exist.", emailAddress.getEmailChangeId())); //NOI18N
-               } else if (!this.isEmailAddressEnqueued(emailAddress.getEmailAddress())) {
-                       // Email address is not enqueued
-                       throw new EJBException(MessageFormat.format("Email address {0} is not enqueued.", emailAddress.getEmailAddress())); //NOI18N
-               }
-
-               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-       }
-
-       /**
-        * Generates a secure, unique hash for given email address change. This
-        * requires to check if the hash is really not there.
-        * <p>
-        * @param emailAddress Email address change
-        */
-       private void generateSecureHash (final ChangeableEmailAddress emailAddress) {
-               // Email address change should be valid
-               if (null == emailAddress) {
-                       // Abort here
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.getEmailAddress().trim().isEmpty()) {
-                       // Email address is empty
-                       throw new IllegalArgumentException("emailAddress.emaiLAddress is empty."); //NOI18N
-               }
-
-               // Initialize loop with null
-               String hash = null;
-
-               // Default is not used
-               boolean isUsed = true;
-
-               // Search for free hash
-               while (isUsed) {
-                       // Generate hash, there is already in UserUtils a nice method that can be used for this purpose.
-                       hash = UserUtils.encryptPassword(String.format("%s:%s", emailAddress.getEmailAddress(), emailAddress.toString())); //NOI18N
-
-                       // The hash *may* be unique, better test it
-                       Query query = this.getEntityManager().createNamedQuery("SearchEmailChangeByHash", EmailAddressChange.class); //NOI18N
-
-                       // Set hash as parameter
-                       query.setParameter("hash", hash); //NOI18N
-
-                       // Try to get single result
-                       try {
-                               // Get single result
-                               ChangeableEmailAddress dummy = (ChangeableEmailAddress) query.getSingleResult();
-                       } catch (final NoResultException ex) {
-                               // Not found
-                               isUsed = false;
-                       }
-               }
-
-               // hash should not be null and set
-               assert (hash != null) : "hash is null"; //NOI18N
-               assert (!hash.isEmpty()) : "hash is empty"; //NOI18N
-
-               // Set it in email change
-               emailAddress.setEmailChangeHash(hash);
-       }
-
-}
diff --git a/src/java/org/mxchange/jusercore/model/user/login/FinancialsUserLoginSessionBean.java b/src/java/org/mxchange/jusercore/model/user/login/FinancialsUserLoginSessionBean.java
deleted file mode 100644 (file)
index 699565c..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user.login;
-
-import java.text.MessageFormat;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-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.login.user.UserLoginSessionBeanRemote;
-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.register.UserRegistrationSessionBeanRemote;
-import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-
-/**
- * A session EJB for user logins
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "userLogin", description = "A bean handling the user login for Financials project")
-public class FinancialsUserLoginSessionBean extends BaseAddressbookDatabaseBean implements UserLoginSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 21_785_978_127_581_965L;
-
-       /**
-        * Registration EJB
-        */
-       @EJB
-       private UserRegistrationSessionBeanRemote registerBean;
-
-       /**
-        * User EJB
-        */
-       @EJB
-       private UserSessionBeanRemote userBean;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsUserLoginSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public User validateUserAccountStatus (final LoginContainer container) throws UserNotFoundException, UserStatusLockedException, UserStatusUnconfirmedException, UserPasswordMismatchException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.loginUser: container={1} - CALLED!", this.getClass().getSimpleName(), 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("{0}.loginUser: updatedUser={1} - EXIT!", this.getClass().getSimpleName(), 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.
-        * <p>
-        * @param container Container instance holding the user instance and
-        * clear-text password
-        * @param updatedUser Updated user instance found for given user name
-        * <p>
-        * @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/user/password_history/AddressbookUserPasswordHistorySessionBean.java b/src/java/org/mxchange/jusercore/model/user/password_history/AddressbookUserPasswordHistorySessionBean.java
deleted file mode 100644 (file)
index dfb2503..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user.password_history;
-
-import java.text.MessageFormat;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A user password history EJB
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "userPasswordHistory", description = "A stateless EJB for user's password history. This bean does return the full user's password history and not limited. The application then needs to limit it to it's purpose.")
-public class AddressbookUserPasswordHistorySessionBean extends BaseAddressbookDatabaseBean implements UserPasswordHistorySessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 395_767_546_195_014L;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookUserPasswordHistorySessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<PasswordHistory> getUserPasswordHistory (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserPasswordHistory(): user={1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // 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) {
-                       // Illegal id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not allowed.", user.getUserId())); //NOI18N
-               }
-
-               // Get named query
-               Query query = this.getEntityManager().createNamedQuery("AllUsersHistoryEntries", UserPasswordHistory.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("user", user); //NOI18N
-
-               // Get full history
-               List<PasswordHistory> history = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserPasswordHistory(): history.size()={1} - EXIT !", this.getClass().getSimpleName(), history.size())); //NOI18N
-
-               // Return it
-               return history;
-       }
-
-}
diff --git a/src/java/org/mxchange/jusercore/model/user/register/AddressbookUserRegistrationSessionBean.java b/src/java/org/mxchange/jusercore/model/user/register/AddressbookUserRegistrationSessionBean.java
deleted file mode 100644 (file)
index 385111d..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user.register;
-
-import java.text.MessageFormat;
-import java.util.Objects;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
-import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
-import org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote;
-import org.mxchange.jusercore.model.user.LoginUser;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
-import org.mxchange.jusercore.model.user.UserUtils;
-
-/**
- * A session-scoped bean for user registration
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "userRegistration", description = "A bean handling the user registration")
-public class AddressbookUserRegistrationSessionBean extends BaseAddressbookDatabaseBean implements UserRegistrationSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 12_348_958_986_818_627L;
-
-       /**
-        * Administrative user bean
-        */
-       @EJB
-       private AdminUserSessionBeanRemote adminUserBean;
-
-       /**
-        * Regular user EJB
-        */
-       @EJB
-       private UserSessionBeanRemote userBean;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookUserRegistrationSessionBean () {
-               // Call super constructor
-               super("jms/addressbook-queue-factory", "jms/addressbook-email-queue"); //NOI18N
-       }
-
-       @Override
-       public String generateConfirmationKey (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateConfirmationKey: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               }
-
-               // Create named instance
-               Query query = this.getEntityManager().createNamedQuery("SearchUserByConfirmKey", LoginUser.class); //NOI18N
-
-               // Init confirmation key
-               String confirmationKey = null;
-
-               // Find a free one
-               while (confirmationKey == null) {
-                       // Create new one
-                       String key = UserUtils.generatedConfirmationKey(user);
-
-                       // Set key as parameter
-                       query.setParameter("confirmKey", key); //NOI18N
-
-                       // Try it
-                       try {
-                               // Get contact instance
-                               Contact contact = (Contact) query.getSingleResult();
-
-                               // Warning message
-                               this.getLoggerBeanLocal().logWarning(MessageFormat.format("{0}.generateConfirmationKey: key {1} already found: contact.contactId={2}", this.getClass().getSimpleName(), key, contact.getContactId())); //NOI18N
-                       } catch (final NoResultException ex) {
-                               // Not found, normal case
-                               confirmationKey = key;
-                               break;
-                       }
-               }
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateConfirmationKey: confirmationKey={1} - EXIT!", this.getClass().getSimpleName(), confirmationKey)); //NOI18N
-
-               // Return it
-               return confirmationKey;
-       }
-
-       @Override
-       public boolean isEmailAddressRegistered (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), 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.isEmailAddressRegistered(user);
-       }
-
-       @Override
-       public boolean isUserNameRegistered (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), 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.isUserNameRegistered(user);
-       }
-
-       @Override
-       public User registerUser (final User user, final String baseUrl, final String randomPassword) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.registerUser: user={1},baseUrl={2},randomPassword[]={3} - CALLED!", this.getClass().getSimpleName(), user, baseUrl, Objects.toString(randomPassword))); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactEmailAddress() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactEmailAddress is null"); //NOI18N
-               } else if (user.getUserContact().getContactEmailAddress().isEmpty()) {
-                       // Is empty
-                       throw new IllegalArgumentException("user.userContact.contactEmailAddress is empty"); //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);
-               }
-
-               // Call other EJB
-               User addedUser = this.adminUserBean.addUser(user);
-
-               // Default template is with no random password
-               String templateName = "user_registration"; //NOI18N
-
-               // Is password set?
-               if ((randomPassword instanceof String) && (!randomPassword.isEmpty())) {
-                       // Switch to other template
-                       templateName = "user_registration_random"; //NOI18N
-               }
-
-               // Send email
-               // @TODO: Internationlize the subject line somehow
-               this.sendEmail("Registration", templateName, addedUser, baseUrl, randomPassword); //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.registerUser: addedUser={1},addedUser.userId={2} - EXIT!", this.getClass().getSimpleName(), addedUser, addedUser.getUserId())); //NOI18N
-
-               // Return it
-               return addedUser;
-       }
-
-}
diff --git a/src/java/org/mxchange/jusercore/model/user/resendlink/AddressbookResendLinkSessionBean.java b/src/java/org/mxchange/jusercore/model/user/resendlink/AddressbookResendLinkSessionBean.java
deleted file mode 100644 (file)
index 70ed720..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jusercore.model.user.resendlink;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
-import org.mxchange.jusercore.exceptions.UserStatusLockedException;
-import org.mxchange.jusercore.model.user.LoginUser;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
-import org.mxchange.jusercore.model.user.register.UserRegistrationSessionBeanRemote;
-import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-
-/**
- * A session-based EJB for resending confirmation links
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "userResendConfirmationLink", description = "A bean resending confirmation links")
-public class AddressbookResendLinkSessionBean extends BaseAddressbookDatabaseBean implements ResendLinkSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 71_546_726_857_195_360L;
-
-       /**
-        * Registration bean
-        */
-       @EJB
-       private UserRegistrationSessionBeanRemote registerBean;
-
-       /**
-        * Regular user bean
-        */
-       @EJB
-       private UserSessionBeanRemote userBean;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookResendLinkSessionBean () {
-               // Call super constructor
-               super("jms/addressbook-queue-factory", "jms/addressbook-email-queue"); //NOI18N
-       }
-
-       @Override
-       public void resendConfirmationLink (final User user, final Locale locale, final String baseUrl) throws UserNotFoundException, UserStatusConfirmedException, UserStatusLockedException {
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.resendConfirmationLink: user={1},locale={2},baseUrl={3} - CALLED!", this.getClass().getSimpleName(), user, locale, baseUrl)); //NOI18N
-
-               // The user instance should be valid
-               if (null == user) {
-                       // Throw NPE
-                       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) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
-               } else if (!this.userBean.ifUserExists(user)) {
-                       // User not found
-                       throw new UserNotFoundException(user);
-               } else if (user.getUserConfirmKey() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.userConfirmKey is null"); //NOI18N
-               } else if (user.getUserAccountStatus() == UserAccountStatus.CONFIRMED) {
-                       // User account status is not UNCONFIRMED
-                       throw new UserStatusConfirmedException(user);
-               } else if (user.getUserAccountStatus() == UserAccountStatus.LOCKED) {
-                       // User account status is not UNCONFIRMED
-                       throw new UserStatusLockedException(user);
-               } else if (null == locale) {
-                       // Locale should be set
-                       throw new NullPointerException("locale is null"); //NOI18N
-               }
-
-               // Get new registration key
-               String confirmationKey = this.registerBean.generateConfirmationKey(user);
-
-               // Get managed instance
-               User managedUser = this.getEntityManager().find(LoginUser.class, user.getUserId());
-
-               // Set it in user
-               managedUser.setUserConfirmKey(confirmationKey);
-
-               // Send email
-               // @TODO: Internationlize the subject line somehow
-               this.sendEmail("Resend user confirmation link", "user_resend_confirmation_link",  user, baseUrl, null); //NOI18N
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.resendConfirmationLink: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-}
diff --git a/src/java/templates/de/account_confirmed.vm b/src/java/templates/de/account_confirmed.vm
new file mode 100644 (file)
index 0000000..f56ac6c
--- /dev/null
@@ -0,0 +1,10 @@
+Hallo $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+Sie hatten soeben ($userUpdated) Ihren Account bestätigt. Vielen Dank.
+
+Sie können sich mit Ihrem Benutzernamen $userName und Ihrem vergebenen Passwort im Mitgliedsbereich einloggen.
+
+Mit freundlichen Grüßen
+
+Kontaktmöglichkeit und Impressum:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/de/account_confirmed_1.vm b/src/java/templates/de/account_confirmed_1.vm
new file mode 100644 (file)
index 0000000..f56ac6c
--- /dev/null
@@ -0,0 +1,10 @@
+Hallo $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+Sie hatten soeben ($userUpdated) Ihren Account bestätigt. Vielen Dank.
+
+Sie können sich mit Ihrem Benutzernamen $userName und Ihrem vergebenen Passwort im Mitgliedsbereich einloggen.
+
+Mit freundlichen Grüßen
+
+Kontaktmöglichkeit und Impressum:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/de/registration.vm b/src/java/templates/de/registration.vm
new file mode 100644 (file)
index 0000000..c0e5baa
--- /dev/null
@@ -0,0 +1,53 @@
+Hallo $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+Sie hatten sich eben ($userCreated) bei uns angemeldet. Sollten Sie dies nicht gewesen sein, so melden Sie sich bitter per Kontaktformular bei uns.
+
+Hier sind Ihre Daten:
+---------------------
+Benuzter-Id:
+$userId
+---------------------
+Benutzername:
+$userName
+---------------------
+Anrede:
+$contactPersonalTitle
+---------------------
+Titel:
+$contactTitle
+---------------------
+Vorname:
+$contactFirstName
+---------------------
+Nachname:
+$contactFamilyName
+---------------------
+Straße + Hausnummer:
+$contactStreet $contactHouseNumber
+---------------------
+PLZ, Wohnort:
+$contactZipCode $contactCity
+---------------------
+Geburtsdatum:
+$contactBirthday
+---------------------
+Email-Adresse:
+$contactEmailAddress
+---------------------
+
+Wenn Sie sich anmelden möchten, so müssen Sie Ihren Account bestätigen. Bitte klicken Sie oder kopieren Sie den unten stehenden Link in Ihren Browser:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/user_confirm_account.xhtml?confirmKey=$userConfirmKey
+- - - - - - - - - - - - - - - - - - - - -
+
+Falls der Link nicht funktioniert, rufen Sie bitte folgenden auf und lassen sich einen neuen Link zuschicken:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/resend_link.xhtml
+- - - - - - - - - - - - - - - - - - - - -
+
+Mit freundlichen Grüßen
+
+Kontaktmöglichkeit und Impressum:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/de/registration_1.vm b/src/java/templates/de/registration_1.vm
new file mode 100644 (file)
index 0000000..c0e5baa
--- /dev/null
@@ -0,0 +1,53 @@
+Hallo $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+Sie hatten sich eben ($userCreated) bei uns angemeldet. Sollten Sie dies nicht gewesen sein, so melden Sie sich bitter per Kontaktformular bei uns.
+
+Hier sind Ihre Daten:
+---------------------
+Benuzter-Id:
+$userId
+---------------------
+Benutzername:
+$userName
+---------------------
+Anrede:
+$contactPersonalTitle
+---------------------
+Titel:
+$contactTitle
+---------------------
+Vorname:
+$contactFirstName
+---------------------
+Nachname:
+$contactFamilyName
+---------------------
+Straße + Hausnummer:
+$contactStreet $contactHouseNumber
+---------------------
+PLZ, Wohnort:
+$contactZipCode $contactCity
+---------------------
+Geburtsdatum:
+$contactBirthday
+---------------------
+Email-Adresse:
+$contactEmailAddress
+---------------------
+
+Wenn Sie sich anmelden möchten, so müssen Sie Ihren Account bestätigen. Bitte klicken Sie oder kopieren Sie den unten stehenden Link in Ihren Browser:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/user_confirm_account.xhtml?confirmKey=$userConfirmKey
+- - - - - - - - - - - - - - - - - - - - -
+
+Falls der Link nicht funktioniert, rufen Sie bitte folgenden auf und lassen sich einen neuen Link zuschicken:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/resend_link.xhtml
+- - - - - - - - - - - - - - - - - - - - -
+
+Mit freundlichen Grüßen
+
+Kontaktmöglichkeit und Impressum:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/de/resend_confirmation_link.vm b/src/java/templates/de/resend_confirmation_link.vm
new file mode 100644 (file)
index 0000000..6782f02
--- /dev/null
@@ -0,0 +1,21 @@
+Hallo $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+Sie hatten soeben ($userUpdated) einen neuen Bestätigungslink angefordert. Die Anmeldung war $userCreated .
+
+Hier ist der neue Link:
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/user_confirm_account.xhtml?confirmKey=$userConfirmKey
+- - - - - - - - - - - - - - - - - - - - -
+
+Falls der Link nicht funktioniert, rufen Sie bitte folgenden auf und lassen sich einen neuen Link zuschicken:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/resend_link.xhtml
+- - - - - - - - - - - - - - - - - - - - -
+
+Sollten Sie dies bereits getan haben und nicht weiterkommen, so melden Sie sich bitte bei uns.
+
+Mit freundlichen Grüßen
+
+Kontaktmöglichkeit und Impressum:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/de/resend_confirmation_link_1.vm b/src/java/templates/de/resend_confirmation_link_1.vm
new file mode 100644 (file)
index 0000000..6782f02
--- /dev/null
@@ -0,0 +1,21 @@
+Hallo $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+Sie hatten soeben ($userUpdated) einen neuen Bestätigungslink angefordert. Die Anmeldung war $userCreated .
+
+Hier ist der neue Link:
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/user_confirm_account.xhtml?confirmKey=$userConfirmKey
+- - - - - - - - - - - - - - - - - - - - -
+
+Falls der Link nicht funktioniert, rufen Sie bitte folgenden auf und lassen sich einen neuen Link zuschicken:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/resend_link.xhtml
+- - - - - - - - - - - - - - - - - - - - -
+
+Sollten Sie dies bereits getan haben und nicht weiterkommen, so melden Sie sich bitte bei uns.
+
+Mit freundlichen Grüßen
+
+Kontaktmöglichkeit und Impressum:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/de/user_password_change.vm b/src/java/templates/de/user_password_change.vm
new file mode 100644 (file)
index 0000000..1757a45
--- /dev/null
@@ -0,0 +1,13 @@
+Hallo $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+Sie haben soeben Ihr Zugangspasswort geändert. Das alte Passwort ist somit nicht mehr gültig. Aus Sicherheitsgründen kann Ihr neuesd Passwort hier nicht mit gesendet werden.
+
+-----------------------------------
+Ihr Benutzername: $userName
+Benutzer-Id: $userId
+-----------------------------------
+
+Mit freundlichen Grüßen
+
+Kontaktmöglichkeit und Impressum:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/de/user_password_change_1.vm b/src/java/templates/de/user_password_change_1.vm
new file mode 100644 (file)
index 0000000..1757a45
--- /dev/null
@@ -0,0 +1,13 @@
+Hallo $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+Sie haben soeben Ihr Zugangspasswort geändert. Das alte Passwort ist somit nicht mehr gültig. Aus Sicherheitsgründen kann Ihr neuesd Passwort hier nicht mit gesendet werden.
+
+-----------------------------------
+Ihr Benutzername: $userName
+Benutzer-Id: $userId
+-----------------------------------
+
+Mit freundlichen Grüßen
+
+Kontaktmöglichkeit und Impressum:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/en/user_account_confirmed.vm b/src/java/templates/en/user_account_confirmed.vm
new file mode 100644 (file)
index 0000000..b19185f
--- /dev/null
@@ -0,0 +1,10 @@
+Hello $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+You have just ($userUpdated) confirmed your account. Thank you.
+
+You can now login with your username $userName and password into the member area.
+
+Best regards
+
+Contact us:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/en/user_account_confirmed_1.vm b/src/java/templates/en/user_account_confirmed_1.vm
new file mode 100644 (file)
index 0000000..b19185f
--- /dev/null
@@ -0,0 +1,10 @@
+Hello $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+You have just ($userUpdated) confirmed your account. Thank you.
+
+You can now login with your username $userName and password into the member area.
+
+Best regards
+
+Contact us:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/en/user_password_change.vm b/src/java/templates/en/user_password_change.vm
new file mode 100644 (file)
index 0000000..07c1ec2
--- /dev/null
@@ -0,0 +1,13 @@
+Hello $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+You have just changed your password. Your old password is no longer valid. For security reasons your new password is not included in this email.
+
+-----------------------------------
+Your user name: $userName
+User id: $userId
+-----------------------------------
+
+Best regards
+
+Contact us:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/en/user_password_change_1.vm b/src/java/templates/en/user_password_change_1.vm
new file mode 100644 (file)
index 0000000..07c1ec2
--- /dev/null
@@ -0,0 +1,13 @@
+Hello $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+You have just changed your password. Your old password is no longer valid. For security reasons your new password is not included in this email.
+
+-----------------------------------
+Your user name: $userName
+User id: $userId
+-----------------------------------
+
+Best regards
+
+Contact us:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/en/user_registration.vm b/src/java/templates/en/user_registration.vm
new file mode 100644 (file)
index 0000000..f38cffe
--- /dev/null
@@ -0,0 +1,53 @@
+Hello $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+You have just ($userCreated) registered. If this wasn't you, please contact us immediately.
+
+Here is your data:
+---------------------
+User id:
+$userId
+---------------------
+User name:
+$userName
+---------------------
+Personal title:
+$contactPersonalTitle
+---------------------
+Academical title:
+$contactTitle
+---------------------
+First name:
+$contactFirstName
+---------------------
+Family name:
+$contactFamilyName
+---------------------
+Street + house number:
+$contactStreet $contactHouseNumber
+---------------------
+ZIP code + city:
+$contactZipCode $contactCity
+---------------------
+Date of birth:
+$contactBirthday
+---------------------
+Email address:
+$contactEmailAddress
+---------------------
+
+If you want to register, you have confirm your account. Please click on following link or copy it into your browser:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/user_confirm_account.xhtml?confirmKey=$userConfirmKey
+- - - - - - - - - - - - - - - - - - - - -
+
+If the above link is not working, please visit following link and send out a new link:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/resend_link.xhtml
+- - - - - - - - - - - - - - - - - - - - -
+
+Best regards
+
+Contact us:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/en/user_registration_1.vm b/src/java/templates/en/user_registration_1.vm
new file mode 100644 (file)
index 0000000..f38cffe
--- /dev/null
@@ -0,0 +1,53 @@
+Hello $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+You have just ($userCreated) registered. If this wasn't you, please contact us immediately.
+
+Here is your data:
+---------------------
+User id:
+$userId
+---------------------
+User name:
+$userName
+---------------------
+Personal title:
+$contactPersonalTitle
+---------------------
+Academical title:
+$contactTitle
+---------------------
+First name:
+$contactFirstName
+---------------------
+Family name:
+$contactFamilyName
+---------------------
+Street + house number:
+$contactStreet $contactHouseNumber
+---------------------
+ZIP code + city:
+$contactZipCode $contactCity
+---------------------
+Date of birth:
+$contactBirthday
+---------------------
+Email address:
+$contactEmailAddress
+---------------------
+
+If you want to register, you have confirm your account. Please click on following link or copy it into your browser:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/user_confirm_account.xhtml?confirmKey=$userConfirmKey
+- - - - - - - - - - - - - - - - - - - - -
+
+If the above link is not working, please visit following link and send out a new link:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/resend_link.xhtml
+- - - - - - - - - - - - - - - - - - - - -
+
+Best regards
+
+Contact us:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/en/user_resend_confirmation_link.vm b/src/java/templates/en/user_resend_confirmation_link.vm
new file mode 100644 (file)
index 0000000..fcc12ec
--- /dev/null
@@ -0,0 +1,21 @@
+Hello $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+you have just ($userUpdated) requested a new confirmation link. Your registration happened on $userCreated .
+
+Here is your new link:
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/user_confirm_account.xhtml?confirmKey=$userConfirmKey
+- - - - - - - - - - - - - - - - - - - - -
+
+If the link is not working, please visit following link and send a new link to this email address.:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/resend_link.xhtml
+- - - - - - - - - - - - - - - - - - - - -
+
+If you have already tried this and you are stuck here, please contact us.
+
+Best regards
+
+Contact us:
+$baseUrl/imprint.xhtml
diff --git a/src/java/templates/en/user_resend_confirmation_link_1.vm b/src/java/templates/en/user_resend_confirmation_link_1.vm
new file mode 100644 (file)
index 0000000..fcc12ec
--- /dev/null
@@ -0,0 +1,21 @@
+Hello $contactPersonalTitle $contactFirstName $contactFamilyName,
+
+you have just ($userUpdated) requested a new confirmation link. Your registration happened on $userCreated .
+
+Here is your new link:
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/user_confirm_account.xhtml?confirmKey=$userConfirmKey
+- - - - - - - - - - - - - - - - - - - - -
+
+If the link is not working, please visit following link and send a new link to this email address.:
+
+- - - - - - - - - - - - - - - - - - - - -
+$baseUrl/guest/user/resend_link.xhtml
+- - - - - - - - - - - - - - - - - - - - -
+
+If you have already tried this and you are stuck here, please contact us.
+
+Best regards
+
+Contact us:
+$baseUrl/imprint.xhtml