From: Roland Haeder Date: Fri, 11 Mar 2016 21:00:41 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b0fba29251888f8061e6717be22cb2dc74890ea7;p=jfinancials-mailer-ejb.git Continued: - added new entity class for changing email addresses - added EJB for changing email addresses which has an injected user EJB - updated jar(s) --- diff --git a/lib/juser-core.jar b/lib/juser-core.jar index 22b1352..7dad4a0 100644 Binary files a/lib/juser-core.jar and b/lib/juser-core.jar differ diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar index 985516f..f637271 100644 Binary files a/lib/juser-lib.jar and b/lib/juser-lib.jar differ diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index a385450..6a0a390 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -809,11 +809,17 @@ exists or setup the property manually. For example like this: + + + + + + @@ -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