From 8cb5ac2aa04f38b4dbf9f94abd03c62449c985f4 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 14 Oct 2015 13:22:58 +0200 Subject: [PATCH] =?utf8?q?Continued:=20-=20added=20user=20profile=20visibi?= =?utf8?q?lity=20flag=20to=20registration=20form=20-=20moved=20all=20conve?= =?utf8?q?rter=20to=20proper=20directory=20-=20added=20missing=20strings?= =?utf8?q?=20to=20i18n=20file=20-=20renamed=20some=20for=20better=20naming?= =?utf8?q?=20convention=20-=20registered=20validator=20with=20this=20appli?= =?utf8?q?cation=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../addressbook/beans/user/UserWebBean.java | 21 +++++++++- .../beans/user/UserWebController.java | 14 +++++++ .../TrueFalseToBooleanConverter.java | 41 ------------------- .../templates/generic/form_personal_data.tpl | 4 +- 4 files changed, 36 insertions(+), 44 deletions(-) delete mode 100644 src/java/org/mxchange/addressbook/converter/TrueFalseToBooleanConverter.java diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java b/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java index 9aaa709a..650d6540 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java @@ -198,6 +198,11 @@ public class UserWebBean implements UserWebController { */ private List publicUserList; + /** + * Whether the user wants a public profile + */ + private Boolean userProfilePublic; + /** * Default constructor */ @@ -241,6 +246,7 @@ public class UserWebBean implements UserWebController { // Clear all data // - personal data this.setUserId(null); + this.setUserProfilePublic(null); this.setGender(Gender.UNKNOWN); this.setFirstName(null); this.setFamilyName(null); @@ -270,6 +276,7 @@ public class UserWebBean implements UserWebController { // Copy all fields: // - base data this.setUserId(user.getUserId()); + this.setUserProfilePublic(user.getUserPublicProfile()); this.setGender(user.getUserContact().getContactGender()); this.setFirstName(user.getUserContact().getContactFirstName()); this.setFamilyName(user.getUserContact().getContactFamilyName()); @@ -317,6 +324,8 @@ public class UserWebBean implements UserWebController { // Create new user instance User user = new LoginUser(); user.setUserName(this.getUserName()); + user.setUserPublicProfile(this.getUserProfilePublic()); + user.setUserCreated(new GregorianCalendar()); // Generate phone number DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber()); @@ -398,7 +407,6 @@ public class UserWebBean implements UserWebController { // Set contact in user user.setUserContact(contact); - user.setUserCreated(new GregorianCalendar()); // Trace message //this.getLogger().logTrace(MessageFormat.format("createUserInstance: user={0} - EXIT!", user)); @@ -636,6 +644,16 @@ public class UserWebBean implements UserWebController { this.userPasswordRepeat = userPasswordRepeat; } + @Override + public Boolean getUserProfilePublic () { + return this.userProfilePublic; + } + + @Override + public void setUserProfilePublic (final Boolean userProfilePublic) { + this.userProfilePublic = userProfilePublic; + } + @Override public Integer getZipCode () { return this.zipCode; @@ -671,6 +689,7 @@ public class UserWebBean implements UserWebController { @Override public boolean isRequiredPersonalDataSet () { return ((this.getUserName() != null) + && (this.getUserProfilePublic() != null) && (this.getGender() != null) && (this.getFirstName() != null) && (this.getFamilyName() != null) diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java index c1352663..91f6ec10 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java @@ -394,6 +394,20 @@ public interface UserWebController extends Serializable { */ public void setZipCode (final Integer zipCode); + /** + * Getter for user public profile flag + *

+ * @return User public profile flag + */ + public Boolean getUserProfilePublic (); + + /** + * Setter for user public profile flag + *

+ * @param userProfilePublic User public profile flag + */ + public void setUserProfilePublic (final Boolean userProfilePublic); + /** * Checks whether user instance's email address is used *

diff --git a/src/java/org/mxchange/addressbook/converter/TrueFalseToBooleanConverter.java b/src/java/org/mxchange/addressbook/converter/TrueFalseToBooleanConverter.java deleted file mode 100644 index 9d63a009..00000000 --- a/src/java/org/mxchange/addressbook/converter/TrueFalseToBooleanConverter.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.addressbook.converter; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.FacesConverter; - -/** - * A converter to convert "true" to boolean true and "false" to boolean false - *

- * @author Roland Haeder - */ -@FacesConverter(value = "trueFalse") -public class TrueFalseToBooleanConverter implements Converter { - - @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String value) { - return Boolean.valueOf(value); - } - - @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { - return Boolean.toString((Boolean) value); - } -} diff --git a/web/WEB-INF/templates/generic/form_personal_data.tpl b/web/WEB-INF/templates/generic/form_personal_data.tpl index 7a20d404..ad7e4133 100644 --- a/web/WEB-INF/templates/generic/form_personal_data.tpl +++ b/web/WEB-INF/templates/generic/form_personal_data.tpl @@ -201,10 +201,10 @@

- + - +
-- 2.39.5