<copyfiles files="${file.reference.jcountry-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.jcountry-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.jphone-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.jphone-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.jcontacts-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.jcustomer-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.jcustomer-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.jcountry-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.jcountry-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.jphone-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.jphone-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.jcontacts-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.jcustomer-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.jcustomer-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
build.xml.stylesheet.CRC32=651128d4@1.68.1.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=6cb26eb6
-nbproject/build-impl.xml.script.CRC32=ad01ddaf
+nbproject/build-impl.xml.data.CRC32=10a373e0
+nbproject/build-impl.xml.script.CRC32=f7d4e4e8
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.75.1.1
file.reference.jcustomer-core.jar=lib/jcustomer-core.jar
file.reference.jcustomer-lib.jar=lib/jcustomer-lib.jar
file.reference.jphone-core.jar=lib/jphone-core.jar
+file.reference.jphone-lib.jar=lib/jphone-lib.jar
file.reference.jshop-core.jar=lib/jshop-core.jar
file.reference.jshop-ee-lib.jar=lib/jshop-ee-lib.jar
includes=**
${file.reference.jcountry-core.jar}:\
${file.reference.jcountry-lib.jar}:\
${file.reference.jphone-core.jar}:\
+ ${file.reference.jphone-lib.jar}:\
${file.reference.jcontacts-core.jar}:\
${file.reference.jcustomer-core.jar}:\
${file.reference.jcustomer-lib.jar}:\
source.reference.jcustomer-core.jar=../jcustomer-core/src/
source.reference.jcustomer-lib.jar=../jcustomer-lib/src/
source.reference.jphone-core.jar=../jphone-core/src/
+source.reference.jphone-lib.jar=../jphone-lib/src/
source.reference.jshop-core.jar=../jshop-core/src/
source.reference.jshop-ee-lib.jar=../jshop-ee-lib/src/
source.root=src
<file>${file.reference.jphone-core.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
+ <library dirs="200">
+ <file>${file.reference.jphone-lib.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
<library dirs="200">
<file>${file.reference.jcontacts-core.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
}
}
+
}
PAGE_TITLE_ADMIN_ADD_USER=Neues Benutzeraccount hinzufuegen
#CONTENT_TITLE_ADMIN_ADD_USER
CONTENT_TITLE_ADMIN_ADD_USER=Neues Benutzeraccount hinzufuegen:
+TABLE_SUMMARY_ADMIN_LIST_USERS=Administration, alle Benutzer auflisten
ADMIN_MENU_USER_TITLE=User management
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
// Return it
return foundItem;
}
+
}
* @return Last added item
*/
String outputLastAddedItem ();
+
}
public void setParentCategory (final Category parentCategory) {
this.parentCategory = parentCategory;
}
+
}
* @param categoryTitle the title to set
*/
void setCategoryTitle (final String categoryTitle);
+
}
throw new FacesException(e);
}
}
+
}
* @param customer Customer instance
*/
void setCustomer (final Customer customer);
+
}
// "Cache" country list as this will not change so often.
this.countryList = this.countryBean.allCountries();
}
+
}
* @return All countries
*/
List<Country> allCountries ();
+
}
public boolean isRequiredPersonalDataSet () {
return ((this.getGender() != null) && (this.getFirstName() != null) && (this.getFamilyName() != null) && (this.getStreet() != null) && (this.getHouseNumber() != null) && (this.getZipCode() != null) && (this.getCity() != null));
}
+
}
* @return Whether the required personal data is set
*/
boolean isRequiredPersonalDataSet ();
+
}
public void setProductTitle (final String productTitle) {
this.productTitle = productTitle;
}
+
}
* @param title Product's title
*/
void setProductTitle (final String title);
+
}
public void setCustomer (final Customer customer) {
this.customer = customer;
}
+
}
* @param customer Customer instance
*/
void setCustomer (final Customer customer);
+
}
throw new FacesException(e);
}
}
+
}
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
List<Product> getAvailableProducts () throws FaceletException;
+
}
--- /dev/null
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaservice.converter.country;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Objects;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+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.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
+
+/**
+ * Converter for country instance
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@FacesConverter (value = "country")
+public class PizzaCountryConverter implements Converter {
+
+ /**
+ * Country bean
+ */
+ private CountrySingletonBeanRemote countryBean;
+
+ /**
+ * Logger instance
+ */
+ @Log
+ private LoggerBeanLocal loggerBeanLocal;
+
+ /**
+ * Initialization of this converter
+ */
+ public PizzaCountryConverter () {
+ // 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
+
+ // ... and country bean
+ this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/pizza-ejb/country!org.mxchange.jcountry.data.AddressbookCountrySingletonBeanRemote"); //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) {
+ // Trace message
+ this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2},this.countryBean={3} - CALLED!", context, component, submittedValue, this.countryBean)); //NOI18N
+
+ // Is the value null or empty?
+ if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+ // Trace message
+ this.loggerBeanLocal.logTrace("getAsObject: submittedValue is null or empty - EXIT!"); //NOI18N
+
+ // Return null
+ return null;
+ }
+
+ // Get full list
+ List<Country> countryList = this.countryBean.allCountries();
+
+ // Init value
+ Country country = null;
+
+ // Try this better
+ try {
+ // Convert it to long
+ Long countryId = Long.parseLong(submittedValue);
+
+ // Category id should not be below 1
+ assert (countryId > 0) : "countryId is smaller than one: " + countryId; //NOI18N
+
+ // Debug message
+ this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: countryId={0}", countryId)); //NOI18N
+
+ // Try to find it
+ for (final Country cntry : countryList) {
+ // Is the id the same? (null-safe)
+ if (Objects.equals(cntry.getCountryId(), countryId)) {
+ // Found it
+ country = cntry;
+ break;
+ }
+ }
+ } catch (final NumberFormatException ex) {
+ // Log exception (maybe to much?)
+ this.loggerBeanLocal.logException(ex);
+ }
+
+ // Trace message
+ this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: country={0} - EXIT!", country)); //NOI18N
+
+ // Return it
+ return country;
+ }
+
+ @Override
+ public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+ // Is the object null?
+ if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+ // Is null
+ return ""; //NOI18N
+ } else if (!(value instanceof Country)) {
+ // Not same interface
+ throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Country.", value)); //NOI18N
+ }
+
+ // Return category id
+ return String.valueOf(((Country) value).getCountryId());
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaservice.converter.smsprovider;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Objects;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+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.jphone.phonenumbers.smsprovider.SmsProvider;
+import org.mxchange.jphone.phonenumbers.smsprovider.SmsProviderSingletonBeanRemote;
+
+/**
+ * Converter for SMS provider instance
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@FacesConverter (value = "cellphoneCarrier")
+public class PizzaSmsProviderConverter implements Converter {
+
+ /**
+ * Logger instance
+ */
+ @Log
+ private LoggerBeanLocal loggerBeanLocal;
+
+ /**
+ * SMS provider bean
+ */
+ private SmsProviderSingletonBeanRemote providerController;
+
+ /**
+ * Initialization of this converter
+ */
+ public PizzaSmsProviderConverter () {
+ // 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
+
+ /// and SMS provider controller
+ this.providerController = (SmsProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/smsprovider!org.mxchange.jphone.phonenumbers.smsprovider.PizzaSmsProviderSingletonBeanRemote"); //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) {
+ // Trace message
+ this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
+
+ // Is the value null or empty?
+ if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+ // Trace message
+ this.loggerBeanLocal.logTrace("getAsObject: submittedValue is null or empty - EXIT!"); //NOI18N
+
+ // Return null
+ return null;
+ }
+
+ // Get full list
+ List<SmsProvider> providerList = this.providerController.allSmsProvider();
+
+ // Init value
+ SmsProvider provider = null;
+
+ // Try this better
+ try {
+ // Convert it to long
+ Long providerId = Long.parseLong(submittedValue);
+
+ // Category id should not be below 1
+ assert (providerId > 0) : "providerId is smaller than one: " + providerId; //NOI18N
+
+ // Debug message
+ this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: providerId={0}", providerId)); //NOI18N
+
+ // Try to find it
+ for (final SmsProvider prov : providerList) {
+ // Is the id the same? (null-safe)
+ if (Objects.equals(prov.getProviderId(), providerId)) {
+ // Found it
+ provider = prov;
+ break;
+ }
+ }
+ } catch (final NumberFormatException ex) {
+ // Log exception (maybe to much?)
+ this.loggerBeanLocal.logException(ex);
+ }
+
+ // Trace message
+ this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: provider={0} - EXIT!", provider)); //NOI18N
+
+ // Return it
+ return provider;
+ }
+
+ @Override
+ public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+ // Is the object null?
+ if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+ // Is null
+ return ""; //NOI18N
+ } else if (!(value instanceof SmsProvider)) {
+ // Not same interface
+ throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement SmsProvider.", value)); //NOI18N
+ }
+
+ // Return category id
+ return String.valueOf(((SmsProvider) value).getProviderId());
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaservice.converter.user;
+
+import java.text.MessageFormat;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.FacesConverter;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
+import org.mxchange.jusercore.exceptions.UserNotFoundException;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * Converter for user id <-> valid user instance
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@FacesConverter (value = "UserConverter")
+public class PizzaUserConverter implements Converter {
+
+ /**
+ * Logger instance
+ */
+ @Log
+ private LoggerBeanLocal loggerBeanLocal;
+
+ /**
+ * User bean
+ */
+ private AddressbookUserWebSessionController userController;
+
+ /**
+ * Initialization of this converter
+ */
+ public PizzaUserConverter () {
+ // 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
+
+ // ... and user controller
+ this.userController = (AddressbookUserWebSessionController) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //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) {
+ // Trace message
+ this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
+
+ // Is the value null or empty?
+ if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+ // Trace message
+ this.loggerBeanLocal.logTrace("getAsObject: submittedValue is null or empty - EXIT!"); //NOI18N
+
+ // Return null
+ return null;
+ }
+
+ // Init instance
+ User user = null;
+
+ try {
+ // Try to parse the value as long
+ Long userId = Long.valueOf(submittedValue);
+
+ // Debug message
+ this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId));
+
+ // Try to get user instance from it
+ user = this.userController.lookupUserById(userId);
+
+ // Debug message
+ this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: user={0}", user));
+ } catch (final NumberFormatException ex) {
+ // Throw again
+ throw new ConverterException(ex);
+ } catch (final UserNotFoundException ex) {
+ // Debug message
+ this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: Exception: {0} - Returning null ...", ex));
+
+ // Return null
+ return null;
+ }
+
+ // Trace message
+ this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: user={0} - EXIT!", user));
+
+ // Return it
+ return user;
+ }
+
+ @Override
+ public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+ // Is the object null?
+ if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+ // Is null
+ return ""; //NOI18N
+ } else if (!(value instanceof User)) {
+ // Not same interface
+ throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement User.", value)); //NOI18N
+ }
+
+ // Return category id
+ return String.valueOf(((User) value).getUserId());
+ }
+
+}
<f:loadBundle var="msg" basename="org.mxchange.localization.bundle" />
- <h:outputStylesheet name="./css/default.css" />
- <h:outputStylesheet name="./css/cssLayout.css" />
+ <h:outputStylesheet name="/css/default.css" />
+ <h:outputStylesheet name="/css/cssLayout.css" />
<title>Pizza-Service - <ui:insert name="title">Default title</ui:insert></title>
</h:head>
<session-timeout>
30
</session-timeout>
- <cookie-config>
- <http-only>true</http-only>
- </cookie-config>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</ui:define>
<ui:define name="content">
- Here goes your content.
+ <h:dataTable id="table_list_users" var="user" value="#{userController.allUsers()}" styleClass="table" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_USERS}" rendered="#{userController.hasUsers()}">
+ </h:dataTable>
</ui:define>
</ui:composition>
</html>