]> 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 982cf38d84d75dcb8cdad8eedd0cdf9e74cb4fce..4e2496f9e62528f0f9e524aef526f6197d9fe50e 100644 (file)
@@ -19,39 +19,36 @@ package org.mxchange.pizzaapplication.beans.contact;
 import java.text.MessageFormat;
 import java.util.Date;
 import java.util.Iterator;
-import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
-import javax.faces.context.FacesContext;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-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.UserContact;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcontacts.contact.utils.ContactUtils;
 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.DialableNumber;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
-import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jcontacts.model.contact.AdminContactSessionBeanRemote;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
+import org.mxchange.jcontacts.model.contact.ContactUtils;
+import org.mxchange.jcontacts.model.contact.UserContact;
+import org.mxchange.jcontacts.model.contact.title.PersonalTitle;
+import org.mxchange.jcountry.model.data.Country;
+import org.mxchange.jphone.model.phonenumbers.DialableNumber;
+import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
+import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
-import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 
 /**
  * Administrative user bean (controller)
@@ -67,6 +64,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
         */
@@ -77,14 +79,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        /**
         * Administrative contact EJB
         */
+       @EJB (lookup = "java:global/jfinancials-ejb/adminContact!org.mxchange.jcontacts.model.contact.AdminContactSessionBeanRemote")
        private AdminContactSessionBeanRemote adminContactBean;
 
-       /**
-        * Bean helper instance
-        */
-       @Inject
-       private PizzaWebRequestHelperController beanHelper;
-
        /**
         * Birth day
         */
@@ -101,25 +98,26 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        private String comment;
 
        /**
-        * Remote contact bean
+        * EJB for general contact purposes
         */
+       @EJB (lookup = "java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote")
        private ContactSessionBeanRemote contactBean;
 
        /**
         * General contact controller
         */
        @Inject
-       private PizzaContactWebSessionController contactController;
+       private PizzaContactWebRequestController contactController;
 
        /**
-        * Contact id
+        * Country instance
         */
-       private Long contactId;
+       private Country contactCountry;
 
        /**
-        * Country instance
+        * Contact id
         */
-       private Country country;
+       private Long contactId;
 
        /**
         * Email address
@@ -156,11 +154,6 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
         */
        private String firstName;
 
-       /**
-        * Gender instance
-        */
-       private Gender gender;
-
        /**
         * House number
         */
@@ -182,7 +175,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        private boolean isLandLineUnlinked;
 
        /**
-        * Whether a cellphone entry has been unlinked
+        * Whether a cmobile entry has been unlinked
         */
        private boolean isMobileNumberUnlinked;
 
@@ -222,14 +215,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
@@ -251,12 +244,17 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                super();
        }
 
-       @Override
+       /**
+        * Adds contact data to database and redirects on success. If the contact is
+        * already found, a proper exception is thrown.
+        * <p>
+        * @return Redirect outcome
+        */
        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
@@ -272,7 +270,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                }
 
                // Create new contact instance
-               Contact contact = this.createContactInstance();
+               final Contact contact = this.createContactInstance();
 
                // Default is not same contact
                if (this.isSameContactFound(contact)) {
@@ -281,7 +279,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                }
 
                // Init contact
-               Contact updatedContact;
+               final Contact updatedContact;
 
                // Try to call EJB
                try {
@@ -302,34 +300,45 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                return "admin_list_contact"; //NOI18N
        }
 
-       @Override
-       public void copyContactToController (final Contact contact) {
+       /**
+        * Observer for events being fired when a bean helper has successfully
+        * created a contact instance.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterCreatedContactEvent (@Observes final ObservableCreatedContactEvent event) {
                // Log message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminContactController::copyContactToController(): contact={0} - CALLED!", contact)); //NOI18N
+               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminContactController::afterCreatedContactEvent(): contact={0} - CALLED!", contact)); //NOI18N
 
-               // The contact instance must be valid
-               if (null == contact) {
+               // The event instance must be valid
+               if (null == event) {
                        // Throw NPE again
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getCreatedContact() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
-               } else if (contact.getContactId() < 1) {
+                       throw new NullPointerException("event.createdContact is null"); //NOI18N //NOI18N
+               } else if (event.getCreatedContact().getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N //NOI18N
+               } else if (event.getCreatedContact().getContactId() < 1) {
                        // Not valid
-                       throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
+                       throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N
                }
 
+               // Get contact instance from event
+               final Contact contact = event.getCreatedContact();
+
                // 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());
-               this.setCountry(contact.getContactCountry());
+               this.setContactCountry(contact.getContactCountry());
                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());
@@ -337,7 +346,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
 
                // Is the cell phone set?
                if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       // ... cellphone data
+                       // ... cmobile data
                        this.setMobileId(contact.getContactMobileNumber().getPhoneId());
                        this.setMobileProvider(contact.getContactMobileNumber().getMobileProvider());
                        this.setMobileNumber(contact.getContactMobileNumber().getPhoneNumber());
@@ -362,15 +371,15 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                }
 
                // Log message
-               //* NOISY-DEBUG: */ System.out.println("AdminContactController::copyContactToController(): EXIT!"); //NOI18N
+               //* NOISY-DEBUG: */ System.out.println("AdminContactController::afterCreatedContactEvent(): EXIT!"); //NOI18N
        }
 
        @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
@@ -386,20 +395,27 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                }
 
                // Generate phone number
-               DialableLandLineNumber landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
-               DialableMobileNumber mobile = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
-               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+               final DialableLandLineNumber landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+               final DialableMobileNumber mobile = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+               final DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Create new instance
-               Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
+               final Contact contact = new UserContact(this.getPersonalTitle(), this.getFirstName(), this.getFamilyName());
+
+               // Is contact id set?
+               if (this.getContactId() instanceof Long) {
+                       // Set it, too
+                       contact.setContactId(this.getContactId());
+               }
 
                // Add all others
+               contact.setContactTitle(this.getAcademicTitle());
                contact.setContactBirthday(this.getBirthday());
                contact.setContactStreet(this.getStreet());
                contact.setContactHouseNumber(this.getHouseNumber());
                contact.setContactZipCode(this.getZipCode());
                contact.setContactCity(this.getCity());
-               contact.setContactCountry(this.getCountry());
+               contact.setContactCountry(this.getContactCountry());
                contact.setContactEmailAddress(this.getEmailAddress());
                contact.setContactBirthday(this.getBirthday());
                contact.setContactComment(this.getComment());
@@ -454,13 +470,13 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                        // Is the number set?
                        if (mobile.getPhoneNumber() == null) {
                                // Is null
-                               throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
+                               throw new NullPointerException("cmobile.phoneNumber is null"); //NOI18N
                        } else if (mobile.getPhoneNumber() < 1) {
                                // Abort here
-                               throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
+                               throw new IllegalArgumentException("cmobile.phoneNumber is zero or below."); //NOI18N
                        }
 
-                       // Set cellphone number
+                       // Set cmobile number
                        contact.setContactMobileNumber(mobile);
                }
 
@@ -468,10 +484,14 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                return contact;
        }
 
-       @Override
+       /**
+        * Edits currently loaded contact's data in database.
+        * <p>
+        * @return Redirect outcome
+        */
        public String editContactData () {
                // Get contact instance
-               Contact contact = this.beanHelper.getContact();
+               final Contact contact = this.createContactInstance();
 
                // Check if contact instance is in helper and valid
                if (null == contact) {
@@ -489,7 +509,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                this.updateContactData(contact);
 
                // Call EJB for updating contact data
-               Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileNumberUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
+               final Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileNumberUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
 
                // Fire event
                this.updatedContactEvent.fire(new AdminUpdatedContactEvent(updatedContact));
@@ -501,7 +521,13 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                return "admin_list_contact"; //NOI18N
        }
 
-       @Override
+       /**
+        * Returns a text representation of given mobile number or null if not set.
+        * <p>
+        * @param mobileNumber Mobile number
+        * <p>
+        * @return Text representation or null
+        */
        public String generateMobileNumber (final DialableMobileNumber mobileNumber) {
                // Is it null?
                if (null == mobileNumber) {
@@ -510,18 +536,25 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                }
 
                // Get all data
-               String number = String.format(
-                          "%s%d%d", //NOI18N
-                          mobileNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(),
-                          mobileNumber.getMobileProvider().getProviderDialPrefix(),
-                          mobileNumber.getPhoneNumber()
-          );
+               final String number = String.format(
+                                        "%s%d%d", //NOI18N
+                                        mobileNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(),
+                                        mobileNumber.getMobileProvider().getProviderDialPrefix(),
+                                        mobileNumber.getPhoneNumber()
+                        );
 
                // Return it
                return number;
        }
 
-       @Override
+       /**
+        * Returns a text representation of given land-line or fax number or null if
+        * not set.
+        * <p>
+        * @param phoneNumber Land-line or fax number
+        * <p>
+        * @return Text representation or null
+        */
        public String generatePhoneNumber (final DialableNumber phoneNumber) {
                // Is it null?
                if (null == phoneNumber) {
@@ -530,55 +563,123 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                }
 
                // Generate it
-               String number = String.format(
-                          "%s%d%d", //NOI18N
-                          phoneNumber.getPhoneCountry().getCountryExternalDialPrefix(),
-                          phoneNumber.getPhoneAreaCode(),
-                          phoneNumber.getPhoneNumber()
-          );
+               final String number = String.format(
+                                        "%s%d%d", //NOI18N
+                                        phoneNumber.getPhoneCountry().getCountryExternalDialPrefix(),
+                                        phoneNumber.getPhoneAreaCode(),
+                                        phoneNumber.getPhoneNumber()
+                        );
 
                // Return it
                return number;
        }
 
-       @Override
+       /**
+        * Getter for academic title
+        * <p>
+        * @return Academic title
+        */
+       public String getAcademicTitle () {
+               return this.academicTitle;
+       }
+
+       /**
+        * Setter for academic title
+        * <p>
+        * @param academicTitle Academic title
+        */
+       public void setAcademicTitle (final String academicTitle) {
+               this.academicTitle = academicTitle;
+       }
+
+       /**
+        * Getter for birth day
+        * <p>
+        * @return Birth day
+        */
        @SuppressWarnings ("ReturnOfDateField")
        public Date getBirthday () {
                return this.birthday;
        }
 
-       @Override
+       /**
+        * Setter for birth day
+        * <p>
+        * @param birthday Birth day
+        */
        @SuppressWarnings ("AssignmentToDateFieldFromParameter")
        public void setBirthday (final Date birthday) {
                this.birthday = birthday;
        }
 
-       @Override
+       /**
+        * Getter for city name
+        * <p>
+        * @return City name
+        */
        public String getCity () {
                return this.city;
        }
 
-       @Override
+       /**
+        * Setter for city name
+        * <p>
+        * @param city City name
+        */
        public void setCity (final String city) {
                this.city = city;
        }
 
-       @Override
+       /**
+        * Getter for comments
+        * <p>
+        * @return Comments
+        */
        public String getComment () {
                return this.comment;
        }
 
-       @Override
+       /**
+        * Setter for comment
+        * <p>
+        * @param comment Comments
+        */
        public void setComment (final String comment) {
                this.comment = comment;
        }
 
-       @Override
+       /**
+        * Getter for contactCountry instance
+        * <p>
+        * @return Country instance
+        */
+       public Country getContactCountry () {
+               return this.contactCountry;
+       }
+
+       /**
+        * Setter for contactCountry instance
+        * <p>
+        * @param contactCountry Country instance
+        */
+       public void setContactCountry (final Country contactCountry) {
+               this.contactCountry = contactCountry;
+       }
+
+       /**
+        * Getter for contact id
+        * <p>
+        * @return Contact id
+        */
        public Long getContactId () {
                return this.contactId;
        }
 
-       @Override
+       /**
+        * Setter for contact id
+        * <p>
+        * @param contactId Contact id
+        */
        public void setContactId (final Long contactId) {
                this.contactId = contactId;
        }
@@ -594,247 +695,385 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                throw new UnsupportedOperationException("Setting controller type is not supported."); //NOI18N
        }
 
-       @Override
-       public Country getCountry () {
-               return this.country;
-       }
-
-       @Override
-       public void setCountry (final Country country) {
-               this.country = country;
-       }
-
-       @Override
+       /**
+        * Getter for email address
+        * <p>
+        * @return Email address
+        */
        public String getEmailAddress () {
                return this.emailAddress;
        }
 
-       @Override
+       /**
+        * Setter for email address
+        * <p>
+        * @param emailAddress Email address
+        */
        public void setEmailAddress (final String emailAddress) {
                this.emailAddress = emailAddress;
        }
 
-       @Override
+       /**
+        * Family name
+        * <p>
+        * @return the familyName
+        */
        public String getFamilyName () {
                return this.familyName;
        }
 
-       @Override
+       /**
+        * Family name
+        * <p>
+        * @param familyName the familyName to set
+        */
        public void setFamilyName (final String familyName) {
                this.familyName = familyName;
        }
 
-       @Override
+       /**
+        * Getter for fax number's area code
+        * <p>
+        * @return Fax number's area code
+        */
        public Integer getFaxAreaCode () {
                return this.faxAreaCode;
        }
 
-       @Override
+       /**
+        * Setter for fax number's area code
+        * <p>
+        * @param faxAreaCode Fax number's area code
+        */
        public void setFaxAreaCode (final Integer faxAreaCode) {
                this.faxAreaCode = faxAreaCode;
        }
 
-       @Override
+       /**
+        * Getter for fax's country instance
+        * <p>
+        * @return Fax' country instance
+        */
        public Country getFaxCountry () {
                return this.faxCountry;
        }
 
-       @Override
+       /**
+        * Setter for fax's country instance
+        * <p>
+        * @param faxCountry Fax' country instance
+        */
        public void setFaxCountry (final Country faxCountry) {
                this.faxCountry = faxCountry;
        }
 
-       @Override
+       /**
+        * Getter for fax id
+        * <p>
+        * @return Fax id
+        */
        public Long getFaxId () {
                return this.faxId;
        }
 
-       @Override
+       /**
+        * Setter for fax id
+        * <p>
+        * @param faxId Fax id
+        */
        public void setFaxId (final Long faxId) {
                this.faxId = faxId;
        }
 
-       @Override
+       /**
+        * Getter for fax number
+        * <p>
+        * @return Fax number
+        */
        public Long getFaxNumber () {
                return this.faxNumber;
        }
 
-       @Override
+       /**
+        * Setter for fax number
+        * <p>
+        * @param faxNumber Fax number
+        */
        public void setFaxNumber (final Long faxNumber) {
                this.faxNumber = faxNumber;
        }
 
-       @Override
+       /**
+        * Getter for first name
+        * <p>
+        * @return First name
+        */
        public String getFirstName () {
                return this.firstName;
        }
 
-       @Override
+       /**
+        * Setter for first name
+        * <p>
+        * @param firstName First name
+        */
        public void setFirstName (final String firstName) {
                this.firstName = firstName;
        }
 
-       @Override
-       public Gender getGender () {
-               return this.gender;
-       }
-
-       @Override
-       public void setGender (final Gender gender) {
-               this.gender = gender;
-       }
-
-       @Override
+       /**
+        * Getter for house number
+        * <p>
+        * @return House number
+        */
        public Short getHouseNumber () {
                return this.houseNumber;
        }
 
-       @Override
+       /**
+        * Setter for house number
+        * <p>
+        * @param houseNumber House number
+        */
        public void setHouseNumber (final Short houseNumber) {
                this.houseNumber = houseNumber;
        }
 
-       @Override
+       /**
+        * Getter for house number extension. Example: 123a, 'a' is the extension
+        * and 123 is the house number.
+        * <p>
+        * @return House number extension
+        */
        public String getHouseNumberExtension () {
                return this.houseNumberExtension;
        }
 
-       @Override
+       /**
+        * Setter for house number extension
+        * <p>
+        * @param houseNumberExtension House number extension
+        */
        public void setHouseNumberExtension (final String houseNumberExtension) {
                this.houseNumberExtension = houseNumberExtension;
        }
 
-       @Override
+       /**
+        * Getter for land-line number's area code
+        * <p>
+        * @return Land-line number's area code
+        */
        public Integer getLandLineAreaCode () {
                return this.landLineAreaCode;
        }
 
-       @Override
+       /**
+        * Setter for land-line number's area code
+        * <p>
+        * @param landLineAreaCode Land-line number's area code
+        */
        public void setLandLineAreaCode (final Integer landLineAreaCode) {
                this.landLineAreaCode = landLineAreaCode;
        }
 
-       @Override
+       /**
+        * Getter for land-line number's country instance
+        * <p>
+        * @return Land-line number's country instance
+        */
        public Country getLandLineCountry () {
                return this.landLineCountry;
        }
 
-       @Override
+       /**
+        * Setter for land-line number's country instance
+        * <p>
+        * @param landLineCountry Land-line number's country instance
+        */
        public void setLandLineCountry (final Country landLineCountry) {
                this.landLineCountry = landLineCountry;
        }
 
-       @Override
+       /**
+        * Getter for land-line id
+        * <p>
+        * @return Land-line id
+        */
        public Long getLandLineId () {
                return this.landLineId;
        }
 
-       @Override
+       /**
+        * Setter for land-line id
+        * <p>
+        * @param landLineId Land-line id
+        */
        public void setLandLineId (final Long landLineId) {
                this.landLineId = landLineId;
        }
 
-       @Override
+       /**
+        * Getter for land-line number
+        * <p>
+        * @return Land-line number
+        */
        public Long getLandLineNumber () {
                return this.landLineNumber;
        }
 
-       @Override
+       /**
+        * Setter for land-line number
+        * <p>
+        * @param landLineNumber Land-line number
+        */
        public void setLandLineNumber (final Long landLineNumber) {
                this.landLineNumber = landLineNumber;
        }
 
-       @Override
+       /**
+        * Getter for mobile id
+        * <p>
+        * @return Mobile id
+        */
        public Long getMobileId () {
                return this.mobileId;
        }
 
-       @Override
+       /**
+        * Setter for mobile id
+        * <p>
+        * @param mobileId Mobile id
+        */
        public void setMobileId (final Long mobileId) {
                this.mobileId = mobileId;
        }
 
-       @Override
+       /**
+        * Getter for mobile number
+        * <p>
+        * @return Mobile number
+        */
        public Long getMobileNumber () {
                return this.mobileNumber;
        }
 
-       @Override
-       public void setMobileNumber (Long mobileNumber) {
+       /**
+        * Setter for mobile number
+        * <p>
+        * @param mobileNumber Mobile number
+        */
+       public void setMobileNumber (final Long mobileNumber) {
                this.mobileNumber = mobileNumber;
        }
 
-       @Override
+       /**
+        * Getter for mobile number's carrier
+        * <p>
+        * @return Mobile number's carrier
+        */
        public MobileProvider getMobileProvider () {
                return this.mobileProvider;
        }
 
-       @Override
+       /**
+        * Setter for mobile number's carrier prefix
+        * <p>
+        * @param mobileProvider Mobile number's carrier prefix
+        */
        public void setMobileProvider (final MobileProvider mobileProvider) {
                this.mobileProvider = mobileProvider;
        }
 
-       @Override
-       public String getStreet () {
-               return this.street;
+       /**
+        * Getter for personal title
+        * <p>
+        * @return Personal title
+        */
+       public PersonalTitle getPersonalTitle () {
+               return this.personalTitle;
        }
 
-       @Override
-       public void setStreet (final String street) {
-               this.street = street;
+       /**
+        * Setter for personal title
+        * <p>
+        * @param personalTitle Personal title
+        */
+       public void setPersonalTitle (final PersonalTitle personalTitle) {
+               this.personalTitle = personalTitle;
        }
 
-       @Override
-       public String getTitle () {
-               return this.title;
+       /**
+        * Getter for street name
+        * <p>
+        * @return Street name
+        */
+       public String getStreet () {
+               return this.street;
        }
 
-       @Override
-       public void setTitle (final String title) {
-               this.title = title;
+       /**
+        * Setter for street name
+        * <p>
+        * @param street Street name
+        */
+       public void setStreet (final String street) {
+               this.street = street;
        }
 
-       @Override
+       /**
+        * Getter for ZIP code
+        * <p>
+        * @return ZIP code
+        */
        public Integer getZipCode () {
                return this.zipCode;
        }
 
-       @Override
+       /**
+        * Setter for ZIP code
+        * <p>
+        * @param zipCode ZIP code
+        */
        public void setZipCode (final Integer zipCode) {
                this.zipCode = zipCode;
        }
 
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
-
-                       // Try to lookup (administative)
-                       this.adminContactBean = (AdminContactSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/adminContact!org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
+       @Override
+       public boolean isRequiredPersonalDataSet () {
+               return ((this.getPersonalTitle() != null) &&
+                               (this.getFirstName() != null) &&
+                               (this.getFamilyName() != null) &&
+                               (this.getStreet() != null) &&
+                               (this.getHouseNumber() != null) &&
+                               (this.getZipCode() != null) &&
+                               (this.getCity() != null) &&
+                               (this.getEmailAddress() != null));
        }
 
        @Override
-       public boolean isGenderRequired () {
-               // Get context parameter
-               String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_gender_enabled"); //NOI18N
-
-               // Is it set?
-               boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
-
-               // Return value
-               return isRequired;
+       public void validateContactData () {
+               if (this.getPersonalTitle() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("contactController.gender is null"); //NOI18N
+               } else if (this.getFirstName() == null) {
+                       // ... and again
+                       throw new NullPointerException("contactController.firstName is null"); //NOI18N
+               } else if (this.getFirstName().isEmpty()) {
+                       // ... and again
+                       throw new IllegalArgumentException("contactController.firstName is empty"); //NOI18N
+               } else if (this.getFamilyName() == null) {
+                       // ... and again
+                       throw new NullPointerException("contactController.familyName is null"); //NOI18N
+               } else if (this.getFamilyName().isEmpty()) {
+                       // ... and again
+                       throw new IllegalArgumentException("contactController.familyName is empty"); //NOI18N
+               } else if (this.getEmailAddress() == null) {
+                       // ... and again
+                       throw new NullPointerException("contactController.emailAddress is null"); //NOI18N
+               } else if (this.getEmailAddress().isEmpty()) {
+                       // ... and again
+                       throw new IllegalArgumentException("contactController.emailAddress is empty"); //NOI18N
+               }
        }
 
        /**
@@ -843,7 +1082,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);
@@ -851,7 +1090,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                this.setHouseNumberExtension(null);
                this.setZipCode(null);
                this.setCity(null);
-               this.setCountry(null);
+               this.setContactCountry(null);
 
                // - contact data
                this.setEmailAddress(null);
@@ -872,21 +1111,21 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        /**
         * Checks whether the given contact is found
         * <p>
-        * @param contact Contact inastance
-        *
-        * @return Wether contact has been found
+        * @param contact Contact instance
+        * <p>
+        * @return Whether contact has been found
         */
        private boolean isSameContactFound (final Contact contact) {
                // Default is not found
                boolean IsFound = false;
 
                // Get iterator
-               Iterator<Contact> iterator = this.contactController.allContacts().iterator();
+               final Iterator<Contact> iterator = this.contactController.allContacts().iterator();
 
                // Loop through all
                while (iterator.hasNext()) {
                        // Get next contact
-                       Contact next = iterator.next();
+                       final Contact next = iterator.next();
 
                        // Is the same?
                        if (ContactUtils.isSameContact(contact, next)) {
@@ -919,8 +1158,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());
@@ -928,9 +1167,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                contact.setContactHouseNumberExtension(this.getHouseNumberExtension());
                contact.setContactZipCode(this.getZipCode());
                contact.setContactCity(this.getCity());
-               contact.setContactCountry(this.getCountry());
+               contact.setContactCountry(this.getContactCountry());
 
-               // Update contact's cellphone number
+               // Update contact's cmobile number
                this.isMobileNumberUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber());
 
                // Update contact's land-line number