From: Roland Haeder Date: Wed, 14 Oct 2015 10:07:01 +0000 (+0200) Subject: added flag for public user profiles + named query for search such profiles X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4d4e931b562965ddca515655542b9405f0d5c3d2;p=juser-core.git added flag for public user profiles + named query for search such profiles Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jusercore/model/user/LoginUser.java b/src/org/mxchange/jusercore/model/user/LoginUser.java index 194ce03..4995ee7 100644 --- a/src/org/mxchange/jusercore/model/user/LoginUser.java +++ b/src/org/mxchange/jusercore/model/user/LoginUser.java @@ -65,7 +65,8 @@ import org.mxchange.jusercore.model.user.status.UserAccountStatus; @NamedQuery (name = "AllUserNames", query = "SELECT DISTINCT u.userName FROM users AS u ORDER BY u.userId ASC"), @NamedQuery (name = "AllEmailAddresses", query = "SELECT DISTINCT c.contactEmailAddress FROM contacts AS c ORDER BY c.contactId ASC"), @NamedQuery (name = "SearchUserName", query = "SELECT u FROM users AS u WHERE LOWER(u.userName) LIKE LOWER(:param)"), - @NamedQuery (name = "SearchEmailAddress", query = "SELECT u FROM users AS u INNER JOIN contacts AS c ON u.userContact = c WHERE LOWER(c.contactEmailAddress) LIKE LOWER(:param)") + @NamedQuery (name = "SearchEmailAddress", query = "SELECT u FROM users AS u INNER JOIN contacts AS c ON u.userContact = c WHERE LOWER(c.contactEmailAddress) LIKE LOWER(:param)"), + @NamedQuery (name = "AllPublicUsers", query = "SELECT u FROM users AS u WHERE u.userAccountStatus LIKE 'CONFIRMED' AND u.userPublicProfile = TRUE") } ) public class LoginUser implements User { @@ -131,10 +132,21 @@ public class LoginUser implements User { @Column (name = "user_name", nullable = false, length = 20) private String userName; + /** + * Whether the user wants a public profile. This means that it can be viewed + * from the Internet by everyone (only profile, no personal data, this needs + * explicit agreement) and it can be found for sharing addresses with. + */ + @Basic (optional = false) + @Column (name = "user_public_profile_flag", nullable = false) + private Boolean userPublicProfile; + /** * Default constructor */ public LoginUser () { + // Default is not public + this.userPublicProfile = Boolean.FALSE; } @Override @@ -246,6 +258,16 @@ public class LoginUser implements User { this.userName = userName; } + @Override + public Boolean getUserPublicProfile () { + return this.userPublicProfile; + } + + @Override + public void setUserPublicProfile (final Boolean userPublicProfile) { + this.userPublicProfile = userPublicProfile; + } + @Override public int hashCode () { int hash = 5; diff --git a/src/org/mxchange/jusercore/model/user/User.java b/src/org/mxchange/jusercore/model/user/User.java index 8c3b1a0..236d8d1 100644 --- a/src/org/mxchange/jusercore/model/user/User.java +++ b/src/org/mxchange/jusercore/model/user/User.java @@ -147,6 +147,20 @@ public interface User extends Serializable { */ public void setUserName (final String customerNumber); + /** + * Getter for public user profile flag + *

+ * @return Whether the user has a public profile + */ + public Boolean getUserPublicProfile (); + + /** + * Setter for public user profile flag + *

+ * @param userPublicProfile Whether the user has a public profile + */ + public void setUserPublicProfile (final Boolean userPublicProfile); + /** * Checks if object is a User instance and whether it matches with this * object.