From b0fba29251888f8061e6717be22cb2dc74890ea7 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 11 Mar 2016 22:00:41 +0100 Subject: [PATCH] Continued: - added new entity class for changing email addresses - added EJB for changing email addresses which has an injected user EJB - updated jar(s) --- lib/juser-core.jar | Bin 30095 -> 38686 bytes lib/juser-lib.jar | Bin 4180 -> 4887 bytes nbproject/build-impl.xml | 13 ++- nbproject/genfiles.properties | 4 +- nbproject/project.properties | 5 +- nbproject/project.xml | 9 ++ src/conf/persistence.xml | 1 + .../email_address/EmailChangeSessionBean.java | 104 ++++++++++++++++++ .../jusercore/model/user/UserSessionBean.java | 52 --------- 9 files changed, 132 insertions(+), 56 deletions(-) create mode 100644 src/java/org/mxchange/jusercore/model/email_address/EmailChangeSessionBean.java diff --git a/lib/juser-core.jar b/lib/juser-core.jar index 22b1352719e70921cb178edbaf2f44438454ab4e..7dad4a093ec73a3f597125d3068b39e293fae567 100644 GIT binary patch delta 8904 zcmcIqc~D(f8UN0Gyal+x10L%OYY2e=Vao!6KwjXnG%N|ENz*Lk1zv%$^B`@b<|WZ; zn(jGWG;Nw#Q){&*O=xYk)6`|gI$E7N%`x#;U2~_nmX!a&O9AqbRSidQmP>nnk%sX%ppB%6d`0t<-7#CH(aQOR0ClGde!t85)}P`h1lk z{ive@!v1P_l_|eaPwkuY%*`8^_)`iAjt`p(!QE%NL8v`%YNc}Fn&}-TDp$>87E$R{ zJ7mwvgnX0edD-44D=Cg$a%d)PyCQ~uma#oXRF*BNla;;sHL~(h(WvBNCFf-2V%e*v zWSY-wo{fhtn*iu(r}^~g=hHIcnH=_d_KkbpWEGb*%F4lUkI(nh|9(r!|fq__dI`mTe#TqlR*SdU{ z-d@`Jhgm>UH!yJMaRj7vaJwzf;B!%>ly2i!b`zVVS zz@#uv>6pnn!Xe?o5|k$Yqk;^6a8(w6V%6Sq$v&V-9UUT=4hB+&q!0L{nV@ z1%g@1&sWCs`PxdGwa?ww=kD*|udZ(6`_i*0Vp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&MBzDHWlsI?u~~kUPq^jR%}(##?|||)Xk;$xb!}k8quVp87(RpcBt5i zE){#Zv=3b@sw~5Q9sW_V3%gZp#9_9$EI76VvsJu|G!>;-prV{lEBSNv zCiQ(=#w71_$jE~iTeLJd0t#Mmq7X%;kSg#ZiZO9MvdDo_b}qFw%z=a{6_|^87)#n` z>+ljLYaWD0#&lYJ7+EHeEJAg+`A^-5k?uB{z!sAGSa|V7i!_gEGqD&2JY^aAEvdj# zI4K{kfu>PBeK1X3ct||Fg0z)vhBIbYCvL zir2_4(JpvHL{*nBl-98G@eV~w*n+J*14X5ZIbcaVjmVRvkTFn%D}xGV(bGtH7u)pUY_R&uAi=>;RO$vS z_+=2b)mWJoW5i~Y_{U*_J<=WfmMJ!UR0g&zAgzfFNuOclDTBJk%lX#i3r~()8S!F9OfJ|f)59&o2)2IY`=d(v|m`=Eg~LbO{6=!42 zU$D&-b`L(#g9l2_cVCSAio=LWxCbU$HV z;2Ml4s*`{c>TYllAl^cJlh7^c`txD)VVm9X#E-#_-*p)b;q2WuyZRZ2XmOkWDe{T$`0GY;y=+8`|vhWs9y(6smiq z%2iofa~vDf9wSno&A)r|2RbGAlj)MO)n9k?X5H;!BL2&EyL>W`)DG4v`?EE}hqJKl zLBf=>-7Z^fhN*kRaMrAwy2(^Nf=uD;qU^__LhS59rxrD=!!DlxTe!CZ;LfTE8`+Lpjd8t|9^LiDU?4s zF5wU3jezyZek_GWi-0S;wmz&RXZ}og2{@QEC?J-t@6g_n%N^e(V0EhT%FmSfvYMS5 zr7a6rT`si%{7H5R=$)kp__FgmwW?g-X_re%40T}L5SHAfiZ_teWtYPi7!Xfphq4`A lTGSCTeX&%S`Zq^Lq&QbDsjDl>w^%t`H2te8P*crk{{wwyhrj>; diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar index 985516ffe2939cd31bb9248be244e20ccb985be7..f637271c38803627467b683fb564c07db7c11532 100644 GIT binary patch delta 831 zcmcbjFkOu|z?+$ci-CcIfuVLs_C#I{<{BVnF`u~tNZpbLQ-3r-)MRx=BQPDqXdwdR zdoUmYZ6JH{M^;(s)ZE0(ocP3)l%mw)Vts_+AOof|+JOzY!RQF4WteQi2FcX@t*d8b zU;trXs6mpb2DyTabN44gokje(H?7)~fY z+8o2g%M9|$<{VabW?oRBoPHXuRKU!@P%ycH!M-5vIxV+@}~h zC%@v(Pz9PU3N~GgK^$tj1juwoCJ|i%#66;1FZs)d$mNycS@(kk<)J zZ{zh4#E6o~{Cs+{sKJPAJ}5>Q`J`Dc14A7Yb(3xRgcQ&XQ3JXS0t6V|Is$!=&u5~9 zu1E={h5@7~f(dM%k{+669_Y~w)3u~=21JW2o+xtUR|eaw@R6l#Jy1CaJHt!>(n}hf zSfKv6!>llQ9|zmy2!0;0f4pb=HO>br2Vqe1f`KKClh}d&(U`o3-x#bA9(Ta_vxTVw a(n}iWa83Tt@6N}^z{fBPXiYjFNEQHeV#E~y delta 443 zcmbQPc13|Vz?+$ci-CcIfx%-@)MJ7iuoyuejqBr-m@G^rL^V!*%1%V + + + + + + @@ -836,6 +842,7 @@ exists or setup the property manually. For example like this: + @@ -848,8 +855,9 @@ exists or setup the property manually. For example like this: + - + @@ -860,6 +868,7 @@ exists or setup the property manually. For example like this: + @@ -873,6 +882,7 @@ exists or setup the property manually. For example like this: + @@ -1257,6 +1267,7 @@ exists or setup the property manually. For example like this: --> + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 5217369..4f6f540 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -3,6 +3,6 @@ build.xml.script.CRC32=7d41e0fd build.xml.stylesheet.CRC32=5910fda3@1.51.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=73853deb -nbproject/build-impl.xml.script.CRC32=b9ae5896 +nbproject/build-impl.xml.data.CRC32=578b807a +nbproject/build-impl.xml.script.CRC32=34424534 nbproject/build-impl.xml.stylesheet.CRC32=6096d939@1.55.1 diff --git a/nbproject/project.properties b/nbproject/project.properties index 4e968a2..2fb4f97 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -54,7 +54,8 @@ javac.classpath=\ ${file.reference.jcontacts-business-core.jar}:\ ${file.reference.juser-core.jar}:\ ${file.reference.juser-lib.jar}:\ - ${reference.addressbook-lib.jar} + ${reference.addressbook-lib.jar}:\ + ${reference.juser-core.jar} javac.compilerargs=-Xlint:unchecked -Xlint:deprecation javac.debug=true javac.deprecation=true @@ -82,8 +83,10 @@ meta.inf=${source.root}/conf meta.inf.excludes=sun-cmp-mappings.xml platform.active=default_platform project.addressbook-lib=../addressbook-lib +project.juser-core=../juser-core project.license=gpl30 reference.addressbook-lib.jar=${project.addressbook-lib}/dist/addressbook-lib.jar +reference.juser-core.jar=${project.juser-core}/dist/juser-core.jar resource.dir=setup run.test.classpath=\ ${javac.test.classpath}:\ diff --git a/nbproject/project.xml b/nbproject/project.xml index 7e85124..8d34321 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -15,6 +15,7 @@ file.reference.juser-core.jar file.reference.juser-lib.jar reference.addressbook-lib.jar + reference.juser-core.jar @@ -34,6 +35,14 @@ clean jar + + juser-core + jar + + jar + clean + jar + diff --git a/src/conf/persistence.xml b/src/conf/persistence.xml index 92674db..f6b140d 100644 --- a/src/conf/persistence.xml +++ b/src/conf/persistence.xml @@ -19,6 +19,7 @@ org.mxchange.jphone.phonenumbers.fax.FaxNumber org.mxchange.jphone.phonenumbers.landline.LandLineNumber org.mxchange.jphone.phonenumbers.smsprovider.CellphoneProvider + org.mxchange.jusercore.model.email_address.EmailAddressChange org.mxchange.jusercore.model.user.LoginUser false diff --git a/src/java/org/mxchange/jusercore/model/email_address/EmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/email_address/EmailChangeSessionBean.java new file mode 100644 index 0000000..bb4131a --- /dev/null +++ b/src/java/org/mxchange/jusercore/model/email_address/EmailChangeSessionBean.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2016 quix0r + * + * 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.email_address; + +import java.text.MessageFormat; +import javax.ejb.Stateless; +import javax.inject.Inject; +import javax.persistence.PersistenceException; +import org.mxchange.jcoreee.database.BaseDatabaseBean; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.UserSessionBeanRemote; + +/** + * A session bean for changing email addresses + *

+ * @author Roland Haeder + */ +@Stateless (name = "email-change", mappedName = "ejb/stateless-addressbook-email-change", description = "A bean handling email changes") +public class EmailChangeSessionBean extends BaseDatabaseBean implements EmailChangeSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 182_698_165_971_548L; + + /** + * User bean + */ + @Inject + private UserSessionBeanRemote userBean; + + /** + * Default constructor + */ + public EmailChangeSessionBean () { + } + + @Override + public void enqueueEmailAddressForChange (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("enqueueEmailAddressForChange: 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.userBean.ifUserIdExists(user.getUserId())) { + // User does not exist + throw new PersistenceException(MessageFormat.format("User with id {0} does not exist.", user.getUserId())); //NOI18N + } + + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public void updateEmailAddress (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateEmailAddress: 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.userBean.ifUserIdExists(user.getUserId())) { + // User does not exist + throw new PersistenceException(MessageFormat.format("User with id {0} does not exist.", user.getUserId())); //NOI18N + } + + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + +} diff --git a/src/java/org/mxchange/jusercore/model/user/UserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/UserSessionBean.java index 1b6e197..4795d84 100644 --- a/src/java/org/mxchange/jusercore/model/user/UserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/UserSessionBean.java @@ -288,58 +288,6 @@ public class UserSessionBean extends BaseDatabaseBean implements UserSessionBean return true; } - @Override - public void enqueueEmailAddressForChange (final User user) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("enqueueEmailAddressForChange: 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 - } - - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public void updateEmailAddress (final User user) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateEmailAddress: 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 - } - - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - @Override public void updateUserPersonalData (final User user) { // Trace message -- 2.39.5