}
// 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);
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.pizzaaplication.database.BasePizzaDatabaseBean;
+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;
import java.text.MessageFormat;
import java.util.GregorianCalendar;
import javax.ejb.Stateless;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean;
/**
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@Stateless (name = "adminphone", description = "Administrative bean handling phone data")
+@Stateless (name = "adminPhone", description = "An administrative bean handling phone data")
public class PizzaAdminPhoneSessionBean extends BasePizzaDatabaseBean 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.NoResultException;
import javax.persistence.Query;
import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
-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.pizzaaplication.database.BasePizzaDatabaseBean;
+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.PersistenceException;
import javax.persistence.Query;
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?