From: Roland Häder <roland@mxchange.org>
Date: Tue, 9 Aug 2016 09:20:12 +0000 (+0200)
Subject: Moved to proper EJB: (please cherry-pick)
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2346998e40a6628e08b14521cb862f6636dc32ec;p=addressbook-ejb.git

Moved to proper EJB: (please cherry-pick)
- these methods are not administrative, they are general and should be used there

Signed-off-by: Roland Häder <roland@mxchange.org>
---

diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java
index 0473e77..3283773 100644
--- a/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java
+++ b/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java
@@ -16,17 +16,8 @@
  */
 package org.mxchange.jphone.phonenumbers.phone;
 
-import java.text.MessageFormat;
-import java.util.List;
 import javax.ejb.Stateless;
-import javax.persistence.Query;
 import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-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;
 
 /**
  * An EJB for administrative phone purposes
@@ -41,61 +32,4 @@ public class AddressbookAdminPhoneSessionBean extends BaseAddressbookDatabaseBea
 	 */
 	private static final long serialVersionUID = 18_597_165_817_401_853L;
 
-	@SuppressWarnings ("unchecked")
-	@Override
-	public List<DialableCellphoneNumber> allCellphoneNumbers () {
-		// Trace message
-		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCellphoneNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-		// Get query
-		Query query = this.getEntityManager().createNamedQuery("AllCellphoneNumbers", CellphoneNumber.class); //NOI18N
-
-		// Get list from it
-		List<DialableCellphoneNumber> list = query.getResultList();
-
-		// Trace message
-		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCellphoneNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-		// Return it
-		return list;
-	}
-
-	@SuppressWarnings ("unchecked")
-	@Override
-	public List<DialableFaxNumber> allFaxNumbers () {
-		// Trace message
-		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allFaxNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-		// Get query
-		Query query = this.getEntityManager().createNamedQuery("AllFaxNumbers", FaxNumber.class); //NOI18N
-
-		// Get list from it
-		List<DialableFaxNumber> list = query.getResultList();
-
-		// Trace message
-		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allFaxNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-		// Return it
-		return list;
-	}
-
-	@SuppressWarnings ("unchecked")
-	@Override
-	public List<DialableLandLineNumber> allLandLineNumbers () {
-		// Trace message
-		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allLandLineNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-		// Get query
-		Query query = this.getEntityManager().createNamedQuery("AllLandLineNumbers", LandLineNumber.class); //NOI18N
-
-		// Get list from it
-		List<DialableLandLineNumber> list = query.getResultList();
-
-		// Trace message
-		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allLandLineNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-		// Return it
-		return list;
-	}
-
 }
diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookPhoneSessionBean.java
index 5255d64..687cc28 100644
--- a/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookPhoneSessionBean.java
+++ b/src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookPhoneSessionBean.java
@@ -17,6 +17,7 @@
 package org.mxchange.jphone.phonenumbers.phone;
 
 import java.text.MessageFormat;
+import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
@@ -24,6 +25,10 @@ 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;
 
 /**
  * A general phone EJB
@@ -83,4 +88,61 @@ public class AddressbookPhoneSessionBean extends BaseDatabaseBean implements Pho
 		return cellphone;
 	}
 
+	@SuppressWarnings ("unchecked")
+	@Override
+	public List<DialableCellphoneNumber> allCellphoneNumbers () {
+		// Trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCellphoneNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
+		// Get query
+		Query query = this.getEntityManager().createNamedQuery("AllCellphoneNumbers", CellphoneNumber.class); //NOI18N
+
+		// Get list from it
+		List<DialableCellphoneNumber> list = query.getResultList();
+
+		// Trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCellphoneNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
+
+		// Return it
+		return list;
+	}
+
+	@SuppressWarnings ("unchecked")
+	@Override
+	public List<DialableFaxNumber> allFaxNumbers () {
+		// Trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allFaxNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
+		// Get query
+		Query query = this.getEntityManager().createNamedQuery("AllFaxNumbers", FaxNumber.class); //NOI18N
+
+		// Get list from it
+		List<DialableFaxNumber> list = query.getResultList();
+
+		// Trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allFaxNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
+
+		// Return it
+		return list;
+	}
+
+	@SuppressWarnings ("unchecked")
+	@Override
+	public List<DialableLandLineNumber> allLandLineNumbers () {
+		// Trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allLandLineNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
+		// Get query
+		Query query = this.getEntityManager().createNamedQuery("AllLandLineNumbers", LandLineNumber.class); //NOI18N
+
+		// Get list from it
+		List<DialableLandLineNumber> list = query.getResultList();
+
+		// Trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allLandLineNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
+
+		// Return it
+		return list;
+	}
+
 }