import javax.persistence.TemporalType;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.UserContact;
+import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
/**
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.
+ * Profile mode of this user
*/
@Basic (optional = false)
- @Column (name = "user_public_profile_flag", nullable = false)
- private Boolean userPublicProfile;
+ @Enumerated (EnumType.STRING)
+ @Column (name = "user_profile_mode", nullable = false)
+ private ProfileMode userProfileMode;
/**
* Default constructor
*/
public LoginUser () {
- // Default is not public
- this.userPublicProfile = Boolean.FALSE;
+ // Default is invisible
+ this.userProfileMode = ProfileMode.INVISIBLE;
}
@Override
final User other = (User) object;
- return ((Objects.equals(this.getUserName(), other.getUserName()))
- && (Objects.equals(this.getUserId(), other.getUserId())));
+ return ((Objects.equals(this.getUserName(), other.getUserName())) &&
+ (Objects.equals(this.getUserId(), other.getUserId())));
}
@Override
}
@Override
- public Boolean getUserPublicProfile () {
- return this.userPublicProfile;
+ public ProfileMode getUserProfileMode () {
+ return this.userProfileMode;
}
@Override
- public void setUserPublicProfile (final Boolean userPublicProfile) {
- this.userPublicProfile = userPublicProfile;
+ public void setUserProfileMode (final ProfileMode userProfileMode) {
+ this.userProfileMode = userProfileMode;
}
@Override
import java.io.Serializable;
import java.util.Calendar;
import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
/**
* <p>
* @return Whether the user has a public profile
*/
- Boolean getUserPublicProfile ();
+ ProfileMode getUserProfileMode ();
/**
* Setter for public user profile flag
* <p>
* @param userPublicProfile Whether the user has a public profile
*/
- void setUserPublicProfile (final Boolean userPublicProfile);
+ void setUserProfileMode (final ProfileMode userPublicProfile);
/**
* Checks if object is a User instance and whether it matches with this
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jusercore.model.user.profilemodes;
+
+import java.io.Serializable;
+
+/**
+ * User profile modes
+ * <p>
+ * @author Roland Haeder
+ */
+public enum ProfileMode implements Serializable {
+
+ /**
+ * Invisible to guests and members (not administrators)
+ */
+ INVISIBLE("USER_PROFILE_MODE_PRIVATE"),
+ /**
+ * Only visible to members (and administrators)
+ */
+ MEMBERS("USER_PROFILE_MODE_PRIVATE"),
+ /**
+ * Visible to all (public in Internet)
+ */
+ PUBLIC("USER_PROFILE_MODE_PRIVATE");
+
+ /**
+ * Message key (i18n)
+ */
+ private final String messageKey;
+
+ /**
+ * Constructor with message key
+ * <p>
+ * @param messageKey Message key
+ */
+ private ProfileMode (final String messageKey) {
+ this.messageKey = messageKey;
+ }
+
+ /**
+ * Getter for message key (i18n)
+ * @return Message key
+ */
+ public String getMessageKey () {
+ return this.messageKey;
+ }
+}