]> git.mxchange.org Git - jfinancials-ejb.git/commitdiff
Continued: (please cherry-pick)
authorRoland Häder <roland@mxchange.org>
Mon, 8 Aug 2016 14:27:05 +0000 (16:27 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 8 Aug 2016 17:53:27 +0000 (19:53 +0200)
- implemented allSomeNumbers() methods
- used MessageFormat
- ignored strings for i18n
- exposed list to method body to have it being logged in trace message

Signed-off-by: Roland Häder <roland@haeder.net>
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java

index 32837737ce8a7a5543d5f8a5f676025e5276da35..0473e7742d2bec503fa207b3cb99f8ed8b658ac9 100644 (file)
  */
 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
@@ -32,4 +41,61 @@ 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;
+       }
+
 }