From 91c71c504207cb9e46ba4f8a5a787d4965e7d41c Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 8 Mar 2016 22:08:10 +0100 Subject: [PATCH] jjobs-user-ejb has been merged into jjobs-ejb: - updated project files - added jcore.jar - updated jar(s) --- lib/jcontacts-business-core.jar | Bin 64576 -> 64576 bytes lib/jcontacts-core.jar | Bin 21279 -> 21291 bytes lib/jcore.jar | Bin 0 -> 13656 bytes lib/jphone-core.jar | Bin 25281 -> 26423 bytes lib/juser-lib.jar | Bin 0 -> 4112 bytes nbproject/build-impl.xml | 28 +- nbproject/genfiles.properties | 6 +- nbproject/project.properties | 6 + nbproject/project.xml | 2 + .../model/login/UserLoginSessionBean.java | 141 ++++++ .../register/UserRegistrationSessionBean.java | 115 +++++ .../jusercore/model/user/UserSessionBean.java | 436 ++++++++++++++++++ 12 files changed, 721 insertions(+), 13 deletions(-) create mode 100644 lib/jcore.jar create mode 100644 lib/juser-lib.jar create mode 100644 src/java/org/mxchange/jusercore/model/login/UserLoginSessionBean.java create mode 100644 src/java/org/mxchange/jusercore/model/register/UserRegistrationSessionBean.java create mode 100644 src/java/org/mxchange/jusercore/model/user/UserSessionBean.java diff --git a/lib/jcontacts-business-core.jar b/lib/jcontacts-business-core.jar index 38f7bec9b70f927a6c77d80bf420e15e01e2b9eb..fcaadf8ccb43000591b17665bdb1e7b4d4824515 100644 GIT binary patch delta 520 zcmX@`gZaP@X5IjAW)?061`Y;>+VvR|c{P}8fRx32=H$)k6K~0bsXrPZYO*?`6_`$8 zbOF<=86Cm&dq!6>Aa@3DfV%ioE}ED~d20AXXWw7&q~<_(;i#6YHOPE{yi12b-@y^;bmjynE?h#d4# zlLL#qN?R@tW=yGj#|mb&wrDGW8Jm|J;{Y>i)*8ry8S78UvV$4tFE;al8KL)Dn81uX z51v67M<3hqF$2S8GTSE$P{2%f{A3SOF}eAZKA7GL6bJD?eDVU*wx2`5^pwwmVEV=9 zP%!QAB^XRk`w|YOKYR%T)1F`b!Sw8}@nHJz*Eld8_bnStpZS&rrY*lGgX#I-A$*=6 wIbeSEk5n-I_(ukq_WPL#rZ@d80n?hla>4Y>Ul8>izth3|qTdj8*M4UK056>3fB*mh delta 520 zcmX@`gZaP@X5IjAW)?061`Y-W_1?6Jyc*1EK+0l1n7Snorv88hC#y4Bfw+@X7+t{h zYDPye{hrYkOq(+~gXvl(cQAdN$qh^kFxv|P^?6vvzMgiDm4N|-O(q{)qBPkdi+}S( z=6kGQ>GF3XGK<6*7(mz zp7tdiOn>+i2Btl~`h)4&U*o~_->-3CI__IGm_G9@3rt&nPX^QTzeD&uKXSnQ>L00K p`tgqpFzxp<5lnCTSpudtf8~PdnZF?FIew>u`9;4W>aP9H0s!%>%SZqK diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar index a9baa32fa6cfb062f87ed9a9ccba1ebe106e8244..e905316a232cc3f743e47c1d041b3c782fa666f1 100644 GIT binary patch delta 474 zcmbQgjB)icM&1B#W)?061`Y;>s`VKYc{P|Tft1C3<`N)vOCC)9(Ew4C)ftVzbPS^v zn4Zb#2&V5c+6n>XJ>He>`^v!yGzy4y7$z?WRGcj5#6CGMkZp4mQxL15M0#q8bADb) zVseR3VqS_*=Hy-Mfr1jnXrh}XIeeMH2L2K9ob*MLfdPaKKn5CZUd8=ZfCPhN88<7+ zHHw3rxp}GS7cMYkj>BwDFvH603=1>R*ONK@EkNF$?BZ_^_EDR^KA7GC6bJeIv%eFV zwg~V7)2#u4VESf&FE5JECmRR)%7a8uoz4IUOB$0V&kuyy@-R@EX^AN~oaBSRAwAhK zNSbN316Zg&NJRl;()`lW+H4jE1`u|Eo5R4cq|wrAvOs|3Wd1XJy?I7P-Nm{U;tqqhRKNmijyD6v2PAxieTjvO;0Ux&d)1JOfCt? z$e+AUCXi3G7+GkufUGRzW*bfeCa_t@)|q~Ir^&zo!UkZoHqYn&CqR@r^CUpd+Pu;9 z3m2HN!eKTinBnGihJ_jE%gLht79ej<4)C`J`(Tp4KA1iN6bJeAzrPchb_wtT(-Q*% z!SvGrUtScSPPPy9RRD>gx|abCmNdq2gF|9Ix8US^fjnSi-UdoD%`gQE7fAC?erL)y z*)9koB$O0|N-Vzzt_$SkkEL1yn3KInPUXvS_dX+b=(m FEC4oLmTmw5 diff --git a/lib/jcore.jar b/lib/jcore.jar new file mode 100644 index 0000000000000000000000000000000000000000..23ef19d3e26ecc03e092895707158a0296bb95bf GIT binary patch literal 13656 zcmcIqX>4586+Uk~GtV;~FBxyK6Nt0eiS5|qgd}8Zh@IGAVml#rLPCIaJo6GyGM+KB zkOip~6roBjs=EE4Raa3ERgq|b1R4csMMXu`N^OOzwxUvns`d{;l`8d51^v#ucjhg= z^SsfK-n{MJbI!fzyJx%a*pVuKn5dd)&C}=ZA=@uRei|R18tfaL7>RxSF43`a({?l+ z{O*fS&7nCTO*qO;#|I}yM}{Y-`o~Ac!^wX((R<-|-pbKdZ1+URb2A(72_by%nF5TBb% zrxK?49^Bg1ofGMlktuleyItMSxSTNNc*gP`eJk)h7f-~KUISgD<~bYB#LpW!4~Cn) zJ64{lW2-*6`9y?>kF9DVL-D*Zl8et8m$JEwlUMQuW41q$j_335e*CjH(B%$#EJST| zivLdQ^gx)}=?vdI$bS!o@%M0;s^~1=ezuz8I!%YEh7$aj)XCuUIsQA(ZD({!Rnvtq zMd_kW>1vwg&KZ7{)oD(rM>Gmf7cSG>YVn z^tsVYz7WqO(020}Be;xD0lM$kJ$os-J}2 zArpPvT416=YYCVU6E`f_d81$rsC!GdiiL7W{zKU$=AeEol`$rYv(rXyDn89K*p$kP z2}_PRQod+{ov#kR}VcROb9hE<1a~xS~FUZ?Lx^K?NMlczIMCM%zp+jn(JrT;$&Iqli z4H}U~ZB}2`K)7>0LIo;n)L^!)Hj*8MOR0px#DRv+MVV}kIvnlNY^G9IMPx8-x&t2C)d=k+On;Z7vG4^QA z01HY6j!N*^yg2v(={1RLF;g%h0IkEej%rjp6VHz$?kPPDWsJ+B35;^dgxF>jf;TG| z@~i$9%j7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4Tq5#mWb#?6>_o{&$I<&mAUI*_ zVN;5Fc#evCIB^_5^{51Mg%}_8sEkj8e>X@gpdJ|*{}0py?+}h~D^fD0h^NCz>~@z9mZ51)sw5TO#xbewdxSEi-B@nSQbFkQ*;0J>U(-K&=E zIq9kwICLuKB$F$zMd|7Q^n$Jqg0NI2j;@AF8{O&hd+36Vt8KD!ese>T4PRZwqit34 zi>VP>B+KTI`qJ7LQvDCi{{MuUy8#+ic$voW|(l;!wD^E8KO z>NKQ4ERW;ceC#*W|8yz@=0^ucIUJh#^Wf-jsQ=s95=Ku&uGke;Fk&>#J0bQP>hCBs z2Q$4*5lS1w+%UK(-v<17aeXB+5i9m diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar new file mode 100644 index 0000000000000000000000000000000000000000..e9610b7b5e6631e07a8b3214791e637e4363fc42 GIT binary patch literal 4112 zcmcInOK;mo5T2DEj1|jv{A%K~sNevG-N2IjOj{>y6~}H2OSWJoKD38mMXlv^DN-dV z*Xhld9t!jq6lgEG7QOe-V-E@XGkPqF{(+z~T#2M;leCR=0g4aJe6uq<-^^}xYhW-7 za0TG4ANC(YXpF!hRMsDrmN&OIiZ7o7RDIDU6fOPq%Xe)Qr)wH7U$j!%-rQKPJt|Z- zD%_O&!f}`PgzZSn{5b!1VI`L>nV~PGHrEeC9>3wA9~C~xW!G%MUC~&+|CHoEEUY}a z^Uks~U16KtSgxtg028qcC#2Sk?Tsdj`ag> zHbsKyYf;g|jw5W{vXhkFh*xS^4PhkMyOpMDSWRgr04$^d*rF*N3~&O*d>RJDAfliD zckt-f3;79q0MW-+o7=cVSk8aSbLkxW?ed z5jSK5lZLcQx^8t$x8`!U<1pZhWm}~@x-ackAH=8UgQ#M5ePh{; ziga4s)en3Zh8Zx(;5C4W#|9Y|lOcQ?#=&GPl%*52{`JAM3kKJvv)i>h*S$0*bTD_l>XMfEuWN8agE$VOKkKL+ag{O1VPSbaBb6r^Svd zjba&_A6C(c1?tIOq#4hVW2f`!l7%9!J4UMNDSPKH41F{l>7yZ% z5Z|x(O-a26lxJGqU&zG~=95jIW;o_P0%cKK?M@jvmAs$h}^ zwQ4m;;~#wNtD8xx6c9B?b&f?;gMDTa2%QQ7kezrCl}SlZw|Yok + @@ -833,10 +834,12 @@ exists or setup the property manually. For example like this: + + @@ -844,22 +847,26 @@ exists or setup the property manually. For example like this: + - - - - - - - - - - + + + + + + + + + + + + + @@ -867,6 +874,7 @@ exists or setup the property manually. For example like this: + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index c5ec146..06c57ad 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=9a28cef7 +build.xml.data.CRC32=1100511e build.xml.script.CRC32=9c0f08a9 build.xml.stylesheet.CRC32=5910fda3@1.55.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=9a28cef7 -nbproject/build-impl.xml.script.CRC32=92d9d94c +nbproject/build-impl.xml.data.CRC32=1100511e +nbproject/build-impl.xml.script.CRC32=866bcec0 nbproject/build-impl.xml.stylesheet.CRC32=6096d939@1.55.1 diff --git a/nbproject/project.properties b/nbproject/project.properties index c02dd66..e3a440e 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -24,11 +24,13 @@ excludes= file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar file.reference.jcontacts-core.jar=lib/jcontacts-core.jar file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar +file.reference.jcore.jar=lib/jcore.jar file.reference.jcoreee.jar=lib/jcoreee.jar file.reference.jcountry-core.jar=lib/jcountry-core.jar file.reference.jletter-lib.jar=lib/jletter-lib.jar file.reference.jphone-core.jar=lib/jphone-core.jar file.reference.juser-core.jar=lib/juser-core.jar +file.reference.juser-lib.jar=lib/juser-lib.jar includes=** j2ee.compile.on.save=true j2ee.deploy.on.save=true @@ -44,6 +46,7 @@ jar.compress=false jar.name=jjobs-ejb.jar jars.in.ejbjar=false javac.classpath=\ + ${file.reference.jcore.jar}:\ ${file.reference.jcoreee.jar}:\ ${file.reference.jcore-logger-lib.jar}:\ ${file.reference.jcontacts-core.jar}:\ @@ -51,6 +54,7 @@ javac.classpath=\ ${file.reference.jcountry-core.jar}:\ ${file.reference.jphone-core.jar}:\ ${file.reference.juser-core.jar}:\ + ${file.reference.juser-lib.jar}:\ ${file.reference.jletter-lib.jar}:\ ${reference.jjobs-lib.jar} javac.compilerargs=-Xlint:unchecked -Xlint:deprecation @@ -93,11 +97,13 @@ source.encoding=UTF-8 source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/ source.reference.jcontacts-core.jar=../jcontacts-core/src/ source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/ +source.reference.jcore.jar=../jcore/src/ source.reference.jcoreee.jar=../jcoreee/src/ source.reference.jcountry-core.jar=../jcountry-core/src/ source.reference.jletter-lib.jar=../jletter-lib/src/ source.reference.jphone-core.jar=../jphone-core/src/ source.reference.juser-core.jar=../juser-core/src/ +source.reference.juser-lib.jar=../juser-lib/src/ source.root=src src.dir=${source.root}/java test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml index 30d1c2d..8b607f6 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -5,6 +5,7 @@ jjobs-ejb 1.6.5 + file.reference.jcore.jar file.reference.jcoreee.jar file.reference.jcore-logger-lib.jar file.reference.jcontacts-core.jar @@ -12,6 +13,7 @@ file.reference.jcountry-core.jar file.reference.jphone-core.jar file.reference.juser-core.jar + file.reference.juser-lib.jar file.reference.jletter-lib.jar reference.jjobs-lib.jar diff --git a/src/java/org/mxchange/jusercore/model/login/UserLoginSessionBean.java b/src/java/org/mxchange/jusercore/model/login/UserLoginSessionBean.java new file mode 100644 index 0000000..feb7e33 --- /dev/null +++ b/src/java/org/mxchange/jusercore/model/login/UserLoginSessionBean.java @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jusercore.model.login; + +import java.text.MessageFormat; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import org.mxchange.jcoreee.database.BaseDatabaseBean; +import org.mxchange.jusercore.container.login.LoginContainer; +import org.mxchange.jusercore.exceptions.UserNotFoundException; +import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; +import org.mxchange.jusercore.exceptions.UserStatusLockedException; +import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; +import org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.UserSessionBeanRemote; +import org.mxchange.jusercore.model.user.UserUtils; +import org.mxchange.jusercore.model.user.status.UserAccountStatus; + +/** + * A session bean for user logins + *

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

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

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

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

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