]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
API has changed: no more cellphone, now is mobile
authorRoland Haeder <roland@mxchange.org>
Tue, 11 Apr 2017 10:47:54 +0000 (12:47 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 11 Apr 2017 10:47:54 +0000 (12:47 +0200)
12 files changed:
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionController.java
src/java/org/mxchange/pizzaapplication/beans/contact/phone/PizzaContactPhoneWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/email_address/PizzaEmailChangeWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/resendlink/PizzaResendLinkWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/password/PizzaUserPasswordWebRequestBean.java
src/java/org/mxchange/pizzaapplication/converter/cellphone/PizzaCellphoneConverter.java [deleted file]
src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileConverter.java [new file with mode: 0644]

index 9c0d356c2ea5cc074a7865ba4f32cc486f0d75cd..2c9f1e5417003a5e9aa9488883b2d289f9f2baa9 100644 (file)
@@ -30,6 +30,7 @@ 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;
@@ -42,12 +43,12 @@ import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jphone.phonenumbers.DialableNumber;
-import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 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.pizzaapplication.beans.BasePizzaController;
 import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestController;
@@ -73,6 +74,11 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
        @Any
        private Event<AdminAddedContactEvent> addedContactEvent;
 
+       /**
+        * Administrative contact EJB
+        */
+       private AdminContactSessionBeanRemote adminContactBean;
+
        /**
         * Admin helper instance
         */
@@ -248,6 +254,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
 
                        // 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
                } catch (final NamingException e) {
                        // Throw again
                        throw new FaceletException(e);
@@ -256,6 +265,24 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
 
        @Override
        public String addContact () {
+               // 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
+               }
+
                // Create new contact instance
                Contact contact = this.createContactInstance();
 
@@ -271,7 +298,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                // Try to call EJB
                try {
                        // Call EJB
-                       updatedContact = this.contactBean.addContact(contact);
+                       updatedContact = this.adminContactBean.addContact(contact);
                } catch (final ContactAlreadyAddedException ex) {
                        // Throw again
                        throw new FaceletException(ex);
@@ -324,7 +351,7 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
                        // ... cellphone data
                        this.setCellphoneId(contact.getContactMobileNumber().getPhoneId());
-                       this.setCellphoneCarrier(contact.getContactMobileNumber().getCellphoneProvider());
+                       this.setCellphoneCarrier(contact.getContactMobileNumber().getMobileProvider());
                        this.setCellphoneNumber(contact.getContactMobileNumber().getPhoneNumber());
                }
 
@@ -371,9 +398,9 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                }
 
                // Generate phone number
-               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
-               DialableMobileNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
-               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+               DialableLandLineNumber landLineNumber = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+               DialableMobileNumber mobileNumber = new MobileNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
+               DialableFaxNumber faxNumber = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Create new instance
                Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
@@ -393,60 +420,60 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                contact.setContactOwnContact(Boolean.TRUE);
 
                // 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 ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
                        // Now the number must be given
-                       if (phone.getPhoneAreaCode() == null) {
+                       if (landLineNumber.getPhoneAreaCode() == null) {
                                // Is null
                                throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
-                       } else if (phone.getPhoneAreaCode() < 1) {
+                       } else if (landLineNumber.getPhoneAreaCode() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
-                       } else if (phone.getPhoneNumber() == null) {
+                       } else if (landLineNumber.getPhoneNumber() == null) {
                                // Is null
                                throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
-                       } else if (phone.getPhoneNumber() < 1) {
+                       } else if (landLineNumber.getPhoneNumber() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
                        }
 
                        // Set phone number
-                       contact.setContactLandLineNumber(phone);
+                       contact.setContactLandLineNumber(landLineNumber);
                }
 
                // 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)) {
+               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.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) {
+                       if (faxNumber.getPhoneAreaCode() == null) {
                                // Is null
                                throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
-                       } else if (fax.getPhoneAreaCode() < 1) {
+                       } else if (faxNumber.getPhoneAreaCode() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
-                       } else if (fax.getPhoneNumber() == null) {
+                       } else if (faxNumber.getPhoneNumber() == null) {
                                // Is null
                                throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
-                       } else if (fax.getPhoneNumber() < 1) {
+                       } else if (faxNumber.getPhoneNumber() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
                        }
 
                        // Set fax number
-                       contact.setContactFaxNumber(fax);
+                       contact.setContactFaxNumber(faxNumber);
                }
 
                // Is the provider set?
-               if ((cellphone instanceof DialableMobileNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) {
+               if ((mobileNumber instanceof DialableMobileNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) {
                        // Is the number set?
-                       if (cellphone.getPhoneNumber() == null) {
+                       if (mobileNumber.getPhoneNumber() == null) {
                                // Is null
                                throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
-                       } else if (cellphone.getPhoneNumber() < 1) {
+                       } else if (mobileNumber.getPhoneNumber() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
                        }
 
                        // Set cellphone number
-                       contact.setContactCellphoneNumber(cellphone);
+                       contact.setContactMobileNumber(mobileNumber);
                }
 
                // Return it
@@ -497,8 +524,8 @@ public class PizzaAdminContactWebRequestBean extends BasePizzaController impleme
                // Get all data
                String number = String.format(
                           "%s%d%d", //NOI18N
-                          cellphoneNumber.getCellphoneProvider().getProviderCountry().getCountryExternalDialPrefix(),
-                          cellphoneNumber.getCellphoneProvider().getProviderDialPrefix(),
+                          cellphoneNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(),
+                          cellphoneNumber.getMobileProvider().getProviderDialPrefix(),
                           cellphoneNumber.getPhoneNumber()
           );
 
index 2ccf58346d2b8336b1f7e1e9fa82ae63954f1b25..ae17941e4f3d2a8afa9dbef531b3b62bd294e70d 100644 (file)
@@ -41,12 +41,12 @@ import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 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.confirmation.UserConfirmedAccountEvent;
 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
@@ -79,12 +79,12 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
        private Date birthday;
 
        /**
-        * Cellphone number's carrier
+        * Mobile number's carrier
         */
        private MobileProvider cellphoneCarrier;
 
        /**
-        * Cellphone number
+        * Mobile number
         */
        private Long cellphoneNumber;
 
@@ -171,7 +171,7 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
        /**
         * Whether a cellphone entry has been unlinked
         */
-       private boolean isCellphoneUnlinked;
+       private boolean isMobileUnlinked;
 
        /**
         * Whether a fax entry has been unlinked
@@ -450,9 +450,9 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
                }
 
                // Generate phone number
-               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
-               DialableMobileNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
-               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+               DialableLandLineNumber landLineNumber = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+               DialableMobileNumber mobileNumber = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+               DialableFaxNumber faxNumber = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Create new contact
                Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
@@ -470,60 +470,60 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
                //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: this.emailAddress={1}", this.getClass().getSimpleName(), this.getEmailAddress()));
 
                // 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 ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
                        // Now the number must be given
-                       if (phone.getPhoneAreaCode() == null) {
+                       if (landLineNumber.getPhoneAreaCode() == null) {
                                // Is null
                                throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
-                       } else if (phone.getPhoneAreaCode() < 1) {
+                       } else if (landLineNumber.getPhoneAreaCode() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
-                       } else if (phone.getPhoneNumber() == null) {
+                       } else if (landLineNumber.getPhoneNumber() == null) {
                                // Is null
                                throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
-                       } else if (phone.getPhoneNumber() < 1) {
+                       } else if (landLineNumber.getPhoneNumber() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
                        }
 
                        // Set phone number
-                       contact.setContactLandLineNumber(phone);
+                       contact.setContactLandLineNumber(landLineNumber);
                }
 
                // 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)) {
+               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.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) {
+                       if (faxNumber.getPhoneAreaCode() == null) {
                                // Is null
                                throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
-                       } else if (fax.getPhoneAreaCode() < 1) {
+                       } else if (faxNumber.getPhoneAreaCode() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
-                       } else if (fax.getPhoneNumber() == null) {
+                       } else if (faxNumber.getPhoneNumber() == null) {
                                // Is null
                                throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
-                       } else if (fax.getPhoneNumber() < 1) {
+                       } else if (faxNumber.getPhoneNumber() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
                        }
 
                        // Set fax number
-                       contact.setContactFaxNumber(fax);
+                       contact.setContactFaxNumber(faxNumber);
                }
 
                // Is the provider set?
-               if ((cellphone instanceof DialableMobileNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) {
+               if ((mobileNumber instanceof DialableMobileNumber) && (this.getMobileProvider() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
                        // Is the number set?
-                       if (cellphone.getPhoneNumber() == null) {
+                       if (mobileNumber.getPhoneNumber() == null) {
                                // Is null
                                throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
-                       } else if (cellphone.getPhoneNumber() < 1) {
+                       } else if (mobileNumber.getPhoneNumber() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
                        }
 
                        // Set cellphone number
-                       contact.setContactCellphoneNumber(cellphone);
+                       contact.setContactMobileNumber(mobileNumber);
                }
 
                // Trace message
@@ -568,7 +568,7 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
                contact.setContactCountry(this.getCountry());
 
                // Update contact's cellphone number
-               this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber());
+               this.isMobileUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getMobileProvider(), this.getMobileNumber());
 
                // Update contact's land-line number
                this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
@@ -577,7 +577,7 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
                this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Send it to the EJB
-               this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
+               this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
 
                // All fine
                return "contact_data_saved"; //NOI18N
@@ -596,22 +596,22 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
        }
 
        @Override
-       public MobileProvider getCellphoneCarrier () {
+       public MobileProvider getMobileProvider () {
                return this.cellphoneCarrier;
        }
 
        @Override
-       public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) {
-               this.cellphoneCarrier = cellphoneCarrier;
+       public void setMobileProvider (final MobileProvider mobileProvider) {
+               this.cellphoneCarrier = mobileProvider;
        }
 
        @Override
-       public Long getCellphoneNumber () {
+       public Long getMobileNumber () {
                return this.cellphoneNumber;
        }
 
        @Override
-       public void setCellphoneNumber (Long cellphoneNumber) {
+       public void setMobileNumber (Long cellphoneNumber) {
                this.cellphoneNumber = cellphoneNumber;
        }
 
@@ -1005,8 +1005,8 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
                this.setPhoneAreaCode(null);
                this.setPhoneCountry(null);
                this.setPhoneNumber(null);
-               this.setCellphoneCarrier(null);
-               this.setCellphoneNumber(null);
+               this.setMobileProvider(null);
+               this.setMobileNumber(null);
                this.setFaxAreaCode(null);
                this.setFaxCountry(null);
                this.setFaxNumber(null);
@@ -1062,9 +1062,9 @@ public class PizzaContactWebSessionBean extends BasePizzaController implements P
                        this.setPhoneNumber(phone.getPhoneNumber());
                }
 
-               if ((cellphone instanceof DialableMobileNumber) && (cellphone.getCellphoneProvider() instanceof MobileProvider)) {
-                       this.setCellphoneCarrier(cellphone.getCellphoneProvider());
-                       this.setCellphoneNumber(cellphone.getPhoneNumber());
+               if ((cellphone instanceof DialableMobileNumber) && (cellphone.getMobileProvider() instanceof MobileProvider)) {
+                       this.setMobileProvider(cellphone.getMobileProvider());
+                       this.setMobileNumber(cellphone.getPhoneNumber());
                }
 
                if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) {
index bbf548c45bd5542af4eb193c2458ce8bdb2731fd..02aae24652e0d9d3dfab1b9ca8ccf24f2041e4b7 100644 (file)
@@ -145,32 +145,32 @@ public interface PizzaContactWebSessionController extends Serializable {
        void setBirthday (final Date birthday);
 
        /**
-        * Getter for ellphone number's carrier
+        * Getter for mobile number's provider
         * <p>
-        * @return Cellphone number's carrier
+        * @return Mobile number's provider
         */
-       MobileProvider getCellphoneCarrier ();
+       MobileProvider getMobileProvider ();
 
        /**
-        * Setter for cellphone number's carrier prefix
+        * Setter for mobile number's provider
         * <p>
-        * @param cellphoneCarrier Cellphone number's carrier prefix
+        * @param mobileProvider Mobile number's provider
         */
-       void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
+       void setMobileProvider (final MobileProvider mobileProvider);
 
        /**
-        * Getter for ellphone number
+        * Getter for mobile number
         * <p>
-        * @return Cellphone number
+        * @return Mobile number
         */
-       Long getCellphoneNumber ();
+       Long getMobileNumber ();
 
        /**
-        * Setter for ellphone number
+        * Setter for mobile number
         * <p>
-        * @param cellphoneNumber Cellphone number
+        * @param mobileNumber Mobile number
         */
-       void setCellphoneNumber (final Long cellphoneNumber);
+       void setMobileNumber (final Long mobileNumber);
 
        /**
         * City
@@ -450,6 +450,7 @@ public interface PizzaContactWebSessionController extends Serializable {
         * Setter for controller type
         * <p>
         * @param controllerType Controller type
+        *
         * @deprecated Don't use this method.
         */
        @Deprecated
index a6fb36bf9df49c5d65732fe32bbdae22011be242..159d7cbea53f951ebd64c681e7a6270c01d1d15d 100644 (file)
@@ -22,7 +22,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Observes;
 import javax.faces.view.facelets.FaceletException;
@@ -34,7 +33,6 @@ import javax.naming.NamingException;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote;
 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
@@ -66,11 +64,6 @@ public class PizzaContactPhoneWebSessionBean extends BasePizzaController impleme
        @Inject
        private PizzaAdminPhoneWebRequestController adminPhoneController;
 
-       /**
-        * All cell phone numbers
-        */
-       private final List<DialableMobileNumber> cellphoneNumbers;
-
        /**
         * General contact controller
         */
@@ -100,7 +93,6 @@ public class PizzaContactPhoneWebSessionBean extends BasePizzaController impleme
                }
 
                // Init lists/maps
-               this.cellphoneNumbers = new LinkedList<>();
                this.contacts = new HashMap<>(10);
        }
 
@@ -121,15 +113,6 @@ public class PizzaContactPhoneWebSessionBean extends BasePizzaController impleme
                        throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N //NOI18N
                }
 
-               // Get contact
-               Contact contact = event.getAddedContact();
-
-               // Is cellphone set?
-               if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       // Unique-add it
-                       this.uniqueAddCellphoneNumber(contact.getContactMobileNumber());
-               }
-
                // Clear this bean
                this.clear();
        }
@@ -176,7 +159,7 @@ public class PizzaContactPhoneWebSessionBean extends BasePizzaController impleme
        @Override
        public List<Contact> allMobileContacts () {
                // Get id
-               Long phoneId = this.adminPhoneController.getCellphone().getPhoneId();
+               Long phoneId = this.adminPhoneController.getMobileNumber().getPhoneId();
 
                // Is cache there?
                if (this.contacts.containsKey(phoneId)) {
@@ -189,7 +172,7 @@ public class PizzaContactPhoneWebSessionBean extends BasePizzaController impleme
                        // "Walk" through all contacts
                        for (final Contact contact : this.contactController.allContacts()) {
                                // Is cellphone instance the same?
-                               if (Objects.equals(contact.getContactMobileNumber(), this.adminPhoneController.getCellphone())) {
+                               if (Objects.equals(contact.getContactMobileNumber(), this.adminPhoneController.getMobileNumber())) {
                                        // Found one
                                        list.add(contact);
                                }
@@ -203,15 +186,6 @@ public class PizzaContactPhoneWebSessionBean extends BasePizzaController impleme
                }
        }
 
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-               // All phone numbers
-               this.cellphoneNumbers.addAll(this.adminPhoneBean.allCellphoneNumbers());
-       }
-
        /**
         * Clears this bean
         */
index 9eb6ac19499aaaba71cf2cb452e627ec88aba95b..3c82045ae2bb2cf1f319871a8c39d58082894702 100644 (file)
@@ -31,7 +31,7 @@ import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
 import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
 import org.mxchange.jusercore.model.email_address.EmailAddressChange;
-import org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote;
+import org.mxchange.jusercore.model.email_address.UserEmailChangeSessionBeanRemote;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
 import org.mxchange.pizzaapplication.beans.features.PizzaFeaturesWebApplicationController;
@@ -69,7 +69,7 @@ public class PizzaEmailChangeWebSessionBean extends BasePizzaController implemen
        /**
         * Remote email change bean
         */
-       private final EmailChangeSessionBeanRemote emailBean;
+       private final UserEmailChangeSessionBeanRemote emailBean;
 
        /**
         * Features controller
@@ -93,7 +93,7 @@ public class PizzaEmailChangeWebSessionBean extends BasePizzaController implemen
                        Context context = new InitialContext();
 
                        // Try to lookup
-                       this.emailBean = (EmailChangeSessionBeanRemote) context.lookup("java:global/addressbook-ejb/email-change!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
+                       this.emailBean = (UserEmailChangeSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/email-change!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
 
                        // Init list
                        this.emailAddresses = this.emailBean.allQueuedAddresses();
index 52f7edbcad1c69060aeb1062c44e1911347d8140..65fbcf3cb456963ce3af4f0ea9a81e68f4473b26 100644 (file)
@@ -29,8 +29,8 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.events.AdminAddedMobileProviderEvent;
-import org.mxchange.jphone.events.AdminMobileProviderAddedEvent;
+import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.events.mobileprovider.added.AdminMobileProviderAddedEvent;
 import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException;
 import org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote;
 import org.mxchange.jphone.phonenumbers.mobileprovider.CellphoneProvider;
index 609ac53fac85741e1c4291e00fc16e7ae76b9c35..a678b272252e7ec896a8242149cebc0dce3bd36f 100644 (file)
@@ -27,7 +27,7 @@ import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jphone.events.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
index 0baad4336b6cf341083e656c39b5e2c2a210cb3f..8b4fa3faf8c345d35cc35883bd7fe266c48779e9 100644 (file)
@@ -18,7 +18,7 @@ package org.mxchange.pizzaapplication.beans.mobileprovider;
 
 import java.io.Serializable;
 import java.util.List;
-import org.mxchange.jphone.events.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 
 /**
index 63475b7c4b8872d26b00164f812f211de43503eb..f775f8a85632d732d0a157d2657ec25b4d66f56f 100644 (file)
@@ -16,8 +16,9 @@
  */
 package org.mxchange.pizzaapplication.beans.resendlink;
 
-import java.text.MessageFormat;
 import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -25,7 +26,10 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.resendlink.ResendLinkUserAccountEvent;
+import org.mxchange.jusercore.events.resendlink.UserResendLinkAccountEvent;
 import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
+import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
 import org.mxchange.jusercore.model.user.User;
@@ -70,6 +74,13 @@ public class PizzaResendLinkWebSessionBean extends BasePizzaController implement
        @Inject
        private PizzaUserWebSessionController userController;
 
+       /**
+        * Event being fired after confirmation link is being sent
+        */
+       @Inject
+       @Any
+       private Event<UserResendLinkAccountEvent> userResendLinkEvent;
+
        /**
         * Default constructor
         */
@@ -106,7 +117,8 @@ public class PizzaResendLinkWebSessionBean extends BasePizzaController implement
                        this.clear();
 
                        // Not found, should not happen as the registered validator should find it
-                       throw new FaceletException(MessageFormat.format("this.emailAddress={0} should be resolveable into User instance.", this.getEmailAddress()), ex); //NOI18N
+                       this.showFacesMessage("form_resend_link:", "ERROR_USER_EMAIL_ADDRESS_NOT_FOUND"); //NOI18N
+                       return ""; //NOI18N
                }
 
                // Is the user account already confirmed?
@@ -115,31 +127,44 @@ public class PizzaResendLinkWebSessionBean extends BasePizzaController implement
                        this.clear();
 
                        // Then abort here
-                       this.showFacesMessage("form_resend_link:resendEmailAddress", new UserStatusConfirmedException(user)); //NOI18N
+                       this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_STATUS_ALREADY_CONFIRMED"); //NOI18N
                        return ""; //NOI18N
                } else if (user.getUserAccountStatus() == UserAccountStatus.LOCKED) {
                        // Always clear bean
                        this.clear();
 
                        // User account is locked
-                       this.showFacesMessage("form_resend_link:resendEmailAddress", new UserStatusLockedException(user)); //NOI18N
+                       this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_STATUS_LOCKED"); //NOI18N
                        return ""; //NOI18N
                } else if (user.getUserConfirmKey() == null) {
                        // Status is UNCONFIRMED but confirmation key is NULL
                        throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
                }
 
-               // Get base URL
-               String baseUrl = FacesUtils.generateBaseUrl();
+               try {
+                       // Get base URL
+                       String baseUrl = FacesUtils.generateBaseUrl();
+
+                       // Call EJB and return redirect target
+                       this.emailBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl);
+               } catch (final UserNotFoundException ex) {
+                       // User not found
+                       this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_NOT_FOUND"); //NOI18N
+                       return ""; //NOI18N
+               } catch (final UserStatusLockedException | UserStatusConfirmedException ex) {
+                       // Output message, this should not happen as the confirmation key is being removed
+                       this.showFacesMessage("form_resend_link:resendEmailAddress", ex); //NOI18N
+                       return ""; //NOI18N
+               }
 
-               // Call EJB and return redirect target
-               this.emailBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl);
+               // Fire event
+               this.userResendLinkEvent.fire(new ResendLinkUserAccountEvent(user));
 
                // Clear this bean
                this.clear();
 
                // Return redirect target
-               return "resend_done"; //NOI18N
+               return "user_resend_done"; //NOI18N
        }
 
        @Override
index ae4b484a8ff08c08945116a78deb93a84f1891e4..0dee5e18cb48282f25d1b4e4f5a8b1b991072cba 100644 (file)
@@ -26,6 +26,7 @@ import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent;
 import org.mxchange.jusercore.events.user.password_change.UserUpdatedPasswordEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
@@ -173,8 +174,11 @@ public class PizzaUserPasswordWebRequestBean extends BasePizzaController impleme
                user.setUserEncryptedPassword(encryptedPassword);
 
                try {
+                       // Get base URL
+                       String baseUrl = FacesUtils.generateBaseUrl();
+
                        // All is set, then update password
-                       PasswordHistory passwordHistory = this.userBean.updateUserPassword(user);
+                       PasswordHistory passwordHistory = this.userBean.updateUserPassword(user, baseUrl);
 
                        // Fire event
                        this.userUpdatedPasswordEvent.fire(new UserUpdatedPasswordEvent(passwordHistory));
diff --git a/src/java/org/mxchange/pizzaapplication/converter/cellphone/PizzaCellphoneConverter.java b/src/java/org/mxchange/pizzaapplication/converter/cellphone/PizzaCellphoneConverter.java
deleted file mode 100644 (file)
index c15af38..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2016 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
- * 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.converter.cellphone;
-
-import java.text.MessageFormat;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
-import javax.faces.convert.FacesConverter;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
-import org.mxchange.jphone.phonenumbers.DialableNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote;
-
-/**
- * Converter for cellphone id <-> valid cellphone instance
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@FacesConverter (value = "CellphoneConverter")
-public class PizzaCellphoneConverter implements Converter {
-
-       /**
-        * Logger instance
-        */
-       @Log
-       private LoggerBeanLocal loggerBeanLocal;
-
-       /**
-        * Phone EJB
-        */
-       private PhoneSessionBeanRemote phoneBean;
-
-       /**
-        * Initialization of this converter
-        */
-       public PizzaCellphoneConverter () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Lookup logger
-                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
-
-                       // ... and user controller
-                       this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
-       }
-
-       @Override
-       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Trace message
-               // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
-
-               // Is the value null or empty?
-               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Warning message
-                       this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
-                       // Return null
-                       return null;
-               }
-
-               // Init instance
-               DialableMobileNumber cellphone = null;
-
-               try {
-                       // Try to parse the value as long
-                       Long cellphoneId = Long.valueOf(submittedValue);
-
-                       // Debug message
-                       // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId)); //NOI18N
-
-                       // Try to get cellphone instance from it
-                       cellphone = this.phoneBean.findCellphoneById(cellphoneId);
-
-                       // Debug message
-                       // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: cellphone={0}", cellphone)); //NOI18N
-               } catch (final NumberFormatException ex) {
-                       // Throw again
-                       throw new ConverterException(ex);
-               } catch (final PhoneEntityNotFoundException ex) {
-                       // Debug message
-                       this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
-               }
-
-               // Trace message
-               // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: cellphone={0} - EXIT!", cellphone)); //NOI18N
-
-               // Return it
-               return cellphone;
-       }
-
-       @Override
-       public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
-               // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
-                       // Is null
-                       return ""; //NOI18N
-               } else if (!(value instanceof DialableNumber)) {
-                       // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N
-               }
-
-               // Return category id
-               return String.valueOf(((DialableNumber) value).getPhoneId());
-       }
-
-}
diff --git a/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileConverter.java b/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileConverter.java
new file mode 100644 (file)
index 0000000..a01af81
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2016 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
+ * 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.converter.mobile;
+
+import java.text.MessageFormat;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.FacesConverter;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
+import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
+import org.mxchange.jphone.phonenumbers.DialableNumber;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote;
+
+/**
+ * Converter for mobile id <-> valid mobile instance
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter (value = "CellphoneConverter")
+public class PizzaMobileConverter implements Converter {
+
+       /**
+        * Logger instance
+        */
+       @Log
+       private LoggerBeanLocal loggerBeanLocal;
+
+       /**
+        * Phone EJB
+        */
+       private PhoneSessionBeanRemote phoneBean;
+
+       /**
+        * Initialization of this converter
+        */
+       public PizzaMobileConverter () {
+               // Try to get it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Lookup logger
+                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+
+                       // ... and user controller
+                       this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/pizzaservice-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw it
+                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+               }
+       }
+
+       @Override
+       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Trace message
+               // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
+
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Warning message
+                       this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Init instance
+               DialableMobileNumber mobile = null;
+
+               try {
+                       // Try to parse the value as long
+                       Long mobileId = Long.valueOf(submittedValue);
+
+                       // Debug message
+                       // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId)); //NOI18N
+
+                       // Try to get mobile instance from it
+                       mobile = this.phoneBean.findMobileNumberById(mobileId);
+
+                       // Debug message
+                       // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: mobile={0}", mobile)); //NOI18N
+               } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final PhoneEntityNotFoundException ex) {
+                       // Debug message
+                       this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
+               }
+
+               // Trace message
+               // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: mobile={0} - EXIT!", mobile)); //NOI18N
+
+               // Return it
+               return mobile;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+               // Is the object null?
+               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               } else if (!(value instanceof DialableNumber)) {
+                       // Not same interface
+                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N
+               }
+
+               // Return category id
+               return String.valueOf(((DialableNumber) value).getPhoneId());
+       }
+
+}