]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - src/java/org/mxchange/pizzaapplication/beans/enums/PizzaServiceDataWebBean.java
updated jshop-ee-jar + made first calls
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / enums / PizzaServiceDataWebBean.java
index e9655c12a5a6fbbc3f7b7fdd4b56cbda1663aca9..06b8161768ef21d01b61eab8d2f3908fecd48420 100644 (file)
 package org.mxchange.pizzaapplication.beans.enums;
 
 import java.text.MessageFormat;
-import java.util.Arrays;
 import java.util.List;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import org.mxchange.jcore.model.contact.gender.Gender;
-import org.mxchange.jshopejb.beans.BaseFrameworkBean;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopeelib.beans.remote.data.ShopDataBeanRemote;
 
 /**
  * A customer bean which hides the customer instance
@@ -38,23 +40,41 @@ public class PizzaServiceDataWebBean extends BaseFrameworkBean implements DataWe
         */
        private static final long serialVersionUID = 835482364189L;
 
+       /**
+        * Remote bean
+        */
+       private final ShopDataBeanRemote remote;
+
+       /**
+        * Default constructor
+        * 
+        * @throws javax.naming.NamingException If something happens?
+        */
+       public PizzaServiceDataWebBean () throws NamingException {
+               // Get initial context
+               InitialContext context = new InitialContext();
+
+               // Try to lookup bean
+               this.remote = (ShopDataBeanRemote) context.lookup("ejb/stateless-data");
+       }
+
        @Override
-       public Gender[] getGenders () {
+       public Gender[] allGenders () {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("Genders={0} - EXIT!", Arrays.toString(Gender.values())));
+               this.getLogger().trace("CALLED!");
 
                // Return it
-               return Gender.values();
+               return this.getRemote().allGenders();
        }
 
        @Override
-       public List<Gender> getSelectableGenders () {
+       public List<Gender> selectableGenders () {
                // Trace message
                this.getLogger().trace("CALLED!"); //NOI18N
 
                // Init array
                // TODO Call EJB here?
-               List<Gender> genders = null;
+               List<Gender> genders = this.getRemote().selectableGenders();
 
                // Trace message
                this.getLogger().trace(MessageFormat.format("genders={0} - EXIT!", genders)); //NOI18N
@@ -62,4 +82,11 @@ public class PizzaServiceDataWebBean extends BaseFrameworkBean implements DataWe
                // Return it
                return genders;
        }
+
+       /**
+        * @return the remote
+        */
+       private ShopDataBeanRemote getRemote () {
+               return this.remote;
+       }
 }