From 4d4e931b562965ddca515655542b9405f0d5c3d2 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 14 Oct 2015 12:07:01 +0200 Subject: [PATCH] =?utf8?q?added=20flag=20for=20public=20user=20profiles=20?= =?utf8?q?+=20named=20query=20for=20search=20such=20profiles=20Signed-off-?= =?utf8?q?by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../jusercore/model/user/LoginUser.java | 24 ++++++++++++++++++- .../mxchange/jusercore/model/user/User.java | 14 +++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) 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. -- 2.39.5