]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java
Please cherry-pick:
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / contact / PizzaAdminContactWebRequestBean.java
index 0f2acff4e58bab21cd9d105d5bee97ddb553cbc0..da791cd9e9378fc62f621dbf7335ba2472508fea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -33,9 +33,9 @@ import javax.naming.NamingException;
 import org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
+import org.mxchange.jcontacts.contact.ContactUtils;
 import org.mxchange.jcontacts.contact.UserContact;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcontacts.contact.utils.ContactUtils;
+import org.mxchange.jcontacts.contact.title.PersonalTitle;
 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
@@ -67,6 +67,11 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
+       /**
+        * Academic academicTitle
+        */
+       private String academicTitle;
+
        /**
         * An event fired when the administrator has added a new contact
         */
@@ -156,11 +161,6 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
         */
        private String firstName;
 
-       /**
-        * Gender instance
-        */
-       private Gender gender;
-
        /**
         * House number
         */
@@ -222,14 +222,14 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        private MobileProvider mobileProvider;
 
        /**
-        * Street
+        * PersonalTitle instance
         */
-       private String street;
+       private PersonalTitle personalTitle;
 
        /**
-        * Title
+        * Street
         */
-       private String title;
+       private String street;
 
        /**
         * An event fired when the administrator has updated contact data
@@ -254,9 +254,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        @Override
        public String addContact () {
                // Are all minimum fields set?
-               if (this.getGender() == null) {
+               if (this.getPersonalTitle() == null) {
                        // Throw NPE
-                       throw new NullPointerException("gender is null"); //NOI18N
+                       throw new NullPointerException("personalTitle is null"); //NOI18N
                } else if (this.getFirstName() == null) {
                        // Throw NPE
                        throw new NullPointerException("firstName is null"); //NOI18N
@@ -321,7 +321,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
 
                // Set all fields: contact
                this.setContactId(contact.getContactId());
-               this.setTitle(contact.getContactTitle());
+               this.setAcademicTitle(contact.getContactTitle());
                this.setBirthday(contact.getContactBirthday());
                this.setCity(contact.getContactCity());
                this.setComment(contact.getContactComment());
@@ -329,7 +329,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                this.setEmailAddress(contact.getContactEmailAddress());
                this.setFamilyName(contact.getContactFamilyName());
                this.setFirstName(contact.getContactFirstName());
-               this.setGender(contact.getContactGender());
+               this.setPersonalTitle(contact.getContactPersonalTitle());
                this.setHouseNumber(contact.getContactHouseNumber());
                this.setHouseNumberExtension(contact.getContactHouseNumberExtension());
                this.setStreet(contact.getContactStreet());
@@ -368,9 +368,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        @Override
        public Contact createContactInstance () {
                // Are all minimum fields set?
-               if (this.getGender() == null) {
+               if (this.getPersonalTitle() == null) {
                        // Throw NPE
-                       throw new NullPointerException("gender is null"); //NOI18N
+                       throw new NullPointerException("personalTitle is null"); //NOI18N
                } else if (this.getFirstName() == null) {
                        // Throw NPE
                        throw new NullPointerException("firstName is null"); //NOI18N
@@ -391,9 +391,10 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Create new instance
-               Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
+               Contact contact = new UserContact(this.getPersonalTitle(), this.getFirstName(), this.getFamilyName());
 
                // Add all others
+               contact.setContactTitle(this.getAcademicTitle());
                contact.setContactBirthday(this.getBirthday());
                contact.setContactStreet(this.getStreet());
                contact.setContactHouseNumber(this.getHouseNumber());
@@ -541,6 +542,16 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                return number;
        }
 
+       @Override
+       public String getAcademicTitle () {
+               return this.academicTitle;
+       }
+
+       @Override
+       public void setAcademicTitle (final String academicTitle) {
+               this.academicTitle = academicTitle;
+       }
+
        @Override
        @SuppressWarnings ("ReturnOfDateField")
        public Date getBirthday () {
@@ -674,16 +685,6 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                this.firstName = firstName;
        }
 
-       @Override
-       public Gender getGender () {
-               return this.gender;
-       }
-
-       @Override
-       public void setGender (final Gender gender) {
-               this.gender = gender;
-       }
-
        @Override
        public Short getHouseNumber () {
                return this.houseNumber;
@@ -775,23 +776,23 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        }
 
        @Override
-       public String getStreet () {
-               return this.street;
+       public PersonalTitle getPersonalTitle () {
+               return this.personalTitle;
        }
 
        @Override
-       public void setStreet (final String street) {
-               this.street = street;
+       public void setPersonalTitle (final PersonalTitle personalTitle) {
+               this.personalTitle = personalTitle;
        }
 
        @Override
-       public String getTitle () {
-               return this.title;
+       public String getStreet () {
+               return this.street;
        }
 
        @Override
-       public void setTitle (final String title) {
-               this.title = title;
+       public void setStreet (final String street) {
+               this.street = street;
        }
 
        @Override
@@ -826,9 +827,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        }
 
        @Override
-       public boolean isGenderRequired () {
+       public boolean isPersonalTitleRequired () {
                // Get context parameter
-               String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_gender_enabled"); //NOI18N
+               String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_personal_title_enabled"); //NOI18N
 
                // Is it set?
                boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
@@ -843,7 +844,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        private void clear () {
                // Clear all data
                // - personal data
-               this.setTitle(null);
+               this.setAcademicTitle(null);
                this.setFirstName(null);
                this.setFamilyName(null);
                this.setStreet(null);
@@ -919,8 +920,8 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                }
 
                // Update all fields
-               contact.setContactGender(this.getGender());
-               contact.setContactTitle(this.getTitle());
+               contact.setContactPersonalTitle(this.getPersonalTitle());
+               contact.setContactTitle(this.getAcademicTitle());
                contact.setContactFirstName(this.getFirstName());
                contact.setContactFamilyName(this.getFamilyName());
                contact.setContactStreet(this.getStreet());