From: Roland Haeder Date: Fri, 30 Oct 2015 14:52:48 +0000 (+0100) Subject: Why is this stupid JSF so complex? Why can't things be done more easier? X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=481c13616a7798636b1e11c38e2c3c8cddc8a8b2;p=addressbook-war.git Why is this stupid JSF so complex? Why can't things be done more easier? --- diff --git a/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebRequestBean.java index 0bc3169b..28e41b14 100644 --- a/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebRequestBean.java @@ -131,4 +131,25 @@ public class UserProfileWebRequestBean implements UserProfileWebRequestControlle // Ask other method return this.isProfileLinkVisible(); } + + @Override + public boolean isProfileLinkVisibleByUser (final User user) { + // Is it correctly set? + if (null == user) { + // Throw NPE + throw new NullPointerException("user is null"); + } else if (user.getUserId() == null) { + // Throw NPE again + throw new NullPointerException("user.userId is null"); + } else if (user.getUserId() < 1) { + // Invalid user id set + throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid.", user.getUserId())); + } + + // Set user here + this.setUser(user); + + // Ask other method + return this.isProfileLinkVisible(); + } } diff --git a/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebRequestController.java b/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebRequestController.java index 12e04ebd..dd7a3ac5 100644 --- a/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebRequestController.java @@ -42,6 +42,15 @@ public interface UserProfileWebRequestController extends Serializable { */ boolean isProfileLinkVisibleById (final Long userId); + /** + * Checks if given user's profile is visible + *

+ * @param user User instance to check + *

+ * @return Whether the user's profile is visible + */ + boolean isProfileLinkVisibleByUser (final User user); + /** * Getter for user instance *

diff --git a/web/login/login_start_sharing_addressbook.xhtml b/web/login/login_start_sharing_addressbook.xhtml index ac7c368a..f86110d8 100644 --- a/web/login/login_start_sharing_addressbook.xhtml +++ b/web/login/login_start_sharing_addressbook.xhtml @@ -24,7 +24,6 @@ - #{msg.USER_ID} @@ -38,7 +37,7 @@ #{msg.LOGIN_START_SHARING_TITLE} - +