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
*/
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
// Return it
return genders;
}
+
+ /**
+ * @return the remote
+ */
+ private ShopDataBeanRemote getRemote () {
+ return this.remote;
+ }
}