From: Roland Haeder Date: Fri, 19 Feb 2016 14:34:59 +0000 (+0100) Subject: Added missing javadoc + organized members X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9e4ed3eceb33f463816ce7a7f68e7a33b03f38a6;p=addressbook-war.git Added missing javadoc + organized members --- diff --git a/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebSessionBean.java index 54ae88c5..bc024c2b 100644 --- a/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebSessionBean.java @@ -348,6 +348,9 @@ public class AddressbookWebSessionBean implements AddressbookWebSessionControlle return (!this.usersAddressbooks.isEmpty()); } + /** + * Post-initialization of this class + */ @PostConstruct public void init () { // Init list diff --git a/src/java/org/mxchange/addressbook/beans/country/CountryWebApplicationBean.java b/src/java/org/mxchange/addressbook/beans/country/CountryWebApplicationBean.java index b994cd84..bae6f545 100644 --- a/src/java/org/mxchange/addressbook/beans/country/CountryWebApplicationBean.java +++ b/src/java/org/mxchange/addressbook/beans/country/CountryWebApplicationBean.java @@ -75,6 +75,9 @@ public class CountryWebApplicationBean implements CountryWebApplicationControlle return Collections.unmodifiableList(this.countryList); } + /** + * Post-initialization of this class + */ @PostConstruct public void init () { this.countryList = this.countryBean.allCountries(); diff --git a/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java index e6329bf4..c6ab33e6 100644 --- a/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/shares/SharesWebSessionBean.java @@ -200,6 +200,9 @@ public class SharesWebSessionBean implements SharesWebSessionController { this.shareeUserId = shareeUserId; } + /** + * Post-initialization of this class + */ @PostConstruct public void init () { } diff --git a/src/java/org/mxchange/addressbook/beans/smsprovider/SmsProviderWebApplicationBean.java b/src/java/org/mxchange/addressbook/beans/smsprovider/SmsProviderWebApplicationBean.java index aa64620c..9d50ea58 100644 --- a/src/java/org/mxchange/addressbook/beans/smsprovider/SmsProviderWebApplicationBean.java +++ b/src/java/org/mxchange/addressbook/beans/smsprovider/SmsProviderWebApplicationBean.java @@ -75,6 +75,9 @@ public class SmsProviderWebApplicationBean implements SmsProviderWebApplicationC return Collections.unmodifiableList(this.cellphoneList); } + /** + * Post-initialization of this class + */ @PostConstruct public void init () { this.cellphoneList = this.cellphoneBean.allSmsProvider(); diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/user/UserWebSessionBean.java index cc31bdc1..a42c1a11 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebSessionBean.java @@ -147,6 +147,12 @@ public class UserWebSessionBean implements UserWebSessionController { */ private Short houseNumber; + /** + * Login bean (controller) + */ + @Inject + private UserLoginWebSessionController loginController; + /** * Phone number area code */ @@ -202,21 +208,15 @@ public class UserWebSessionBean implements UserWebSessionController { */ private ProfileMode userProfileMode; - /** - * ZIP code - */ - private Integer zipCode; - /** * A list of all public user profiles */ private List visibleUserList; /** - * Login bean (controller) + * ZIP code */ - @Inject - private UserLoginWebSessionController loginController; + private Integer zipCode; /** * Default constructor @@ -238,32 +238,6 @@ public class UserWebSessionBean implements UserWebSessionController { } } - @Override - public void afterUserLogin (final @Observes UserLoggedInEvent event) { - // Trace message - System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N - - // event should not be null - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getUser() == null) { - // Throw NPE again - throw new NullPointerException("event.user is null"); //NOI18N - } else if (event.getUser().getUserId() == null) { - // userId is null - throw new NullPointerException("event.user.userId is null"); //NOI18N - } else if (event.getUser().getUserId() < 1) { - // Not avalid id - throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUser(), event.getUser().getUserId())); //NOI18N - } - - // Re-initialize list - this.visibleUserList = this.userBean.allMemberPublicVisibleUsers(); - - // Trace message - System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: this.visibleUserList.size()={0} - EXIT!", this.visibleUserList.size())); //NOI18N - } @Override public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) { @@ -313,6 +287,33 @@ public class UserWebSessionBean implements UserWebSessionController { System.out.println("UserWebBean:afterRegistration: EXIT!"); //NOI18N } + @Override + public void afterUserLogin (final @Observes UserLoggedInEvent event) { + // Trace message + System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N + + // event should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getUser() == null) { + // Throw NPE again + throw new NullPointerException("event.user is null"); //NOI18N + } else if (event.getUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.user.userId is null"); //NOI18N + } else if (event.getUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUser(), event.getUser().getUserId())); //NOI18N + } + + // Re-initialize list + this.visibleUserList = this.userBean.allMemberPublicVisibleUsers(); + + // Trace message + System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: this.visibleUserList.size()={0} - EXIT!", this.visibleUserList.size())); //NOI18N + } + @Override public List allVisibleUsers () { // Return it @@ -670,6 +671,9 @@ public class UserWebSessionBean implements UserWebSessionController { this.zipCode = zipCode; } + /** + * Post-initialization of this class + */ @PostConstruct public void init () { // Get full user name list for reducing EJB calls @@ -720,6 +724,11 @@ public class UserWebSessionBean implements UserWebSessionController { return (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())); } + @Override + public boolean isUserIdEmpty () { + return ((this.getUserId() == null) || (this.getUserId() == 0)); + } + @Override public boolean isUserNameRegistered (final User user) { return ((this.userNameList instanceof List) && (this.userNameList.contains(user.getUserName()))); @@ -858,9 +867,4 @@ public class UserWebSessionBean implements UserWebSessionController { this.setBirthday(user.getUserContact().getContactBirthday()); this.setComment(user.getUserContact().getContactComment()); } - - @Override - public boolean isUserIdEmpty () { - return ((this.getUserId() == null) || (this.getUserId() == 0)); - } } diff --git a/src/java/org/mxchange/addressbook/converter/country/CountryConverter.java b/src/java/org/mxchange/addressbook/converter/country/CountryConverter.java index a70df8ce..a29b64c5 100644 --- a/src/java/org/mxchange/addressbook/converter/country/CountryConverter.java +++ b/src/java/org/mxchange/addressbook/converter/country/CountryConverter.java @@ -50,6 +50,26 @@ public class CountryConverter implements Converter { @Log private LoggerBeanLocal loggerBeanLocal; + /** + * Initialization of this converter + */ + public CountryConverter () { + // Try to get it + try { + // Get initial context + Context context = new InitialContext(); + + // Lookup logger + this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N + + // ... and country controller + this.countryController = (AddressbookCountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.AddressbookCountrySingletonBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new RuntimeException("context.lookup() failed.", ex); //NOI18N + } + } + @Override public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Trace message @@ -113,24 +133,4 @@ public class CountryConverter implements Converter { // Return category id return String.valueOf(((Country) value).getCountryId()); } - - /** - * Initialization of this converter - */ - public CountryConverter () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // Lookup logger - this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N - - // ... and country controller - this.countryController = (AddressbookCountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.AddressbookCountrySingletonBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException("context.lookup() failed.", ex); //NOI18N - } - } } diff --git a/src/java/org/mxchange/addressbook/converter/smsprovider/SmsProviderConverter.java b/src/java/org/mxchange/addressbook/converter/smsprovider/SmsProviderConverter.java index 464c113e..6b3b6884 100644 --- a/src/java/org/mxchange/addressbook/converter/smsprovider/SmsProviderConverter.java +++ b/src/java/org/mxchange/addressbook/converter/smsprovider/SmsProviderConverter.java @@ -50,6 +50,26 @@ public class SmsProviderConverter implements Converter { */ private AddressbookSmsProviderSingletonBeanRemote providerController; + /** + * Initialization of this converter + */ + public SmsProviderConverter () { + // Try to get it + try { + // Get initial context + Context context = new InitialContext(); + + // Lookup logger + this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N + + /// and SMS provider controller + this.providerController = (AddressbookSmsProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/smsprovider!org.mxchange.jphone.phonenumbers.smsprovider.AddressbookSmsProviderSingletonBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new RuntimeException("context.lookup() failed.", ex); //NOI18N + } + } + @Override public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Trace message @@ -113,25 +133,4 @@ public class SmsProviderConverter implements Converter { // Return category id return String.valueOf(((SmsProvider) value).getProviderId()); } - - /** - * Initialization of this converter - */ - public SmsProviderConverter () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // Lookup logger - this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N - - /// and SMS provider controller - this.providerController = (AddressbookSmsProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/smsprovider!org.mxchange.jphone.phonenumbers.smsprovider.AddressbookSmsProviderSingletonBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException("context.lookup() failed.", ex); //NOI18N - } - } - } diff --git a/src/java/org/mxchange/addressbook/converter/user/UserConverter.java b/src/java/org/mxchange/addressbook/converter/user/UserConverter.java index 2b2c2f2b..8d0592fe 100644 --- a/src/java/org/mxchange/addressbook/converter/user/UserConverter.java +++ b/src/java/org/mxchange/addressbook/converter/user/UserConverter.java @@ -50,6 +50,26 @@ public class UserConverter implements Converter { */ private UserWebSessionController userController; + /** + * Initialization of this converter + */ + public UserConverter () { + // Try to get it + try { + // Get initial context + Context context = new InitialContext(); + + // Lookup logger + this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N + + // ... and user controller + this.userController = (UserWebSessionController) context.lookup("java:global/juser-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new RuntimeException("context.lookup() failed.", ex); //NOI18N + } + } + @Override public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Trace message @@ -108,24 +128,4 @@ public class UserConverter implements Converter { // Return category id return String.valueOf(((User) value).getUserId()); } - - /** - * Initialization of this converter - */ - public UserConverter () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // Lookup logger - this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N - - // ... and user controller - this.userController = (UserWebSessionController) context.lookup("java:global/juser-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException("context.lookup() failed.", ex); //NOI18N - } - } }