From: Roland Häder Date: Tue, 16 Aug 2016 08:04:17 +0000 (+0200) Subject: Renaming season has started: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=aa6764f565c88856d714b974230ee68a288cbc32;p=jjobs-ejb.git Renaming season has started: - renamed cellphone to mobile (all occurences) - let's don't discrimite other mobile phones, right? Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcontacts/contact/JobsAdminContactSessionBean.java b/src/java/org/mxchange/jcontacts/contact/JobsAdminContactSessionBean.java new file mode 100644 index 0000000..709e0a8 --- /dev/null +++ b/src/java/org/mxchange/jcontacts/contact/JobsAdminContactSessionBean.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * 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 org.mxchange.jcontacts.contact; + +import java.text.MessageFormat; +import java.util.GregorianCalendar; +import javax.ejb.Stateless; +import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; +import org.mxchange.jjobs.database.BaseJobsDatabaseBean; + +/** + * An administrative contact EJB + *

+ * @author Roland Haeder + */ +@Stateless (name = "adminContact", description = "An administrative contact EJB") +public class JobsAdminContactSessionBean extends BaseJobsDatabaseBean implements AdminContactSessionBeanRemote { + + /** + * Serial number + */ + private static final long serialVersionUID = 542_145_347_916L; + + /** + * Default constructor + */ + public JobsAdminContactSessionBean () { + } + + @Override + public Contact addContact (final Contact contact) throws ContactAlreadyAddedException { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addContact: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N + + // Is the instance set? + if (null == contact) { + // Throw NPE + throw new NullPointerException("contact is null"); //NOI18N + } else if (contact.getContactId() != null) { + // Should be null + throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} - is not null", contact.getContactId())); //NOI18N + } + + // Set created timestamp + contact.setContactCreated(new GregorianCalendar()); + + // Set all created timestamps, if instance is there + this.setAllContactPhoneEntriesCreated(contact); + + // Persist it + this.getEntityManager().persist(contact); + + // Flush it to get contactId set + this.getEntityManager().flush(); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addContact: contact.contactId={1} after persisting - EXIT!", this.getClass().getSimpleName(), contact.getContactId())); //NOI18N + + // Return it + return contact; + } + + @Override + public void deleteContactData (final Contact contact) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteContactData: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N + + // Is the instance set? + if (null == contact) { + // Throw NPE + throw new NullPointerException("contact is null"); //NOI18N + } else if (contact.getContactId() == null) { + // Should not be null + 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 + } + + // Merge it to get a managed entity back + Contact managedContact = this.getEntityManager().getReference(contact.getClass(), contact.getContactId()); + + // Remove it from database + this.getEntityManager().remove(managedContact); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteContactData: EXIT!", this.getClass().getSimpleName())); //NOI18N + } + +} diff --git a/src/java/org/mxchange/jcontacts/contact/JobsContactSessionBean.java b/src/java/org/mxchange/jcontacts/contact/JobsContactSessionBean.java index 3b4736b..5d6cb59 100644 --- a/src/java/org/mxchange/jcontacts/contact/JobsContactSessionBean.java +++ b/src/java/org/mxchange/jcontacts/contact/JobsContactSessionBean.java @@ -311,7 +311,7 @@ public class JobsContactSessionBean extends BaseJobsDatabaseBean implements Cont } // Is cell phone/land-line/fax number unlinked? - boolean isCellphoneUnlinked = (contact.getContactCellphoneNumber() == null); + boolean isCellphoneUnlinked = (contact.getContactMobileNumber() == null); boolean isLandLineUnlinked = (contact.getContactLandLineNumber() == null); boolean isFaxUnlinked = (contact.getContactFaxNumber() == null); diff --git a/src/java/org/mxchange/jcontacts/contact/LandingAdminContactSessionBean.java b/src/java/org/mxchange/jcontacts/contact/LandingAdminContactSessionBean.java deleted file mode 100644 index 29470d7..0000000 --- a/src/java/org/mxchange/jcontacts/contact/LandingAdminContactSessionBean.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 org.mxchange.jcontacts.contact; - -import de.chotime.landingpage.database.BaseLandingDatabaseBean; -import java.text.MessageFormat; -import java.util.GregorianCalendar; -import javax.ejb.Stateless; -import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; - -/** - * An administrative contact EJB - *

- * @author Roland Haeder - */ -@Stateless (name = "adminContact", description = "An administrative contact EJB") -public class LandingAdminContactSessionBean extends BaseLandingDatabaseBean implements AdminContactSessionBeanRemote { - - /** - * Serial number - */ - private static final long serialVersionUID = 542_145_347_916L; - - /** - * Default constructor - */ - public LandingAdminContactSessionBean () { - } - - @Override - public Contact addContact (final Contact contact) throws ContactAlreadyAddedException { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addContact: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N - - // Is the instance set? - if (null == contact) { - // Throw NPE - throw new NullPointerException("contact is null"); //NOI18N - } else if (contact.getContactId() != null) { - // Should be null - throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} - is not null", contact.getContactId())); //NOI18N - } - - // Set created timestamp - contact.setContactCreated(new GregorianCalendar()); - - // Set all created timestamps, if instance is there - this.setAllContactPhoneEntriesCreated(contact); - - // Persist it - this.getEntityManager().persist(contact); - - // Flush it to get contactId set - this.getEntityManager().flush(); - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addContact: contact.contactId={1} after persisting - EXIT!", this.getClass().getSimpleName(), contact.getContactId())); //NOI18N - - // Return it - return contact; - } - - @Override - public void deleteContactData (final Contact contact) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteContactData: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N - - // Is the instance set? - if (null == contact) { - // Throw NPE - throw new NullPointerException("contact is null"); //NOI18N - } else if (contact.getContactId() == null) { - // Should not be null - 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 - } - - // Merge it to get a managed entity back - Contact managedContact = this.getEntityManager().getReference(contact.getClass(), contact.getContactId()); - - // Remove it from database - this.getEntityManager().remove(managedContact); - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteContactData: EXIT!", this.getClass().getSimpleName())); //NOI18N - } - -} diff --git a/src/java/org/mxchange/jcontacts/phone/JobsAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jcontacts/phone/JobsAdminContactPhoneSessionBean.java index 1cadb32..745e860 100644 --- a/src/java/org/mxchange/jcontacts/phone/JobsAdminContactPhoneSessionBean.java +++ b/src/java/org/mxchange/jcontacts/phone/JobsAdminContactPhoneSessionBean.java @@ -23,8 +23,8 @@ import javax.ejb.Stateless; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; import org.mxchange.jjobs.database.BaseJobsDatabaseBean; -import org.mxchange.jphone.exceptions.CellphoneNotLinkedException; -import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.exceptions.MobileNumberNotLinkedException; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; /** * A session EJB for administrative contact's phone number purposes @@ -46,9 +46,9 @@ public class JobsAdminContactPhoneSessionBean extends BaseJobsDatabaseBean imple private ContactSessionBeanRemote contactBean; @Override - public Contact unlinkCellphoneDataFromContact (final Contact contact, final DialableCellphoneNumber cellphoneNumber) throws CellphoneNotLinkedException { + public Contact unlinkMobileDataFromContact (final Contact contact, final DialableMobileNumber mobileNumber) throws MobileNumberNotLinkedException { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkCellphoneDataFromContact: contact={1},cellphoneNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, cellphoneNumber)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkMobileDataFromContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N // Is the contact set? if (null == contact) { @@ -60,28 +60,28 @@ public class JobsAdminContactPhoneSessionBean extends BaseJobsDatabaseBean imple } else if (contact.getContactId() < 1) { // Invalid id number throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N - } else if (contact.getContactCellphoneNumber() == null) { + } else if (contact.getContactMobileNumber() == null) { // Not set cell phone instance - throw new CellphoneNotLinkedException(cellphoneNumber); - } else if (contact.getContactCellphoneNumber().getPhoneId() == null) { + throw new MobileNumberNotLinkedException(mobileNumber); + } else if (contact.getContactMobileNumber().getPhoneId() == null) { // Throw NPE again throw new NullPointerException("contact.contactCellphoneNumber.phoneId is null"); //NOI18N - } else if (contact.getContactCellphoneNumber().getPhoneId() < 1) { + } else if (contact.getContactMobileNumber().getPhoneId() < 1) { // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("contact.contactCellphoneNumber.phoneId={0} is invalid.", contact.getContactCellphoneNumber().getPhoneId())); //NOI18N - } else if (!Objects.equals(cellphoneNumber.getPhoneId(), contact.getContactCellphoneNumber().getPhoneId())) { + throw new IllegalArgumentException(MessageFormat.format("contact.contactCellphoneNumber.phoneId={0} is invalid.", contact.getContactMobileNumber().getPhoneId())); //NOI18N + } else if (!Objects.equals(mobileNumber.getPhoneId(), contact.getContactMobileNumber().getPhoneId())) { // Not same object - throw new IllegalArgumentException(MessageFormat.format("contact.contactCellphoneNumber.phoneId={0} and cellphoneNumber.phoneId={1} are not the same.", contact.getContactCellphoneNumber().getPhoneId(), cellphoneNumber.getPhoneId())); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("contact.contactCellphoneNumber.phoneId={0} and mobileNumber.phoneId={1} are not the same.", contact.getContactMobileNumber().getPhoneId(), mobileNumber.getPhoneId())); //NOI18N } // Remove it from contact - contact.setContactCellphoneNumber(null); + contact.setContactMobileNumber(null); // Update database Contact updatedContact = this.contactBean.updateContactData(contact); // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkCellphoneDataFromContact: updatedContact={1} - EXIT!", this.getClass().getSimpleName(), updatedContact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkMobileDataFromContact: updatedContact={1} - EXIT!", this.getClass().getSimpleName(), updatedContact)); //NOI18N // Return it return updatedContact; diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/JobsAdminPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/JobsAdminPhoneSessionBean.java index 5c381d5..5bd557b 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/phone/JobsAdminPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/phonenumbers/phone/JobsAdminPhoneSessionBean.java @@ -20,14 +20,14 @@ import java.text.MessageFormat; import java.util.GregorianCalendar; import javax.ejb.Stateless; import org.mxchange.jjobs.database.BaseJobsDatabaseBean; -import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; /** * An EJB for administrative phone purposes *

* @author Roland Haeder */ -@Stateless (name = "adminphone", description = "An administrative bean handling phone data") +@Stateless (name = "adminPhone", description = "An administrative bean handling phone data") public class JobsAdminPhoneSessionBean extends BaseJobsDatabaseBean implements AdminPhoneSessionBeanRemote { /** @@ -36,93 +36,93 @@ public class JobsAdminPhoneSessionBean extends BaseJobsDatabaseBean implements A private static final long serialVersionUID = 18_597_165_817_401_853L; @Override - public void deleteCellphoneData (final DialableCellphoneNumber cellPhoneNumber) { + public void deleteMobileData (final DialableMobileNumber mobileNumber) { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteCellphoneData: cellPhoneNumber={1} - CALLED!", this.getClass().getSimpleName(), cellPhoneNumber)); + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber)); // Is all data set - if (null == cellPhoneNumber) { + if (null == mobileNumber) { // Not set, throw NPE - throw new NullPointerException("cellphoneNumber is null"); //NOI18N - } else if (cellPhoneNumber.getPhoneId() == null) { + throw new NullPointerException("mobileNumber is null"); //NOI18N + } else if (mobileNumber.getPhoneId() == null) { // Throw NPE again - throw new NullPointerException("cellphoneNumber.phoneId is null"); //NOI18N - } else if (cellPhoneNumber.getPhoneId() < 1) { + throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N + } else if (mobileNumber.getPhoneId() < 1) { // Invalid number - throw new IllegalArgumentException(MessageFormat.format("cellphoneNumber.phoneId={0} is not valid", cellPhoneNumber.getPhoneId())); //NOI18N - } else if (cellPhoneNumber.getCellphoneProvider() == null) { + throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N + } else if (mobileNumber.getMobileProvider() == null) { // Throw NPE - throw new NullPointerException("cellphoneNumber.cellphoneProvider is null"); //NOI18N - } else if (cellPhoneNumber.getCellphoneProvider().getProviderId() == null) { + throw new NullPointerException("mobileNumber.cellphoneProvider is null"); //NOI18N + } else if (mobileNumber.getMobileProvider().getProviderId() == null) { // ... throw again - throw new NullPointerException("cellphoneNumber.cellphoneProvider.providerId is null"); //NOI18N - } else if (cellPhoneNumber.getCellphoneProvider().getProviderId() < 1) { + throw new NullPointerException("mobileNumber.cellphoneProvider.providerId is null"); //NOI18N + } else if (mobileNumber.getMobileProvider().getProviderId() < 1) { // Id not valid - throw new IllegalArgumentException(MessageFormat.format("cellphoneNumber.cellphoneProvider.providerId={0} is not valid.", cellPhoneNumber.getCellphoneProvider().getProviderId())); //NOI18N - } else if (cellPhoneNumber.getPhoneNumber() == null) { + throw new IllegalArgumentException(MessageFormat.format("mobileNumber.cellphoneProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N + } else if (mobileNumber.getPhoneNumber() == null) { // Throw NPE again - throw new NullPointerException("cellphoneNumber.phoneNumber is null"); //NOI18N - } else if (cellPhoneNumber.getPhoneNumber() < 1) { + throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N + } else if (mobileNumber.getPhoneNumber() < 1) { // Throw NPE again - throw new NullPointerException(MessageFormat.format("cellphoneNumber.phoneNumber={0} is not valid.", cellPhoneNumber.getPhoneNumber())); //NOI18N + throw new NullPointerException(MessageFormat.format("mobileNumber.phoneNumber={0} is not valid.", mobileNumber.getPhoneNumber())); //NOI18N } // Merge it to get a managed entity back - DialableCellphoneNumber managedNumber = this.getEntityManager().getReference(cellPhoneNumber.getClass(), cellPhoneNumber.getPhoneId()); + DialableMobileNumber managedNumber = this.getEntityManager().getReference(mobileNumber.getClass(), mobileNumber.getPhoneId()); // Remove it from database this.getEntityManager().remove(managedNumber); // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteCellphoneData: EXIT!", this.getClass().getSimpleName())); + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: EXIT!", this.getClass().getSimpleName())); } @Override - public DialableCellphoneNumber updateCellphoneData (final DialableCellphoneNumber cellPhoneNumber) { + public DialableMobileNumber updateMobileData (final DialableMobileNumber mobileNumber) { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateCellphoneData: cellPhoneNumber={1} - CALLED!", this.getClass().getSimpleName(), cellPhoneNumber)); + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateCellphoneData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber)); // Is all data set - if (null == cellPhoneNumber) { + if (null == mobileNumber) { // Not set, throw NPE - throw new NullPointerException("cellphoneNumber is null"); //NOI18N - } else if (cellPhoneNumber.getPhoneId() == null) { + throw new NullPointerException("mobileNumber is null"); //NOI18N + } else if (mobileNumber.getPhoneId() == null) { // Throw NPE again - throw new NullPointerException("cellphoneNumber.phoneId is null"); //NOI18N - } else if (cellPhoneNumber.getPhoneId() < 1) { + throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N + } else if (mobileNumber.getPhoneId() < 1) { // Invalid number - throw new IllegalArgumentException(MessageFormat.format("cellphoneNumber.phoneId={0} is not valid", cellPhoneNumber.getPhoneId())); //NOI18N - } else if (cellPhoneNumber.getCellphoneProvider() == null) { + throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N + } else if (mobileNumber.getMobileProvider() == null) { // Throw NPE - throw new NullPointerException("cellphoneNumber.cellphoneProvider is null"); //NOI18N - } else if (cellPhoneNumber.getCellphoneProvider().getProviderId() == null) { + throw new NullPointerException("mobileNumber.cellphoneProvider is null"); //NOI18N + } else if (mobileNumber.getMobileProvider().getProviderId() == null) { // ... throw again - throw new NullPointerException("cellphoneNumber.cellphoneProvider.providerId is null"); //NOI18N - } else if (cellPhoneNumber.getCellphoneProvider().getProviderId() < 1) { + throw new NullPointerException("mobileNumber.cellphoneProvider.providerId is null"); //NOI18N + } else if (mobileNumber.getMobileProvider().getProviderId() < 1) { // Id not valid - throw new IllegalArgumentException(MessageFormat.format("cellphoneNumber.cellphoneProvider.providerId={0} is not valid.", cellPhoneNumber.getCellphoneProvider().getProviderId())); //NOI18N - } else if (cellPhoneNumber.getPhoneNumber() == null) { + throw new IllegalArgumentException(MessageFormat.format("mobileNumber.cellphoneProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N + } else if (mobileNumber.getPhoneNumber() == null) { // Throw NPE again - throw new NullPointerException("cellphoneNumber.phoneNumber is null"); //NOI18N - } else if (cellPhoneNumber.getPhoneNumber() < 1) { + throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N + } else if (mobileNumber.getPhoneNumber() < 1) { // Throw NPE again - throw new NullPointerException(MessageFormat.format("cellphoneNumber.phoneNumber={0} is not valid.", cellPhoneNumber.getPhoneNumber())); //NOI18N + throw new NullPointerException(MessageFormat.format("mobileNumber.phoneNumber={0} is not valid.", mobileNumber.getPhoneNumber())); //NOI18N } // Set updated timestamp - cellPhoneNumber.setPhoneEntryUpdated(new GregorianCalendar()); + mobileNumber.setPhoneEntryUpdated(new GregorianCalendar()); // Get contact from it and find it - DialableCellphoneNumber foundNumber = this.getEntityManager().find(cellPhoneNumber.getClass(), cellPhoneNumber.getPhoneId()); + DialableMobileNumber foundNumber = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getPhoneId()); // Should be found - assert (foundNumber instanceof DialableCellphoneNumber) : MessageFormat.format("Cell phone number with id {0} not found, but should be.", cellPhoneNumber.getPhoneId()); //NOI18N + assert (foundNumber instanceof DialableMobileNumber) : MessageFormat.format("Cell phone number with id {0} not found, but should be.", mobileNumber.getPhoneId()); //NOI18N // Debug message this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateCellphoneData: foundNumber.phoneId={0}", foundNumber.getPhoneId())); //NOI18N // Merge contact instance - DialableCellphoneNumber detachedNumber = this.getEntityManager().merge(foundNumber); + DialableMobileNumber detachedNumber = this.getEntityManager().merge(foundNumber); // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateCellphoneData: detachedNumber={1} - EXIT!", this.getClass().getSimpleName(), detachedNumber)); //NOI18N diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/JobsPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/JobsPhoneSessionBean.java index 9101821..64ec26d 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/phone/JobsPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/phonenumbers/phone/JobsPhoneSessionBean.java @@ -23,12 +23,12 @@ import javax.persistence.NoResultException; import javax.persistence.Query; import org.mxchange.jjobs.database.BaseJobsDatabaseBean; import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -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; /** * A general phone EJB @@ -51,18 +51,18 @@ public class JobsPhoneSessionBean extends BaseJobsDatabaseBean implements PhoneS @SuppressWarnings ("unchecked") @Override - public List allCellphoneNumbers () { + public List allMobileNumbers () { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCellphoneNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N // Get query - Query query = this.getEntityManager().createNamedQuery("AllCellphoneNumbers", CellphoneNumber.class); //NOI18N + Query query = this.getEntityManager().createNamedQuery("AllCellphoneNumbers", MobileNumber.class); //NOI18N // Get list from it - List list = query.getResultList(); + List list = query.getResultList(); // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCellphoneNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N // Return it return list; @@ -107,7 +107,7 @@ public class JobsPhoneSessionBean extends BaseJobsDatabaseBean implements PhoneS } @Override - public DialableCellphoneNumber findCellphoneById (final Long cellphoneId) throws PhoneEntityNotFoundException { + public DialableMobileNumber findMobileNumberById (final Long cellphoneId) throws PhoneEntityNotFoundException { // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCellphoneById: cellphoneId={1} - CALLED!", this.getClass().getSimpleName(), cellphoneId)); //NOI18N @@ -121,18 +121,18 @@ public class JobsPhoneSessionBean extends BaseJobsDatabaseBean implements PhoneS } // Now find it - Query query = this.getEntityManager().createNamedQuery("SearchCellphoneId", CellphoneNumber.class); //NOI18N + Query query = this.getEntityManager().createNamedQuery("SearchCellphoneId", MobileNumber.class); //NOI18N // Set parameter query.setParameter("cellphoneId", cellphoneId); //NOI18N // Init instance - DialableCellphoneNumber cellphone = null; + DialableMobileNumber cellphone = null; // Try to get a result try { // Get a single result - cellphone = (DialableCellphoneNumber) query.getSingleResult(); + cellphone = (DialableMobileNumber) query.getSingleResult(); } catch (NoResultException ex) { // The entry was not found, so throw it again throw new PhoneEntityNotFoundException(cellphoneId, ex); diff --git a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java index c308cf3..e0af749 100644 --- a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java @@ -30,9 +30,9 @@ import javax.persistence.PersistenceException; import javax.persistence.Query; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jjobs.database.BaseJobsDatabaseBean; -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; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; @@ -705,34 +705,34 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes // Should be found! assert (detachedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not merged, but should be.", user.getUserContact().getContactId()); //NOI18N - // Get cellphone instance - DialableCellphoneNumber cellphone = detachedContact.getContactCellphoneNumber(); + // Get mobile instance + DialableMobileNumber mobileNumber = detachedContact.getContactMobileNumber(); - // Is there a cellphone instance set? - if (cellphone instanceof DialableCellphoneNumber) { + // Is there a mobile instance set? + if (mobileNumber instanceof DialableMobileNumber) { // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: cellphone.phoneId={0} is being updated ...", cellphone.getPhoneId())); //NOI18N + this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: mobile.phoneId={0} is being updated ...", mobileNumber.getPhoneId())); //NOI18N // Then find it, too - DialableCellphoneNumber foundCellphone = this.getEntityManager().find(cellphone.getClass(), cellphone.getPhoneId()); + DialableMobileNumber foundMobile = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getPhoneId()); // Should be there - assert (foundCellphone instanceof DialableCellphoneNumber) : MessageFormat.format("Cellphone number with id {0} not found but should be.", foundCellphone.getPhoneId()); //NOI18N + assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N // Then merge it, too - DialableCellphoneNumber detachedCellphone = this.getEntityManager().merge(foundCellphone); + DialableMobileNumber detachedMobile = this.getEntityManager().merge(foundMobile); // Should be there - assert (detachedCellphone instanceof DialableCellphoneNumber) : MessageFormat.format("Cellphone number with id {0} not found but should be.", detachedCellphone.getPhoneId()); //NOI18N + assert (detachedMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", detachedMobile.getPhoneId()); //NOI18N // Copy all - detachedCellphone.copyAll(user.getUserContact().getContactCellphoneNumber()); + detachedMobile.copyAll(user.getUserContact().getContactMobileNumber()); // Set it back - detachedContact.setContactCellphoneNumber(detachedCellphone); + detachedContact.setContactMobileNumber(detachedMobile); } - // Get cellphone instance + // Get mobile instance DialableFaxNumber fax = detachedContact.getContactFaxNumber(); // Is there a fax instance set? @@ -759,7 +759,7 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes detachedContact.setContactFaxNumber(detachedFax); } - // Get cellphone instance + // Get mobile instance DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber(); // Is there a fax instance set?