From 0777661c1867334838f946fcb0fac2bd550eb218 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 20 Aug 2017 23:28:15 +0200 Subject: [PATCH] Repeated past commit: - renamed "copy" methods to "notify" as these methods don't copy properties but notify other controllers - sorted members MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../AddressbookWebRequestHelperBean.java | 287 +++++++++--------- web/admin/contact/admin_contact_edit.xhtml | 2 +- web/admin/contact/admin_contact_show.xhtml | 2 +- web/admin/fax/admin_fax_delete.xhtml | 2 +- web/admin/fax/admin_fax_edit.xhtml | 2 +- web/admin/fax/admin_fax_show.xhtml | 2 +- .../landline/admin_landline_delete.xhtml | 2 +- web/admin/landline/admin_landline_edit.xhtml | 2 +- web/admin/landline/admin_landline_show.xhtml | 2 +- web/admin/mobile/admin_mobile_delete.xhtml | 2 +- web/admin/mobile/admin_mobile_edit.xhtml | 2 +- web/admin/mobile/admin_mobile_show.xhtml | 2 +- web/admin/user/admin_user_activity_log.xhtml | 2 +- web/admin/user/admin_user_delete.xhtml | 2 +- web/admin/user/admin_user_edit.xhtml | 2 +- web/admin/user/admin_user_lock.xhtml | 2 +- .../admin_user_resend_confirmation_link.xhtml | 2 +- web/admin/user/admin_user_show.xhtml | 2 +- web/admin/user/admin_user_unlock.xhtml | 2 +- 19 files changed, 164 insertions(+), 159 deletions(-) diff --git a/src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelperBean.java b/src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelperBean.java index e66d19f4..bed5ac52 100644 --- a/src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelperBean.java +++ b/src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelperBean.java @@ -157,11 +157,141 @@ public class AddressbookWebRequestHelperBean implements AddressbookWebRequestHel } /** - * Copies currently set contact instances data to adminContactController + * Getter for contact instance + *

+ * @return Contact instance + */ + public Contact getContact () { + return this.contact; + } + + /** + * Setter for contact instance + *

+ * @param contact Contact instance + */ + public void setContact (final Contact contact) { + // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); + // System.out.println(MessageFormat.format("{0}: Setting contact={1}, previous: {2}, caller: {3}", this.getClass().getSimpleName(), contact, this.contact, caller)); + this.contact = contact; + } + + /** + * Returns a message key depending on if this contact is a user and/or a + * contact. If this contact is unused, a default key is returned. + *

+ * @param contact Contact instance to check + *

+ * @return Message key + */ + public String getContactUsageMessageKey (final Contact contact) { + // The contact must be valid + if (null == contact) { + // Throw NPE + throw new NullPointerException("contact is null"); //NOI18N + } else if (contact.getContactId() == null) { + // Throw again ... + throw new NullPointerException("contact.contactId is null"); //NOI18N + } else if (contact.getContactId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N + } + + // Default key is "unused" + String messageKey = "CONTACT_IS_UNUSED"; //NOI18N + + // Check user contact + boolean isUserContact = this.userController.isContactFound(contact); + + // Check user first + if (isUserContact) { + // Only user + messageKey = "CONTACT_IS_USER"; //NOI18N + } + + // Return message key + return messageKey; + } + + /** + * Getter for dialable fax number + *

+ * @return Dialable fax number + */ + public DialableFaxNumber getFaxNumber () { + return this.faxNumber; + } + + /** + * Setter for dialable fax number + *

+ * @param faxNumber Dialable fax number + */ + public void setFaxNumber (final DialableFaxNumber faxNumber) { + this.faxNumber = faxNumber; + } + + /** + * Getter for dialable land-line number + *

+ * @return Dialable land-line number + */ + public DialableLandLineNumber getLandLineNumber () { + return this.landLineNumber; + } + + /** + * Setter for dialable land-line number + *

+ * @param landLineNumber Dialable land-line number + */ + public void setLandLineNumber (final DialableLandLineNumber landLineNumber) { + this.landLineNumber = landLineNumber; + } + + /** + * Getter for dialable mobile number + *

+ * @return Dialable mobile number + */ + public DialableMobileNumber getMobileNumber () { + return this.mobileNumber; + } + + /** + * Setter for dialable mobile number + *

+ * @param mobileNumber Dialable mobile number + */ + public void setMobileNumber (final DialableMobileNumber mobileNumber) { + this.mobileNumber = mobileNumber; + } + + /** + * Getter for user instance + *

+ * @return User instance + */ + public User getUser () { + return this.user; + } + + /** + * Setter for user instance + *

+ * @param user User instance + */ + public void setUser (final User user) { + this.user = user; + } + + /** + * Notifies other controllers (backing beans) if a contact id has been + * successfully converted to a Contact instance. */ - public void copyContactToController () { + public void notifyControllerContactConverted () { // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); - // System.out.println(MessageFormat.format("{0}.copyContactToController: CALLED, caller: {2}", this.getClass().getSimpleName(), this.contact, caller)); + // System.out.println(MessageFormat.format("{0}.notifyControllerContactConverted: CALLED, caller: {2}", this.getClass().getSimpleName(), this.contact, caller)); // Validate contact instance if (this.getContact() == null) { @@ -183,9 +313,10 @@ public class AddressbookWebRequestHelperBean implements AddressbookWebRequestHel } /** - * Copies currently set fax number's data to admin phone controller + * Notifies other controllers (backing beans) if a phone id has been + * successfully converted to a DialableFaxNumber instance. */ - public void copyFaxNumberToController () { + public void notifyControllerFaxNumberConverted () { // Validate fax instance if (this.getFaxNumber() == null) { // Throw NPE @@ -224,9 +355,10 @@ public class AddressbookWebRequestHelperBean implements AddressbookWebRequestHel } /** - * Copies currently set land-line number's data to admin phone controller + * Notifies other controllers (backing beans) if a phone id has been + * successfully converted to a DialableLandLineNumber instance. */ - public void copyLandLineNumberToController () { + public void notifyControllerLandLineNumberConverted () { // Validate land-line instance if (this.getLandLineNumber() == null) { // Throw NPE @@ -265,9 +397,10 @@ public class AddressbookWebRequestHelperBean implements AddressbookWebRequestHel } /** - * Copies currently set mobile number's data to admin phone controller + * Notifies other controllers (backing beans) if a phone id has been + * successfully converted to a DialableMobileNumber instance. */ - public void copyMobileNumberToController () { + public void notifyControllerMobileNumberConverted () { // Validate mobile instance if (this.getMobileNumber() == null) { // Throw NPE @@ -300,11 +433,12 @@ public class AddressbookWebRequestHelperBean implements AddressbookWebRequestHel } /** - * Copies currently set user instances data to adminUserController + * Notifies other controllers (backing beans) if a user id has been + * successfully converted to a User instance. */ - public void copyUserToController () { + public void notifyControllerUserConverted () { // Log message - //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N + //* NOISY-DEBUG: */ System.out.println("AdminHelper::notifyControllerUserConverted - CALLED!"); //NOI18N // Validate user instance if (this.getUser() == null) { @@ -331,135 +465,6 @@ public class AddressbookWebRequestHelperBean implements AddressbookWebRequestHel this.userCreatedEvent.fire(new CreatedUserEvent(this.getUser())); } - /** - * Getter for contact instance - *

- * @return Contact instance - */ - public Contact getContact () { - return this.contact; - } - - /** - * Setter for contact instance - *

- * @param contact Contact instance - */ - public void setContact (final Contact contact) { - // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); - // System.out.println(MessageFormat.format("{0}: Setting contact={1}, previous: {2}, caller: {3}", this.getClass().getSimpleName(), contact, this.contact, caller)); - this.contact = contact; - } - - /** - * Returns a message key depending on if this contact is a user and/or a - * contact. If this contact is unused, a default key is returned. - *

- * @param contact Contact instance to check - *

- * @return Message key - */ - public String getContactUsageMessageKey (final Contact contact) { - // The contact must be valid - if (null == contact) { - // Throw NPE - throw new NullPointerException("contact is null"); //NOI18N - } else if (contact.getContactId() == null) { - // Throw again ... - throw new NullPointerException("contact.contactId is null"); //NOI18N - } else if (contact.getContactId() < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N - } - - // Default key is "unused" - String messageKey = "CONTACT_IS_UNUSED"; //NOI18N - - // Check user contact - boolean isUserContact = this.userController.isContactFound(contact); - - // Check user first - if (isUserContact) { - // Only user - messageKey = "CONTACT_IS_USER"; //NOI18N - } - - // Return message key - return messageKey; - } - - /** - * Getter for dialable fax number - *

- * @return Dialable fax number - */ - public DialableFaxNumber getFaxNumber () { - return this.faxNumber; - } - - /** - * Setter for dialable fax number - *

- * @param faxNumber Dialable fax number - */ - public void setFaxNumber (final DialableFaxNumber faxNumber) { - this.faxNumber = faxNumber; - } - - /** - * Getter for dialable land-line number - *

- * @return Dialable land-line number - */ - public DialableLandLineNumber getLandLineNumber () { - return this.landLineNumber; - } - - /** - * Setter for dialable land-line number - *

- * @param landLineNumber Dialable land-line number - */ - public void setLandLineNumber (final DialableLandLineNumber landLineNumber) { - this.landLineNumber = landLineNumber; - } - - /** - * Getter for dialable mobile number - *

- * @return Dialable mobile number - */ - public DialableMobileNumber getMobileNumber () { - return this.mobileNumber; - } - - /** - * Setter for dialable mobile number - *

- * @param mobileNumber Dialable mobile number - */ - public void setMobileNumber (final DialableMobileNumber mobileNumber) { - this.mobileNumber = mobileNumber; - } - - /** - * Getter for user instance - *

- * @return User instance - */ - public User getUser () { - return this.user; - } - - /** - * Setter for user instance - *

- * @param user User instance - */ - public void setUser (final User user) { - this.user = user; - } - /** * Set's all given contact's phone instances: land-line, mobile and * faxNumber diff --git a/web/admin/contact/admin_contact_edit.xhtml b/web/admin/contact/admin_contact_edit.xhtml index b7b61208..58fc3516 100644 --- a/web/admin/contact/admin_contact_edit.xhtml +++ b/web/admin/contact/admin_contact_edit.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/contact/admin_contact_show.xhtml b/web/admin/contact/admin_contact_show.xhtml index 2eb503fc..fbf5e9ec 100644 --- a/web/admin/contact/admin_contact_show.xhtml +++ b/web/admin/contact/admin_contact_show.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/fax/admin_fax_delete.xhtml b/web/admin/fax/admin_fax_delete.xhtml index fc6b699f..7d5b8770 100644 --- a/web/admin/fax/admin_fax_delete.xhtml +++ b/web/admin/fax/admin_fax_delete.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/fax/admin_fax_edit.xhtml b/web/admin/fax/admin_fax_edit.xhtml index 2830912a..c74d6538 100644 --- a/web/admin/fax/admin_fax_edit.xhtml +++ b/web/admin/fax/admin_fax_edit.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/fax/admin_fax_show.xhtml b/web/admin/fax/admin_fax_show.xhtml index 1b50f0eb..8d736fe5 100644 --- a/web/admin/fax/admin_fax_show.xhtml +++ b/web/admin/fax/admin_fax_show.xhtml @@ -8,7 +8,7 @@ - + diff --git a/web/admin/landline/admin_landline_delete.xhtml b/web/admin/landline/admin_landline_delete.xhtml index 6cedc09b..02f27acf 100644 --- a/web/admin/landline/admin_landline_delete.xhtml +++ b/web/admin/landline/admin_landline_delete.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/landline/admin_landline_edit.xhtml b/web/admin/landline/admin_landline_edit.xhtml index 248accdb..7dbbe5dd 100644 --- a/web/admin/landline/admin_landline_edit.xhtml +++ b/web/admin/landline/admin_landline_edit.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/landline/admin_landline_show.xhtml b/web/admin/landline/admin_landline_show.xhtml index 85f64734..747709ca 100644 --- a/web/admin/landline/admin_landline_show.xhtml +++ b/web/admin/landline/admin_landline_show.xhtml @@ -2,7 +2,7 @@ - + diff --git a/web/admin/mobile/admin_mobile_delete.xhtml b/web/admin/mobile/admin_mobile_delete.xhtml index 6fde1e97..fd1490c6 100644 --- a/web/admin/mobile/admin_mobile_delete.xhtml +++ b/web/admin/mobile/admin_mobile_delete.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/mobile/admin_mobile_edit.xhtml b/web/admin/mobile/admin_mobile_edit.xhtml index 061e47ef..4941db33 100644 --- a/web/admin/mobile/admin_mobile_edit.xhtml +++ b/web/admin/mobile/admin_mobile_edit.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/mobile/admin_mobile_show.xhtml b/web/admin/mobile/admin_mobile_show.xhtml index 35187f5a..744d1813 100644 --- a/web/admin/mobile/admin_mobile_show.xhtml +++ b/web/admin/mobile/admin_mobile_show.xhtml @@ -8,7 +8,7 @@ - + diff --git a/web/admin/user/admin_user_activity_log.xhtml b/web/admin/user/admin_user_activity_log.xhtml index 6353fc2c..6ad32da2 100644 --- a/web/admin/user/admin_user_activity_log.xhtml +++ b/web/admin/user/admin_user_activity_log.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/user/admin_user_delete.xhtml b/web/admin/user/admin_user_delete.xhtml index 8751edd9..f9846079 100644 --- a/web/admin/user/admin_user_delete.xhtml +++ b/web/admin/user/admin_user_delete.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/user/admin_user_edit.xhtml b/web/admin/user/admin_user_edit.xhtml index 052438bf..bd6d4909 100644 --- a/web/admin/user/admin_user_edit.xhtml +++ b/web/admin/user/admin_user_edit.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/user/admin_user_lock.xhtml b/web/admin/user/admin_user_lock.xhtml index 882da437..022c6136 100644 --- a/web/admin/user/admin_user_lock.xhtml +++ b/web/admin/user/admin_user_lock.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/user/admin_user_resend_confirmation_link.xhtml b/web/admin/user/admin_user_resend_confirmation_link.xhtml index 442bbd31..79ed9ff8 100644 --- a/web/admin/user/admin_user_resend_confirmation_link.xhtml +++ b/web/admin/user/admin_user_resend_confirmation_link.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/user/admin_user_show.xhtml b/web/admin/user/admin_user_show.xhtml index 25fd4e13..3e6f6916 100644 --- a/web/admin/user/admin_user_show.xhtml +++ b/web/admin/user/admin_user_show.xhtml @@ -9,7 +9,7 @@ - + diff --git a/web/admin/user/admin_user_unlock.xhtml b/web/admin/user/admin_user_unlock.xhtml index d61f2962..9c97e6d7 100644 --- a/web/admin/user/admin_user_unlock.xhtml +++ b/web/admin/user/admin_user_unlock.xhtml @@ -9,7 +9,7 @@ - + -- 2.39.5