From c3944946206baeb4412a1a5498a18f5a06dd3a08 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 10 Apr 2017 22:08:20 +0200 Subject: [PATCH] Continued a bit: - not just cellphones, let's support any mobile phone - mobileNumbers was no longer used - tpzo fixed --- ...AddressbookAdminContactWebRequestBean.java | 146 +++++++++--------- ...sbookAdminContactWebRequestController.java | 46 +++--- .../AddressbookContactWebSessionBean.java | 68 ++++---- ...ddressbookContactWebSessionController.java | 24 +-- ...AddressbookContactPhoneWebSessionBean.java | 34 +--- ...sbookContactPhoneWebSessionController.java | 2 +- .../helper/AddressbookWebRequestHelper.java | 6 +- .../AddressbookAdminPhoneWebRequestBean.java | 8 +- ...essbookAdminPhoneWebRequestController.java | 18 +-- ...ressbookAdminUserWebRequestController.java | 2 +- ...AddressbookUserPasswordWebRequestBean.java | 6 +- .../AddressbookCellphoneConverter.java | 6 +- .../cellphone/admin_cellphone_show.xhtml | 2 +- 13 files changed, 176 insertions(+), 192 deletions(-) diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java index e7e316fd..9b75c12e 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java @@ -32,6 +32,7 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.addressbook.beans.BaseAddressbookController; import org.mxchange.addressbook.beans.helper.AddressbookWebRequestController; +import org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; import org.mxchange.jcontacts.contact.UserContact; @@ -44,12 +45,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.cellphone.DialableCellphoneNumber; 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; /** @@ -73,6 +74,11 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro @Any private Event addedContactEvent; + /** + * Administrative contact EJB + */ + private AdminContactSessionBeanRemote adminContactBean; + /** * Admin helper instance */ @@ -84,21 +90,6 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro */ private Date birthday; - /** - * Cellphone number's carrier - */ - private MobileProvider cellphoneCarrier; - - /** - * Cellphone id number - */ - private Long cellphoneId; - - /** - * Cellphone number - */ - private Long cellphoneNumber; - /** * City */ @@ -180,11 +171,6 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro */ private String houseNumberExtension; - /** - * Whether a cellphone entry has been unlinked - */ - private boolean isCellphoneUnlinked; - /** * Whether a fax entry has been unlinked */ @@ -195,11 +181,31 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro */ private boolean isLandLineUnlinked; + /** + * Whether a mobile entry has been unlinked + */ + private boolean isMobileUnlinked; + /** * Land-line id number */ private Long landLineId; + /** + * Mobile number's carrier + */ + private MobileProvider mobileCarrier; + + /** + * Mobile id number + */ + private Long mobileId; + + /** + * Mobile number + */ + private Long mobileNumber; + /** * Phone number area code */ @@ -289,7 +295,7 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro // 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); @@ -335,11 +341,11 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro this.setStreet(contact.getContactStreet()); this.setZipCode(contact.getContactZipCode()); - // ... cellphone data - if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) { - this.setCellphoneId(contact.getContactCellphoneNumber().getPhoneId()); - this.setCellphoneCarrier(contact.getContactCellphoneNumber().getCellphoneProvider()); - this.setCellphoneNumber(contact.getContactCellphoneNumber().getPhoneNumber()); + // ... mobile data + if (contact.getContactMobileNumber() instanceof DialableMobileNumber) { + this.setMobileId(contact.getContactMobileNumber().getPhoneId()); + this.setMobileCarrier(contact.getContactMobileNumber().getMobileProvider()); + this.setMobileNumber(contact.getContactMobileNumber().getPhoneNumber()); } // ... fax data @@ -363,7 +369,7 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro public Contact createContactInstance () { // Generate phone number DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber()); - DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber()); + DialableMobileNumber mobile = new MobileNumber(this.getMobileCarrier(), this.getMobileNumber()); DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber()); // Create new instance @@ -385,7 +391,7 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro this.updateContactData(contact); // Call EJB for updating contact data - Contact updatedContact = this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked); + Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked); // Fire event this.updatedContactEvent.fire(new AdminContactUpdatedEvent(updatedContact)); @@ -418,7 +424,7 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro this.updateContactData(contact); // Call EJB for updating contact data - Contact updatedContact = this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked); + Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked); // Fire event this.updatedContactEvent.fire(new AdminContactUpdatedEvent(updatedContact)); @@ -431,9 +437,9 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro } @Override - public String generateCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) { + public String generateMobileNumber (final DialableMobileNumber mobileNumber) { // Is it null? - if (null == cellphoneNumber) { + if (null == mobileNumber) { // Return null return null; } @@ -441,9 +447,9 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro // Get all data String number = String.format( "%s%d%d", //NOI18N - cellphoneNumber.getCellphoneProvider().getProviderCountry().getCountryExternalDialPrefix(), - cellphoneNumber.getCellphoneProvider().getProviderDialPrefix(), - cellphoneNumber.getPhoneNumber() + mobileNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(), + mobileNumber.getMobileProvider().getProviderDialPrefix(), + mobileNumber.getPhoneNumber() ); // Return it @@ -482,36 +488,6 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro this.birthday = birthday; } - @Override - public MobileProvider getCellphoneCarrier () { - return this.cellphoneCarrier; - } - - @Override - public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) { - this.cellphoneCarrier = cellphoneCarrier; - } - - @Override - public Long getCellphoneId () { - return this.cellphoneId; - } - - @Override - public void setCellphoneId (final Long cellphoneId) { - this.cellphoneId = cellphoneId; - } - - @Override - public Long getCellphoneNumber () { - return this.cellphoneNumber; - } - - @Override - public void setCellphoneNumber (Long cellphoneNumber) { - this.cellphoneNumber = cellphoneNumber; - } - @Override public String getCity () { return this.city; @@ -662,6 +638,36 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro this.landLineId = landLineId; } + @Override + public MobileProvider getMobileCarrier () { + return this.mobileCarrier; + } + + @Override + public void setMobileCarrier (final MobileProvider mobileCarrier) { + this.mobileCarrier = mobileCarrier; + } + + @Override + public Long getMobileId () { + return this.mobileId; + } + + @Override + public void setMobileId (final Long mobileId) { + this.mobileId = mobileId; + } + + @Override + public Long getMobileNumber () { + return this.mobileNumber; + } + + @Override + public void setMobileNumber (Long mobileNumber) { + this.mobileNumber = mobileNumber; + } + @Override public Integer getPhoneAreaCode () { return this.phoneAreaCode; @@ -763,8 +769,8 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro this.setPhoneCountry(null); this.setPhoneAreaCode(null); this.setPhoneNumber(null); - this.setCellphoneCarrier(null); - this.setCellphoneNumber(null); + this.setMobileCarrier(null); + this.setMobileNumber(null); this.setFaxCountry(null); this.setFaxAreaCode(null); this.setFaxNumber(null); @@ -835,8 +841,8 @@ public class AddressbookAdminContactWebRequestBean extends BaseAddressbookContro contact.setContactCity(this.getCity()); contact.setContactCountry(this.getCountry()); - // Update contact's cellphone number - this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber()); + // Update contact's mobile number + this.isMobileUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getMobileCarrier(), this.getMobileNumber()); // Update contact's land-line number this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber()); diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestController.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestController.java index 80e1a0c7..b6a4a6d3 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestController.java @@ -22,7 +22,7 @@ import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.gender.Gender; import org.mxchange.jcountry.data.Country; import org.mxchange.jphone.phonenumbers.DialableNumber; -import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; /** @@ -55,25 +55,25 @@ public interface AddressbookAdminContactWebRequestController extends Serializabl void copyContactToController (final Contact contact); /** - * Edits cuirrently loaded contact's data in database. + * Edits currently loaded contact's data in database. *

* @return Redirect outcome */ String editContactData (); /** - * Getter for cellphone id + * Getter for mobile id *

- * @return Cellphone id + * @return Mobile id */ - Long getCellphoneId (); + Long getMobileId (); /** - * Setter for cellphone id + * Setter for mobile id *

- * @param cellphoneId Cellphone id + * @param mobileId Mobile id */ - void setCellphoneId (final Long cellphoneId); + void setMobileId (final Long mobileId); /** * Getter for fax id @@ -118,32 +118,32 @@ public interface AddressbookAdminContactWebRequestController extends Serializabl void setBirthday (final Date birthday); /** - * Getter for ellphone number's carrier + * Getter for mobile number's carrier *

- * @return Cellphone number's carrier + * @return Mobile number's carrier */ - MobileProvider getCellphoneCarrier (); + MobileProvider getMobileCarrier (); /** - * Setter for cellphone number's carrier prefix + * Setter for mobile number's carrier prefix *

- * @param cellphoneCarrier Cellphone number's carrier prefix + * @param mobileCarrier Mobile number's carrier prefix */ - void setCellphoneCarrier (final MobileProvider cellphoneCarrier); + void setMobileCarrier (final MobileProvider mobileCarrier); /** - * Getter for ellphone number + * Getter for mobile number *

- * @return Cellphone number + * @return Mobile number */ - Long getCellphoneNumber (); + Long getMobileNumber (); /** - * Setter for ellphone number + * Setter for mobile number *

- * @param cellphoneNumber Cellphone number + * @param mobileNumber Mobile number */ - void setCellphoneNumber (final Long cellphoneNumber); + void setMobileNumber (final Long mobileNumber); /** * City @@ -422,14 +422,14 @@ public interface AddressbookAdminContactWebRequestController extends Serializabl String generatePhoneNumber (final DialableNumber phoneNumber); /** - * Returns a text representation of given cellphone number or null if not + * Returns a text representation of given mobile number or null if not * set. *

- * @param cellphoneNumber Cellphone number + * @param mobileNumber Mobile number *

* @return Text respresentation or null */ - String generateCellphoneNumber (final DialableCellphoneNumber cellphoneNumber); + String generateMobileNumber (final DialableMobileNumber mobileNumber); /** * Checks/returns whether the gender/salutation is required for this diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java index f9ea24c8..6261435f 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java @@ -44,12 +44,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.cellphone.DialableCellphoneNumber; 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,14 +79,14 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController private Date birthday; /** - * Cellphone number's carrier + * Mobile number's carrier */ - private MobileProvider cellphoneCarrier; + private MobileProvider mobileCarrier; /** - * Cellphone number + * Mobile number */ - private Long cellphoneNumber; + private Long mobileNumber; /** * City @@ -169,9 +169,9 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController private String houseNumberExtension; /** - * Whether a cellphone entry has been unlinked + * Whether a mobile entry has been unlinked */ - private boolean isCellphoneUnlinked; + private boolean isMobileUnlinked; /** * Whether a fax entry has been unlinked @@ -460,7 +460,7 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController // Generate phone number DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber()); - DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber()); + DialableMobileNumber mobile = new MobileNumber(this.getMobileCarrier(), this.getMobileNumber()); DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber()); // Create new contact @@ -521,18 +521,18 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController } // Is the provider set? - if ((cellphone instanceof DialableCellphoneNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) { + if ((mobile instanceof DialableMobileNumber) && (this.getMobileCarrier() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) { // Is the number set? - if (cellphone.getPhoneNumber() == null) { + if (mobile.getPhoneNumber() == null) { // Is null - throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N - } else if (cellphone.getPhoneNumber() < 1) { + throw new NullPointerException("mobile.phoneNumber is null"); //NOI18N + } else if (mobile.getPhoneNumber() < 1) { // Abort here - throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N + throw new IllegalArgumentException("mobile.phoneNumber is zero or below."); //NOI18N } - // Set cellphone number - contact.setContactCellphoneNumber(cellphone); + // Set mobile number + contact.setContactMobileNumber(mobile); } // Trace message @@ -576,8 +576,8 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController contact.setContactCity(this.getCity()); contact.setContactCountry(this.getCountry()); - // Update contact's cellphone number - this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber()); + // Update contact's mobile number + this.isMobileUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getMobileCarrier(), this.getMobileNumber()); // Update contact's land-line number this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber()); @@ -586,7 +586,7 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController 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 @@ -605,23 +605,23 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController } @Override - public MobileProvider getCellphoneCarrier () { - return this.cellphoneCarrier; + public MobileProvider getMobileCarrier () { + return this.mobileCarrier; } @Override - public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) { - this.cellphoneCarrier = cellphoneCarrier; + public void setMobileCarrier (final MobileProvider mobileCarrier) { + this.mobileCarrier = mobileCarrier; } @Override - public Long getCellphoneNumber () { - return this.cellphoneNumber; + public Long getMobileNumber () { + return this.mobileNumber; } @Override - public void setCellphoneNumber (Long cellphoneNumber) { - this.cellphoneNumber = cellphoneNumber; + public void setMobileNumber (final Long mobileNumber) { + this.mobileNumber = mobileNumber; } @Override @@ -1014,8 +1014,8 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.setPhoneAreaCode(null); this.setPhoneCountry(null); this.setPhoneNumber(null); - this.setCellphoneCarrier(null); - this.setCellphoneNumber(null); + this.setMobileCarrier(null); + this.setMobileNumber(null); this.setFaxAreaCode(null); this.setFaxCountry(null); this.setFaxNumber(null); @@ -1059,8 +1059,8 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.setBirthday(contact.getContactBirthday()); this.setComment(contact.getContactComment()); - // Get cellphone, phone and fax instance - DialableCellphoneNumber cellphone = contact.getContactCellphoneNumber(); + // Get mobile, phone and fax instance + DialableMobileNumber mobile = contact.getContactMobileNumber(); DialableFaxNumber fax = contact.getContactFaxNumber(); DialableLandLineNumber phone = contact.getContactLandLineNumber(); @@ -1071,9 +1071,9 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController this.setPhoneNumber(phone.getPhoneNumber()); } - if ((cellphone instanceof DialableCellphoneNumber) && (cellphone.getCellphoneProvider() instanceof MobileProvider)) { - this.setCellphoneCarrier(cellphone.getCellphoneProvider()); - this.setCellphoneNumber(cellphone.getPhoneNumber()); + if ((mobile instanceof DialableMobileNumber) && (mobile.getMobileProvider() instanceof MobileProvider)) { + this.setMobileCarrier(mobile.getMobileProvider()); + this.setMobileNumber(mobile.getPhoneNumber()); } if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) { diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java index 2d5ee2bf..17aba7c5 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java @@ -145,32 +145,32 @@ public interface AddressbookContactWebSessionController extends Serializable { void setBirthday (final Date birthday); /** - * Getter for ellphone number's carrier + * Getter for mobile number's carrier *

- * @return Cellphone number's carrier + * @return Mobile number's carrier */ - MobileProvider getCellphoneCarrier (); + MobileProvider getMobileCarrier (); /** - * Setter for cellphone number's carrier prefix + * Setter for mobile number's carrier prefix *

- * @param cellphoneCarrier Cellphone number's carrier prefix + * @param mobileCarrier Mobile number's carrier prefix */ - void setCellphoneCarrier (final MobileProvider cellphoneCarrier); + void setMobileCarrier (final MobileProvider mobileCarrier); /** - * Getter for ellphone number + * Getter for mobile number *

- * @return Cellphone number + * @return Mobile number */ - Long getCellphoneNumber (); + Long getMobileNumber (); /** - * Setter for ellphone number + * Setter for mobile number *

- * @param cellphoneNumber Cellphone number + * @param mobileNumber Mobile number */ - void setCellphoneNumber (final Long cellphoneNumber); + void setMobileNumber (final Long mobileNumber); /** * City diff --git a/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java index 1cd635e3..333b5520 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionBean.java @@ -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; @@ -37,7 +36,6 @@ import org.mxchange.addressbook.beans.phone.AddressbookAdminPhoneWebRequestContr 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.phone.AdminPhoneSessionBeanRemote; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; @@ -66,11 +64,6 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro @Inject private AddressbookAdminPhoneWebRequestController adminPhoneController; - /** - * All cell phone numbers - */ - private final List cellphoneNumbers; - /** * General contact controller */ @@ -100,7 +93,6 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro } // Init lists/maps - this.cellphoneNumbers = new LinkedList<>(); this.contacts = new HashMap<>(10); } @@ -121,15 +113,6 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro 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.getContactCellphoneNumber() instanceof DialableCellphoneNumber) { - // Unique-add it - this.uniqueAddCellphoneNumber(contact.getContactCellphoneNumber()); - } - // Clear this bean this.clear(); } @@ -174,9 +157,9 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro } @Override - public List allCellphoneContacts () { + public List allMobileContacts () { // Get id - Long phoneId = this.adminPhoneController.getCellPhone().getPhoneId(); + Long phoneId = this.adminPhoneController.getMobileNumber().getPhoneId(); // Is cache there? if (this.contacts.containsKey(phoneId)) { @@ -188,8 +171,8 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro // "Walk" through all contacts for (final Contact contact : this.contactController.allContacts()) { - // Is cellphone instance the same? - if (Objects.equals(contact.getContactCellphoneNumber(), this.adminPhoneController.getCellPhone())) { + // Is mobile instance the same? + if (Objects.equals(contact.getContactMobileNumber(), this.adminPhoneController.getMobileNumber())) { // Found one list.add(contact); } @@ -203,15 +186,6 @@ public class AddressbookContactPhoneWebSessionBean extends BaseAddressbookContro } } - /** - * Post-initialization of this class - */ - @PostConstruct - public void init () { - // All phone numbers - this.cellphoneNumbers.addAll(this.adminPhoneBean.allCellphoneNumbers()); - } - /** * Clears this bean */ diff --git a/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionController.java b/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionController.java index 00e70a74..f946ac1f 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/contact/phone/AddressbookContactPhoneWebSessionController.java @@ -42,7 +42,7 @@ public interface AddressbookContactPhoneWebSessionController extends Serializabl *

* @return List of all linked contacts */ - List allCellphoneContacts (); + List allMobileContacts (); /** * Event observer for newly added users by adminstrator diff --git a/src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelper.java b/src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelper.java index ffb7490f..edc5beb3 100644 --- a/src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelper.java +++ b/src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelper.java @@ -23,7 +23,7 @@ import javax.inject.Named; import org.mxchange.addressbook.beans.contact.AddressbookAdminContactWebRequestController; import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jusercore.model.user.User; @@ -206,9 +206,9 @@ public class AddressbookWebRequestHelper implements AddressbookWebRequestControl } // Is cellphone set? - if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) { + if (contact.getContactMobileNumber() instanceof DialableMobileNumber) { // Yes, then set it in admin controller - this.adminPhoneController.setCellPhone(contact.getContactCellphoneNumber()); + this.adminPhoneController.setCellPhone(contact.getContactMobileNumber()); } // Is land-line set? diff --git a/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java index 3ad2697e..644401b8 100644 --- a/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java @@ -24,7 +24,7 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.addressbook.beans.BaseAddressbookController; import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote; -import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; @@ -50,7 +50,7 @@ public class AddressbookAdminPhoneWebRequestBean extends BaseAddressbookControll /** * Cell phone number */ - private DialableCellphoneNumber cellPhone; + private DialableMobileNumber cellPhone; /** * Fax number @@ -80,12 +80,12 @@ public class AddressbookAdminPhoneWebRequestBean extends BaseAddressbookControll } @Override - public DialableCellphoneNumber getCellPhone () { + public DialableMobileNumber getMobileNumber () { return this.cellPhone; } @Override - public void setCellPhone (final DialableCellphoneNumber cellPhone) { + public void setCellPhone (final DialableMobileNumber cellPhone) { this.cellPhone = cellPhone; } diff --git a/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestController.java b/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestController.java index a0ef0249..074568ab 100644 --- a/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestController.java @@ -18,9 +18,9 @@ package org.mxchange.addressbook.beans.phone; import java.io.Serializable; import javax.ejb.Local; -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.mobile.DialableMobileNumber; /** * An interface for a request web controller (bean) for administrative phone @@ -31,12 +31,19 @@ import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; @Local public interface AddressbookAdminPhoneWebRequestController extends Serializable { + /** + * Setter for dialable cellphone number instance + *

+ * @param cellPhone Dialable cellphone number instance + */ + void setCellPhone (final DialableMobileNumber cellPhone); + /** * Getter for dialable cellphone number instance *

* @return Dialable cellphone number instance */ - DialableCellphoneNumber getCellPhone (); + DialableMobileNumber getMobileNumber (); /** * Setter for dialable land-line number instance @@ -66,11 +73,4 @@ public interface AddressbookAdminPhoneWebRequestController extends Serializable */ DialableFaxNumber getFax (); - /** - * Setter for dialable cellphone number instance - *

- * @param cellPhone Dialable cellphone number instance - */ - void setCellPhone (final DialableCellphoneNumber cellPhone); - } diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java index 6146c723..ee400627 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java @@ -44,7 +44,7 @@ public interface AddressbookAdminUserWebRequestController extends Serializable { String addUser (); /** - * Edits cuirrently loaded user's data in database. + * Edits currently loaded user's data in database. *

* @return Redirect outcome */ diff --git a/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java index f9606de4..54304272 100644 --- a/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/password/AddressbookUserPasswordWebRequestBean.java @@ -29,6 +29,7 @@ import javax.naming.NamingException; import org.mxchange.addressbook.beans.BaseAddressbookController; import org.mxchange.addressbook.beans.features.AddressbookFeaturesWebApplicationController; import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController; +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 AddressbookUserPasswordWebRequestBean extends BaseAddressbookContro 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/addressbook/converter/cellphone/AddressbookCellphoneConverter.java b/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java index 02cff527..2d507114 100644 --- a/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java +++ b/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java @@ -29,7 +29,7 @@ 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.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; /** @@ -86,7 +86,7 @@ public class AddressbookCellphoneConverter implements Converter { } // Init instance - DialableCellphoneNumber cellphone = null; + DialableMobileNumber cellphone = null; try { // Try to parse the value as long @@ -96,7 +96,7 @@ public class AddressbookCellphoneConverter implements Converter { // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId)); //NOI18N // Try to get cellphone instance from it - cellphone = this.phoneBean.findCellphoneById(cellphoneId); + cellphone = this.phoneBean.findMobileNumberById(cellphoneId); // Debug message // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: cellphone={0}", cellphone)); //NOI18N diff --git a/web/admin/cellphone/admin_cellphone_show.xhtml b/web/admin/cellphone/admin_cellphone_show.xhtml index 569b0624..4e040639 100644 --- a/web/admin/cellphone/admin_cellphone_show.xhtml +++ b/web/admin/cellphone/admin_cellphone_show.xhtml @@ -23,7 +23,7 @@ - + -- 2.39.5