]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 25 Apr 2017 11:59:38 +0000 (13:59 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 25 Apr 2017 12:08:16 +0000 (14:08 +0200)
- renamed cellphone -> mobile
- renamed carrier -> provider
- renamed phone* -> landLine*
- all more common over all (other) projects

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestController.java
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionController.java

index 86afccbe92a012ad73e5241311f4209795777171..f96f3a97ecea38d30eeca1f4ec783aca36de6c4f 100644 (file)
@@ -22,8 +22,8 @@ import java.util.Iterator;
 import javax.annotation.PostConstruct;
 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;
@@ -38,8 +38,6 @@ 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.deleted.AdminDeletedContactEvent;
-import org.mxchange.jcontacts.events.contact.deleted.ObservableAdminDeletedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
@@ -48,10 +46,12 @@ import org.mxchange.jjobs.beans.BaseJobsController;
 import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 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.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 
 /**
  * An administrative user controller (bean)
@@ -80,7 +80,7 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
        private AdminContactSessionBeanRemote adminContactBean;
 
        /**
-        * Bean helper
+        * Bean helper instance
         */
        @Inject
        private JobsWebRequestHelperController beanHelper;
@@ -101,7 +101,7 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
        private String comment;
 
        /**
-        * General contact EJB
+        * Remote contact bean
         */
        private ContactSessionBeanRemote contactBean;
 
@@ -121,13 +121,6 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
         */
        private Country country;
 
-       /**
-        * Event being fired when contact data has been deleted
-        */
-       @Inject
-       @Any
-       private Event<ObservableAdminDeletedContactEvent> deletedContactEvent;
-
        /**
         * Email address
         */
@@ -149,14 +142,14 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
        private Country faxCountry;
 
        /**
-        * Fax number
+        * Fax id number
         */
-       private Long faxNumber;
+       private Long faxId;
 
        /**
-        * Fax id number
+        * Fax number
         */
-       private Long faxNumberId;
+       private Long faxNumber;
 
        /**
         * First name
@@ -189,17 +182,17 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
        private boolean isLandLineUnlinked;
 
        /**
-        * Whether a mobile entry has been unlinked
+        * Whether a cellphone entry has been unlinked
         */
-       private boolean isMobileUnlinked;
+       private boolean isMobileNumberUnlinked;
 
        /**
-        * Land-line number area code
+        * Phone number area code
         */
        private Integer landLineAreaCode;
 
        /**
-        * Country instance for land-line number
+        * Country instance for phone number
         */
        private Country landLineCountry;
 
@@ -209,22 +202,22 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
        private Long landLineId;
 
        /**
-        * Land-line number
+        * Phone number
         */
        private Long landLineNumber;
 
        /**
-        * Mobile number
+        * Mobile id number
         */
-       private Long mobileNumber;
+       private Long mobileId;
 
        /**
-        * Mobile id number
+        * Mobile number
         */
-       private Long mobileNumberId;
+       private Long mobileNumber;
 
        /**
-        * Mobile provider
+        * Mobile number's provider
         */
        private MobileProvider mobileProvider;
 
@@ -309,36 +302,18 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
                return "admin_list_contact"; //NOI18N
        }
 
-       @Override
-       public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.addedUser is null"); //NOI18N
-               } else if (event.getAddedUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
-               } else if (event.getAddedUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
-               }
-
-               // Clear all data
-               this.clear();
-       }
-
        @Override
        public void copyContactToController (final Contact contact) {
+               // Log message
+               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminContactController::copyContactToController(): contact={0} - CALLED!", contact)); //NOI18N
+
                // The contact instance must be valid
                if (null == contact) {
                        // Throw NPE again
                        throw new NullPointerException("contact is null"); //NOI18N
                } else if (contact.getContactId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
                } else if (contact.getContactId() < 1) {
                        // Not valid
                        throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
@@ -360,64 +335,137 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
                this.setStreet(contact.getContactStreet());
                this.setZipCode(contact.getContactZipCode());
 
-               // ... mobile data
+               // Is the cell phone set?
                if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       this.setMobileNumberId(contact.getContactMobileNumber().getPhoneId());
+                       // ... cellphone data
+                       this.setMobileId(contact.getContactMobileNumber().getPhoneId());
                        this.setMobileProvider(contact.getContactMobileNumber().getMobileProvider());
                        this.setMobileNumber(contact.getContactMobileNumber().getPhoneNumber());
                }
 
-               // ... fax data
+               // Is the fax set?
                if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
-                       this.setFaxNumberId(contact.getContactFaxNumber().getPhoneId());
+                       // ... fax data
+                       this.setFaxId(contact.getContactFaxNumber().getPhoneId());
                        this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
                        this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
                        this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
                }
 
-               // .. land-line data
+               // Is the land-line number set?
                if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
+                       // .. land-line data
                        this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
                        this.setLandLineAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
                        this.setLandLineCountry(contact.getContactLandLineNumber().getPhoneCountry());
                        this.setLandLineNumber(contact.getContactLandLineNumber().getPhoneNumber());
                }
+
+               // Log message
+               //* NOISY-DEBUG: */ System.out.println("AdminContactController::copyContactToController(): EXIT!"); //NOI18N
        }
 
        @Override
        public Contact createContactInstance () {
+               // Are all minimum fields set?
+               if (this.getGender() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("gender is null"); //NOI18N
+               } else if (this.getFirstName() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("firstName is null"); //NOI18N
+               } else if (this.getFirstName().isEmpty()) {
+                       // Empty string
+                       throw new IllegalStateException("firstName is empty"); //NOI18N
+               } else if (this.getFamilyName() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("familyName is null"); //NOI18N
+               } else if (this.getFamilyName().isEmpty()) {
+                       // Empty string
+                       throw new IllegalStateException("familyName is empty"); //NOI18N
+               }
+
+               // 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());
+
                // Create new instance
                Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
 
-               // Update all data in contact
-               this.updateContactData(contact);
+               // Add all others
+               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.setContactEmailAddress(this.getEmailAddress());
+               contact.setContactBirthday(this.getBirthday());
+               contact.setContactComment(this.getComment());
 
-               // Return it
-               return contact;
-       }
+               // Set ownContact
+               contact.setContactOwnContact(Boolean.TRUE);
+
+               // Don't set null or wrong references
+               if ((landLine instanceof DialableLandLineNumber) && (landLine.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
+                       // Now the number must be given
+                       if (landLine.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
+                       } else if (landLine.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (landLine.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
+                       } else if (landLine.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
+                       }
 
-       @Override
-       public String deleteContactData (final Contact contact) {
-               // The instance must be valid
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+                       // Set phone number
+                       contact.setContactLandLineNumber(landLine);
                }
 
-               // Call EJB
-               this.adminContactBean.deleteContactData(contact);
+               // Don't set null or wrong references
+               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
+                       // Now the number must be given
+                       if (fax.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
+                       } else if (fax.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (fax.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
+                       } else if (fax.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
+                       }
 
-               // Fire event
-               this.deletedContactEvent.fire(new AdminDeletedContactEvent(contact));
+                       // Set fax number
+                       contact.setContactFaxNumber(fax);
+               }
 
-               // All fine
-               return "admin_list_contact"; //NOI18N
+               // Is the provider set?
+               if ((mobile instanceof DialableMobileNumber) && (this.getMobileProvider() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
+                       // Is the number set?
+                       if (mobile.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
+                       } else if (mobile.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set cellphone number
+                       contact.setContactMobileNumber(mobile);
+               }
+
+               // Return it
+               return contact;
        }
 
        @Override
@@ -431,7 +479,7 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
                        throw new NullPointerException("beanHelper.contact is null"); //NOI18N
                } else if (contact.getContactId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N
+                       throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
                } else if (contact.getContactId() < 1) {
                        // Invalid id
                        throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
@@ -441,7 +489,7 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
                this.updateContactData(contact);
 
                // Call EJB for updating contact data
-               Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
+               Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileNumberUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
 
                // Fire event
                this.updatedContactEvent.fire(new AdminUpdatedContactEvent(updatedContact));
@@ -597,23 +645,23 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
        }
 
        @Override
-       public Long getFaxNumber () {
-               return this.faxNumber;
+       public Long getFaxId () {
+               return this.faxId;
        }
 
        @Override
-       public void setFaxNumber (final Long faxNumber) {
-               this.faxNumber = faxNumber;
+       public void setFaxId (final Long faxId) {
+               this.faxId = faxId;
        }
 
        @Override
-       public Long getFaxNumberId () {
-               return this.faxNumberId;
+       public Long getFaxNumber () {
+               return this.faxNumber;
        }
 
        @Override
-       public void setFaxNumberId (final Long faxNumberId) {
-               this.faxNumberId = faxNumberId;
+       public void setFaxNumber (final Long faxNumber) {
+               this.faxNumber = faxNumber;
        }
 
        @Override
@@ -697,23 +745,23 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
        }
 
        @Override
-       public Long getMobileNumber () {
-               return this.mobileNumber;
+       public Long getMobileId () {
+               return this.mobileId;
        }
 
        @Override
-       public void setMobileNumber (Long mobileNumber) {
-               this.mobileNumber = mobileNumber;
+       public void setMobileId (final Long mobileId) {
+               this.mobileId = mobileId;
        }
 
        @Override
-       public Long getMobileNumberId () {
-               return this.mobileNumberId;
+       public Long getMobileNumber () {
+               return this.mobileNumber;
        }
 
        @Override
-       public void setMobileNumberId (final Long mobileNumberId) {
-               this.mobileNumberId = mobileNumberId;
+       public void setMobileNumber (Long mobileNumber) {
+               this.mobileNumber = mobileNumber;
        }
 
        @Override
@@ -766,24 +814,35 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
                        // Get initial context
                        Context context = new InitialContext();
 
-                       // Try to lookup (general)
-                       this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jjobs-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
+                       // 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/jjobs-ejb/adminContact!org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote"); //NOI18N
+                       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 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;
+       }
+
        /**
         * Clears this bean
         */
        private void clear () {
                // Clear all data
                // - personal data
-               this.setGender(null);
                this.setTitle(null);
                this.setFirstName(null);
                this.setFamilyName(null);
@@ -851,6 +910,12 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
                if (null == contact) {
                        // Throw NPE
                        throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Invalid id
+                       throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
                }
 
                // Update all fields
@@ -864,12 +929,9 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
                contact.setContactZipCode(this.getZipCode());
                contact.setContactCity(this.getCity());
                contact.setContactCountry(this.getCountry());
-               contact.setContactEmailAddress(this.getEmailAddress());
-               contact.setContactBirthday(this.getBirthday());
-               contact.setContactComment(this.getComment());
 
-               // Update contact's mobile number
-               this.isMobileUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber());
+               // Update contact's cellphone number
+               this.isMobileNumberUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber());
 
                // Update contact's land-line number
                this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
index 1bc2438a6a099cdb8d792d57c8eb9ca01384dfaa..da3b3785277a2ac32df343c294e4052df2b47ab1 100644 (file)
@@ -24,7 +24,6 @@ import org.mxchange.jcountry.data.Country;
 import org.mxchange.jphone.phonenumbers.DialableNumber;
 import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 
 /**
  * An administrative interface for user beans
@@ -41,22 +40,6 @@ public interface JobsAdminContactWebRequestController extends Serializable {
         */
        String addContact ();
 
-       /**
-        * Deletes contact data
-        * <p>
-        * @param contact Contact instance to be deleted
-        * <p>
-        * @return Redirect outcome
-        */
-       String deleteContactData (final Contact contact);
-
-       /**
-        * Event observer for newly added users by adminstrator
-        * <p>
-        * @param event Event being fired
-        */
-       void afterAdminAddedUserEvent (final ObservableAdminAddedUserEvent event);
-
        /**
         * Creates an instance from contact data
         * <p>
@@ -79,32 +62,32 @@ public interface JobsAdminContactWebRequestController extends Serializable {
        String editContactData ();
 
        /**
-        * Getter for mobile id
+        * Getter for cellphone id
         * <p>
         * @return Mobile id
         */
-       Long getMobileNumberId ();
+       Long getMobileId ();
 
        /**
-        * Setter for mobile number id
+        * Setter for cellphone id
         * <p>
-        * @param mobileNumberId Mobile number id
+        * @param cellphoneId Mobile id
         */
-       void setMobileNumberId (final Long mobileNumberId);
+       void setMobileId (final Long cellphoneId);
 
        /**
         * Getter for fax id
         * <p>
         * @return Fax id
         */
-       Long getFaxNumberId ();
+       Long getFaxId ();
 
        /**
-        * Setter for fax number id
+        * Setter for fax id
         * <p>
-        * @param faxNumberId Fax number id
+        * @param faxId Fax id
         */
-       void setFaxNumberId (final Long faxNumberId);
+       void setFaxId (final Long faxId);
 
        /**
         * Getter for land-line id
@@ -135,28 +118,28 @@ public interface JobsAdminContactWebRequestController extends Serializable {
        void setBirthday (final Date birthday);
 
        /**
-        * Getter for mobile provider
+        * Getter for ellphone number's carrier
         * <p>
-        * @return mobile provider
+        * @return Mobile number's carrier
         */
        MobileProvider getMobileProvider ();
 
        /**
-        * Setter for mobile provider
+        * Setter for cellphone number's carrier prefix
         * <p>
-        * @param mobileProvider Mobile provider
+        * @param cellphoneCarrier Mobile number's carrier prefix
         */
-       void setMobileProvider (final MobileProvider mobileProvider);
+       void setMobileProvider (final MobileProvider cellphoneCarrier);
 
        /**
-        * Getter for mobile number
+        * Getter for ellphone number
         * <p>
         * @return Mobile number
         */
        Long getMobileNumber ();
 
        /**
-        * Setter for mobile number
+        * Setter for ellphone number
         * <p>
         * @param mobileNumber Mobile number
         */
@@ -456,7 +439,7 @@ public interface JobsAdminContactWebRequestController extends Serializable {
        String generatePhoneNumber (final DialableNumber phoneNumber);
 
        /**
-        * Returns a text representation of given mobile number or null if not
+        * Returns a text representation of given cellphone number or null if not
         * set.
         * <p>
         * @param mobileNumber Mobile number
@@ -465,4 +448,12 @@ public interface JobsAdminContactWebRequestController extends Serializable {
         */
        String generateMobileNumber (final DialableMobileNumber mobileNumber);
 
+       /**
+        * Checks/returns whether the gender/salutation is required for this
+        * controller.
+        * <p>
+        * @return Whether gender is required
+        */
+       boolean isGenderRequired ();
+
 }
index abbaea24e8e3df9ea91985620b734fc7f96890e7..7a515449e7c93a31d071785d80d2159bad6d186c 100644 (file)
@@ -174,29 +174,29 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
        private boolean isMobileUnlinked;
 
        /**
-        * Mobile number's carrier
+        * Phone number area code
         */
-       private MobileProvider mobileCarrier;
+       private Integer landLineAreaCode;
 
        /**
-        * Mobile number
+        * Country instance for phone number
         */
-       private Long mobileNumber;
+       private Country landLineCountry;
 
        /**
-        * Phone number area code
+        * Phone number
         */
-       private Integer phoneAreaCode;
+       private Long landLineNumber;
 
        /**
-        * Country instance for phone number
+        * Mobile number
         */
-       private Country phoneCountry;
+       private Long mobileNumber;
 
        /**
-        * Phone number
+        * Mobile number's carrier
         */
-       private Long phoneNumber;
+       private MobileProvider mobileProvider;
 
        /**
         * A list of all selectable contacts
@@ -471,8 +471,8 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
 
                // Generate phone number
-               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
-               DialableMobileNumber mobile = new MobileNumber(this.getMobileCarrier(), this.getMobileNumber());
+               DialableLandLineNumber phone = 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());
 
                // Create new contact
@@ -488,7 +488,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                contact.setContactComment(this.getComment());
 
                // Don't set null or wrong references
-               if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
+               if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
                        // Now the number must be given
                        if (phone.getPhoneAreaCode() == null) {
                                // Is null
@@ -530,7 +530,7 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                }
 
                // Is the provider set?
-               if ((mobile instanceof DialableMobileNumber) && (this.getMobileCarrier() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
+               if ((mobile instanceof DialableMobileNumber) && (this.getMobileProvider() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
                        // Is the number set?
                        if (mobile.getPhoneNumber() == null) {
                                // Is null
@@ -583,10 +583,10 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                contact.setContactCountry(this.getCountry());
 
                // Update contact's mobile number
-               this.isMobileUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileCarrier(), this.getMobileNumber());
+               this.isMobileUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber());
 
                // Update contact's land-line number
-               this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+               this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
 
                // Update contact's fax number
                this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
@@ -752,53 +752,53 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
        }
 
        @Override
-       public MobileProvider getMobileCarrier () {
-               return this.mobileCarrier;
+       public Integer getLandLineAreaCode () {
+               return this.landLineAreaCode;
        }
 
        @Override
-       public void setMobileCarrier (final MobileProvider mobileCarrier) {
-               this.mobileCarrier = mobileCarrier;
+       public void setLandLineAreaCode (final Integer landLineAreaCode) {
+               this.landLineAreaCode = landLineAreaCode;
        }
 
        @Override
-       public Long getMobileNumber () {
-               return this.mobileNumber;
+       public Country getLandLineCountry () {
+               return this.landLineCountry;
        }
 
        @Override
-       public void setMobileNumber (final Long mobileNumber) {
-               this.mobileNumber = mobileNumber;
+       public void setLandLineCountry (final Country landLineCountry) {
+               this.landLineCountry = landLineCountry;
        }
 
        @Override
-       public Integer getPhoneAreaCode () {
-               return this.phoneAreaCode;
+       public Long getLandLineNumber () {
+               return this.landLineNumber;
        }
 
        @Override
-       public void setPhoneAreaCode (final Integer phoneAreaCode) {
-               this.phoneAreaCode = phoneAreaCode;
+       public void setLandLineNumber (final Long landLineNumber) {
+               this.landLineNumber = landLineNumber;
        }
 
        @Override
-       public Country getPhoneCountry () {
-               return this.phoneCountry;
+       public Long getMobileNumber () {
+               return this.mobileNumber;
        }
 
        @Override
-       public void setPhoneCountry (final Country phoneCountry) {
-               this.phoneCountry = phoneCountry;
+       public void setMobileNumber (final Long mobileNumber) {
+               this.mobileNumber = mobileNumber;
        }
 
        @Override
-       public Long getPhoneNumber () {
-               return this.phoneNumber;
+       public MobileProvider getMobileProvider () {
+               return this.mobileProvider;
        }
 
        @Override
-       public void setPhoneNumber (final Long phoneNumber) {
-               this.phoneNumber = phoneNumber;
+       public void setMobileProvider (final MobileProvider mobileProvider) {
+               this.mobileProvider = mobileProvider;
        }
 
        @Override
@@ -1029,10 +1029,10 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                // - contact data
                this.setEmailAddress(null);
                this.setEmailAddressRepeat(null);
-               this.setPhoneAreaCode(null);
-               this.setPhoneCountry(null);
-               this.setPhoneNumber(null);
-               this.setMobileCarrier(null);
+               this.setLandLineAreaCode(null);
+               this.setLandLineCountry(null);
+               this.setLandLineNumber(null);
+               this.setMobileProvider(null);
                this.setMobileNumber(null);
                this.setFaxAreaCode(null);
                this.setFaxCountry(null);
@@ -1084,13 +1084,13 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
 
                // - contact data
                if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneAreaCode() > 0)) {
-                       this.setPhoneCountry(phone.getPhoneCountry());
-                       this.setPhoneAreaCode(phone.getPhoneAreaCode());
-                       this.setPhoneNumber(phone.getPhoneNumber());
+                       this.setLandLineCountry(phone.getPhoneCountry());
+                       this.setLandLineAreaCode(phone.getPhoneAreaCode());
+                       this.setLandLineNumber(phone.getPhoneNumber());
                }
 
                if ((mobile instanceof DialableMobileNumber) && (mobile.getMobileProvider() instanceof MobileProvider)) {
-                       this.setMobileCarrier(mobile.getMobileProvider());
+                       this.setMobileProvider(mobile.getMobileProvider());
                        this.setMobileNumber(mobile.getPhoneNumber());
                }
 
index b5e2f81f73f53654279abc4b5ed858fb7d8d0242..0fdd03d10bf605c414b1df29441092bc921219f3 100644 (file)
@@ -91,14 +91,14 @@ public interface JobsContactWebSessionController extends Serializable {
         * <p>
         * @return Mobile number's carrier
         */
-       MobileProvider getMobileCarrier ();
+       MobileProvider getMobileProvider ();
 
        /**
         * Setter for mobile number's carrier prefix
         * <p>
         * @param mobileCarrier Mobile number's carrier prefix
         */
-       void setMobileCarrier (final MobileProvider mobileCarrier);
+       void setMobileProvider (final MobileProvider mobileCarrier);
 
        /**
         * Getter for mobile number
@@ -302,42 +302,42 @@ public interface JobsContactWebSessionController extends Serializable {
         * <p>
         * @return Phone number's area code
         */
-       Integer getPhoneAreaCode ();
+       Integer getLandLineAreaCode ();
 
        /**
         * Setter for phone number's area code
         * <p>
         * @param phoneAreaCode Phone number's area code
         */
-       void setPhoneAreaCode (final Integer phoneAreaCode);
+       void setLandLineAreaCode (final Integer phoneAreaCode);
 
        /**
         * Getter for phone number's country instance
         * <p>
         * @return Phone number's country instance
         */
-       Country getPhoneCountry ();
+       Country getLandLineCountry ();
 
        /**
         * Setter for phone number's country instance
         * <p>
         * @param phoneCountry Phone number's country instance
         */
-       void setPhoneCountry (final Country phoneCountry);
+       void setLandLineCountry (final Country phoneCountry);
 
        /**
         * Getter for phone number
         * <p>
         * @return Phone number
         */
-       Long getPhoneNumber ();
+       Long getLandLineNumber ();
 
        /**
         * Setter for phone number
         * <p>
         * @param phoneNumber Phone number
         */
-       void setPhoneNumber (final Long phoneNumber);
+       void setLandLineNumber (final Long phoneNumber);
 
        /**
         * Street