/**
* EJB for general contact purposes
*/
- @EJB (lookup = "java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote")
+ @EJB (lookup = "java:global/addressbook-ejb/contact!org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote")
private ContactSessionBeanRemote contactBean;
/**
/**
* Remote country EJB
*/
- @EJB (lookup = "java:global/jfinancials-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote")
+ @EJB (lookup = "java:global/addressbook-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote")
private CountrySingletonBeanRemote countryBean;
/**
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * 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.jphone.model.phonenumbers.mobile;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import javax.ejb.Stateless;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
+
+/**
+ * An EJB for administrative mobile number purposes
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Stateless (name = "adminMobile", description = "An administrative bean handling mobile number data")
+public class AddressbookAdminMobileSessionBean extends BaseAddressbookEnterpriseBean implements AdminMobileSessionBeanRemote {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 18_597_165_817_401_854L;
+
+ /**
+ * Default constructor
+ */
+ public AddressbookAdminMobileSessionBean () {
+ // Call super constructor
+ super();
+ }
+
+ @Override
+ public void deleteMobileData (final DialableMobileNumber mobileNumber) {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber));
+
+ // Is all data set
+ if (null == mobileNumber) {
+ // Not set, throw NPE
+ throw new NullPointerException("mobileNumber is null"); //NOI18N
+ } else if (mobileNumber.getMobileId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
+ } else if (mobileNumber.getMobileId() < 1) {
+ // Invalid number
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getMobileId())); //NOI18N
+ } else if (mobileNumber.getMobileProvider() == null) {
+ // Throw NPE
+ throw new NullPointerException("mobileNumber.cellphoneProvider is null"); //NOI18N
+ } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
+ // ... throw again
+ throw new NullPointerException("mobileNumber.cellphoneProvider.providerId is null"); //NOI18N
+ } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
+ // Id not valid
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.cellphoneProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
+ } else if (mobileNumber.getMobileNumber() == null) {
+ // Throw NPE again
+ throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18N
+ } else if (mobileNumber.getMobileNumber() < 1) {
+ // Throw NPE again
+ throw new NullPointerException(MessageFormat.format("mobileNumber.mobileNumber={0} is not valid.", mobileNumber.getMobileNumber())); //NOI18N
+ }
+
+ // Get a managed instance
+ final DialableMobileNumber managedNumber = this.getEntityManager().getReference(mobileNumber.getClass(), mobileNumber.getMobileId());
+
+ // Remove it from database
+ this.getEntityManager().remove(managedNumber);
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: EXIT!", this.getClass().getSimpleName()));
+ }
+
+ @Override
+ public DialableMobileNumber updateMobileData (final DialableMobileNumber mobileNumber) {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber));
+
+ // Is all data set
+ if (null == mobileNumber) {
+ // Not set, throw NPE
+ throw new NullPointerException("mobileNumber is null"); //NOI18N
+ } else if (mobileNumber.getMobileId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
+ } else if (mobileNumber.getMobileId() < 1) {
+ // Invalid number
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getMobileId())); //NOI18N
+ } else if (mobileNumber.getMobileProvider() == null) {
+ // Throw NPE
+ throw new NullPointerException("mobileNumber.cellphoneProvider is null"); //NOI18N
+ } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
+ // ... throw again
+ throw new NullPointerException("mobileNumber.cellphoneProvider.providerId is null"); //NOI18N
+ } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
+ // Id not valid
+ throw new IllegalArgumentException(MessageFormat.format("mobileNumber.cellphoneProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
+ } else if (mobileNumber.getMobileNumber() == null) {
+ // Throw NPE again
+ throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18N
+ } else if (mobileNumber.getMobileNumber() < 1) {
+ // Throw NPE again
+ throw new NullPointerException(MessageFormat.format("mobileNumber.mobileNumber={0} is not valid.", mobileNumber.getMobileNumber())); //NOI18N
+ }
+
+ // Get contact from it and find it
+ final DialableMobileNumber managedNumber = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getMobileId());
+
+ // Should be found
+ assert (managedNumber instanceof DialableMobileNumber) : MessageFormat.format("Cell phone number with id {0} not found, but should be.", mobileNumber.getMobileId()); //NOI18N
+
+ // Debug message
+ this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateMobileData: managedNumber.phoneId={1}", this.getClass().getSimpleName(), managedNumber.getMobileId())); //NOI18N
+
+ // Set updated timestamp
+ MobileNumbers.copyMobileNumber(mobileNumber, managedNumber);
+ managedNumber.setMobileEntryUpdated(new Date());
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateMobileData: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
+
+ // Return it
+ return managedNumber;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * 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.jphone.model.phonenumbers.mobile;
+
+import java.text.MessageFormat;
+import java.util.List;
+import javax.ejb.Stateless;
+import javax.persistence.Query;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
+
+/**
+ * A general mobile number EJB
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Stateless (name = "mobile", description = "A bean handling mobile number data")
+public class AddressbookMobileSessionBean extends BaseAddressbookEnterpriseBean implements MobileSessionBeanRemote {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 134_945_698_127_602L;
+
+ /**
+ * Default constructor
+ */
+ public AddressbookMobileSessionBean () {
+ // Call super constructor
+ super();
+ }
+
+ @SuppressWarnings ("unchecked")
+ @Override
+ public List<DialableMobileNumber> fetchAllMobileNumbers () {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
+ // Get query
+ final Query query = this.getEntityManager().createNamedQuery("AllMobileNumbers", MobileNumber.class); //NOI18N
+
+ // Get list from it
+ final List<DialableMobileNumber> list = query.getResultList();
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
+
+ // Return it
+ return list;
+ }
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.jphone.model.phonenumbers.mobile;
-
-import java.text.MessageFormat;
-import java.util.Date;
-import javax.ejb.Stateless;
-import org.mxchange.jfinancials.enterprise.BaseFinancialsEnterpriseBean;
-
-/**
- * An EJB for administrative mobile number purposes
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "adminMobile", description = "An administrative bean handling mobile number data")
-public class FinancialsAdminMobileSessionBean extends BaseFinancialsEnterpriseBean implements AdminMobileSessionBeanRemote {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 18_597_165_817_401_854L;
-
- /**
- * Default constructor
- */
- public FinancialsAdminMobileSessionBean () {
- // Call super constructor
- super();
- }
-
- @Override
- public void deleteMobileData (final DialableMobileNumber mobileNumber) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber));
-
- // Is all data set
- if (null == mobileNumber) {
- // Not set, throw NPE
- throw new NullPointerException("mobileNumber is null"); //NOI18N
- } else if (mobileNumber.getMobileId() == null) {
- // Throw NPE again
- throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
- } else if (mobileNumber.getMobileId() < 1) {
- // Invalid number
- throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getMobileId())); //NOI18N
- } else if (mobileNumber.getMobileProvider() == null) {
- // Throw NPE
- throw new NullPointerException("mobileNumber.cellphoneProvider is null"); //NOI18N
- } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
- // ... throw again
- throw new NullPointerException("mobileNumber.cellphoneProvider.providerId is null"); //NOI18N
- } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
- // Id not valid
- throw new IllegalArgumentException(MessageFormat.format("mobileNumber.cellphoneProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
- } else if (mobileNumber.getMobileNumber() == null) {
- // Throw NPE again
- throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18N
- } else if (mobileNumber.getMobileNumber() < 1) {
- // Throw NPE again
- throw new NullPointerException(MessageFormat.format("mobileNumber.mobileNumber={0} is not valid.", mobileNumber.getMobileNumber())); //NOI18N
- }
-
- // Get a managed instance
- final DialableMobileNumber managedNumber = this.getEntityManager().getReference(mobileNumber.getClass(), mobileNumber.getMobileId());
-
- // Remove it from database
- this.getEntityManager().remove(managedNumber);
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteMobileData: EXIT!", this.getClass().getSimpleName()));
- }
-
- @Override
- public DialableMobileNumber updateMobileData (final DialableMobileNumber mobileNumber) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber));
-
- // Is all data set
- if (null == mobileNumber) {
- // Not set, throw NPE
- throw new NullPointerException("mobileNumber is null"); //NOI18N
- } else if (mobileNumber.getMobileId() == null) {
- // Throw NPE again
- throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
- } else if (mobileNumber.getMobileId() < 1) {
- // Invalid number
- throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getMobileId())); //NOI18N
- } else if (mobileNumber.getMobileProvider() == null) {
- // Throw NPE
- throw new NullPointerException("mobileNumber.cellphoneProvider is null"); //NOI18N
- } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
- // ... throw again
- throw new NullPointerException("mobileNumber.cellphoneProvider.providerId is null"); //NOI18N
- } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
- // Id not valid
- throw new IllegalArgumentException(MessageFormat.format("mobileNumber.cellphoneProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
- } else if (mobileNumber.getMobileNumber() == null) {
- // Throw NPE again
- throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18N
- } else if (mobileNumber.getMobileNumber() < 1) {
- // Throw NPE again
- throw new NullPointerException(MessageFormat.format("mobileNumber.mobileNumber={0} is not valid.", mobileNumber.getMobileNumber())); //NOI18N
- }
-
- // Get contact from it and find it
- final DialableMobileNumber managedNumber = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getMobileId());
-
- // Should be found
- assert (managedNumber instanceof DialableMobileNumber) : MessageFormat.format("Cell phone number with id {0} not found, but should be.", mobileNumber.getMobileId()); //NOI18N
-
- // Debug message
- this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateMobileData: managedNumber.phoneId={1}", this.getClass().getSimpleName(), managedNumber.getMobileId())); //NOI18N
-
- // Set updated timestamp
- MobileNumbers.copyMobileNumber(mobileNumber, managedNumber);
- managedNumber.setMobileEntryUpdated(new Date());
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateMobileData: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
- // Return it
- return managedNumber;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.jphone.model.phonenumbers.mobile;
-
-import java.text.MessageFormat;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.persistence.Query;
-import org.mxchange.jfinancials.enterprise.BaseFinancialsEnterpriseBean;
-
-/**
- * A general mobile number EJB
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "mobile", description = "A bean handling mobile number data")
-public class FinancialsMobileSessionBean extends BaseFinancialsEnterpriseBean implements MobileSessionBeanRemote {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 134_945_698_127_602L;
-
- /**
- * Default constructor
- */
- public FinancialsMobileSessionBean () {
- // Call super constructor
- super();
- }
-
- @SuppressWarnings ("unchecked")
- @Override
- public List<DialableMobileNumber> fetchAllMobileNumbers () {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
- // Get query
- final Query query = this.getEntityManager().createNamedQuery("AllMobileNumbers", MobileNumber.class); //NOI18N
-
- // Get list from it
- final List<DialableMobileNumber> list = query.getResultList();
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
- // Return it
- return list;
- }
-
-}