From 016479b464899f3bfd00e264a5f335c7eb1f342a Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 16 Oct 2015 19:12:21 +0200 Subject: [PATCH] Continued: - sorted members - now that there are member-visible users the public user list doesn't fit to naming convention -> renamed - injected login controller for checking if the user is logged-in - for this the new business method allMemberPublicVisibleUsers() is called - updated jar(s) --- lib/juser-core.jar | Bin 28474 -> 28664 bytes lib/juser-lib.jar | Bin 3987 -> 4033 bytes .../addressbook/beans/user/UserWebBean.java | 47 +++++++++++------- .../beans/user/UserWebController.java | 42 ++++++++-------- web/user/user_list.xhtml | 2 +- 5 files changed, 52 insertions(+), 39 deletions(-) diff --git a/lib/juser-core.jar b/lib/juser-core.jar index ff5b3c74e1c64d288b59fb88e1e3974250580b90..703a0b80f39f09238c27db8637f60068503db2d3 100644 GIT binary patch delta 1288 zcmZvcZA@EL7{~wT-rg2U5jJ6fu;sE5*E(5YFWDe;wv@JX1Y{%Nlo1%TFreKE1dU6U zg{U9=U<@8JI}_)S?j=$8V!M4HCh7#8#2{{iZA|x~iNa!xFVW242hVeABpREX=Xamq z`QP*5??|F}^$(&sVVo^bvWUKy?%>B5gNAjt)XC%|sT~Z%76|MJaFFe8$ zc|anM-(Bxq`IQ-Ka4r?^A)boWNSH-ApN1?d7kIUOQxP>6Nq)G`F7gVNc?@JRdn{b8q8LjbO?eA)AB0jSDvXMo2VTI0LttcON1G=lh&5-2^g=&N0_F#YgV0);$qfzV)FdX{(#f@Hnoo+3U$h}AP^015! z*#7@G3tG`;!c_}q&|<-ED$nA83A22@!mVDzb$)l1EyaWz7W80_w>nDM&G@jxpr#&% z0a2vk2tVq4Zsk#AU<7%1OI*SziV?#W9ES@hP=k|vo9j^C+amuCj5v*DID-epmF6M= z8_x4tS34WyL*8s&S83HgfQAqGIZqCMrP9vErN1WpXTncPpYOJ_De2qXR_%)LSEY{$ ze_i?o;lCFCmh{C{cJ__*{Z&@&d*SD$zaab%(k}}Cv+%!2|CqEhyw&MhP*^rH*a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6bRYsxJLFsIlbQr5x1=&?^5h!I=}y7ces+7kG0TF=VB$iT+Hz`(@7&cevR$pCaVkmhDUi1PsXyl8wr27a(Q0R}-ZEd-*0W(b2x z5e88p%?31CjDaD*n~_O`85SA=?m!th;AEJ5l^Ya1lXx6JVd2DM0HR8GEJ4(I9%m5s qg~t;VB=)@iAZh|{5Quuh>j$Dt`0_#2Qoc&`;L+hvWP8dDvIzjLOi&L1 delta 342 zcmX>oKUtn9z?+$ci-CcIf#Lnsi9DK2@1{;PU%&)p-&6pRzcqp6WHm-(5Ead638JPk z+JmU;j7}g*n#m4GZH{K*V+PULtQ^dI@23X1hou`G{>;R{@R@0HBZrTeBs+r`JA*ho zg9IZ3Ut&&9KxtA=X7c0@9O;`gIN6vO*(c|7i^g*@Ft9K(a51nlFfy<)FfcGNa0B@~ zXnbA>%g}|gRg9wmj1DYVpz!2cg$RxrH^Wfyq+?GHePS)db06D#Y z#{fhv;sJZ>E{`*ar^M?CqH=ltLDW9pAP^ publicUserList; - /** * Street */ @@ -207,6 +204,17 @@ public class UserWebBean implements UserWebController { */ private Integer zipCode; + /** + * A list of all public user profiles + */ + private List visibleUserList; + + /** + * Login bean (controller) + */ + @Inject + private UserLoginWebController loginController; + /** * Default constructor */ @@ -268,7 +276,7 @@ public class UserWebBean implements UserWebController { // Is the account public? if (registeredUser.getUserProfileMode().equals(ProfileMode.PUBLIC)) { // Also add it to this list - this.publicUserList.add(registeredUser); + this.visibleUserList.add(registeredUser); } // Trace message @@ -276,9 +284,9 @@ public class UserWebBean implements UserWebController { } @Override - public List allPublicUsers () { + public List allVisibleUsers () { // Return it - return Collections.unmodifiableList(this.publicUserList); + return Collections.unmodifiableList(this.visibleUserList); } @Override @@ -640,8 +648,14 @@ public class UserWebBean implements UserWebController { // Get full email address list for reducing EJB calls this.emailAddressList = this.userBean.getEmailAddressList(); - // Initialize user list - this.publicUserList = this.userBean.allPublicUsers(); + // Is the user logged-in? + if (this.loginController.isUserLoggedIn()) { + // Is logged-in, so load also users visible to memebers + this.visibleUserList = this.userBean.allMemberPublicVisibleUsers(); + } else { + // Initialize user list + this.visibleUserList = this.userBean.allPublicUsers(); + } } @Override @@ -649,11 +663,6 @@ public class UserWebBean implements UserWebController { return ((this.emailAddressList instanceof List) && (this.emailAddressList.contains(user.getUserContact().getContactEmailAddress()))); } - @Override - public boolean isPublicUserRegistered () { - return ((this.publicUserList instanceof List) && (this.publicUserList.size() > 0)); - } - @Override public boolean isRequiredPersonalDataSet () { return ((this.getUserName() != null) && @@ -686,10 +695,14 @@ public class UserWebBean implements UserWebController { return ((this.userNameList instanceof List) && (this.userNameList.contains(user.getUserName()))); } + @Override + public boolean isVisibleUserFound () { + return ((this.visibleUserList instanceof List) && (this.visibleUserList.size() > 0)); + } + /** * Adds user's name and email address to bean's internal list. It also - * updates the public user list if the user has decided to have a public - * profile on registration. + * updates the public user list if the user has decided to ha } *

* @param user User instance */ diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java index a0bf8d59..9a71ae45 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java @@ -33,12 +33,19 @@ import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; */ public interface UserWebController extends Serializable { + /** + * Event observer for new user registrations + *

+ * @param event User registration event + */ + void afterRegistrationEvent (final UserRegisteredEvent event); + /** * All public user profiles *

* @return A list of all public user profiles */ - List allPublicUsers (); + List allVisibleUsers (); /** * Creates an instance from all properties @@ -370,32 +377,32 @@ public interface UserWebController extends Serializable { void setUserPasswordRepeat (final String userPasswordRepeat); /** - * ZIP code + * Getter for user profile mode *

- * @return the zipCode + * @return User profile mode */ - Integer getZipCode (); + ProfileMode getUserProfileMode (); /** - * ZIP code + * Setter for user profile mode *

- * @param zipCode the zipCode to set + * @param userProfileMode User profile mode */ - void setZipCode (final Integer zipCode); + void setUserProfileMode (final ProfileMode userProfileMode); /** - * Getter for user profile mode + * ZIP code *

- * @return User profile mode + * @return the zipCode */ - ProfileMode getUserProfileMode (); + Integer getZipCode (); /** - * Setter for user profile mode + * ZIP code *

- * @param userProfileMode User profile mode + * @param zipCode the zipCode to set */ - void setUserProfileMode (final ProfileMode userProfileMode); + void setZipCode (final Integer zipCode); /** * Checks whether user instance's email address is used @@ -442,12 +449,5 @@ public interface UserWebController extends Serializable { *

* @return Whether at least one user has a public profile */ - boolean isPublicUserRegistered (); - - /** - * Event observer for new user registrations - *

- * @param event User registration event - */ - void afterRegistrationEvent (final UserRegisteredEvent event); + boolean isVisibleUserFound (); } diff --git a/web/user/user_list.xhtml b/web/user/user_list.xhtml index 9b32294a..286620b9 100644 --- a/web/user/user_list.xhtml +++ b/web/user/user_list.xhtml @@ -19,7 +19,7 @@ #{msg.TABLE_HEADER_USER_LIST} - + #{msg.USER_ID} -- 2.39.5