--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontacts.contact;
+
+import java.text.MessageFormat;
+import java.util.GregorianCalendar;
+import javax.ejb.Stateless;
+import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
+
+/**
+ * An administrative contact EJB
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Stateless (name = "adminContact", description = "An administrative contact EJB")
+public class AddressbookAdminContactSessionBean extends BaseAddressbookDatabaseBean implements AdminContactSessionBeanRemote {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 542_145_347_916L;
+
+ /**
+ * Default constructor
+ */
+ public AddressbookAdminContactSessionBean () {
+ }
+
+ @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
+ }
+
+}
}
// 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);
+++ /dev/null
-/*
- * 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 <http://www.gnu.org/licenses/>.
- */
-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
- * <p>
- * @author Roland Haeder<rhaeder@cho-time.de>
- */
-@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
- }
-
-}
import javax.ejb.Stateless;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
-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
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) {
} 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;
*/
package org.mxchange.jphone.phonenumbers.phone;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
import java.text.MessageFormat;
import java.util.GregorianCalendar;
import javax.ejb.Stateless;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
+import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
/**
* An EJB for administrative phone purposes
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@Stateless (name = "adminphone", description = "An administrative bean handling phone data")
+@Stateless (name = "adminPhone", description = "An administrative bean handling phone data")
public class AddressbookAdminPhoneSessionBean extends BaseAddressbookDatabaseBean implements AdminPhoneSessionBeanRemote {
/**
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
import javax.persistence.Query;
import org.mxchange.jcoreee.database.BaseDatabaseBean;
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
@SuppressWarnings ("unchecked")
@Override
- public List<DialableCellphoneNumber> allCellphoneNumbers () {
+ public List<DialableMobileNumber> 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<DialableCellphoneNumber> list = query.getResultList();
+ List<DialableMobileNumber> 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;
}
@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
}
// 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);
import javax.persistence.Query;
import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
import org.mxchange.jcontacts.contact.Contact;
-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;
// 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?
detachedContact.setContactFaxNumber(detachedFax);
}
- // Get cellphone instance
+ // Get mobile instance
DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber();
// Is there a fax instance set?