import java.text.MessageFormat;
import java.util.List;
import java.util.Objects;
-import javax.annotation.PostConstruct;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
-import javax.inject.Inject;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreeelogger.beans.local.logger.Log;
import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
-import org.mxchange.pizzaapplication.beans.shop.PizzaShopWebApplicationController;
/**
* A converter for transfering category objects
@FacesConverter (value = "category")
public class PizzaCategoryConverter implements Converter {
+ /**
+ * Category EJB
+ */
+ private CategorySessionBeanRemote categoryBean;
+
/**
* Logger instance
*/
private LoggerBeanLocal loggerBeanLocal;
/**
- * Category bean
+ * Default constructor
*/
- @Inject
- private PizzaShopWebApplicationController shopController;
+ public PizzaCategoryConverter () {
+ // Try to get it
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Lookup logger
+ this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+ } catch (final NamingException ex) {
+ // Continue to throw it
+ throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
+ }
+ }
@Override
public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
// Get full list
- List<Category> categoryList = this.shopController.getAllCategories();
+ List<Category> categoryList = this.categoryBean.getAllCategories();
// Is the value null or empty?
if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
return String.valueOf(((Category) value).getCategoryId());
}
- /**
- * Initialization of this converter
- */
- @PostConstruct
- public void init () {
- // Try to get it
- try {
- // Get initial context
- Context context = new InitialContext();
-
- // Lookup logger
- this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
- } catch (final NamingException ex) {
- // Continue to throw it
- throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
- }
- }
-
}
#CONTENT_TITLE_ADMIN_ADD_USER
CONTENT_TITLE_ADMIN_ADD_USER=Neues Benutzeraccount hinzufuegen:
TABLE_SUMMARY_ADMIN_LIST_USERS=Administration, alle Benutzer auflisten
+ITEM_ORDER_AMOUNT=Bestellmenge:
PAGE_TITLE_ADMIN_ADD_USER=Add new user account
CONTENT_TITLE_ADMIN_ADD_USER=Add new user account:
TABLE_SUMMARY_ADMIN_LIST_USERS=Administration, list all users
+ITEM_ORDER_AMOUNT=Amount:
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@Named ("admin_category")
+@Named ("adminCategoryController")
@RequestScoped
public class PizzaAdminCategoryWebRequestBean implements PizzaAdminCategoryWebRequestController {
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@Named ("country")
+@Named ("countryController")
@ApplicationScoped
public class PizzaCountryWebApplicationBean implements PizzaCountryWebApplicationController {
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@Named ("gender")
+@Named ("genderController")
@ApplicationScoped
public class PizzaGenderWebApplicationBean implements PizzaGenderWebApplicationController {
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@Named ("localization")
+@Named ("localizationController")
@SessionScoped
public class PizzaLocalizationSessionBean extends BaseDatabaseBean implements PizzaLocalizationSessionController {
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@Named ("controller")
+@Named ("shopController")
@ApplicationScoped
public class PizzaShopWebApplicationBean implements PizzaShopWebApplicationController {
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@FacesConverter (value = "cellphoneCarrier")
+@FacesConverter (value = "CellphoneCarrierConverter")
public class PizzaSmsProviderConverter implements Converter {
/**
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:selectOneMenu class="select" id="productCategory" value="#{adminProductController.productCategory}" required="true" requiredMessage="#{msg.ADMIN_CATEGORY_MUST_BE_SELECTED}" converter="category">
- <f:selectItems value="#{controller.allCategories}" var="cat" itemValue="#{cat}" itemLabel="#{cat.categoryTitle}" />
+ <f:selectItems value="#{shopController.allCategories}" var="cat" itemValue="#{cat}" itemLabel="#{cat.categoryTitle}" />
</h:selectOneMenu>
</ui:composition>
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
- <h:selectOneMenu class="select" id="parentCategory" value="#{admin_category.parentCategory}">
+ <h:selectOneMenu class="select" id="parentCategory" value="#{adminCategoryController.parentCategory}">
<f:selectItem itemValue="" itemLabel="#{msg.ADMIN_CATEGORY_HAS_NO_PARENT}" />
- <f:selectItems value="#{controller.allCategoriesParent}" var="parent_category" itemValue="#{parent_category.categoryId}" itemLabel="#{parent_category.categoryTitle}" />
+ <f:selectItems value="#{shopController.allCategoriesParent}" var="parent_category" itemValue="#{parent_category.categoryId}" itemLabel="#{parent_category.categoryTitle}" />
</h:selectOneMenu>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<html
- lang="#{localization.language}" xml:lang="#{localization.language}"
+ lang="#{localizationController.language}" xml:lang="#{localizationController.language}"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
- <f:view locale="#{localization.locale}" contentType="text/html">
+ <f:view locale="#{localizationController.locale}" contentType="text/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<div class="table_right">
<h:selectOneMenu class="select" id="country" value="#{userController.country}" converter="country">
<f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{country.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryCode} (#{msg[c.countryI18nkey]})" />
+ <f:selectItems value="#{countryController.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryCode} (#{msg[c.countryI18nkey]})" />
</h:selectOneMenu>
</div>
<div class="table_right">
<h:selectOneMenu class="select" id="phoneCountryCode" value="#{userController.phoneCountry}" converter="country">
<f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{country.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryAbroadDialPrefix}#{c.countryPhoneCode}" />
+ <f:selectItems value="#{countryController.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryAbroadDialPrefix}#{c.countryPhoneCode}" />
</h:selectOneMenu>
<h:inputText class="input" id="phoneAreaCode" size="5" maxlength="10" value="#{userController.phoneAreaCode}">
<div class="table_right">
<h:selectOneMenu class="select" id="faxCountryCode" value="#{userController.faxCountry}" converter="country">
<f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{country.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryAbroadDialPrefix}#{c.countryPhoneCode}" />
+ <f:selectItems value="#{countryController.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryAbroadDialPrefix}#{c.countryPhoneCode}" />
</h:selectOneMenu>
<h:inputText class="input" id="faxAreaCode" size="5" maxlength="10" value="#{userController.faxAreaCode}">
</div>
<div class="table_right">
- <h:selectOneMenu class="select" id="cellphoneCarrier" value="#{userController.cellphoneCarrier}" converter="cellphoneCarrier">
+ <h:selectOneMenu class="select" id="cellphoneCarrier" value="#{userController.cellphoneCarrier}" converter="CellphoneCarrierConverter">
<f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems value="#{cellphone.allSmsProvider()}" var="p" itemValue="#{p}" itemLabel="#{p.providerCountry.countryLocalDialPrefix}#{p.providerDialPrefix} (#{p.providerName})" />
</h:selectOneMenu>
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:selectOneMenu class="select" id="gender" value="#{customerController.gender}">
- <f:selectItems value="#{gender.selectableGenders}" var="g" itemValue="#{g}" itemLabel="#{msg[g.messageKey]}" />
+ <f:selectItems value="#{genderController.selectableGenders}" var="g" itemValue="#{g}" itemLabel="#{msg[g.messageKey]}" />
</h:selectOneMenu>
</ui:composition>
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:form id="locale_selection">
- <h:selectOneMenu id="language_selection" value="#{localization.language}" onchange="submit()">
+ <h:selectOneMenu id="language_selection" value="#{localizationController.language}" onchange="submit()">
<f:selectItem itemLabel="#{msg.SELECT_LANGUAGE}" noSelectionOption="true" />
- <f:selectItems value="#{localization.selectableLocalizations}" var="l" itemValue="#{l}" itemLabel="#{msg[l.toString().toUpperCase()]}" />
+ <f:selectItems value="#{localizationController.selectableLocalizations}" var="l" itemValue="#{l}" itemLabel="#{msg[l.toString().toUpperCase()]}" />
</h:selectOneMenu>
</h:form>
</ui:composition>
<div class="table_footer">
<h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
- <h:commandButton class="submit" type="submit" action="#{controller.doLogin()}" value="#{msg.BUTTON_CUSTOMER_LOGIN}" />
+ <h:commandButton class="submit" type="submit" action="#{loginController.doLogin()}" value="#{msg.BUTTON_CUSTOMER_LOGIN}" />
</div>
</div>
</h:form>
<ui:define name="content">
<div class="para">
<h:form id="form">
- <h:dataTable id="categories" var="cat" value="#{controller.allCategories}" styleClass="table" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_CATEGORY}">
+ <h:dataTable id="categories" var="cat" value="#{shopController.allCategories}" styleClass="table" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_CATEGORY}">
<h:column>
<f:facet name="header">#{msg.SELECT_ENTRY}</f:facet>
#{cat.categoryId}:
<div class="table_footer">
<h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
- <h:commandButton class="submit" type="submit" id="edit" action="#{admin_category.editCategory(cat)}" value="#{msg.ADMIN_BUTTON_EDIT_ENTRIES}" />
- <h:commandButton class="delete" type="submit" id="delete" action="#{admin_category.deleteCategory(cat)}" value="#{msg.ADMIN_BUTTON_DELETE_ENTRIES}" />
+ <h:commandButton class="submit" type="submit" id="edit" action="#{adminCategoryController.editCategory(cat)}" value="#{msg.ADMIN_BUTTON_EDIT_ENTRIES}" />
+ <h:commandButton class="delete" type="submit" id="delete" action="#{adminCategoryController.deleteCategory(cat)}" value="#{msg.ADMIN_BUTTON_DELETE_ENTRIES}" />
</div>
</h:form>
</div>
</div>
<div class="table_right">
- <h:inputText class="input" id="guest_title" value="#{admin_category.categoryTitle}" size="10" maxlength="255" required="true" />
+ <h:inputText class="input" id="guest_title" value="#{adminCategoryController.categoryTitle}" size="10" maxlength="255" required="true" />
</div>
<div class="clear"></div>
<div class="table_footer">
<h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
- <h:commandButton class="submit" type="submit" action="#{admin_category.addCategory()}" value="#{msg.ADMIN_BUTTON_ADD_CATEGORY}" />
+ <h:commandButton class="submit" type="submit" action="#{adminCategoryController.addCategory()}" value="#{msg.ADMIN_BUTTON_ADD_CATEGORY}" />
</div>
</div>
</h:form>
</div>
<div class="table_right">
- <h:inputText class="input" id="guest_title" size="10" maxlength="255" required="true" value="#{admin_product.productTitle}" />
+ <h:inputText class="input" id="guest_title" size="10" maxlength="255" required="true" value="#{adminProductController.productTitle}" />
</div>
<div class="clear"></div>
</div>
<div class="table_right">
- <h:inputText class="input" id="price" size="10" maxlength="255" required="true" value="#{admin_product.productPrice}" />
+ <h:inputText class="input" id="price" size="10" maxlength="255" required="true" value="#{adminProductController.productPrice}" />
</div>
<div class="clear"></div>
</div>
</div>
- <h:dataTable id="table_show_available_products" var="product" value="#{controller.availableProducts}" styleClass="table" summary="#{msg.TABLE_SUMMARY_INDEX_PRODUCTS}">
+ <h:dataTable id="table_show_available_products" var="product" value="#{shopController.availableProducts}" styleClass="table" summary="#{msg.TABLE_SUMMARY_INDEX_PRODUCTS}">
<h:column>
<div id="main_item_container">
<div class="item_title">
<ui:fragment rendered="#{basketController.isProductAdded(product)}">
<div class="item_amount">
- Anzahl:
+ #{msg.ITEM_ORDER_AMOUNT}
#{basketController.getItemAmount(product)}
</div>
<div class="table_right">
<div class="item_price">
#{msg.SINGLE_ITEM_PRICE}
- <h:outputText class="price" value="#{product.price}">
+ <h:outputText class="price" value="#{product.productPrice}">
<f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
</h:outputText>
</div>