From: Roland Haeder Date: Thu, 24 Sep 2015 13:21:31 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4ef7436096b6951600657d9cea402eb91d9a7328;p=pizzaservice-swing.git Continued: - auto-reformatted many files - updated jars Signed-off-by:Roland Häder --- diff --git a/lib/jcore.jar b/lib/jcore.jar index 57dc0a0..c0bdbee 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index 884b0d9..d550fe0 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/lib/jshop-core.jar b/lib/jshop-core.jar index 90365fe..3e77fa7 100644 Binary files a/lib/jshop-core.jar and b/lib/jshop-core.jar differ diff --git a/lib/jshop-ee-lib.jar b/lib/jshop-ee-lib.jar index deaa0af..2873021 100644 Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ diff --git a/lib/jswingcore.jar b/lib/jswingcore.jar index 15d1d73..0525b1a 100644 Binary files a/lib/jswingcore.jar and b/lib/jswingcore.jar differ diff --git a/src/org/mxchange/pizzaapplication/application/PizzaApplication.java b/src/org/mxchange/pizzaapplication/application/PizzaApplication.java index 5fe0ae6..dcd825b 100644 --- a/src/org/mxchange/pizzaapplication/application/PizzaApplication.java +++ b/src/org/mxchange/pizzaapplication/application/PizzaApplication.java @@ -31,19 +31,22 @@ import org.mxchange.jshopcore.model.product.Product; * @author Roland Haeder */ public interface PizzaApplication extends Application { + /** - * Some "getter" for a linked list of only available products - * - * @return Only available products + * Adds given category data from request to database + * + * @param category Category instance + * @throws org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException If the category's title has been used */ - public Deque getAvailableProducts (); + public void doAdminAddCategory (final Category category) throws CategoryTitleAlreadyUsedException; /** - * Some "getter" for a linked list of all products + * Adds given product data from request to database * - * @return All products + * @param product Product instance + * @throws org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException If the * product's title has been used */ - public Deque getAllProducts (); + public void doAdminAddProduct (final Product product) throws ProductTitleAlreadyUsedException; /** * Some "getter" for a linked list of all categories @@ -53,19 +56,18 @@ public interface PizzaApplication extends Application { public Deque getAllCategories (); /** - * Initializes this instance with given ServletContext + * Some "getter" for a an array of all categories * - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.io.IOException If an IO error occurs + * @return All categories */ - public void init () throws SQLException, IOException; + public Iterator getAllCategoriesIterator (); /** - * Some "getter" for a an array of only available products - * - * @return Only available products + * Some "getter" for a linked list of all products + * + * @return All products */ - public Iterator getAvailableProductsIterator (); + public Deque getAllProducts (); /** * Some "getter" for a an array of all products @@ -75,25 +77,24 @@ public interface PizzaApplication extends Application { public Iterator getAllProductsIterator (); /** - * Some "getter" for a an array of all categories + * Some "getter" for a linked list of only available products * - * @return All categories + * @return Only available products */ - public Iterator getAllCategoriesIterator (); + public Deque getAvailableProducts (); /** - * Adds given category data from request to database + * Some "getter" for a an array of only available products * - * @param category Category instance - * @throws org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException If the category's title has been used + * @return Only available products */ - public void doAdminAddCategory (final Category category) throws CategoryTitleAlreadyUsedException; + public Iterator getAvailableProductsIterator (); /** - * Adds given product data from request to database + * Initializes this instance with given ServletContext * - * @param product Product instance - * @throws org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException If the product's title has been used + * @throws java.sql.SQLException If an SQL error occurs + * @throws java.io.IOException If an IO error occurs */ - public void doAdminAddProduct (final Product product) throws ProductTitleAlreadyUsedException; + public void init () throws SQLException, IOException; } diff --git a/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java b/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java index 235f307..72abe71 100644 --- a/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ b/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -32,6 +32,7 @@ import org.mxchange.jshopcore.model.product.Product; * @author Roland Haeder */ public class PizzaServiceApplication extends BaseFrameworkSystem implements PizzaApplication { + /** * Default constructor */ @@ -40,99 +41,6 @@ public class PizzaServiceApplication extends BaseFrameworkSystem implements Pizz this.getLogger().trace("CALLED!"); //NOI18N } - @Override - public Deque getAllCategories () { - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - public Deque getAllProducts () { - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - public Deque getAvailableProducts () { - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - public void init () throws SQLException { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Is the bundle initialized? - if (!BaseFrameworkSystem.isBundledInitialized()) { - // Temporary initialize default bundle - // TODO The enum Gender uses this - this.initBundle(); - } - - // Trace message - this.getLogger().trace("EXIT!"); //NOI18N - } - - @Override - public void doBootstrap () { - throw new UnsupportedOperationException("Not supported yet."); //NOI18N - } - - @Override - public void doMainLoop () { - throw new UnsupportedOperationException("Not supported yet."); //NOI18N - } - - @Override - public void doShutdown () { - throw new UnsupportedOperationException("Not supported yet."); //NOI18N - } - - @Override - @SuppressWarnings ("unchecked") - public Iterator getAvailableProductsIterator () { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - @SuppressWarnings ("unchecked") - public Iterator getAllProductsIterator () { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - @Override - @SuppressWarnings ("unchecked") - public Iterator getAllCategoriesIterator () { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - - /** - * 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) { - // Trace message - this.getLogger().trace(MessageFormat.format("title={0} - CALLED!", title)); //NOI18N - - // Unfinished - throw new UnsupportedOperationException("Unfinished method."); - } - @Override public void doAdminAddCategory (final Category category) throws CategoryTitleAlreadyUsedException { // Trace message @@ -146,10 +54,10 @@ public class PizzaServiceApplication extends BaseFrameworkSystem implements Pizz // Get all fields String title = category.getTitle(); - Long parentId = category.getParentId(); + Category parentCategory = category.getParentCategory(); // Debug message - this.getLogger().debug(MessageFormat.format("title={0},parentId={1}", title, parentId)); //NOI18N + this.getLogger().debug(MessageFormat.format("title={0},parentCategory={1}", title, parentCategory)); //NOI18N // Init variables for casting Integer id = 0; @@ -161,9 +69,9 @@ public class PizzaServiceApplication extends BaseFrameworkSystem implements Pizz } else if (title.isEmpty()) { // Is left empty throw new IllegalArgumentException("title is empty."); //NOI18N - } else if ((parentId == null) || (parentId == 0)) { + } else if (null == parentCategory) { // Is left empty - throw new IllegalArgumentException("parentId is empty."); //NOI18N + throw new IllegalArgumentException("parentCategory is null."); //NOI18N } // Try to check if title is used already @@ -233,74 +141,167 @@ public class PizzaServiceApplication extends BaseFrameworkSystem implements Pizz //this.getLogger().trace("EXIT!"); //NOI18N } + @Override + public void doBootstrap () { + throw new UnsupportedOperationException("Not supported yet."); //NOI18N + } + + @Override + public void doMainLoop () { + throw new UnsupportedOperationException("Not supported yet."); //NOI18N + } + + @Override + public void doShutdown () { + throw new UnsupportedOperationException("Not supported yet."); //NOI18N + } + + @Override + public Deque getAllCategories () { + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + @SuppressWarnings ("unchecked") + public Iterator getAllCategoriesIterator () { + // Trace message + this.getLogger().trace("CALLED!"); //NOI18N + + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + public Deque getAllProducts () { + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + @SuppressWarnings ("unchecked") + public Iterator getAllProductsIterator () { + // Trace message + this.getLogger().trace("CALLED!"); //NOI18N + + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + public Deque getAvailableProducts () { + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + @SuppressWarnings ("unchecked") + public Iterator getAvailableProductsIterator () { + // Trace message + this.getLogger().trace("CALLED!"); //NOI18N + + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + public void init () throws SQLException { + // Trace message + this.getLogger().trace("CALLED!"); //NOI18N + + // Is the bundle initialized? + if (!BaseFrameworkSystem.isBundledInitialized()) { + // Temporary initialize default bundle + // TODO The enum Gender uses this + this.initBundle(); + } + + // Trace message + this.getLogger().trace("EXIT!"); //NOI18N + } + /** - * Checks if product's title is already used. - * - * @param product Product instance + * 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) { + // Trace message + this.getLogger().trace(MessageFormat.format("title={0} - CALLED!", title)); //NOI18N + + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + /** + * Checks if category's title is already used. + * + * @param category Category instance * @return Whether the product title is already used */ - private boolean isProductTitleUsed (final Product product) { + private boolean isCategoryTitleUsed (final Category category) { // Trace message - this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", product)); //NOI18N + this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N // Init title - String title = product.getTitle(); + String title = category.getTitle(); // category must not be null and "title" must be found and non-empty - if (null == product) { + if (null == category) { // Abort here throw new NullPointerException("category is null"); //NOI18N } else if (null == title) { // title is not set - throw new IllegalArgumentException("product title is not set"); //NOI18N + throw new IllegalArgumentException("category title is not set."); //NOI18N } else if (title.isEmpty()) { // Is left empty - throw new IllegalArgumentException("product title is empty"); //NOI18N + throw new IllegalArgumentException("category title is empty."); //NOI18N } // Default is not used - // TODO Call backend - throw new UnsupportedOperationException("not finished yet."); + boolean isUsed = this.isCategoryTitleUsed(title); // 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; } /** - * Checks if category's title is already used. - * - * @param category Category instance + * Checks if product's title is already used. + * + * @param product Product instance * @return Whether the product title is already used */ - private boolean isCategoryTitleUsed (final Category category) { + private boolean isProductTitleUsed (final Product product) { // Trace message - this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N + this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", product)); //NOI18N // Init title - String title = category.getTitle(); + String title = product.getTitle(); // category must not be null and "title" must be found and non-empty - if (null == category) { + if (null == product) { // Abort here throw new NullPointerException("category is null"); //NOI18N } else if (null == title) { // title is not set - throw new IllegalArgumentException("category title is not set."); //NOI18N + throw new IllegalArgumentException("product title is not set"); //NOI18N } else if (title.isEmpty()) { // Is left empty - throw new IllegalArgumentException("category title is empty."); //NOI18N + throw new IllegalArgumentException("product title is empty"); //NOI18N } // Default is not used - boolean isUsed = this.isCategoryTitleUsed(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; } }