]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 17:12:21 +0000 (19:12 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 17:12:21 +0000 (19:12 +0200)
- 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
lib/juser-lib.jar
src/java/org/mxchange/addressbook/beans/user/UserWebBean.java
src/java/org/mxchange/addressbook/beans/user/UserWebController.java
web/user/user_list.xhtml

index ff5b3c74e1c64d288b59fb88e1e3974250580b90..703a0b80f39f09238c27db8637f60068503db2d3 100644 (file)
Binary files a/lib/juser-core.jar and b/lib/juser-core.jar differ
index d4090c07c6c9e68d9d9a618e907e727b32c0f76a..b7bd137e9dfbcca350fcb893ea38f9753e0544cc 100644 (file)
Binary files a/lib/juser-lib.jar and b/lib/juser-lib.jar differ
index 97cdd0a01a882eabc11bbcae9798be37b7f1ef19..4aa9d47d46daa92cf97feaa3f2d4786dddb7855e 100644 (file)
@@ -26,10 +26,12 @@ import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Observes;
 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.beans.login.UserLoginWebController;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.UserContact;
 import org.mxchange.jcontacts.contact.gender.Gender;
@@ -157,11 +159,6 @@ public class UserWebBean implements UserWebController {
         */
        private Long phoneNumber;
 
-       /**
-        * A list of all public user profiles
-        */
-       private List<User> publicUserList;
-
        /**
         * Street
         */
@@ -207,6 +204,17 @@ public class UserWebBean implements UserWebController {
         */
        private Integer zipCode;
 
+       /**
+        * A list of all public user profiles
+        */
+       private List<User> 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<User> allPublicUsers () {
+       public List<User> 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   }
         * <p>
         * @param user User instance
         */
index a0bf8d597192c487208536443b4ee178017204ec..9a71ae45a2762a0a7b5b3b2818d34f6b2b76fd57 100644 (file)
@@ -33,12 +33,19 @@ import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
  */
 public interface UserWebController extends Serializable {
 
+       /**
+        * Event observer for new user registrations
+        * <p>
+        * @param event User registration event
+        */
+       void afterRegistrationEvent (final UserRegisteredEvent event);
+
        /**
         * All public user profiles
         * <p>
         * @return A list of all public user profiles
         */
-       List<User> allPublicUsers ();
+       List<User> 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
         * <p>
-        * @return the zipCode
+        * @return User profile mode
         */
-       Integer getZipCode ();
+       ProfileMode getUserProfileMode ();
 
        /**
-        * ZIP code
+        * Setter for user profile mode
         * <p>
-        * @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
         * <p>
-        * @return User profile mode
+        * @return the zipCode
         */
-       ProfileMode getUserProfileMode ();
+       Integer getZipCode ();
 
        /**
-        * Setter for user profile mode
+        * ZIP code
         * <p>
-        * @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 {
         * <p>
         * @return Whether at least one user has a public profile
         */
-       boolean isPublicUserRegistered ();
-
-       /**
-        * Event observer for new user registrations
-        * <p>
-        * @param event User registration event
-        */
-       void afterRegistrationEvent (final UserRegisteredEvent event);
+       boolean isVisibleUserFound ();
 }
index 9b32294a82d12fc690e177853a40026348b2c215..286620b93850cd38654444194b3d35b0f16accf3 100644 (file)
@@ -19,7 +19,7 @@
                                        #{msg.TABLE_HEADER_USER_LIST}
                                </div>
 
-                               <h:dataTable id="userList" var="user" value="#{userController.allPublicUsers()}" headerClass="table_header_column25" summary="#{msg.TABLE_SUMMARY_USER_LIST}" rendered="#{userController.isPublicUserRegistered()}">
+                               <h:dataTable id="userList" var="user" value="#{userController.allVisibleUsers()}" headerClass="table_header_column25" summary="#{msg.TABLE_SUMMARY_USER_LIST}" rendered="#{userController.isVisibleUserFound()}">
                                        <h:column>
                                                <f:facet name="header">#{msg.USER_ID}</f:facet>
                                                <ui:include id="userProfileLink" src="/WEB-INF/templates/generic/user_profile_link.tpl">