From: Roland Häder Date: Tue, 9 Aug 2016 10:51:04 +0000 (+0200) Subject: Continued with cell phone: (please cherry-pick) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ee77d492df84046cb48397b21b208e4ebe88d1c1;p=jjobs-war.git Continued with cell phone: (please cherry-pick) - completed listing of all cellphone number data - renamed method to allCellphoneNumbers() to have it nicer named - renamed admin_contact_cellphone_list.xhtml to admin_cellphone_list.xhtml as this is generic - removed _contact from cellphone navigation rules - introduced new general phone controller (not administrative) with application-scope to have all cellphone, land-line and fax numbers being cached - moved proper attributes (fields) and methods to that new controller - added missing navigation case for admin_cellphone_list.xhtml - added missing i18n strings Signed-off-by: Roland Häder --- diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData index afcb6558..12f3b080 100644 --- a/nbproject/faces-config.NavData +++ b/nbproject/faces-config.NavData @@ -2,74 +2,75 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/de/chotime/landingpage/beans/phone/LandingPhoneWebApplicationBean.java b/src/java/de/chotime/landingpage/beans/phone/LandingPhoneWebApplicationBean.java new file mode 100644 index 00000000..54ffccb9 --- /dev/null +++ b/src/java/de/chotime/landingpage/beans/phone/LandingPhoneWebApplicationBean.java @@ -0,0 +1,349 @@ +/* + * Copyright (C) 2016 Cho-Time GmbH + * + * 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 . + */ +package de.chotime.landingpage.beans.phone; + +import de.chotime.landingpage.beans.BaseLandingController; +import java.text.MessageFormat; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import javax.annotation.PostConstruct; +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.event.Observes; +import javax.faces.view.facelets.FaceletException; +import javax.inject.Named; +import javax.naming.Context; +import javax.naming.InitialContext; +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.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; +import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; + +/** + * Regular bean (controller) for phone numbers + *

+ * @author Roland Haeder + */ +@Named ("phoneController") +@ApplicationScoped +public class LandingPhoneWebApplicationBean extends BaseLandingController implements LandingPhoneWebApplicationController { + + /** + * Serial number + */ + private static final long serialVersionUID = 491_058_674_675_690_105L; + + /** + * All cell phone numbers + */ + private final List cellphoneNumbers; + + /** + * All fax numbers + */ + private final List faxNumbers; + + /** + * All land-line numbers + */ + private final List landLineNumbers; + + /** + * General EJB for phone numbers + */ + private PhoneSessionBeanRemote phoneBean; + + /** + * Default constructor + */ + public LandingPhoneWebApplicationBean () { + // Try it + try { + // Get initial context + Context context = new InitialContext(); + + // Try to lookup the beans + this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/jlandingpage-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N + } catch (final NamingException e) { + // Throw it again + throw new FaceletException(e); + } + + // Init all lists + this.cellphoneNumbers = new LinkedList<>(); + this.faxNumbers = new LinkedList<>(); + this.landLineNumbers = new LinkedList<>(); + } + + @Override + public void afterAdminAddedContact (@Observes final AdminAddedContactEvent event) { + // The event must be valid + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getAddedContact() == null) { + // Throw again ... + throw new NullPointerException("event.addedContact is null"); //NOI18N + } else if (event.getAddedContact().getContactId() == null) { + // ... and again + throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N + } else if (event.getAddedContact().getContactId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N //NOI18N + } + + // Update contact's cellphone, land-line and fax number + this.updateContactPhoneNumbers(event.getAddedContact()); + + // Clear this bean + this.clear(); + } + + @Override + public void afterAdminAddedUserEvent (@Observes final AdminAddedUserEvent 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 + } + + // Update contact's cellphone, land-line and fax number + this.updateContactPhoneNumbers(event.getAddedUser().getUserContact()); + + // Clear all data + this.clear(); + } + + @Override + public void afterAdminUpdatedContactDataEvent (@Observes final AdminUpdatedContactEvent event) { + // event should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getUpdatedContact() == null) { + // Throw NPE again + throw new NullPointerException("event.updatedContact is null"); //NOI18N + } else if (event.getUpdatedContact().getContactId() == null) { + // userId is null + throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N + } else if (event.getUpdatedContact().getContactId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N + } + + // Update contact's cellphone, land-line and fax number + this.updateContactPhoneNumbers(event.getUpdatedContact()); + + // Clear all data + this.clear(); + } + + @Override + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List allCellphoneNumbers () { + return this.cellphoneNumbers; + } + + @Override + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List allFaxNumbers () { + return this.faxNumbers; + } + + @Override + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List allLandLineNumbers () { + return this.landLineNumbers; + } + + /** + * Post-construction method + */ + @PostConstruct + public void init () { + // All phone numbers + this.cellphoneNumbers.addAll(this.phoneBean.allCellphoneNumbers()); + this.faxNumbers.addAll(this.phoneBean.allFaxNumbers()); + this.landLineNumbers.addAll(this.phoneBean.allLandLineNumbers()); + } + + /** + * Clears this bean + */ + private void clear () { + // Clear all data + } + + /** + * Uniquely add given cellphone number to this bean's list. First remove the + * old instance (by id number), then re-add it again. + *

+ * @param cellphoneNumber Cellphone number to add + */ + private void uniqueAddCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) { + // Make sure the parameter is valid + if (null == cellphoneNumber) { + // Throw NPE + throw new NullPointerException("cellphoneNumber is null"); + } else if (cellphoneNumber.getPhoneId() == null) { + // Throw again ... + throw new NullPointerException("cellphoneNumber.phoneId is null"); + } else if (cellphoneNumber.getPhoneId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("cellphoneNumber.phoneId={0} is not valid.", cellphoneNumber.getPhoneId())); + } + + // First remove it by object + if (!this.cellphoneNumbers.remove(cellphoneNumber)) { + // Did not work, try by id number + for (final DialableCellphoneNumber cell : this.cellphoneNumbers) { + // Is id number the same? + if (Objects.equals(cell.getPhoneId(), cellphoneNumber.getPhoneId())) { + // Found it + this.cellphoneNumbers.remove(cell); + break; + } + } + } + + // ... then add it + this.cellphoneNumbers.add(cellphoneNumber); + } + + /** + * Uniquely add given fax number to this bean's list. First remove the old + * instance (by id number), then re-add it again. + *

+ * @param faxNumber number to add + */ + private void uniqueAddFaxNumber (final DialableFaxNumber faxNumber) { + // Make sure the parameter is valid + if (null == faxNumber) { + // Throw NPE + throw new NullPointerException("faxNumber is null"); + } else if (faxNumber.getPhoneId() == null) { + // Throw again ... + throw new NullPointerException("faxNumber.phoneId is null"); + } else if (faxNumber.getPhoneId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid.", faxNumber.getPhoneId())); + } + + // First remove it + if (!this.faxNumbers.remove(faxNumber)) { + // Did not work, try by id number + for (final DialableFaxNumber fax : this.faxNumbers) { + // Is id number the same? + if (Objects.equals(fax.getPhoneId(), faxNumber.getPhoneId())) { + // Found it + this.faxNumbers.remove(fax); + break; + } + } + } + + // ... then add it + this.faxNumbers.add(faxNumber); + } + + /** + * Uniquely add given land-line number to this bean's list. First remove the + * old instance (by id number), then re-add it again. + *

+ * @param landLineNumber Land-line number to add + */ + private void uniqueAddLandLineNumber (final DialableLandLineNumber landLineNumber) { + // Make sure the parameter is valid + if (null == landLineNumber) { + // Throw NPE + throw new NullPointerException("landLineNumber is null"); + } else if (landLineNumber.getPhoneId() == null) { + // Throw again ... + throw new NullPointerException("landLineNumber.phoneId is null"); + } else if (landLineNumber.getPhoneId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid.", landLineNumber.getPhoneId())); + } + + // First remove it + if (!this.landLineNumbers.remove(landLineNumber)) { + // Did not work, try by id number + for (final DialableLandLineNumber landLine : this.landLineNumbers) { + // Is id number the same? + if (Objects.equals(landLine.getPhoneId(), landLineNumber.getPhoneId())) { + // Found it + this.landLineNumbers.remove(landLine); + break; + } + } + } + + // ... then add it + this.landLineNumbers.add(landLineNumber); + } + + /** + * Updates given contact's cellphone, land-line and fax number + *

+ * @param contact Contact instance + */ + private void updateContactPhoneNumbers (final Contact contact) { + // Parameter must be valid + if (null == contact) { + // Throw NPE + throw new NullPointerException("contact is null"); + } else if (contact.getContactId() == null) { + // Throw again + throw new NullPointerException("contact.contactId is null"); + } else if (contact.getContactId() < 1) { + // Id number is not valid + } + + // Is cellphone set? + if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) { + // Unique-add it + this.uniqueAddCellphoneNumber(contact.getContactCellphoneNumber()); + } + + // Is land-line set? + if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) { + // Unique-add it + this.uniqueAddLandLineNumber(contact.getContactLandLineNumber()); + } + + // Is fax set? + if (contact.getContactFaxNumber() instanceof DialableFaxNumber) { + // Unique-add it + this.uniqueAddFaxNumber(contact.getContactFaxNumber()); + } + } + +} diff --git a/src/java/de/chotime/landingpage/beans/phone/LandingPhoneWebApplicationController.java b/src/java/de/chotime/landingpage/beans/phone/LandingPhoneWebApplicationController.java new file mode 100644 index 00000000..d835888c --- /dev/null +++ b/src/java/de/chotime/landingpage/beans/phone/LandingPhoneWebApplicationController.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2016 Cho-Time GmbH + * + * 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 . + */ +package de.chotime.landingpage.beans.phone; + +import java.io.Serializable; +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.jphone.phonenumbers.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; + +/** + * An interface for a request web controller (bean) for administrative phone + * number purposes. + *

+ * @author Roland Haeder + */ +@Local +public interface LandingPhoneWebApplicationController extends Serializable { + + /** + * Event observer for newly added users by adminstrator + *

+ * @param event Event being fired + */ + void afterAdminAddedUserEvent (final AdminAddedUserEvent event); + + /** + * Observes events being fired when an administrator has added a new + * contact. + *

+ * @param event Event being fired + */ + void afterAdminAddedContact (final AdminAddedContactEvent event); + + /** + * Event observer for updated contact data by administrators + *

+ * @param event Updated contact data event + */ + void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event); + + /** + * Returns a list of all cellphone numbers. For performance reasons, the + * controller (bean) should be application-scoped as from user to user + * nothing changes. And the controller's post-construct method should load + * all numbers and cache it in the controller. + *

+ * @return List of all cell phone numbers + */ + List allCellphoneNumbers (); + + /** + * Returns a list of all fax numbers. For performance reasons, the + * controller (bean) should be application-scoped as from user to user + * nothing changes. And the controller's post-construct method should load + * all numbers and cache it in the controller. + *

+ * @return List of all fax numbers + */ + List allFaxNumbers (); + + /** + * Returns a list of all land-line numbers. For performance reasons, the + * controller (bean) should be application-scoped as from user to user + * nothing changes. And the controller's post-construct method should load + * all numbers and cache it in the controller. + *

+ * @return List of all land-line numbers + */ + List allLandLineNumbers (); + +} diff --git a/src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java index 64e6c0b6..a566b33c 100644 --- a/src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java @@ -37,14 +37,11 @@ import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController; import org.mxchange.jjobs.beans.phone.JobsAdminPhoneWebRequestController; -import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote; +import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; /** - * A general contact bean (controller) + * A general contact phone bean (controller) *

* @author Roland Haeder */ @@ -57,32 +54,12 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement */ private static final long serialVersionUID = 542_145_347_916L; - /** - * Remote EJB for phone number (administrative) - */ - private AdminPhoneSessionBeanRemote adminPhoneBean; - /** * Administrative phone controller */ @Inject private JobsAdminPhoneWebRequestController adminPhoneController; - /** - * All cell phone numbers - */ - private final List cellphoneNumbers; - - /** - * All fax numbers - */ - private final List faxNumbers; - - /** - * All land-line numbers - */ - private final List landLineNumbers; - /** * General contact controller */ @@ -95,6 +72,11 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement */ private final Map> contacts; + /** + * Remote EJB for phone number (administrative) + */ + private PhoneSessionBeanRemote phoneBean; + /** * Default constructor */ @@ -105,16 +87,13 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement Context context = new InitialContext(); // Try to lookup the beans - this.adminPhoneBean = (AdminPhoneSessionBeanRemote) context.lookup("java:global/jlandingpage-ejb/adminphone!org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote"); //NOI18N + this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/jlandingpage-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N } catch (final NamingException e) { // Throw again throw new FaceletException(e); } // Init lists/maps - this.cellphoneNumbers = new LinkedList<>(); - this.faxNumbers = new LinkedList<>(); - this.landLineNumbers = new LinkedList<>(); this.contacts = new HashMap<>(10); } @@ -135,9 +114,6 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N //NOI18N } - // Update contact's cellphone, land-line and fax number - this.updateContactPhoneNumbers(event.getAddedContact()); - // Clear this bean this.clear(); } @@ -159,9 +135,6 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N } - // Update contact's cellphone, land-line and fax number - this.updateContactPhoneNumbers(event.getAddedUser().getUserContact()); - // Clear all data this.clear(); } @@ -183,9 +156,6 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N } - // Update contact's cellphone, land-line and fax number - this.updateContactPhoneNumbers(event.getUpdatedContact()); - // Clear all data this.clear(); } @@ -225,8 +195,6 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement */ @PostConstruct public void init () { - // All phone numbers - this.cellphoneNumbers.addAll(this.adminPhoneBean.allCellphoneNumbers()); } /** @@ -236,148 +204,4 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement // Clear all data } - /** - * Uniquely add given cellphone number to this bean's list. First remove the - * old instance (by id number), then re-add it again. - *

- * @param cellphoneNumber Cellphone number to add - */ - private void uniqueAddCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) { - // Make sure the parameter is valid - if (null == cellphoneNumber) { - // Throw NPE - throw new NullPointerException("cellphoneNumber is null"); - } else if (cellphoneNumber.getPhoneId() == null) { - // Throw again ... - throw new NullPointerException("cellphoneNumber.phoneId is null"); - } else if (cellphoneNumber.getPhoneId() < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("cellphoneNumber.phoneId={0} is not valid.", cellphoneNumber.getPhoneId())); - } - - // First remove it by object - if (!this.cellphoneNumbers.remove(cellphoneNumber)) { - // Did not work, try by id number - for (final DialableCellphoneNumber cell : this.cellphoneNumbers) { - // Is id number the same? - if (Objects.equals(cell.getPhoneId(), cellphoneNumber.getPhoneId())) { - // Found it - this.cellphoneNumbers.remove(cell); - break; - } - } - } - - // ... then add it - this.cellphoneNumbers.add(cellphoneNumber); - } - - /** - * Uniquely add given fax number to this bean's list. First remove the old - * instance (by id number), then re-add it again. - *

- * @param faxNumber number to add - */ - private void uniqueAddFaxNumber (final DialableFaxNumber faxNumber) { - // Make sure the parameter is valid - if (null == faxNumber) { - // Throw NPE - throw new NullPointerException("faxNumber is null"); - } else if (faxNumber.getPhoneId() == null) { - // Throw again ... - throw new NullPointerException("faxNumber.phoneId is null"); - } else if (faxNumber.getPhoneId() < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid.", faxNumber.getPhoneId())); - } - - // First remove it - if (!this.faxNumbers.remove(faxNumber)) { - // Did not work, try by id number - for (final DialableFaxNumber fax : this.faxNumbers) { - // Is id number the same? - if (Objects.equals(fax.getPhoneId(), faxNumber.getPhoneId())) { - // Found it - this.faxNumbers.remove(fax); - break; - } - } - } - - // ... then add it - this.faxNumbers.add(faxNumber); - } - - /** - * Uniquely add given land-line number to this bean's list. First remove the - * old instance (by id number), then re-add it again. - *

- * @param landLineNumber Land-line number to add - */ - private void uniqueAddLandLineNumber (final DialableLandLineNumber landLineNumber) { - // Make sure the parameter is valid - if (null == landLineNumber) { - // Throw NPE - throw new NullPointerException("landLineNumber is null"); - } else if (landLineNumber.getPhoneId() == null) { - // Throw again ... - throw new NullPointerException("landLineNumber.phoneId is null"); - } else if (landLineNumber.getPhoneId() < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid.", landLineNumber.getPhoneId())); - } - - // First remove it - if (!this.landLineNumbers.remove(landLineNumber)) { - // Did not work, try by id number - for (final DialableLandLineNumber landLine : this.landLineNumbers) { - // Is id number the same? - if (Objects.equals(landLine.getPhoneId(), landLineNumber.getPhoneId())) { - // Found it - this.landLineNumbers.remove(landLine); - break; - } - } - } - - // ... then add it - this.landLineNumbers.add(landLineNumber); - } - - /** - * Updates given contact's cellphone, land-line and fax number - *

- * @param contact Contact instance - */ - private void updateContactPhoneNumbers (final Contact contact) { - // Parameter must be valid - if (null == contact) { - // Throw NPE - throw new NullPointerException("contact is null"); - } else if (contact.getContactId() == null) { - // Throw again - throw new NullPointerException("contact.contactId is null"); - } else if (contact.getContactId() < 1) { - // Id number is not valid - } - - // Is cellphone set? - if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) { - // Unique-add it - this.uniqueAddCellphoneNumber(contact.getContactCellphoneNumber()); - } - - // Is land-line set? - if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) { - // Unique-add it - this.uniqueAddLandLineNumber(contact.getContactLandLineNumber()); - } - - // Is fax set? - if (contact.getContactFaxNumber() instanceof DialableFaxNumber) { - // Unique-add it - this.uniqueAddFaxNumber(contact.getContactFaxNumber()); - } - } - } diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 2d84ab9f..1fbb69c2 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -601,3 +601,9 @@ ERROR_BEAN_HELPER_USER_NOT_SET=Fehler: Instanz 'user' im Bean-Helper nicht geset ERROR_BEAN_HELPER_CONTACT_NOT_SET=Fehler: Instanz 'contact' im Bean-Helper nicht gesetzt. ERROR_ADMIN_BEAN_CELLPHONE_NUMBER_NOT_SET=Fehler: Instanz 'cellPhone' in administrativer Bean nicht gesetzt. CONTENT_TITLE_ADMIN_LIST_CONTACT_CELLPHONE=Mobiltelefonnummern auflisten: +ADMIN_LIST_CELLPHONE_EMPTY=Es sind keine Mobilfunknummern gespeichert. +ADMIN_MENU_PHONE_NUMBERS_TITLE=Telefonnummern: +LINK_ADMIN_LIST_CELLPHONE_PHONE_NUMBERS=Handynummern ... +LINK_ADMIN_LIST_CELLPHONE_PHONE_NUMBERS_TITLE=Alle Mobilfunknummern auflisten. +ADMIN_SHOW_CELLPHONE_CREATED=Erstellt: +ADMIN_SHOW_CELLPHONE_UPDATED=Zuletzt ge\u00e4ndert: diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 0f1b52f1..855dcb0e 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -601,3 +601,9 @@ ERROR_BEAN_HELPER_USER_NOT_SET=Error: Instance 'user' not set in bean helper. ERROR_BEAN_HELPER_CONTACT_NOT_SET=Error: Instance 'contact' not set in bean helper. ERROR_ADMIN_BEAN_CELLPHONE_NUMBER_NOT_SET=Error: Instance 'cellPhone' in administrative bean not set. CONTENT_TITLE_ADMIN_LIST_CONTACT_CELLPHONE=List mobile phone numbers: +ADMIN_LIST_CELLPHONE_EMPTY=No cell phone numbers are saved. +ADMIN_MENU_PHONE_NUMBERS_TITLE=Phone numbers: +LINK_ADMIN_LIST_CELLPHONE_PHONE_NUMBERS=Cell phone numbers ... +LINK_ADMIN_LIST_CELLPHONE_PHONE_NUMBERS_TITLE=List all cell phone numbers. +ADMIN_SHOW_CELLPHONE_CREATED=Created: +ADMIN_SHOW_CELLPHONE_UPDATED=Last changed: diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index 73c83b81..c5f840de 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -67,6 +67,10 @@ user_profile /user/user_profile.xhtml + + admin_list_cellphone + /admin/cellphone/admin_cellphone_list.xhtml + admin_list_countries /admin/country/admin_country_list.xhtml @@ -351,33 +355,33 @@ - /admin/cellphone/admin_contact_cellphone_list.xhtml + /admin/cellphone/admin_cellphone_list.xhtml admin_show_cellphone - /admin/cellphone/admin_contact_cellphone_show.xhtml + /admin/cellphone/admin_cellphone_show.xhtml admin_edit_cellphone - /admin/cellphone/admin_contact_cellphone_edit.xhtml + /admin/cellphone/admin_cellphone_edit.xhtml admin_delete_cellphone - /admin/cellphone/admin_contact_cellphone_delete.xhtml + /admin/cellphone/admin_cellphone_delete.xhtml - /admin/cellphone/admin_contact_cellphone_show.xhtml + /admin/cellphone/admin_cellphone_show.xhtml admin_show_mobile_provider /admin/mobile_provider/admin_mobile_provider_show.xhtml admin_edit_cellphone - /admin/cellphone/admin_contact_cellphone_edit.xhtml + /admin/cellphone/admin_cellphone_edit.xhtml admin_delete_cellphone - /admin/cellphone/admin_contact_cellphone_delete.xhtml + /admin/cellphone/admin_cellphone_delete.xhtml admin_unlink_contact_cellphone diff --git a/web/WEB-INF/templates/admin/admin_menu.tpl b/web/WEB-INF/templates/admin/admin_menu.tpl index da659c55..d6e5faa5 100644 --- a/web/WEB-INF/templates/admin/admin_menu.tpl +++ b/web/WEB-INF/templates/admin/admin_menu.tpl @@ -32,6 +32,14 @@

  • + + +
      +
    • +
    + diff --git a/web/admin/cellphone/admin_cellphone_list.xhtml b/web/admin/cellphone/admin_cellphone_list.xhtml new file mode 100644 index 00000000..d9488d92 --- /dev/null +++ b/web/admin/cellphone/admin_cellphone_list.xhtml @@ -0,0 +1,73 @@ + + + + + #{msg.PAGE_TITLE_ADMIN_LIST_CONTACT_CELLPHONE} + + + #{msg.CONTENT_TITLE_ADMIN_LIST_CONTACT_CELLPHONE} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/admin/cellphone/admin_contact_cellphone_list.xhtml b/web/admin/cellphone/admin_contact_cellphone_list.xhtml deleted file mode 100644 index b319d1e6..00000000 --- a/web/admin/cellphone/admin_contact_cellphone_list.xhtml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - #{msg.PAGE_TITLE_ADMIN_LIST_CONTACT_CELLPHONE} - - - #{msg.CONTENT_TITLE_ADMIN_LIST_CONTACT_CELLPHONE} - - - - - - - - - - - - -