<!--
COMPILATION SECTION
-->
- <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps">
- <ant antfile="${project.jshop}/build.xml" inheritall="false" target="jar">
- <property name="deploy.on.save" value="false"/>
- </ant>
- </target>
- <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps">
- <ant antfile="${project.jshop}/build.xml" inheritall="false" target="jar">
- <property name="deploy.on.save" value="false"/>
- </ant>
- </target>
+ <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"/>
+ <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"/>
<target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
<target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
<target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
- <copyfiles files="${reference.jshop.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.cdi-api.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.gf-client.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.commons-codec-1.10.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.commons-lang3-3.4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.jcore.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.jsfcore.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.jshop.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.log4j-api-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.log4j-core-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.log4j-web-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
- <copyfiles files="${reference.jshop.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.cdi-api.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.gf-client.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.commons-codec-1.10.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.commons-lang3-3.4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.jcore.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.jsfcore.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.jshop.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.log4j-api-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.log4j-core-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.log4j-web-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
<delete dir="${build.web.dir}/WEB-INF/lib"/>
CLEANUP SECTION
-->
- <target depends="init" name="deps-clean" unless="no.deps">
- <ant antfile="${project.jshop}/build.xml" inheritall="false" target="clean"/>
- </target>
+ <target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="do-clean">
<condition property="build.dir.to.clean" value="${build.web.dir}">
<isset property="dist.ear.dir"/>
-build.xml.data.CRC32=dda72f05
+build.xml.data.CRC32=d470fc14
build.xml.script.CRC32=82213886
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=dda72f05
-nbproject/build-impl.xml.script.CRC32=06b680e3
+nbproject/build-impl.xml.data.CRC32=d470fc14
+nbproject/build-impl.xml.script.CRC32=617ba396
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
${libs.javaee-endorsed-api-6.0.classpath}
excludes=
file.reference.cdi-api.jar=lib/cdi-api.jar
+file.reference.commons-codec-1.10.jar=lib/commons-codec-1.10.jar
+file.reference.commons-lang3-3.4.jar=lib/commons-lang3-3.4.jar
file.reference.gf-client.jar=lib/gf-client.jar
+file.reference.jcore.jar=lib/jcore.jar
+file.reference.jsfcore.jar=lib/jsfcore.jar
+file.reference.jshop.jar=lib/jshop.jar
+file.reference.log4j-api-2.3.jar=lib/log4j-api-2.3.jar
+file.reference.log4j-core-2.3.jar=lib/log4j-core-2.3.jar
+file.reference.log4j-web-2.3.jar=lib/log4j-web-2.3.jar
includes=**
j2ee.compile.on.save=true
j2ee.copy.static.files.on.save=true
j2ee.server.type=gfv3ee6
jar.compress=false
javac.classpath=\
- ${reference.jshop.jar}:\
+ ${file.reference.jcore.jar}:\
+ ${file.reference.jsfcore.jar}:\
+ ${file.reference.jshop.jar}:\
${file.reference.cdi-api.jar}:\
- ${file.reference.gf-client.jar}
+ ${file.reference.gf-client.jar}:\
+ ${file.reference.commons-codec-1.10.jar}:\
+ ${file.reference.commons-lang3-3.4.jar}:\
+ ${file.reference.log4j-api-2.3.jar}:\
+ ${file.reference.log4j-core-2.3.jar}:\
+ ${file.reference.log4j-web-2.3.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.debug=true
lib.dir=${web.docbase.dir}/WEB-INF/lib
persistence.xml.dir=${conf.dir}
platform.active=default_platform
-project.jshop=../../jshop
-reference.jshop.jar=${project.jshop}/dist/jshop.jar
resource.dir=setup
run.test.classpath=\
${javac.test.classpath}:\
<minimum-ant-version>1.6.5</minimum-ant-version>
<web-module-libraries>
<library dirs="200">
- <file>${reference.jshop.jar}</file>
+ <file>${file.reference.cdi-api.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
- <file>${file.reference.cdi-api.jar}</file>
+ <file>${file.reference.gf-client.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
- <file>${file.reference.gf-client.jar}</file>
+ <file>${file.reference.commons-codec-1.10.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.commons-lang3-3.4.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.jcore.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.jsfcore.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.jshop.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.log4j-api-2.3.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.log4j-core-2.3.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.log4j-web-2.3.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
<definitions>.\lib\nblibraries.properties</definitions>
</libraries>
- <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
- <reference>
- <foreign-project>jshop</foreign-project>
- <artifact-type>jar</artifact-type>
- <script>build.xml</script>
- <target>jar</target>
- <clean-target>clean</clean-target>
- <id>jar</id>
- </reference>
- </references>
+ <references xmlns="http://www.netbeans.org/ns/ant-project-references/1"/>
</configuration>
</project>
import java.sql.SQLException;
import java.util.Deque;
import java.util.Iterator;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
import org.mxchange.jcore.application.Application;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.jshop.category.Category;
import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException;
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Deque<Product> getAvailableProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public Deque<Product> getAvailableProducts () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
/**
* Some "getter" for a linked list of all products
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Deque<Product> getAllProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public Deque<Product> getAllProducts () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
/**
* Some "getter" for a linked list of all categories
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Deque<Category> getAllCategories () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public Deque<Category> getAllCategories () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
/**
* Initializes this instance with given ServletContext
*
- * @param context Servlet context
- * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported
* @throws java.sql.SQLException If an SQL error occurs
* @throws java.io.IOException If an IO error occurs
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
*/
- public void init (final ServletContext context) throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException;
+ public void init () throws SQLException, IOException;
/**
* Some "getter" for a an array of only available products
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Iterator<Product> getAvailableProductsIterator () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public Iterator<Product> getAvailableProductsIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
/**
* Some "getter" for a an array of all products
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Iterator<Product> getAllProductsIterator () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public Iterator<Product> getAllProductsIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
/**
* Some "getter" for a an array of all categories
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Iterator<Category> getAllCategoriesIterator () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public Iterator<Category> getAllCategoriesIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
/**
* Generates a link for category's parent category. If none is given, the method will return only a small
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
* @deprecated Old lost code
*/
@Deprecated
- public String getPrintableProductCategory (final Product product) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public String getPrintableProductCategory (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
/**
* Adds given category data from request to database
*
- * @param request Request instance
+ * @param category Category instance
* @throws org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException The category's title is already used
* @throws java.io.IOException If an IO error occurs
* @throws java.sql.SQLException If an SQL error occurs
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public void doAdminAddCategory (final ServletRequest request) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException;
+ public void doAdminAddCategory (final Category category) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException;
/**
* Adds given product data from request to database
*
- * @param request Request instance
+ * @param product Product instance
* @throws java.io.IOException If an IO error occurs
* @throws java.sql.SQLException If an SQL error occurs
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
* @throws org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException If the product's title is already used
*/
- public void doAdminAddProduct (final ServletRequest request) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException;
+ public void doAdminAddProduct (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException;
/**
* Handles admin product form requests
*
- * @param request Request instance
- * @param response Response instance
* @throws java.io.IOException If an IO error occurs
* @throws java.sql.SQLException If an SQL error occurs
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
* @throws org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException If the product's title is already used
+ * @deprecated Old lost code
*/
- public void doAdminHandleProductForms (final ServletRequest request, final ServletResponse response) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException;
+ @Deprecated
+ public void doAdminHandleProductForms () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException;
/**
* Handles admin category form requests
*
- * @param request Request instance
- * @param response Response instance
* @throws java.io.IOException If an IO error occurs
* @throws java.sql.SQLException If an SQL error occurs
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
* @throws org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException The category's title is already used
+ * @deprecated
*/
- public void doAdminHandleCategoryForms (final ServletRequest request, final ServletResponse response) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException;
+ @Deprecated
+ public void doAdminHandleCategoryForms () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException;
/**
* Some "getter" for a Product instance from given item
* @throws java.lang.NoSuchMethodException If a method was not found
* @throws java.lang.IllegalAccessException If the method cannot be accessed publicly
* @throws java.lang.reflect.InvocationTargetException If something else happens?
- * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
- * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Product getProduct (final AddableBasketItem item) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ public Product getProduct (final AddableBasketItem item) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
}
import java.text.MessageFormat;
import java.util.Deque;
import java.util.Iterator;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.jshop.category.Category;
-import org.mxchange.jshop.database.frontend.category.CategoryDatabaseFrontend;
-import org.mxchange.jshop.database.frontend.category.CategoryFrontend;
-import org.mxchange.jshop.database.frontend.product.ProductDatabaseFrontend;
-import org.mxchange.jshop.database.frontend.product.ProductFrontend;
import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException;
import org.mxchange.jshop.item.AddableBasketItem;
* @author Roland Haeder
*/
public class PizzaServiceApplication extends BasePizzaServiceSystem implements PizzaApplication {
- /**
- * Database frontend for products
- */
- private ProductFrontend productFrontend;
-
- /**
- * Database frontend for categories
- */
- private CategoryFrontend categoryFrontend;
-
/**
* Default constructor
*/
}
@Override
- public Deque<Category> getAllCategories () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ public Deque<Category> getAllCategories () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Deligate to frontend
return this.categoryFrontend.getAllCategories();
}
@Override
- public Deque<Product> getAllProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ public Deque<Product> getAllProducts () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Deligate to frontend
return this.productFrontend.getAllProducts();
}
@Override
- public Deque<Product> getAvailableProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ public Deque<Product> getAvailableProducts () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Deligate to frontend
return this.productFrontend.getAllAvailableProducts();
}
@Override
- public void init (final ServletContext context) throws UnsupportedDatabaseBackendException, SQLException {
+ public void init () throws SQLException {
// Trace message
- this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
-
- // context should not be null
- if (null == context) {
- // Abort here
- throw new NullPointerException("context is null"); //NOI18N
- }
+ this.getLogger().trace("CALLED!"); //NOI18N
// Is the bundle initialized?
- if (!this.isBundledInitialized()) {
+ if (!isBundledInitialized()) {
// Temporary initialize default bundle
// TODO The enum Gender uses this
this.initBundle();
}
- // Initialize properties from context
- this.initProperties(context);
-
- // Init database frontends
- this.initDatabaseFrontends();
-
// Trace message
this.getLogger().trace("EXIT!"); //NOI18N
}
@Override
@SuppressWarnings ("unchecked")
- public Iterator<Product> getAvailableProductsIterator () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- // categoryFrontend must be set
- if (null == this.productFrontend) {
- // Abort here
- throw new NullPointerException("productFrontend is null"); //NOI18N
- }
+ public Iterator<Product> getAvailableProductsIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ // Trace message
+ this.getLogger().trace("CALLED!"); //NOI18N
// Ask frontend for a list of products
return (Iterator<Product>) this.productFrontend.getAvailableProductsIterator();
@Override
@SuppressWarnings ("unchecked")
- public Iterator<Product> getAllProductsIterator () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ public Iterator<Product> getAllProductsIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
- // categoryFrontend must be set
- if (null == this.productFrontend) {
- // Abort here
- throw new NullPointerException("productFrontend is null"); //NOI18N
- }
-
// Ask frontend for a list of products
return (Iterator<Product>) this.productFrontend.getAllProductsIterator();
}
@Override
@SuppressWarnings ("unchecked")
- public Iterator<Category> getAllCategoriesIterator () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ public Iterator<Category> getAllCategoriesIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
- // categoryFrontend must be set
- if (null == this.categoryFrontend) {
- // Abort here
- throw new NullPointerException("categoryFrontend is null"); //NOI18N
- }
-
// Ask frontend for a list of categories
return (Iterator<Category>) this.categoryFrontend.getAllCategoriesIterator();
}
- /**
- * Initializes database frontends.
- */
- private void initDatabaseFrontends () throws UnsupportedDatabaseBackendException, SQLException {
- // Trace message
- this.getLogger().trace("CALLED!"); //NOI18N
-
- // Product frontend
- this.productFrontend = new ProductDatabaseFrontend();
-
- // Category frontend
- this.categoryFrontend = new CategoryDatabaseFrontend();
-
- // Trace message
- this.getLogger().trace("EXIT!"); //NOI18N
- }
-
/**
* Checks whether given category title is already used
*
* @param title Title of category to check
* @return Whether it has been found
*/
- private boolean isCategoryTitleUsed(final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- // categoryFrontend must be set
- if (null == this.categoryFrontend) {
- // Abort here
- throw new NullPointerException("categoryFrontend is null"); //NOI18N
- }
+ private boolean isCategoryTitleUsed(final String title) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // Trace message
+ this.getLogger().trace("title=" + title + " - CALLED!"); //NOI18N
// Delegate to frontend
return this.categoryFrontend.isCategoryTitleUsed(title);
}
- /**
- * Checks if given product title is already used
- * @param title Product title to check
- * @return Whether the product title has already been used
- */
- private boolean isProductTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- // categoryFrontend must be set
- if (null == this.productFrontend) {
- // Abort here
- throw new NullPointerException("productFrontend is null"); //NOI18N
- }
-
- // Delegate to frontend
- return this.productFrontend.isProductTitleUsed(title);
- }
-
@Override
- public void doAdminAddCategory (final ServletRequest request) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException {
+ public void doAdminAddCategory (final Category category) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException {
// Trace message
- this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N
- // request must not be null
- if (null == request) {
+ // category must not be null
+ if (null == category) {
// Is null
- throw new NullPointerException("request is null"); //NOI18N
+ throw new NullPointerException("category is null"); //NOI18N
}
// Get all fields
- String title = request.getParameter(CategoryFrontend.COLUMN_TITLE);
- String parentId = request.getParameter(CategoryFrontend.COLUMN_PARENT);
+ String title = category.getTitle();
+ Long parentId = category.getParentId();
// Debug message
this.getLogger().debug(MessageFormat.format("title={0},parentId={1}", title, parentId)); //NOI18N
// Check all fields
if (null == title) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException("title is not set."); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
- } else if ((parentId != null) && (!parentId.isEmpty())) {
- // "parent" is set, so check it
- try {
- id = Integer.parseInt(parentId);
- } catch (final NumberFormatException e) {
- // Not valid number
- throw new IllegalArgumentException(e);
- }
+ throw new IllegalArgumentException("title is empty."); //NOI18N
+ } else if ((parentId == null) || (parentId == 0)) {
+ // Is left empty
+ throw new IllegalArgumentException("parentId is empty."); //NOI18N
}
// Try to check if title is used already
if (this.isCategoryTitleUsed(title)) {
// Title already used
- throw new CategoryTitleAlreadyUsedException(request);
+ throw new CategoryTitleAlreadyUsedException(category);
}
// The category is not found, so add it to database
}
@Override
- public void doAdminAddProduct (final ServletRequest request) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException {
+ public void doAdminAddProduct (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException {
// Trace message
- this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
- // request must not be null
- if (null == request) {
+ // product must not be null
+ if (null == product) {
// Is null
- throw new NullPointerException("request is null"); //NOI18N
+ throw new NullPointerException("product is null"); //NOI18N
}
// Get title, price and category id
- String title = request.getParameter(ProductFrontend.COLUMN_TITLE);
- String price = request.getParameter(ProductFrontend.COLUMN_PRICE);
- String categoryId = request.getParameter(ProductFrontend.COLUMN_CATEGORY);
- String available = request.getParameter(ProductFrontend.COLUMN_AVAILABLE);
+ String title = product.getTitle();
+ Float price = product.getPrice();
+ Long categoryId = product.getCategoryId();
+ Boolean available = product.getAvailable();
// Debug message
this.getLogger().debug(MessageFormat.format("title={0},price={1},categoryId={2},available={3}", title, price, categoryId, available)); //NOI18N
- // Variables for converting
- Long id = null;
- Float p = null;
-
// Check all fields
if (null == title) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException("product title is not set"); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException("product title is empty"); //NOI18N
} else if (null == price) {
// "price" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_PRICE)); //NOI18N
- } else if (price.isEmpty()) {
- // Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_PRICE)); //NOI18N
+ throw new IllegalArgumentException("product price is not set."); //NOI18N
} else if (null == categoryId) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_CATEGORY)); //NOI18N
- } else if (categoryId.isEmpty()) {
- // Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_CATEGORY)); //NOI18N
+ throw new IllegalArgumentException("product category id is not set."); //NOI18N
} else if (null == available) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_AVAILABLE)); //NOI18N
- } else if (available.isEmpty()) {
- // Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_AVAILABLE)); //NOI18N
- } else if ((!"true".equals(available)) && (!"false".equals(available))) { //NOI18N
- // Invalid value
- throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", ProductFrontend.COLUMN_AVAILABLE, available)); //NOI18N
- }
-
- // Parse numbers
- try {
- id = Long.parseLong(categoryId);
- p = Float.parseFloat(price);
- } catch (final NumberFormatException e) {
- // Not valid number
- throw new IllegalArgumentException(e);
+ throw new IllegalArgumentException("product availability not set."); //NOI18N
}
- // Parse boolean
- Boolean a = Boolean.parseBoolean(available);
-
// Try to check if title is used already
- if (this.isProductTitleUsed(title)) {
+ if (this.isProductTitleUsed(product)) {
// Title already used
- throw new ProductTitleAlreadyUsedException(request);
+ throw new ProductTitleAlreadyUsedException(product);
}
// The product is not found, so add it to database
- this.productFrontend.addProduct(title, p, id, a);
+ this.productFrontend.addProduct(title, price, categoryId, available);
// Trace message
this.getLogger().trace("EXIT!"); //NOI18N
@Override
@Deprecated
- public String getPrintableProductCategory (final Product product) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ public String getPrintableProductCategory (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
/**
* Checks if product's title is already used.
*
- * @param request Request instance
+ * @param product Product instance
* @return Whether the product title is already used
* @throws java.io.IOException If any IO error occurs
* @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
* @throws java.lang.IllegalAccessException If the method cannot be accessed
* @throws java.lang.reflect.InvocationTargetException Any other problems?
*/
- private boolean isProductTitleUsed (final ServletRequest request) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ private boolean isProductTitleUsed (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
// Trace message
- this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", product)); //NOI18N
// Init title
- String title = request.getParameter(ProductFrontend.COLUMN_TITLE);
+ String title = product.getTitle();
- // request must not be null and "title" must be found and non-empty
- if (null == request) {
+ // category must not be null and "title" must be found and non-empty
+ if (null == product) {
// Abort here
- throw new NullPointerException("request is null"); //NOI18N
+ throw new NullPointerException("category is null"); //NOI18N
} else if (null == title) {
// title is not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException("product title is not set"); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException("product title is empty"); //NOI18N
}
// Default is not used
- boolean isUsed = this.isProductTitleUsed(title);
+ // TODO Call backend
+ throw new UnsupportedOperationException("not finished yet.");
// Trace message
- this.getLogger().trace(MessageFormat.format("isUsed={0} - EXIT!", isUsed)); //NOI18N
+ //this.getLogger().trace(MessageFormat.format("isUsed={0} - EXIT!", isUsed)); //NOI18N
// Return it
- return isUsed;
+ //return isUsed;
}
@Override
- public void doAdminHandleProductForms (final ServletRequest request, final ServletResponse response) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException {
- // Trace message
- this.getLogger().trace(MessageFormat.format("request={0},response={1} - CALLED!", request, response)); //NOI18N
-
- // request and response must both be set
- if (null == request) {
- // request is null
- throw new NullPointerException("request is null"); //NOI18N
- } else if (null == response) {
- // response is null
- throw new NullPointerException("response is null"); //NOI18N
- }
-
- // Is it post?
- if ("POST".equals(((HttpServletRequest) request).getMethod())) { //NOI18N
- // Is "add/edit/delete" set?
- if (request.getParameter("add") != null) { //NOI18N
- // Is it already added?
- if (this.isProductTitleUsed(request)) {
- // Debug message
- this.getLogger().debug("Already used, redirecting ..."); //NOI18N
-
- // Already added, so redirect here, else a ServletException will be thrown
- ((HttpServletResponse) response).sendRedirect(String.format("%s/admin/product.jsp?already=1", ((HttpServletRequest) request).getContextPath())); //NOI18N
- } else {
- // Add new product
- this.doAdminAddProduct(request);
-
- // Redirect to proper URL
- ((HttpServletResponse) response).sendRedirect(String.format("%s/admin/product.jsp?added=1", ((HttpServletRequest) request).getContextPath())); //NOI18N
- }
- } else if (request.getParameter("edit") != null) { //NOI18N
- // TODO
- } else if (request.getParameter("delete") != null) { //NOI18N
- // TODO
- }
-
- // Request not handled
- throw new IllegalArgumentException("request not handled."); //NOI18N
- }
-
- // Trace message
- this.getLogger().trace("EXIT!"); //NOI18N
+ @Deprecated
+ public void doAdminHandleProductForms () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException {
+ // Deprecated method called
+ throw new UnsupportedOperationException("Deprecated method called.");
}
@Override
- public void doAdminHandleCategoryForms (final ServletRequest request, final ServletResponse response) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException {
- // Trace message
- this.getLogger().trace(MessageFormat.format("request={0},response={1} - CALLED!", request, response)); //NOI18N
-
- // request and response must both be set
- if (null == request) {
- // request is null
- throw new NullPointerException("request is null"); //NOI18N
- } else if (null == response) {
- // response is null
- throw new NullPointerException("response is null"); //NOI18N
- }
-
- // Is it post?
- if ("POST".equals(((HttpServletRequest) request).getMethod())) { //NOI18N
- // Is "add/edit/delete" set?
- if (request.getParameter("add") != null) { //NOI18N
- // Is the category title already used?
- if (this.isCategoryTitleUsed(request)) {
- // Debug message
- this.getLogger().debug("Already used, redirecting ..."); //NOI18N
-
- // Already added, so redirect here, else a ServletException will be thrown
- ((HttpServletResponse) response).sendRedirect(String.format("%s/admin/category.jsp?already=1", ((HttpServletRequest) request).getContextPath())); //NOI18N
- } else {
- // Add new category
- this.doAdminAddCategory(request);
-
- // Redirect to proper URL
- ((HttpServletResponse) response).sendRedirect(String.format("%s/admin/category.jsp?added=1", ((HttpServletRequest) request).getContextPath())); //NOI18N
- }
- } else if (request.getParameter("edit") != null) { //NOI18N
- // TODO
- } else if (request.getParameter("delete") != null) { //NOI18N
- // TODO
- }
-
- // Request not handled
- throw new IllegalArgumentException("request not handled."); //NOI18N
- }
-
- // Trace message
- this.getLogger().trace("EXIT!"); //NOI18N
+ @Deprecated
+ public void doAdminHandleCategoryForms () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException {
+ // Deprecated method called
+ throw new UnsupportedOperationException("Deprecated method called.");
}
/**
* Checks if category's title is already used.
*
- * @param request Request instance
+ * @param category Category instance
* @return Whether the product title is already used
* @throws java.io.IOException If any IO error occurs
* @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
* @throws java.lang.IllegalAccessException If the method cannot be accessed
* @throws java.lang.reflect.InvocationTargetException Any other problems?
*/
- private boolean isCategoryTitleUsed (final ServletRequest request) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ private boolean isCategoryTitleUsed (final Category category) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
// Trace message
- this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N
// Init title
- String title = request.getParameter(CategoryFrontend.COLUMN_TITLE);
+ String title = category.getTitle();
- // request must not be null and "title" must be found and non-empty
- if (null == request) {
+ // category must not be null and "title" must be found and non-empty
+ if (null == category) {
// Abort here
- throw new NullPointerException("request is null"); //NOI18N
+ throw new NullPointerException("category is null"); //NOI18N
} else if (null == title) {
// title is not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException("category title is not set."); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException("category title is empty."); //NOI18N
}
// Default is not used
}
@Override
- public Product getProduct (final AddableBasketItem item) throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ public Product getProduct (final AddableBasketItem item) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace message
this.getLogger().trace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N
if (null == item) {
// Abort here
throw new NullPointerException("item is null"); //NOI18N
- } else if (null == this.productFrontend) {
- // Abort here
- throw new NullPointerException("productFrontend is null"); //NOI18N
}
// Init product instance
*/
package org.mxchange.pizzaapplication.beans.controller;
+import java.rmi.RemoteException;
import java.util.Deque;
import java.util.Iterator;
import javax.faces.FacesException;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpSession;
import org.mxchange.jshop.beans.FrameworkBean;
import org.mxchange.jshop.category.Category;
import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
* Some "getter" for an iterator of only available products
*
* @return Only available products
- * @throws javax.servlet.ServletException If anything went wrong
+ * @throws java.rmi.RemoteException If anything went wrong
*/
- public Iterator<Product> getAvailableProductsIterator () throws ServletException;
+ public Iterator<Product> getAvailableProductsIterator () throws RemoteException;
/**
* Some "getter" for an iterator of all products
*
* @return All products
- * @throws javax.servlet.ServletException If anything went wrong
+ * @throws java.rmi.RemoteException If anything went wrong
*/
- public Iterator<Product> getAllProductsIterator () throws ServletException;
+ public Iterator<Product> getAllProductsIterator () throws RemoteException;
/**
* Some "getter" for an iterator of all categories
*
* @return All categories
- * @throws javax.servlet.ServletException If anything went wrong
+ * @throws java.rmi.RemoteException If anything went wrong
*/
- public Iterator<Category> getAllCategoriesIterator () throws ServletException;
+ public Iterator<Category> getAllCategoriesIterator () throws RemoteException;
/**
* Some "getter" for a linked list of only available products
*
* @return Only available products
- * @throws javax.servlet.ServletException If anything went wrong
+ * @throws java.rmi.RemoteException If anything went wrong
*/
- public Deque<Product> getAvailableProducts () throws ServletException;
+ public Deque<Product> getAvailableProducts () throws RemoteException;
/**
* Some "getter" for a linked list of all products
*
* @return All products
- * @throws javax.servlet.ServletException If anything went wrong
+ * @throws java.rmi.RemoteException If anything went wrong
*/
- public Deque<Product> getAllProducts () throws ServletException;
+ public Deque<Product> getAllProducts () throws RemoteException;
/**
* Some "getter" for a linked list of all categories
*
* @return All categories
- * @throws javax.servlet.ServletException If anything went wrong
+ * @throws java.rmi.RemoteException If anything went wrong
*/
- public Deque<Category> getAllCategories () throws ServletException;
+ public Deque<Category> getAllCategories () throws RemoteException;
/**
* Generates a link for category's parent category. If none is given, the method will return only a small
*
* @param product Product instance to check
* @return Human-readable version of product availability
- * @throws javax.servlet.ServletException If something unexpected happened
+ * @throws java.rmi.RemoteException If something unexpected happened
* @deprecated Old lost code
*/
@Deprecated
- public String getPrintableProduktCategory (final Product product) throws ServletException;
+ public String getPrintableProduktCategory (final Product product) throws RemoteException;
/**
* Adds given category data from request to database
*
- * @param request Request instance
- * @throws javax.servlet.ServletException If something unexpected happened
+ * @param category Category instance
+ * @throws java.rmi.RemoteException If something unexpected happened
* @throws org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException If the given title is already used
*/
- public void doAdminAddCategory (final ServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException;
+ public void doAdminAddCategory (final Category category) throws RemoteException, CategoryTitleAlreadyUsedException;
/**
* Adds given product data from request to database
*
- * @param request Request instance
- * @throws javax.servlet.ServletException If something unexpected happened
+ * @param product Product instance
+ * @throws java.rmi.RemoteException If something unexpected happened
* @throws org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException If the given product title is already used
*/
- public void doAdminAddProduct (final ServletRequest request) throws ServletException, ProductTitleAlreadyUsedException;
+ public void doAdminAddProduct (final Product product) throws RemoteException, ProductTitleAlreadyUsedException;
/**
* Handles admin product form requests
*
- * @throws ServletException If something unexpected happened
+ * @throws RemoteException If something unexpected happened
+ * @deprecated Old lost code
*/
- public void doAdminHandleProductForms () throws ServletException;
+ @Deprecated
+ public void doAdminHandleProductForms () throws RemoteException;
/**
* Handles admin category form requests
*
- * @throws ServletException If something unexpected happened
+ * @throws RemoteException If something unexpected happened
+ * @deprecated Old lost code
*/
- public void doAdminHandleCategoryForms () throws ServletException;
+ @Deprecated
+ public void doAdminHandleCategoryForms () throws RemoteException;
/**
* Some "getter" for a product from given item
* @param item Item instance
* @return A Product instance
- * @throws javax.servlet.ServletException If something bad happens
+ * @throws java.rmi.RemoteException If something bad happens
*/
- public Product getProduct (final AddableBasketItem item) throws ServletException;
+ public Product getProduct (final AddableBasketItem item) throws RemoteException;
}
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.rmi.RemoteException;
import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.Deque;
import javax.enterprise.context.SessionScoped;
import javax.faces.FacesException;
import javax.inject.Named;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.jshop.beans.BaseFrameworkBean;
import org.mxchange.jshop.category.Category;
import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
try {
// Call init method
- this.app.init(this.getApplication());
- } catch (final UnsupportedDatabaseBackendException | SQLException | IOException | BadTokenException ex) {
+ this.app.init();
+ } catch (final SQLException | IOException ex) {
// Continue to throw
throw new FacesException(ex);
}
}
@Override
- public Iterator<Product> getAvailableProductsIterator () throws ServletException {
+ public Iterator<Product> getAvailableProductsIterator () throws RemoteException {
try {
return this.app.getAvailableProductsIterator();
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("getAvailableProductsIterator() failed", ex);
}
}
@Override
- public Iterator<Product> getAllProductsIterator () throws ServletException {
+ public Iterator<Product> getAllProductsIterator () throws RemoteException {
try {
return this.app.getAllProductsIterator();
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("getAllProductsIterator() failed.", ex);
}
}
@Override
- public Deque<Product> getAvailableProducts () throws ServletException {
+ public Deque<Product> getAvailableProducts () throws RemoteException {
try {
return this.app.getAvailableProducts();
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("getAvailableProducts() failed.", ex);
}
}
@Override
- public Deque<Product> getAllProducts () throws ServletException {
+ public Deque<Product> getAllProducts () throws RemoteException {
try {
return this.app.getAllProducts();
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("getAllProducts() failed", ex);
}
}
@Override
- public Iterator<Category> getAllCategoriesIterator () throws ServletException {
+ public Iterator<Category> getAllCategoriesIterator () throws RemoteException {
try {
return this.app.getAllCategoriesIterator();
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("getAllCategoriesIterator() failed.", ex);
}
}
@Override
- public Deque<Category> getAllCategories () throws ServletException {
+ public Deque<Category> getAllCategories () throws RemoteException {
try {
return this.app.getAllCategories();
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("getAllCategories() failed.", ex);
}
}
@Override
- public void doAdminAddCategory (final ServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException {
+ public void doAdminAddCategory (final Category category) throws RemoteException, CategoryTitleAlreadyUsedException {
try {
- this.app.doAdminAddCategory(request);
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ this.app.doAdminAddCategory(category);
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("doAdminAddCategory() failed.", ex);
}
}
@Override
- public void doAdminAddProduct (final ServletRequest request) throws ServletException, ProductTitleAlreadyUsedException {
+ public void doAdminAddProduct (final Product product) throws RemoteException, ProductTitleAlreadyUsedException {
try {
- this.app.doAdminAddProduct(request);
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ this.app.doAdminAddProduct(product);
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("doAdminAddProduct() failed.", ex);
}
}
@Override
@Deprecated
- public String getPrintableProduktCategory (final Product product) throws ServletException {
+ public String getPrintableProduktCategory (final Product product) throws RemoteException {
try {
return this.app.getPrintableProductCategory(product);
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("getPrintableProduktCategory() failed.", ex);
}
}
@Override
- public void doAdminHandleProductForms () throws ServletException {
- try {
- this.app.doAdminHandleProductForms(this.getRequest(), this.getResponse());
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | ProductTitleAlreadyUsedException ex) {
- // Continue to throw
- throw new ServletException(ex);
- }
+ @Deprecated
+ public void doAdminHandleProductForms () throws RemoteException {
+ // Deprecated method called
+ throw new UnsupportedOperationException("Deprecated method called");
}
@Override
- public void doAdminHandleCategoryForms () throws ServletException {
- try {
- this.app.doAdminHandleCategoryForms(this.getRequest(), this.getResponse());
- } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | CategoryTitleAlreadyUsedException ex) {
- // Continue to throw
- throw new ServletException(ex);
- }
+ @Deprecated
+ public void doAdminHandleCategoryForms () throws RemoteException {
+ // Deprecated method called
+ throw new UnsupportedOperationException("Deprecated method called");
}
@Override
- public Product getProduct (final AddableBasketItem item) throws ServletException {
+ public Product getProduct (final AddableBasketItem item) throws RemoteException {
try {
// Deligate to application
return this.app.getProduct(item);
- } catch (IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
- throw new ServletException(ex);
+ throw new RemoteException("getProductI() failed.", ex);
}
}
*/
package org.mxchange.pizzaapplication.beans.customer;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import java.util.Map;
import org.mxchange.jcore.client.Client;
-import org.mxchange.jcore.contact.Gender;
+import org.mxchange.jcore.contact.gender.Gender;
import org.mxchange.jshop.beans.FrameworkBean;
/**
* @author Roland Haeder
*/
public interface CustomerBean extends FrameworkBean {
- /**
- * Returns an iterator of all values from this object
- *
- * @return An iterator
- * @throws java.lang.NoSuchMethodException If the invoked method was not found
- * @throws java.lang.IllegalAccessException If the method cannot be accessed
- * @throws java.lang.reflect.InvocationTargetException Any other problems?
- */
- public Iterator<Map.Entry<Field, Object>> iterator ()throws NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
/**
* Some "getter" for translated gender of the contact
*
* @param client Client instance to call back
*/
public void show (final Client client);
-
- /**
- * Some "getter for a value from given column name. This name will be
- * translated into a method name and then this method is called.
- *
- * @param columnName Column name
- * @return Value from field
- * @throws IllegalArgumentException Some implementations may throw this
- * @throws java.lang.NoSuchMethodException If the invoked method was not found
- * @throws java.lang.IllegalAccessException If the method cannot be accessed
- * @throws java.lang.reflect.InvocationTargetException Any other problems?
- */
- public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
- /**
- * Some "setter" for a value from given column name. You may wish to overwrite this method in your
- * own class.
- *
- * @param columnName Column name
- * @param value Value to set in object's field
- * @throws IllegalArgumentException Some implementations may throw this
- * @throws java.lang.NoSuchMethodException If the invoked method was not found
- * @throws java.lang.IllegalAccessException If the method cannot be accessed
- * @throws java.lang.reflect.InvocationTargetException Any other problems?
- */
- public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
}
import javax.inject.Named;
import org.mxchange.jcore.client.Client;
import org.mxchange.jcore.contact.Contact;
-import org.mxchange.jcore.contact.Gender;
+import org.mxchange.jcore.contact.gender.Gender;
import org.mxchange.jshop.beans.BaseFrameworkBean;
import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
throw new UnsupportedOperationException("Not supported yet."); //NOI18N
}
- @Override
- public Iterator<Map.Entry<Field, Object>> iterator () throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- // Deligate to "hidden" object
- return this.getContact().iterator();
- }
-
@Override
public void show (final Client client) {
throw new UnsupportedOperationException("Not supported yet."); //NOI18N
}
- @Override
- public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- // Deligate to "hidden" object
- return this.getContact().getValueFromColumn(columnName);
- }
-
- @Override
- public void setValueFromColumn (final String columnName, final Object value) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- // Deligate to "hidden" object
- this.getContact().setValueFromColumn(columnName, value);
- }
-
/**
* Setter for Contact instance
* @param contact Contact instance to set
+++ /dev/null
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.enums;
-
-import java.util.List;
-import org.mxchange.jcore.contact.Gender;
-import org.mxchange.jshop.beans.FrameworkBean;
-
-/**
- * An interface for data beans
- *
- * @author Roland Haeder
- */
-public interface DataBean extends FrameworkBean {
- /**
- * Getter for all genders as array
- *
- * @return All genders as array
- */
- public Gender[] getGenders ();
- /**
- * Getter for only selectable genders as array, UNKNOWN is not selectable
- *
- * @return All genders as array
- */
- public List<Gender> getSelectableGenders ();
-}
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.enums;
+
+import java.util.List;
+import org.mxchange.jcore.contact.gender.Gender;
+import org.mxchange.jshop.beans.FrameworkBean;
+
+/**
+ * An interface for data beans
+ *
+ * @author Roland Haeder
+ */
+public interface DataWebBean extends FrameworkBean {
+ /**
+ * Getter for all genders as array
+ *
+ * @return All genders as array
+ */
+ public Gender[] getGenders ();
+ /**
+ * Getter for only selectable genders as array, UNKNOWN is not selectable
+ *
+ * @return All genders as array
+ */
+ public List<Gender> getSelectableGenders ();
+}
+++ /dev/null
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.enums;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Named;
-import org.mxchange.jcore.contact.Gender;
-import org.mxchange.jshop.beans.BaseFrameworkBean;
-
-/**
- * A customer bean which hides the customer instance
- *
- * @author Roland Haeder
- */
-@Named ("data")
-@ApplicationScoped
-public class PizzaServiceDataBean extends BaseFrameworkBean implements DataBean {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 835482364189L;
-
- @Override
- public Gender[] getGenders () {
- // Trace message
- this.getLogger().trace(MessageFormat.format("Genders={0} - EXIT!", Arrays.toString(Gender.values())));
-
- // Return it
- return Gender.values();
- }
-
- @Override
- public List<Gender> getSelectableGenders () {
- // Trace message
- this.getLogger().trace("CALLED!"); //NOI18N
-
- // Init array
- List<Gender> genders = new ArrayList<>(this.getGenders().length - 1);
-
- // Debug message
- this.getLogger().debug(MessageFormat.format("genders.size()={0}", genders.size()));
-
- // Return it
- for (final Gender gender : Gender.values()) {
- // Debug message
- this.getLogger().debug(MessageFormat.format("gender={0}", gender));
-
- // Is it unknown?
- if (!gender.equals(Gender.UNKNOWN)) {
- // Debug message
- this.getLogger().debug(MessageFormat.format("gender={0} - adding ...", gender));
-
- // Not, then add it
- boolean added = genders.add(gender);
-
- // Debug message
- this.getLogger().debug(MessageFormat.format("added={0}", added));
- }
- }
-
- // Trace message
- this.getLogger().trace(MessageFormat.format("genders={0} - EXIT!", genders)); //NOI18N
-
- // Return it
- return genders;
- }
-}
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.enums;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import org.mxchange.jcore.contact.gender.Gender;
+import org.mxchange.jshop.beans.BaseFrameworkBean;
+
+/**
+ * A customer bean which hides the customer instance
+ *
+ * @author Roland Haeder
+ */
+@Named ("data")
+@ApplicationScoped
+public class PizzaServiceDataWebBean extends BaseFrameworkBean implements DataWebBean {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 835482364189L;
+
+ @Override
+ public Gender[] getGenders () {
+ // Trace message
+ this.getLogger().trace(MessageFormat.format("Genders={0} - EXIT!", Arrays.toString(Gender.values())));
+
+ // Return it
+ return Gender.values();
+ }
+
+ @Override
+ public List<Gender> getSelectableGenders () {
+ // Trace message
+ this.getLogger().trace("CALLED!"); //NOI18N
+
+ // Init array
+ List<Gender> genders = new ArrayList<>(this.getGenders().length - 1);
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("genders.size()={0}", genders.size()));
+
+ // Return it
+ for (final Gender gender : Gender.values()) {
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("gender={0}", gender));
+
+ // Is it unknown?
+ if (!gender.equals(Gender.UNKNOWN)) {
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("gender={0} - adding ...", gender));
+
+ // Not, then add it
+ boolean added = genders.add(gender);
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("added={0}", added));
+ }
+ }
+
+ // Trace message
+ this.getLogger().trace(MessageFormat.format("genders={0} - EXIT!", genders)); //NOI18N
+
+ // Return it
+ return genders;
+ }
+}