]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 23 Aug 2016 15:34:05 +0000 (17:34 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 24 Aug 2016 19:45:50 +0000 (21:45 +0200)
- fixed administrative fax listing (column data was in facet=header)
- added event observer afterAdminLinked(Fax|LandLine|Mobile)NumberEvent()
- these observers only add new (not existing) phone numbers to the corresponding lists

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java
src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebApplicationBean.java
src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebApplicationController.java
web/admin/fax/admin_fax_list.xhtml

index e087f813b170adccf7f7d6c4a2d66a6e0c2975fa..1f4ee396cbd9bf4b003f005e64adac801e3eb1c0 100644 (file)
@@ -1231,13 +1231,13 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                // Is it valid?
                if (null == faxNumber) {
                        // Throw NPE
-                       throw new NullPointerException("faxNumber is null");
+                       throw new NullPointerException("faxNumber is null"); //NOI18N
                } else if (faxNumber.getPhoneId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("faxNumber.phoneId is null");
+                       throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
                } else if (faxNumber.getPhoneId() < 1) {
                        // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId()));
+                       throw new NullPointerException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId())); //NOI18N
                }
 
                // Loop through all contacts
@@ -1259,13 +1259,13 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
                // Is it valid?
                if (null == landLineNumber) {
                        // Throw NPE
-                       throw new NullPointerException("landLineNumber is null");
+                       throw new NullPointerException("landLineNumber is null"); //NOI18N
                } else if (landLineNumber.getPhoneId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("landLineNumber.phoneId is null");
+                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
                } else if (landLineNumber.getPhoneId() < 1) {
                        // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId()));
+                       throw new NullPointerException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId())); //NOI18N
                }
 
                // Loop through all contacts
@@ -1284,23 +1284,32 @@ public class JobsContactWebSessionBean extends BaseJobsController implements Job
         * @param mobileNumber Mobile number to remove
         */
        private void removeFromContacts (final DialableMobileNumber mobileNumber) {
+               // Log message
+               System.out.println(MessageFormat.format("{0}.removeFromContacts: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
                // Is it valid?
                if (null == mobileNumber) {
                        // Throw NPE
-                       throw new NullPointerException("mobileNumber is null");
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
                } else if (mobileNumber.getPhoneId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneId is null");
+                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
                } else if (mobileNumber.getPhoneId() < 1) {
                        // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId()));
+                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
                }
 
                // Loop through all contacts
                for (final Contact contact : this.contacts) {
+                       // Log message
+                       System.out.println(MessageFormat.format("{0}.removeFromContacts: contact={1}", this.getClass().getSimpleName(), contact)); //NOI18N
+
                        // Is the number set?
                        if (Objects.equals(contact.getContactMobileNumber(), mobileNumber)) {
-                               // Found it
+                               // Log message
+                               System.out.println(MessageFormat.format("{0}.removeFromContacts: Unsetting ...", this.getClass().getSimpleName())); //NOI18N
+
+                               // Unset it
                                contact.setContactMobileNumber(null);
                        }
                }
index 09dcbecaf842062b3ad8990db6fe673cc009eeab..138f07f282721bf935ed67c85e908dd78f4ac6e4 100644 (file)
@@ -31,6 +31,9 @@ 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.jcontacts.events.fax.linked.AdminLinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.landline.linked.AdminLinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
 import org.mxchange.jjobs.beans.BaseJobsController;
 import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
@@ -220,6 +223,132 @@ public class JobsPhoneWebApplicationBean extends BaseJobsController implements J
                this.clear();
        }
 
+       @Override
+       public void afterAdminLinkedFaxNumberEvent (@Observes final AdminLinkedFaxNumberEvent event) {
+               // Is the event fine?
+               if (event == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact is null");
+               } else if (event.getContact().getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId is null");
+               } else if (event.getContact().getContactId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId="+ event.getContact().getContactId() + " is invalid");
+               } else if (event.getContact().getContactFaxNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactFaxNumber is null");
+               } else if (event.getContact().getContactFaxNumber().getPhoneId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId is null");
+               } else if (event.getContact().getContactFaxNumber().getPhoneId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId="+event.getContact().getContactFaxNumber().getPhoneId() + " is invalid");
+               } else if (event.getLinkedFaxNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.linkedFaxNumer is null");
+               }
+
+               // Log message
+               System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedFaxNumberEvent: event.linkedFaxNumber.phoneId=" + event.getLinkedFaxNumber().getPhoneId());
+
+               // Is the id number in linked number not set?
+               if (event.getLinkedFaxNumber().getPhoneId() == null) {
+                       // Log message
+                       System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedFaxNumberEvent: Adding to list: "+event.getContact().getContactFaxNumber());
+
+                       // Then it is a new number, so add it from contact as there the id number has been set
+                       this.uniqueAddFaxNumber(event.getContact().getContactFaxNumber());
+               }
+       }
+
+       @Override
+       public void afterAdminLinkedLandLineNumberEvent (@Observes final AdminLinkedLandLineNumberEvent event) {
+               // Is the event fine?
+               if (event == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact is null");
+               } else if (event.getContact().getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId is null");
+               } else if (event.getContact().getContactId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId="+ event.getContact().getContactId() + " is invalid");
+               } else if (event.getContact().getContactLandLineNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactLandLineNumber is null");
+               } else if (event.getContact().getContactLandLineNumber().getPhoneId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId is null");
+               } else if (event.getContact().getContactLandLineNumber().getPhoneId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId="+event.getContact().getContactLandLineNumber().getPhoneId() + " is invalid");
+               } else if (event.getLinkedLandLineNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.linkedLandLineNumer is null");
+               }
+
+               // Log message
+               System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedLandLineNumberEvent: event.linkedLandLineNumber.phoneId=" + event.getLinkedLandLineNumber().getPhoneId());
+
+               // Is the id number in linked number not set?
+               if (event.getLinkedLandLineNumber().getPhoneId() == null) {
+                       // Log message
+                       System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedLandLineNumberEvent: Adding to list: "+event.getContact().getContactLandLineNumber());
+
+                       // Then it is a new number, so add it from contact as there the id number has been set
+                       this.uniqueAddLandLineNumber(event.getContact().getContactLandLineNumber());
+               }
+       }
+
+       @Override
+       public void afterAdminLinkedMobileNumberEvent (@Observes final AdminLinkedMobileNumberEvent event) {
+               // Is the event fine?
+               if (event == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact is null");
+               } else if (event.getContact().getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId is null");
+               } else if (event.getContact().getContactId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId="+ event.getContact().getContactId() + " is invalid");
+               } else if (event.getContact().getContactMobileNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactMobileNumber is null");
+               } else if (event.getContact().getContactMobileNumber().getPhoneId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactMobileNumber.phoneId is null");
+               } else if (event.getContact().getContactMobileNumber().getPhoneId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactMobileNumber.phoneId="+event.getContact().getContactMobileNumber().getPhoneId() + " is invalid");
+               } else if (event.getLinkedMobileNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.linkedMobileNumer is null");
+               }
+
+               // Log message
+               System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedMobileNumberEvent: event.linkedMobileNumber.phoneId=" + event.getLinkedMobileNumber().getPhoneId());
+
+               // Is the id number in linked number not set?
+               if (event.getLinkedMobileNumber().getPhoneId() == null) {
+                       // Log message
+                       System.out.println(this.getClass().getSimpleName()+".afterAdminLinkedMobileNumberEvent: Adding to list: "+event.getContact().getContactMobileNumber());
+
+                       // Then it is a new number, so add it from contact as there the id number has been set
+                       this.uniqueAddMobileNumber(event.getContact().getContactMobileNumber());
+               }
+       }
+
        @Override
        public void afterAdminUpdatedContactDataEvent (@Observes final AdminUpdatedContactEvent event) {
                // event should not be null
index 8550f90d5bf208a6a005118969233719a08471b5..ff08165466e61954daecbdb5a4e7de34dd9c8367 100644 (file)
@@ -21,6 +21,9 @@ import java.util.List;
 import javax.ejb.Local;
 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.fax.linked.AdminLinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.landline.linked.AdminLinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
 import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
 import org.mxchange.jphone.events.landline.deleted.AdminDeletedLandLineNumberEvent;
@@ -57,26 +60,53 @@ public interface JobsPhoneWebApplicationController extends Serializable {
        void afterAdminAddedContactEvent (final AdminAddedContactEvent event);
 
        /**
-        * Observes events being fired when an administrator has deleted a fax number
+        * Observes events being fired when an administrator has deleted a fax
+        * number
         * <p>
         * @param event Event being fired
         */
        void afterAdminDeletedFaxNumberEvent (final AdminDeletedFaxNumberEvent event);
 
        /**
-        * Observes events being fired when an administrator has deleted a land-line number
+        * Observes events being fired when an administrator has deleted a land-line
+        * number
         * <p>
         * @param event Event being fired
         */
        void afterAdminDeletedLandLineNumberEvent (final AdminDeletedLandLineNumberEvent event);
 
        /**
-        * Observes events being fired when an administrator has deleted a mobile number
+        * Observes events being fired when an administrator has deleted a mobile
+        * number
         * <p>
         * @param event Event being fired
         */
        void afterAdminDeletedMobileNumberEvent (final AdminDeletedMobileNumberEvent event);
 
+       /**
+        * Observes events being fired when an administrator has a linked a fax
+        * number
+        * <p>
+        * @param event Event being fired
+        */
+       void afterAdminLinkedFaxNumberEvent (final AdminLinkedFaxNumberEvent event);
+
+       /**
+        * Observes events being fired when an administrator has a linked a
+        * land-line number
+        * <p>
+        * @param event Event being fired
+        */
+       void afterAdminLinkedLandLineNumberEvent (final AdminLinkedLandLineNumberEvent event);
+
+       /**
+        * Observes events being fired when an administrator has a linked a mobile
+        * number
+        * <p>
+        * @param event Event being fired
+        */
+       void afterAdminLinkedMobileNumberEvent (final AdminLinkedMobileNumberEvent event);
+
        /**
         * Observes events being fired when an administrator has updated a fax
         * number.
index 96c527c193b6f75b3398964720cdb7136f012536..ee4f4ceb3187f30ca6248ed5ce995b98cdf8dadb 100644 (file)
 
                                <h:column>
                                        <f:facet name="header">
-                                               <h:outputLabel for="phoneNumber" value="#{msg.PERSONAL_DATA_PHONE_NUMBER}" />
-
-                                               <h:outputText id="phoneNumber" value="#{faxNumber.phoneCountry.countryAbroadDialPrefix}#{faxNumber.phoneCountry.countryPhoneCode} (#{faxNumber.phoneAreaCode}) #{faxNumber.phoneNumber}" />
+                                               <h:outputLabel for="phoneNumber" value="#{msg.ADMIN_SHOW_PHONE_NUMBER}" />
                                        </f:facet>
+
+                                       <h:outputText id="phoneNumber" value="#{faxNumber.phoneCountry.countryAbroadDialPrefix}#{faxNumber.phoneCountry.countryPhoneCode} (#{faxNumber.phoneAreaCode}) #{faxNumber.phoneNumber}" />
                                </h:column>
 
                                <h:column>