]> git.mxchange.org Git - addressbook-mailer-ejb.git/commitdiff
Please move:
authorRoland Häder <roland@mxchange.org>
Mon, 8 Aug 2016 14:03:26 +0000 (16:03 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 8 Aug 2016 17:52:29 +0000 (19:52 +0200)
- this is for e.g. unlinking or linking cell phone, land-line or fax numbers with contacts
- this is not any-phone-numbers only

Signed-off-by: Roland Häder <roland@haeder.net>
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jcontacts/phone/AddressbookAdminContactPhoneSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminContactPhoneSessionBean.java [deleted file]
src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java

diff --git a/src/java/org/mxchange/jcontacts/phone/AddressbookAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jcontacts/phone/AddressbookAdminContactPhoneSessionBean.java
new file mode 100644 (file)
index 0000000..487c710
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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.phone;
+
+import javax.ejb.Stateless;
+import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+
+/**
+ * A session EJB for administrative contact's phone number purposes
+ * <p>
+ * @author Roland Haeder<rhaeder@cho-time.de>
+ */
+@Stateless (name = "admincontactphone", description = "An administrative bean handling contact's phone data")
+public class AddressbookAdminContactPhoneSessionBean extends BaseAddressbookDatabaseBean implements AdminContactsPhoneSessionBeanRemote {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 189_217_561_460_237_108L;
+
+}
diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminContactPhoneSessionBean.java
deleted file mode 100644 (file)
index fbb3606..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.jphone.phonenumbers.phone;
-
-import java.text.MessageFormat;
-import java.util.LinkedList;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.UserContact;
-import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
-import org.mxchange.jcoreee.database.BaseDatabaseBean;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
-
-/**
- * A session EJB for administrative contact's phone number purposes
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Stateless (name = "admincontactphone", description = "An administrative bean handling contact's phone data")
-public class AddressbookAdminContactPhoneSessionBean extends BaseDatabaseBean implements AdminContactsPhoneSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 189_217_561_460_237_108L;
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<Contact> allContacts (final DialableCellphoneNumber cellPhone) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allContacts: cellPhone={1} - CALLED!", this.getClass().getSimpleName(), cellPhone)); //NOI18N
-
-               // The parameter should be valid
-               if (null == cellPhone) {
-                       // Throw NPE
-                       throw new NullPointerException("cellPhone is null"); //NOI18N
-               } else if (cellPhone.getPhoneId() == null) {
-                       // Phone id is null, means not persisted or correclty updated instance
-                       throw new NullPointerException("cellPhone.phoneId is null"); //NOI18N
-               } else if (cellPhone.getPhoneId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("cellPhone.phoneId={0} is not valid", cellPhone.getPhoneId())); //NOI18N
-               }
-
-               // Init list instance
-               List<Contact> contacts = new LinkedList<>();
-
-               // Get query object from all found contact-cellphone links
-               Query query = this.getEntityManager().createNamedQuery("AllContactsByCellphone", UserContact.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("cellPhone", cellPhone); //NOI18N
-
-               // Try to find all
-               try {
-                       contacts = query.getResultList();
-               } catch (final NoResultException ex) {
-                       // No results found
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allContacts: contacts.size()={1} - EXIT!", this.getClass().getSimpleName(), contacts.size())); //NOI18N
-
-               // Return list
-               return contacts;
-       }
-
-}
index 0ef7a7c7a749fbfb822ac9887fb4008b42e3099b..32837737ce8a7a5543d5f8a5f676025e5276da35 100644 (file)
@@ -17,7 +17,7 @@
 package org.mxchange.jphone.phonenumbers.phone;
 
 import javax.ejb.Stateless;
-import org.mxchange.jcoreee.database.BaseDatabaseBean;
+import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
 
 /**
  * An EJB for administrative phone purposes
@@ -25,7 +25,7 @@ import org.mxchange.jcoreee.database.BaseDatabaseBean;
  * @author Roland Haeder<roland@mxchange.org>
  */
 @Stateless (name = "adminphone", description = "An administrative bean handling phone data")
-public class AddressbookAdminPhoneSessionBean extends BaseDatabaseBean implements AdminPhoneSessionBeanRemote {
+public class AddressbookAdminPhoneSessionBean extends BaseAddressbookDatabaseBean implements AdminPhoneSessionBeanRemote {
 
        /**
         * Serial number