From caebe98795900fd5f93092d46f8697bbe335194c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 9 Aug 2016 11:20:12 +0200 Subject: [PATCH] Moved to proper EJB: (please cherry-pick) - these methods are not administrative, they are general and should be used there MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../phone/PizzaAdminPhoneSessionBean.java | 66 ------------------- .../phone/PizzaPhoneSessionBean.java | 62 +++++++++++++++++ 2 files changed, 62 insertions(+), 66 deletions(-) diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaAdminPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaAdminPhoneSessionBean.java index 6a1a294..61c3f21 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaAdminPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaAdminPhoneSessionBean.java @@ -16,16 +16,7 @@ */ 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.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.pizzaaplication.database.BasePizzaDatabaseBean; /** @@ -41,61 +32,4 @@ public class PizzaAdminPhoneSessionBean extends BasePizzaDatabaseBean implements */ private static final long serialVersionUID = 18_597_165_817_401_853L; - @SuppressWarnings ("unchecked") - @Override - public List 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 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 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 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 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 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/PizzaPhoneSessionBean.java b/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaPhoneSessionBean.java index 7763501..cdb58d0 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaPhoneSessionBean.java @@ -17,11 +17,16 @@ 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; 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; /** @@ -82,4 +87,61 @@ public class PizzaPhoneSessionBean extends BasePizzaDatabaseBean implements Phon return cellphone; } + @SuppressWarnings ("unchecked") + @Override + public List 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 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 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 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 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 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; + } + } -- 2.39.5