From: Roland Häder Date: Sat, 23 Sep 2017 12:06:24 +0000 (+0200) Subject: Please repeat/cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=97444d7c45396322623b1208843cce62cafca6fe;p=jfinancials-ejb.git Please repeat/cherry-pick: - added lookup attribute to @EJB annotation as some lookup did not work as expected and this is "guranteed" to work (if you have the right JNDI name, of course) - plus all these EJBs can now be more distributed over separate EJB modules allowing a distributed operation over several data centers, awsome words, right? ;-) - sorted members in base database bean Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcontacts/model/phone/FinancialsAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jcontacts/model/phone/FinancialsAdminContactPhoneSessionBean.java index cf500f7..aaabc9b 100644 --- a/src/java/org/mxchange/jcontacts/model/phone/FinancialsAdminContactPhoneSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/phone/FinancialsAdminContactPhoneSessionBean.java @@ -46,7 +46,7 @@ public class FinancialsAdminContactPhoneSessionBean extends BaseFinancialsDataba /** * Contact EJB */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote") private ContactSessionBeanRemote contactBean; /** diff --git a/src/java/org/mxchange/jcontactsbusiness/model/basicdata/FinancialsAdminBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/FinancialsAdminBusinessDataSessionBean.java index 893ca4e..51b4df2 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/basicdata/FinancialsAdminBusinessDataSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/FinancialsAdminBusinessDataSessionBean.java @@ -43,7 +43,7 @@ public class FinancialsAdminBusinessDataSessionBean extends BaseFinancialsDataba /** * Administrative EJB */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/basicCompanyData!org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote") private BasicCompanyDataSessionBeanRemote businessDataBean; /** diff --git a/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/FinancialsAdminBranchOfficeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/FinancialsAdminBranchOfficeSessionBean.java index 6f98e46..6941efa 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/FinancialsAdminBranchOfficeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/FinancialsAdminBranchOfficeSessionBean.java @@ -43,7 +43,7 @@ public class FinancialsAdminBranchOfficeSessionBean extends BaseFinancialsDataba /** * General branch office bean */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/branchOffice!org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeSessionBeanRemote") private BranchOfficeSessionBeanRemote branchOfficeBean; /** diff --git a/src/java/org/mxchange/jfinancials/database/BaseFinancialsDatabaseBean.java b/src/java/org/mxchange/jfinancials/database/BaseFinancialsDatabaseBean.java index 3485a51..aa50643 100644 --- a/src/java/org/mxchange/jfinancials/database/BaseFinancialsDatabaseBean.java +++ b/src/java/org/mxchange/jfinancials/database/BaseFinancialsDatabaseBean.java @@ -80,6 +80,195 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean { super(factoryJndi, queueJndi); } + /** + * Get back a managed instance from given contact + *

+ * @param contact Unmanaged/detached contact instance + *

+ * @return Managed contact instance + */ + protected Contact createManaged (final Contact contact) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N + + // user should not be null + if (null == contact) { + // Abort here + throw new NullPointerException("contact is null"); //NOI18N + } else if (contact.getContactId() == null) { + // Id is set + throw new NullPointerException("contact.contactId is null"); //NOI18N + } else if (contact.getContactId() < 1) { + // Id is set + throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is null", contact.getContactId())); //NOI18N + } + + // Try to find it (should be there) + final Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId()); + + // Should be there + assert (managedContact instanceof Contact) : "managedContact is null"; //NOI18N + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N + + // Return it + return managedContact; + } + + /** + * Get back a managed instance from given country + *

+ * @param country Unmanaged/detached country instance + *

+ * @return Managed country instance + */ + protected Country createManaged (final Country country) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: country={1} - CALLED!", this.getClass().getSimpleName(), country)); //NOI18N + + // user should not be null + if (null == country) { + // Abort here + throw new NullPointerException("country is null"); //NOI18N + } else if (country.getCountryId() == null) { + // Id is set + throw new NullPointerException("country.countryId is null"); //NOI18N + } else if (country.getCountryId() < 1) { + // Id is set + throw new IllegalArgumentException(MessageFormat.format("country.countryId={0} is null", country.getCountryId())); //NOI18N + } + + // Try to find it (should be there) + final Country managedCountry = this.getEntityManager().find(CountryData.class, country.getCountryId()); + + // Should be there + assert (managedCountry instanceof Country) : "managedCountry is null"; //NOI18N + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedCountry={1} - EXIT!", this.getClass().getSimpleName(), managedCountry)); //NOI18N + + // Return it + return managedCountry; + } + + /** + * Get back a managed instance from given basic data + *

+ * @param basicData Unmanaged/detached basic data instance + *

+ * @return Managed basic data instance + */ + protected BusinessBasicData createManaged (final BusinessBasicData basicData) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: basicData={1} - CALLED!", this.getClass().getSimpleName(), basicData)); //NOI18N + + // user should not be null + if (null == basicData) { + // Abort here + throw new NullPointerException("basicData is null"); //NOI18N + } else if (basicData.getBasicDataId() == null) { + // Id is set + throw new NullPointerException("basicData.basicDataId is null"); //NOI18N + } else if (basicData.getBasicDataId() < 1) { + // Id is set + throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is null", basicData.getBasicDataId())); //NOI18N + } + + // Try to find it (should be there) + final BusinessBasicData managedBasicData = this.getEntityManager().find(CompanyBasicData.class, basicData.getBasicDataId()); + + // Should be there + assert (managedBasicData instanceof BusinessBasicData) : "managedBasicData is null"; //NOI18N + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedBasicData={1} - EXIT!", this.getClass().getSimpleName(), managedBasicData)); //NOI18N + + // Return it + return managedBasicData; + } + + /** + * Get back a managed instance from given employee + *

+ * @param employee Unmanaged/detached employee instance + *

+ * @return Managed employee instance + */ + protected Employee createManaged (final Employee employee) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: employee={1} - CALLED!", this.getClass().getSimpleName(), employee)); //NOI18N + + // user should not be null + if (null == employee) { + // Abort here + throw new NullPointerException("employee is null"); //NOI18N + } else if (employee.getEmployeeId() == null) { + // Id is set + throw new NullPointerException("employee.employeeId is null"); //NOI18N + } else if (employee.getEmployeeId() < 1) { + // Id is set + throw new IllegalArgumentException(MessageFormat.format("employee.employeeId={0} is null", employee.getEmployeeId())); //NOI18N + } + + // Try to find it (should be there) + final Employee managedEmployee = this.getEntityManager().find(CompanyEmployee.class, employee.getEmployeeId()); + + // Should be there + assert (managedEmployee instanceof Employee) : "managedEmployee is null"; //NOI18N + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedEmployee={1} - EXIT!", this.getClass().getSimpleName(), managedEmployee)); //NOI18N + + // Return it + return managedEmployee; + } + + /** + * Get back a managed instance from given user + *

+ * @param user Unmanaged/detached user instance + *

+ * @return Managed user instance + */ + protected User createManaged (final User user) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: 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) + final 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}.createManaged: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N + + // Return it + return managedUser; + } + /** * Updates all contact's phone entry's created timestamps *

@@ -278,195 +467,6 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean { return detachedNumber; } - /** - * Get back a managed instance from given contact - *

- * @param contact Unmanaged/detached contact instance - *

- * @return Managed contact instance - */ - protected Contact createManaged (final Contact contact) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N - - // user should not be null - if (null == contact) { - // Abort here - throw new NullPointerException("contact is null"); //NOI18N - } else if (contact.getContactId() == null) { - // Id is set - throw new NullPointerException("contact.contactId is null"); //NOI18N - } else if (contact.getContactId() < 1) { - // Id is set - throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is null", contact.getContactId())); //NOI18N - } - - // Try to find it (should be there) - final Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId()); - - // Should be there - assert (managedContact instanceof Contact) : "managedContact is null"; //NOI18N - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N - - // Return it - return managedContact; - } - - /** - * Get back a managed instance from given country - *

- * @param country Unmanaged/detached country instance - *

- * @return Managed country instance - */ - protected Country createManaged (final Country country) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: country={1} - CALLED!", this.getClass().getSimpleName(), country)); //NOI18N - - // user should not be null - if (null == country) { - // Abort here - throw new NullPointerException("country is null"); //NOI18N - } else if (country.getCountryId() == null) { - // Id is set - throw new NullPointerException("country.countryId is null"); //NOI18N - } else if (country.getCountryId() < 1) { - // Id is set - throw new IllegalArgumentException(MessageFormat.format("country.countryId={0} is null", country.getCountryId())); //NOI18N - } - - // Try to find it (should be there) - final Country managedCountry = this.getEntityManager().find(CountryData.class, country.getCountryId()); - - // Should be there - assert (managedCountry instanceof Country) : "managedCountry is null"; //NOI18N - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedCountry={1} - EXIT!", this.getClass().getSimpleName(), managedCountry)); //NOI18N - - // Return it - return managedCountry; - } - - /** - * Get back a managed instance from given basic data - *

- * @param basicData Unmanaged/detached basic data instance - *

- * @return Managed basic data instance - */ - protected BusinessBasicData createManaged (final BusinessBasicData basicData) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: basicData={1} - CALLED!", this.getClass().getSimpleName(), basicData)); //NOI18N - - // user should not be null - if (null == basicData) { - // Abort here - throw new NullPointerException("basicData is null"); //NOI18N - } else if (basicData.getBasicDataId() == null) { - // Id is set - throw new NullPointerException("basicData.basicDataId is null"); //NOI18N - } else if (basicData.getBasicDataId() < 1) { - // Id is set - throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is null", basicData.getBasicDataId())); //NOI18N - } - - // Try to find it (should be there) - final BusinessBasicData managedBasicData = this.getEntityManager().find(CompanyBasicData.class, basicData.getBasicDataId()); - - // Should be there - assert (managedBasicData instanceof BusinessBasicData) : "managedBasicData is null"; //NOI18N - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedBasicData={1} - EXIT!", this.getClass().getSimpleName(), managedBasicData)); //NOI18N - - // Return it - return managedBasicData; - } - - /** - * Get back a managed instance from given employee - *

- * @param employee Unmanaged/detached employee instance - *

- * @return Managed employee instance - */ - protected Employee createManaged (final Employee employee) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: employee={1} - CALLED!", this.getClass().getSimpleName(), employee)); //NOI18N - - // user should not be null - if (null == employee) { - // Abort here - throw new NullPointerException("employee is null"); //NOI18N - } else if (employee.getEmployeeId() == null) { - // Id is set - throw new NullPointerException("employee.employeeId is null"); //NOI18N - } else if (employee.getEmployeeId() < 1) { - // Id is set - throw new IllegalArgumentException(MessageFormat.format("employee.employeeId={0} is null", employee.getEmployeeId())); //NOI18N - } - - // Try to find it (should be there) - final Employee managedEmployee = this.getEntityManager().find(CompanyEmployee.class, employee.getEmployeeId()); - - // Should be there - assert (managedEmployee instanceof Employee) : "managedEmployee is null"; //NOI18N - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedEmployee={1} - EXIT!", this.getClass().getSimpleName(), managedEmployee)); //NOI18N - - // Return it - return managedEmployee; - } - - /** - * Get back a managed instance from given user - *

- * @param user Unmanaged/detached user instance - *

- * @return Managed user instance - */ - protected User createManaged (final User user) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: 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) - final 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}.createManaged: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N - - // Return it - return managedUser; - } - /** * Merges given contact's data *

diff --git a/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java index f0924d4..550242e 100644 --- a/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java @@ -29,7 +29,6 @@ import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; import org.mxchange.jusercore.model.user.status.UserAccountStatus; -import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote; /** * An administrative user EJB @@ -44,16 +43,10 @@ public class FinancialsAdminUserSessionBean extends BaseFinancialsDatabaseBean i */ private static final long serialVersionUID = 542_145_347_916L; - /** - * Registration EJB - */ - @EJB - private UserRegistrationSessionBeanRemote registerBean; - /** * Regular user bean */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote") private UserSessionBeanRemote userBean; /** @@ -79,10 +72,10 @@ public class FinancialsAdminUserSessionBean extends BaseFinancialsDatabaseBean i } // Check if user is registered - if (this.registerBean.isUserNameRegistered(user)) { + if (this.userBean.isUserNameRegistered(user)) { // Abort here throw new UserNameAlreadyRegisteredException(user); - } else if (this.registerBean.isEmailAddressRegistered(user)) { + } else if (this.userBean.isEmailAddressRegistered(user)) { // Abort here throw new EmailAddressAlreadyRegisteredException(user); } diff --git a/src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java index bb99c45..301e4e4 100644 --- a/src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java @@ -60,7 +60,7 @@ public class FinancialsUserSessionBean extends BaseFinancialsDatabaseBean implem /** * Registration EJB */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote") private UserRegistrationSessionBeanRemote registerBean; /** diff --git a/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java index 9c74ab2..845cb1d 100644 --- a/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java @@ -46,7 +46,7 @@ public class FinancialsUserEmailChangeSessionBean extends BaseFinancialsDatabase /** * User bean */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote") private UserSessionBeanRemote userBean; /** @@ -111,7 +111,6 @@ public class FinancialsUserEmailChangeSessionBean extends BaseFinancialsDatabase // 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 diff --git a/src/java/org/mxchange/juserlogincore/model/user/login/FinancialsUserLoginSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/login/FinancialsUserLoginSessionBean.java index d2b5a49..11f7943 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/login/FinancialsUserLoginSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/login/FinancialsUserLoginSessionBean.java @@ -29,7 +29,6 @@ import org.mxchange.jusercore.model.user.status.UserAccountStatus; import org.mxchange.juserlogincore.container.login.LoginContainer; import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; import org.mxchange.juserlogincore.login.UserLoginUtils; -import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote; /** * A session EJB for user logins @@ -44,16 +43,10 @@ public class FinancialsUserLoginSessionBean extends BaseFinancialsDatabaseBean i */ private static final long serialVersionUID = 21_785_978_127_581_965L; - /** - * Registration EJB - */ - @EJB - private UserRegistrationSessionBeanRemote registerBean; - /** * User EJB */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote") private UserSessionBeanRemote userBean; /** @@ -69,10 +62,6 @@ public class FinancialsUserLoginSessionBean extends BaseFinancialsDatabaseBean i // 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 @@ -89,7 +78,7 @@ public class FinancialsUserLoginSessionBean extends BaseFinancialsDatabaseBean i } // Is the account there? - if (!this.registerBean.isUserNameRegistered(container.getUser())) { + if (!this.userBean.isUserNameRegistered(container.getUser())) { // Not registered throw new UserNotFoundException(container.getUser()); } diff --git a/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java index 5bc14a2..e14efab 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java @@ -48,13 +48,13 @@ public class FinancialsUserRegistrationSessionBean extends BaseFinancialsDatabas /** * Administrative user bean */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote") private AdminUserSessionBeanRemote adminUserBean; /** * Regular user EJB */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote") private UserSessionBeanRemote userBean; /** @@ -111,42 +111,6 @@ public class FinancialsUserRegistrationSessionBean extends BaseFinancialsDatabas 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 @@ -168,10 +132,10 @@ public class FinancialsUserRegistrationSessionBean extends BaseFinancialsDatabas } // Check if user is registered - if (this.isUserNameRegistered(user)) { + if (this.userBean.isUserNameRegistered(user)) { // Abort here throw new UserNameAlreadyRegisteredException(user); - } else if (this.isEmailAddressRegistered(user)) { + } else if (this.userBean.isEmailAddressRegistered(user)) { // Abort here throw new EmailAddressAlreadyRegisteredException(user); } diff --git a/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java index b2e1e62..6eaaee5 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java @@ -46,13 +46,13 @@ public class FinancialsResendLinkSessionBean extends BaseFinancialsDatabaseBean /** * Registration bean */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote") private UserRegistrationSessionBeanRemote registerBean; /** * Regular user bean */ - @EJB + @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote") private UserSessionBeanRemote userBean; /**