From f8051174856764edd3088f1d0c0f7d4038c1557a Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 16 Feb 2016 01:15:16 +0100 Subject: [PATCH] Sharing of address books is not part of this application --- nbproject/faces-config.NavData | 30 +- .../AddressbookWebSessionBean.java | 28 -- .../AddressbookWebSessionController.java | 9 - .../beans/shares/SharesWebSessionBean.java | 341 ------------------ .../shares/SharesWebSessionController.java | 121 ------- .../jjobs/beans/user/UserWebSessionBean.java | 82 ++--- .../converter/country/CountryConverter.java | 40 +- .../smsprovider/SmsProviderConverter.java | 41 +-- .../jjobs/converter/user/UserConverter.java | 42 +-- .../localization/bundle_de_DE.properties | 32 -- .../localization/bundle_en_US.properties | 32 -- web/WEB-INF/faces-config.xml | 29 -- web/WEB-INF/templates/login/login_menu.tpl | 6 - .../login_list_sharing_addressbooks.xhtml | 33 -- web/login/login_other_addressbooks.xhtml | 20 - web/login/login_shared_addressbooks.xhtml | 58 --- .../login_start_sharing_addressbook.xhtml | 61 ---- web/user/show_addressbook.xhtml | 2 - web/user/user_list.xhtml | 12 - 19 files changed, 131 insertions(+), 888 deletions(-) delete mode 100644 src/java/org/mxchange/jjobs/beans/shares/SharesWebSessionBean.java delete mode 100644 src/java/org/mxchange/jjobs/beans/shares/SharesWebSessionController.java delete mode 100644 web/login/login_list_sharing_addressbooks.xhtml delete mode 100644 web/login/login_other_addressbooks.xhtml delete mode 100644 web/login/login_shared_addressbooks.xhtml delete mode 100644 web/login/login_start_sharing_addressbook.xhtml diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData index 298bfc50..38d417be 100644 --- a/nbproject/faces-config.NavData +++ b/nbproject/faces-config.NavData @@ -1,6 +1,34 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/org/mxchange/jjobs/beans/addressbook/AddressbookWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/addressbook/AddressbookWebSessionBean.java index 6ef381b6..f8301e9f 100644 --- a/src/java/org/mxchange/jjobs/beans/addressbook/AddressbookWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/addressbook/AddressbookWebSessionBean.java @@ -23,8 +23,6 @@ import java.util.GregorianCalendar; import java.util.LinkedList; import java.util.List; import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; @@ -57,11 +55,6 @@ import org.mxchange.jusercore.model.user.User; @SessionScoped public class AddressbookWebSessionBean implements AddressbookWebSessionController { - /** - * Map for count of user's shared addresses - */ - private static ConcurrentMap countSharesList; - /** * Serial number */ @@ -130,9 +123,6 @@ public class AddressbookWebSessionBean implements AddressbookWebSessionControlle // Throw again throw new FaceletException(e); } - - // Init list - AddressbookWebSessionBean.countSharesList = new ConcurrentHashMap<>(0); } @Override @@ -268,24 +258,6 @@ public class AddressbookWebSessionBean implements AddressbookWebSessionControlle return this.addressbookBean.allUsersNotSharing(this.loginController.getLoggedInUser(), this.getAddressbook()); } - @Override - public Integer countAllUserSharedAddressbooks (final User user) { - // Is there cache? - if (AddressbookWebSessionBean.countSharesList.containsKey(user)) { - // Return it instead - return AddressbookWebSessionBean.countSharesList.get(user); - } - - // Call EJB ("expensive") - Integer count = this.addressbookBean.countAllUserSharedAddressbooks(user); - - // Add to list - AddressbookWebSessionBean.countSharesList.put(user, count); - - // Return it - return count; - } - @Override public Addressbook getAddressbook () { return this.addressbook; diff --git a/src/java/org/mxchange/jjobs/beans/addressbook/AddressbookWebSessionController.java b/src/java/org/mxchange/jjobs/beans/addressbook/AddressbookWebSessionController.java index 02ea4043..110753b9 100644 --- a/src/java/org/mxchange/jjobs/beans/addressbook/AddressbookWebSessionController.java +++ b/src/java/org/mxchange/jjobs/beans/addressbook/AddressbookWebSessionController.java @@ -147,15 +147,6 @@ public interface AddressbookWebSessionController extends Serializable { */ void afterAddressbookLoadedEvent (final AddressbookLoadedEvent event); - /** - * Count all shared address books by given user id - *

- * @param user User instance to look for - *

- * @return Count of user's shared address books - */ - Integer countAllUserSharedAddressbooks (final User user); - /** * This method is called when a user has successfully logged in his/her * account. diff --git a/src/java/org/mxchange/jjobs/beans/shares/SharesWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/shares/SharesWebSessionBean.java deleted file mode 100644 index 183cbd73..00000000 --- a/src/java/org/mxchange/jjobs/beans/shares/SharesWebSessionBean.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * 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.jjobs.beans.shares; - -import java.text.MessageFormat; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import javax.annotation.PostConstruct; -import javax.enterprise.context.SessionScoped; -import javax.enterprise.event.Event; -import javax.enterprise.event.Observes; -import javax.enterprise.inject.Any; -import javax.faces.view.facelets.FaceletException; -import javax.inject.Inject; -import javax.inject.Named; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import org.mxchange.addressbook.events.sharing.AddressbookSharingEvent; -import org.mxchange.addressbook.events.sharing.StartedAddressbookSharingEvent; -import org.mxchange.addressbook.events.sharing.type.SharingType; -import org.mxchange.addressbook.exceptions.UserAlreadySharingAddressbookException; -import org.mxchange.addressbook.model.addressbook.Addressbook; -import org.mxchange.addressbook.model.addressbook.shared.ShareableAddressbook; -import org.mxchange.addressbook.model.shared.SharedAddressbooksSessionBeanRemote; -import org.mxchange.jjobs.beans.login.UserLoginWebSessionController; -import org.mxchange.jusercore.events.login.UserLoggedInEvent; -import org.mxchange.jusercore.model.user.User; -import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; - -/** - * A bean for sharing address books with other users - *

- * @author Roland Haeder - */ -@Named (value = "shareController") -@SessionScoped -public class SharesWebSessionBean implements SharesWebSessionController { - - /** - * Serial number - */ - private static final long serialVersionUID = 19_868_976_871_976_780L; - - /** - * Cached flag whether the user is sharing address books - */ - private Boolean isUserSharing = null; - - /** - * Login controller injection - */ - @Inject - private UserLoginWebSessionController loginController; - - /** - * Share instance - */ - private ShareableAddressbook share; - - /** - * Remote bean for sharing address books - */ - private SharedAddressbooksSessionBeanRemote shareBean; - - /** - * A list of all user's shared (with others) address books - */ - private List sharedAddressbooks; - - /** - * User id of sharee - */ - private Long shareeUserId; - - /** - * An event triggered when address book sharing starts or ends - */ - @Inject - @Any - private Event sharingEvent; - - /** - * Default constructor - */ - public SharesWebSessionBean () { - // Try it - try { - // Get initial context - Context context = new InitialContext(); - - // Look up bean - this.shareBean = (SharedAddressbooksSessionBeanRemote) context.lookup("ejb/stateless-share"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw - throw new FaceletException(ex); - } - } - - @Override - public void afterAdressbookShareEnded (final @Observes AddressbookSharingEvent event) { - // Validate parameter - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getSharingType() == null) { - // Throw NPE - throw new NullPointerException("event.sharingType is null"); //NOI18N - } else if (event.getSharingType() != SharingType.ENDED) { - // Wrong event - return; - } - - // Validate event - this.validateEvent(event); - - // Add it to list - this.sharedAddressbooks.remove(event.getShareableAddressbook()); - } - - @Override - public void afterAdressbookShareStarted (final @Observes AddressbookSharingEvent event) { - // Validate parameter - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getSharingType() == null) { - // Throw NPE - throw new NullPointerException("event.sharingType is null"); //NOI18N - } else if (event.getSharingType() != SharingType.STARTED) { - // Wrong event - return; - } - - // Validate event - this.validateEvent(event); - - // Add it to list - this.sharedAddressbooks.add(event.getShareableAddressbook()); - } - - @Override - public void afterLoginEvent (final @Observes UserLoggedInEvent event) { - // Is the user logged in? - if (null == event) { - // Is null - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getUser() == null) { - // user is null - throw new NullPointerException("event.user is null"); //NOI18N - } - - // Init share list - this.sharedAddressbooks = this.shareBean.allSharedAddressbooks(event.getUser()); - } - - @Override - public List allShares () { - // Is the user logged in? - if (!this.loginController.isUserLoggedIn()) { - // Not logged in - throw new FaceletException("This method can only be called as logged-in user."); //NOI18N - } - - return Collections.unmodifiableList(this.sharedAddressbooks); - } - - @Override - public ShareableAddressbook getShare () { - return this.share; - } - - @Override - public void setShare (final ShareableAddressbook share) { - this.share = share; - } - - @Override - public Long getShareeUserId () { - return this.shareeUserId; - } - - @Override - public void setShareeUserId (final Long shareeUserId) { - this.shareeUserId = shareeUserId; - } - - @PostConstruct - public void init () { - } - - @Override - public boolean isShareeUserIdEmpty () { - return (!this.isShareeUserIdSet()); - } - - @Override - public boolean isShareeUserIdSet () { - return ((this.getShareeUserId() instanceof Long) && (this.getShareeUserId() > 0)); - } - - @Override - public boolean isSharingAddressbooks () { - // Only to be called for logged-in users - if (!this.loginController.isUserLoggedIn()) { - // Not logged in - throw new FaceletException("This method can only be called as logged-in user."); //NOI18N - } else if (this.isUserSharing instanceof Boolean) { - // Return cached value - return this.isUserSharing; - } - - // Call the proper bean - this.isUserSharing = this.shareBean.isUserSharingAddressbooks(this.loginController.getLoggedInUser()); - - // Return it - return this.isUserSharing; - } - - @Override - public String startSharing (final User user, final Addressbook addressbook) { - // Check conditions - if (!this.loginController.isUserLoggedIn()) { - // No, then throw exception - throw new FaceletException("This method can only be called as logged-in user."); //NOI18N - } else if (null == user) { - // Throw NPE - 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) { - // Invalid id number - throw new IllegalStateException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N - } else if (Objects.equals(user, this.loginController.getLoggedInUser())) { - // Sharing with yourself! - throw new IllegalStateException("User tries to share with himself."); //NOI18N - } else if (null == addressbook) { - // Throw NPE again - throw new NullPointerException("addressbook is null"); //NOI18N - } else if (addressbook.getAddressbookId() == null) { - // Throw NPE again - throw new NullPointerException("addressbook.addressbookId is null"); //NOI18N - } else if (addressbook.getAddressbookId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("addressbook.addressbookId={0} is invalid.", addressbook.getAddressbookId())); //NOI18N - } else if (!Objects.equals(addressbook.getAddressbookUser(), this.loginController.getLoggedInUser())) { - // Not the same user! - throw new IllegalStateException(MessageFormat.format("Address book id {0} owner id {1} mismatching logged-in user id {2}", addressbook.getAddressbookId(), addressbook.getAddressbookUser().getUserId(), this.loginController.getLoggedInUser().getUserId())); //NOI18N - } else if (this.loginController.getLoggedInUser().getUserProfileMode() == ProfileMode.INVISIBLE) { - // User is invisible - throw new FaceletException(MessageFormat.format("user {0} is invisible and cannot start sharing address books.", this.loginController.getLoggedInUser().getUserId())); //NOI18N - } else if (user.getUserProfileMode() == ProfileMode.INVISIBLE) { - // User is invisible - throw new FaceletException(MessageFormat.format("user {0} is invisible and cannot be selected for sharing.", user.getUserId())); //NOI18N - } - - try { - // Init sharing - ShareableAddressbook shared = this.shareBean.startSharing(user, addressbook); - - // TODO Set it here - this.setShare(shared); - - /// Trigger event - this.sharingEvent.fire(new StartedAddressbookSharingEvent(shared)); - } catch (final UserAlreadySharingAddressbookException ex) { - // Throw again - throw new FaceletException(ex); - } - - // TODO Unfinished - return null; - } - - /** - * Validates given event for all values and throws exceptions - *

- * @param event Event to validate - */ - private void validateEvent (final AddressbookSharingEvent event) { - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getSharingType() == null) { - // Throw NPE - throw new NullPointerException("event.sharingType is null"); //NOI18N - } else if (event.getShareableAddressbook() == null) { - // Throw NPE again - throw new NullPointerException("event.shareableAddressbook is null"); //NOI18N - } else if (event.getShareableAddressbook().getShareId() == null) { - // Throw NPE again - throw new NullPointerException("event.shareableAddressbook.shareId is null"); //NOI18N - } else if (event.getShareableAddressbook().getShareId() < 1) { - // Throw NPE again - throw new IllegalArgumentException(MessageFormat.format("event.shareableAddressbook.shareId={0} is invalid", event.getShareableAddressbook().getShareId())); //NOI18N - } else if (event.getShareableAddressbook().getShareAddressbook() == null) { - // Throw NPE again - throw new NullPointerException("event.shareableAddressbook.shareAddressbook is null"); //NOI18N - } else if (event.getShareableAddressbook().getShareAddressbook().getAddressbookId() == null) { - // Throw NPE again - throw new NullPointerException("event.shareableAddressbook.shareAddressbook.addressbookId is null"); //NOI18N - } else if (event.getShareableAddressbook().getShareAddressbook().getAddressbookId() < 1) { - // Throw NPE again - throw new IllegalArgumentException(MessageFormat.format("event.shareableAddressbook.shareAddressbook.addressbookId={0} is invalid", event.getShareableAddressbook().getShareAddressbook().getAddressbookId())); //NOI18N - } else if (event.getShareableAddressbook().getShareUserOwner() == null) { - // Throw NPE again - throw new NullPointerException("event.shareableAddressbook.shareUserOwner is null"); //NOI18N - } else if (event.getShareableAddressbook().getShareUserOwner().getUserId() == null) { - // Throw NPE again - throw new NullPointerException("event.shareableAddressbook.shareUserOwner.userId is null"); //NOI18N - } else if (event.getShareableAddressbook().getShareUserOwner().getUserId() < 1) { - // Throw NPE again - throw new IllegalArgumentException(MessageFormat.format("event.shareableAddressbook.shareUserOwner.userId={0} is invalid", event.getShareableAddressbook().getShareUserOwner().getUserId())); //NOI18N - } else if (event.getShareableAddressbook().getShareUserSharee() == null) { - // Throw NPE again - throw new NullPointerException("event.shareableAddressbook.shareUserSharee is null"); //NOI18N - } else if (event.getShareableAddressbook().getShareUserSharee().getUserId() == null) { - // Throw NPE again - throw new NullPointerException("event.shareableAddressbook.shareUserSharee.userId is null"); //NOI18N - } else if (event.getShareableAddressbook().getShareUserSharee().getUserId() < 1) { - // Throw NPE again - throw new IllegalArgumentException(MessageFormat.format("event.shareableAddressbook.shareUserSharee.userId={0} is invalid", event.getShareableAddressbook().getShareUserOwner().getUserId())); //NOI18N - } - } -} diff --git a/src/java/org/mxchange/jjobs/beans/shares/SharesWebSessionController.java b/src/java/org/mxchange/jjobs/beans/shares/SharesWebSessionController.java deleted file mode 100644 index 0fb27e75..00000000 --- a/src/java/org/mxchange/jjobs/beans/shares/SharesWebSessionController.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.jjobs.beans.shares; - -import java.io.Serializable; -import java.util.List; -import org.mxchange.addressbook.events.sharing.AddressbookSharingEvent; -import org.mxchange.addressbook.model.addressbook.Addressbook; -import org.mxchange.addressbook.model.addressbook.shared.ShareableAddressbook; -import org.mxchange.jusercore.events.login.UserLoggedInEvent; -import org.mxchange.jusercore.model.user.User; - -/** - * Controller interface sharing address books - *

- * @author Roland Haeder - */ -public interface SharesWebSessionController extends Serializable { - - /** - * Observer method for ended sharing events - *

- * @param event Event instance - */ - void afterAdressbookShareEnded (final AddressbookSharingEvent event); - - /** - * Observer method for started sharing events - *

- * @param event Event instance - */ - void afterAdressbookShareStarted (final AddressbookSharingEvent event); - - /** - * This method is called when a user has successfully logged in his/her - * account. - *

- * @param event - */ - void afterLoginEvent (final UserLoggedInEvent event); - - /** - * Returns a list of all address books the user is sharing with others. - *

- * @return List of all shared address books - */ - List allShares (); - - /** - * Getter for share instance - *

- * @return Share instance - */ - ShareableAddressbook getShare (); - - /** - * Setter for share instance - *

- * @param share Share instance - */ - void setShare (final ShareableAddressbook share); - - /** - * Getter for sharee's user id - *

- * @return Sharee's user id - */ - Long getShareeUserId (); - - /** - * Setter for sharee's user id - *

- * @param shareeUserId Sharee's user id - */ - void setShareeUserId (final Long shareeUserId); - - /** - * Checks if the sharee's user id is empty. - *

- * @return Whether the sharee's user id is empty. - */ - boolean isShareeUserIdEmpty (); - - /** - * Checks whether the sharee's user id is set - *

- * @return Whether the sharee's user id is set - */ - boolean isShareeUserIdSet (); - - /** - * Checks wether the current user is sharing address books with others - *

- * @return Whether the current user is sharing address books - */ - boolean isSharingAddressbooks (); - - /** - * Starts an address book share between currently logged-in user and - * assigned user for current address book. - *

- * @param user User instance - * @param addressbook Address book instance - * @return Redirect target - */ - String startSharing (final User user, final Addressbook addressbook); -} diff --git a/src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java index 65f17ca2..69d87e1f 100644 --- a/src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java @@ -32,11 +32,11 @@ import javax.inject.Named; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; -import org.mxchange.jjobs.beans.login.UserLoginWebSessionController; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.UserContact; import org.mxchange.jcontacts.contact.gender.Gender; import org.mxchange.jcountry.data.Country; +import org.mxchange.jjobs.beans.login.UserLoginWebSessionController; import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber; import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; @@ -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,33 +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) { // Trace message @@ -313,6 +286,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 @@ -720,6 +720,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 +863,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/jjobs/converter/country/CountryConverter.java b/src/java/org/mxchange/jjobs/converter/country/CountryConverter.java index d76e38ce..72d37ab3 100644 --- a/src/java/org/mxchange/jjobs/converter/country/CountryConverter.java +++ b/src/java/org/mxchange/jjobs/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/jjobs/converter/smsprovider/SmsProviderConverter.java b/src/java/org/mxchange/jjobs/converter/smsprovider/SmsProviderConverter.java index 5022e001..806e01b8 100644 --- a/src/java/org/mxchange/jjobs/converter/smsprovider/SmsProviderConverter.java +++ b/src/java/org/mxchange/jjobs/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/jjobs/converter/user/UserConverter.java b/src/java/org/mxchange/jjobs/converter/user/UserConverter.java index 546d9dcf..eb0fb090 100644 --- a/src/java/org/mxchange/jjobs/converter/user/UserConverter.java +++ b/src/java/org/mxchange/jjobs/converter/user/UserConverter.java @@ -26,9 +26,9 @@ import javax.inject.Inject; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; -import org.mxchange.jjobs.beans.user.UserWebSessionController; import org.mxchange.jcoreeelogger.beans.local.logger.Log; import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; +import org.mxchange.jjobs.beans.user.UserWebSessionController; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.model.user.User; @@ -52,6 +52,26 @@ public class UserConverter implements Converter { @Inject private UserWebSessionController userController; + /** + * Constructor 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 @@ -110,24 +130,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 - } - } } diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 927bc276..8d13f8bc 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -129,8 +129,6 @@ LINK_LOGIN_LOGOUT=Ausloggen LINK_LOGIN_OWN_ADDRESSBOOKS=Meine Adressb\u00fccher LINK_LOGIN_LOGOUT_TITLE=Aus dem Benutzerbereich ausloggen LINK_LOGIN_OWN_ADDRESSBOOKS_TITLE=Meine eigenen Adressb\u00fccher verwalten -LINK_LOGIN_OTHER_ADDRESSBOOKS=Mit mir geteilt -LINK_LOGIN_OTHER_ADDRESSBOOKS_TITLE=Von anderen Benutzern freigegebene Adressb\u00fccher MENU_ADDRESSBOOKS_TITLE=Adressb\u00fccher verwalten PAGE_TITLE_LOGIN_OWN_ADDRESSBOOKS=Meine Adressb\u00fccher verwalten CONTENT_TITLE_LOGIN_OWN_ADDRESSBOOKS=Verwalten Sie Ihre eigenen Adressb\u00fccher: @@ -190,14 +188,6 @@ PARAMETER_ADDRESSBOOK_ID_INVALID=Id-Nummer f\u00fcr Adressbuch ung\u00fcltig. Bi ENTERED_HOUSE_NUMBER_INVALID=Die eingegebene Hausnummer ist ung\u00fcltig. ENTERED_ZIP_CODE_INVALID=Die eingegebene Postleitzahl ist ung\u00fcltig. PARAMETER_ADDRESSBOOK_ID_NOT_FOUND=Der angeklickte Link ist nicht mehr g\u00fcltig: Adressbuch mit der Id-Nummer nicht gefunden. -LINK_LOGIN_SHARED_ADDRESS_BOOKS=Mit anderen geteilt -LINK_LOGIN_SHARED_ADDRESS_BOOKS_TITLE=Mit anderen Benutzern geteilte Adressb\u00fccher -PAGE_TITLE_LOGIN_SHARED_ADDRESSBOOKS=Mit anderen geteilte Adressb\u00fccher -CONTENT_TITLE_LOGIN_SHARED_ADDRESSBOOKS=Meine mit anderen Benutzern geteilte Adressb\u00fccher: -LINK_LOGIN_START_SHARING_ADDRESSBOOKS=Jetzt Ihre Adressb\u00fccher mit anderen Mitgliedern teilen! -LOGIN_TABLE_HEADER_SHARED_ADDRESSBOOKS=Meine mit anderen Benutzern geteilte Adressb\u00fccher -TABLE_SUMMARY_LOGIN_SHARED_ADDRESSBOOKS=Diese Tabelle listed alle von Ihnen mit anderen Benutzern geteilte Adressb\u00fccher auf. -LOGIN_USER_HAS_NOT_SHARED_ADDRESSBOOKS=Derzeit teilen Sie keine Adressb\u00fccher mit anderen Benutzern. TABLE_HEADER_USER_LIST=Alle Benutzer auflisten TABLE_SUMMARY_USER_LIST=Diese Tabelle listet alle registrierten Benutzer aus, mit denen Sie Ihre Adressb\u00fccher teilen k\u00f6nnen. USER_PROFILE_LEGEND=\u00d6ffentlich einsehbares Profil: @@ -211,40 +201,18 @@ USER_ID=Benutzernummer: USER_NAME=Benutzername: USER_CREATED=Beigetreten: USER_CREATED_TITLE=Wann der Benutzer dieser Community beigetreten ist. -USER_LIST_SHARING_ADDRESSBOOKS=Freigegebene Adressb\u00fccher: -LINK_LOGIN_LIST_SHARING_ADDRESSBOOKS=Auflisten -LINK_LOGIN_LIST_SHARING_ADDRESSBOOKS_TITLE=Listet alle mit dem Benutzer geteilte Adressb\u00fccher auf. PAGE_TITLE_INDEX_USER_PROFILE=Benutzerprofil CONTENT_TITLE_INDEX_USER_PROFILE=\u00d6ffentliches Profil des Benutzers: -PAGE_TITLE_LOGIN_LIST_SHARING_ADDRESSBOOKS=Mit einem Benutzer geteilte Adressb\u00fccher -CONTENT_TITLE_LOGIN_LIST_SHARING_ADDRESSBOOKS=Mit einem Benutzer geteilte Adressb\u00fccher auflisten: PARAMETER_USER_ID_MISSING=Benutzernummer nicht angegeben. PARAMETER_USER_ID_INVALID=Der angeklickte Link ist nicht mehr g\u00fcltig: Den Benutzer mit der Id-Nummer existiert nicht (mehr). PARAMETER_USER_ID_NOT_FOUND=Benutzeraccount mit der Id-Nummer nicht gefunden. TABLE_HEADER_ERROR_HANDLING_USER_ID=Fehler beim Verarbeiten der Benutzernummer: TABLE_HEADER_SHOW_ADDRESSBOOK=Adressbuchdaten: -LINK_LOGIN_START_SHARING_ADDRESSBOOK=Mit jemandem dieses Adressbuch teilen -LINK_LOGIN_START_SHARING_ADDRESSBOOK_TITLE=Dieses Adresssbuch k\u00f6nnen Sie mit einem anderen Benutzer teilen. Dadurch kann er Ihre Kontakte sehen. -PAGE_TITLE_LOGIN_START_SHARING_ADDRESSBOOK=Das Adressbuch mit anderen Benutzern teilen -CONTENT_TITLE_LOGIN_START_SHARING_ADDRESSBOOK=Teilen Sie dieses Adressbuch mit anderen Benutzern: -LOGIN_START_SHARING_TITLE=Teilen -LOGIN_START_SHARING_BUTTON=Mit diesem Benutzer teilen -LOGIN_START_SHARING_BUTTON_TITLE=Teilen Sie Ihr ausgew\u00e4hltes Adressbuch mit diesem Benutzer. -TABLE_HEADER_CHOOSE_USER_FOR_SHARING=W\u00e4hlen Sie einen Benutzer zum Teilen Ihres Adressbuches aus. -LOGIN_START_SHARING_NOTICE1=Damit werden Ihr gesamtes Adressbuch fuer den ausgewaehlten Benutzer sichtbar. -LOGIN_START_SHARING_NOTICE2=Sie k\u00f6nnen dies jederzeit wiederrufen. LINK_USER_PROFILE=Zum Benutzerprofil LINK_USER_PROFILE_TITLE=Das Benutzerprofil in einem neuen Fenster aufrufen. -LINK_LOGIN_START_SHARING_ADDRESSBOOKS_TITLE=Teilen Sie Ihre Adressb\u00fccher mit anderen Benutzern. Sie k\u00f6nnen den Schritt jederzeit zur\u00fccknehmen. ADDRESSBOOK_STATUS_UNLOCKED=Freigegeben ADDRESSBOOK_STATUS_LOCKED=Gesperrt ADDRESSBOOK_STATUS_TITLE=Status des Adressbuches -SHARED_ADDRESSBOOK=Adressbuch: -SHAREE_USER_NAME=Geteilt mit: -SHARE_CREATED=Wann gestartet: -SHARE_CREATED_TITLE=Wann die Freigabe erfolgte -SHARED_ADDRESSBOOK_TITLE=Welches Adressbuch freigegeben wurde -SHAREE_USER_NAME_TITLE=Mit wem Sie Ihr Adressbuch teilen ADDRESSBOOK_OWNER=Besitzer: ADDRESSBOOK_STATUS=Status: PAGE_TITLE_INDEX_SHOW_ADDRESSBOOK=\u00d6ffentlicher Teil des Adressbuchs anzeigen diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 0fa1830c..8553c945 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -129,8 +129,6 @@ LINK_LOGIN_LOGOUT=Logout LINK_LOGIN_OWN_ADDRESSBOOKS=My address books LINK_LOGIN_LOGOUT_TITLE=Logout from user area LINK_LOGIN_OWN_ADDRESSBOOKS_TITLE=Manage my own address books -LINK_LOGIN_OTHER_ADDRESSBOOKS=Shared with me -LINK_LOGIN_OTHER_ADDRESSBOOKS_TITLE=From other users shared address books MENU_ADDRESSBOOKS_TITLE=Manage address books PAGE_TITLE_LOGIN_OWN_ADDRESSBOOKS=Manage my address books CONTENT_TITLE_LOGIN_OWN_ADDRESSBOOKS=Manage your own address books: @@ -190,14 +188,6 @@ PARAMETER_ADDRESSBOOK_ID_INVALID=Id number for address book invalid. Please cont ENTERED_HOUSE_NUMBER_INVALID=The entered house number is invalid. ENTERED_ZIP_CODE_INVALID=The entered ZIP code is invalid. PARAMETER_ADDRESSBOOK_ID_NOT_FOUND=The clicked link is no longer valid: Address book with entered id number does not exist (anymore). -LINK_LOGIN_SHARED_ADDRESS_BOOKS=Shared with others -LINK_LOGIN_SHARED_ADDRESS_BOOKS_TITLE=With other users shared address books -PAGE_TITLE_LOGIN_SHARED_ADDRESSBOOKS=With others shared address books -CONTENT_TITLE_LOGIN_SHARED_ADDRESSBOOKS=Mine with other users shared address books: -LINK_LOGIN_START_SHARING_ADDRESSBOOKS=Start now sharing your address books with other users! -LOGIN_TABLE_HEADER_SHARED_ADDRESSBOOKS=My with other users shared address books -TABLE_SUMMARY_LOGIN_SHARED_ADDRESSBOOKS=This table lists all your with other users shared address books. -LOGIN_USER_HAS_NOT_SHARED_ADDRESSBOOKS=Currently you don't share any address books with other users. TABLE_HEADER_USER_LIST=List all users TABLE_SUMMARY_USER_LIST=This table lists all registered users you can share your address books with. USER_PROFILE_LEGEND=Publicly visible profile: @@ -210,40 +200,18 @@ USER_ID=User id: USER_NAME=User name: USER_CREATED=Joined: USER_CREATED_TITLE=When the user has joined this community. -USER_LIST_SHARING_ADDRESSBOOKS=Shared address books: -LINK_LOGIN_LIST_SHARING_ADDRESSBOOKS=List -LINK_LOGIN_LIST_SHARING_ADDRESSBOOKS_TITLE=Lists all with this user shared address books. PAGE_TITLE_INDEX_USER_PROFILE=User profile CONTENT_TITLE_INDEX_USER_PROFILE=Public profile of the user: -PAGE_TITLE_LOGIN_LIST_SHARING_ADDRESSBOOKS=With a user shared address books -CONTENT_TITLE_LOGIN_LIST_SHARING_ADDRESSBOOKS=List with a user shared address books: PARAMETER_USER_ID_MISSING=No user id number provided PARAMETER_USER_ID_INVALID=The clicked link is no longer valid: The user with provided id number does not exist (anymore). PARAMETER_USER_ID_NOT_FOUND=User account with given id number not found. TABLE_HEADER_ERROR_HANDLING_USER_ID=Error while handling user id: TABLE_HEADER_SHOW_ADDRESSBOOK=Address book data: -LINK_LOGIN_START_SHARING_ADDRESSBOOK=Start sharing this address book with another user -LINK_LOGIN_START_SHARING_ADDRESSBOOK_TITLE=You can start sharing this address book with anther user. Then he cann see your contacts. -PAGE_TITLE_LOGIN_START_SHARING_ADDRESSBOOK=Share the address book with other users -CONTENT_TITLE_LOGIN_START_SHARING_ADDRESSBOOK=Start sharing this address book with other users: -LOGIN_START_SHARING_TITLE=Share -LOGIN_START_SHARING_BUTTON=Share with this user -LOGIN_START_SHARING_BUTTON_TITLE=Share your choosen address book with this user. -TABLE_HEADER_CHOOSE_USER_FOR_SHARING=Choose a user for sharing your address book with. -LOGIN_START_SHARING_NOTICE1=With this your whole address book becomes visible to the other user. -LOGIN_START_SHARING_NOTICE2=You can always revoke your choice. LINK_USER_PROFILE=To user profile LINK_USER_PROFILE_TITLE=Open the user profile in a new window. -LINK_LOGIN_START_SHARING_ADDRESSBOOKS_TITLE=Start sharing your address books with other users. You can always revoke your decission. ADDRESSBOOK_STATUS_UNLOCKED=Unlocked ADDRESSBOOK_STATUS_LOCKED=Locked ADDRESSBOOK_STATUS_TITLE=Status of the address book -SHARED_ADDRESSBOOK=Address book: -SHAREE_USER_NAME=Shared with: -SHARE_CREATED=Started: -SHARE_CREATED_TITLE=When the sharing has started. -SHARED_ADDRESSBOOK_TITLE=Which address book is being shared -SHAREE_USER_NAME_TITLE=With who you shared your address book ADDRESSBOOK_OWNER=Owner: ADDRESSBOOK_STATUS=Status: PAGE_TITLE_INDEX_SHOW_ADDRESSBOOK=Show public part of address book diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index 9dbe1025..71d40e20 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -87,10 +87,6 @@ login_own_addressbooks /login/login_own_addressbooks.xhtml - - login_other_addressbooks - /login/login_other_addressbooks.xhtml - user_list /user/user_list.xhtml @@ -107,10 +103,6 @@ login_edit_user_data /login/login_edit_user_data.xhtml - - login_shared_addressbooks - /login/login_shared_addressbooks.xhtml - user_profile /user/user_profile.xhtml @@ -152,25 +144,4 @@ /user/show_addressbook_entries.xhtml - - /user/user_list.xhtml - - login_list_sharing_addressbooks - /login/login_list_sharing_addressbooks.xhtml - - - - /user/show_addressbook.xhtml - - login_start_sharing_addressbook - /login/login_start_sharing_addressbook.xhtml - - - - /login/login_shared_addressbooks.xhtml - - user_show_addressbook - /user/show_addressbook.xhtml - - diff --git a/web/WEB-INF/templates/login/login_menu.tpl b/web/WEB-INF/templates/login/login_menu.tpl index c655637a..e9ada820 100644 --- a/web/WEB-INF/templates/login/login_menu.tpl +++ b/web/WEB-INF/templates/login/login_menu.tpl @@ -41,12 +41,6 @@

  • -
  • - -
  • -
  • - -
  • -- 2.39.5