From: Roland Haeder Date: Thu, 1 Oct 2015 08:19:07 +0000 (+0200) Subject: Merges from rewrites/jpa X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=022d87d2e17ae400de4d452bf2af6340735e025c;p=pizzaservice-swing.git Merges from rewrites/jpa Signed-off-by: Roland Häder --- diff --git a/build.xml b/build.xml index 8202baa..7f99c19 100644 --- a/build.xml +++ b/build.xml @@ -69,5 +69,5 @@ properties which you can use, check the target you are overriding in the nbproject/build-impl.xml file. - --> + --> diff --git a/lib/jcore-swing.jar b/lib/jcore-swing.jar new file mode 100644 index 0000000..bcf9b93 Binary files /dev/null and b/lib/jcore-swing.jar differ diff --git a/lib/jcore.jar b/lib/jcore.jar index 12190be..848bebf 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index 93d401d..86cfb5e 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/lib/jshop-ee-lib.jar b/lib/jshop-ee-lib.jar index 6506266..3248b43 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 deleted file mode 100644 index 2d0b47f..0000000 Binary files a/lib/jswingcore.jar and /dev/null differ diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index fe0d44c..a7fc149 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -18,1437 +18,1437 @@ is divided into following sections: - applet - cleanup - --> +--> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties index 344d53c..849d818 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -30,11 +30,11 @@ dist.jar=${dist.dir}/PizzaService-swing.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= +file.reference.jcore-swing.jar=lib/jcore-swing.jar file.reference.jcore.jar=lib/jcore.jar file.reference.jcoreee.jar=lib/jcoreee.jar file.reference.jshop-core.jar=lib/jshop-core.jar file.reference.jshop-ee-lib.jar=lib/jshop-ee-lib.jar -file.reference.jswingcore.jar=lib/jswingcore.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 includes=** @@ -44,9 +44,9 @@ jar.index=${jnlp.enabled} javac.classpath=\ ${file.reference.jcore.jar}:\ ${file.reference.jcoreee.jar}:\ - ${file.reference.jswingcore.jar}:\ ${file.reference.jshop-core.jar}:\ ${file.reference.jshop-ee-lib.jar}:\ + ${file.reference.jcore-swing.jar}:\ ${reference.PizzaService-lib.jar}:\ ${file.reference.log4j-api-2.3.jar}:\ ${file.reference.log4j-core-2.3.jar} @@ -105,10 +105,10 @@ run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 +source.reference.jcore-swing.jar=../jcore-swing/src/ source.reference.jcore.jar=../jcore/src/ source.reference.jcoreee.jar=../jcoreee/src/ source.reference.jshop-core.jar=../jshop-core/src/ source.reference.jshop-ee-lib.jar=../jshop-ee-lib/src/ -source.reference.jswingcore.jar=../jswingcore/src/ src.dir=src test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml index 1dc5238..7aa35cf 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -1,28 +1,28 @@ - org.netbeans.modules.java.j2seproject - - - PizzaService-swing - - - - - - - - - ./lib/nblibraries.properties - - - - PizzaService-lib - jar - - jar - clean - jar - - - + org.netbeans.modules.java.j2seproject + + + PizzaService-swing + + + + + + + + + ./lib/nblibraries.properties + + + + PizzaService-lib + jar + + jar + clean + jar + + + diff --git a/src/org/mxchange/pizzaapplication/application/PizzaApplication.java b/src/org/mxchange/pizzaapplication/application/PizzaApplication.java index 5fe0ae6..f7b2262 100644 --- a/src/org/mxchange/pizzaapplication/application/PizzaApplication.java +++ b/src/org/mxchange/pizzaapplication/application/PizzaApplication.java @@ -31,69 +31,74 @@ 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 - * - * @return All products + * Adds given product data from request to database + *

+ * @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 - * + *

* @return All categories */ public Deque getAllCategories (); /** - * Initializes this instance with given ServletContext - * - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.io.IOException If an IO error occurs + * Some "getter" for a an array of all categories + *

+ * @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 - * + *

* @return All products */ public Iterator getAllProductsIterator (); /** - * Some "getter" for a an array of all categories - * - * @return All categories + * Some "getter" for a linked list of only available products + *

+ * @return Only available products */ - public Iterator getAllCategoriesIterator (); + public Deque getAvailableProducts (); /** - * 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 + * Some "getter" for a an array of only available products + *

+ * @return Only available products */ - public void doAdminAddCategory (final Category category) throws CategoryTitleAlreadyUsedException; + public Iterator getAvailableProductsIterator (); /** - * Adds given product data from request to database - * - * @param product Product instance - * @throws org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException If the product's title has been used + * Initializes this instance with given ServletContext + *

+ * @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..a34807e 100644 --- a/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ b/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -28,115 +28,23 @@ import org.mxchange.jshopcore.model.product.Product; /** * Main application class - * + *

* @author Roland Haeder */ public class PizzaServiceApplication extends BaseFrameworkSystem implements PizzaApplication { + /** * Default constructor */ public PizzaServiceApplication () { // Trace message - 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."); + this.getLogger().logTrace("CALLED!"); //NOI18N } @Override public void doAdminAddCategory (final Category category) throws CategoryTitleAlreadyUsedException { // Trace message - this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N + this.getLogger().logTrace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N // category must not be null if (null == category) { @@ -145,11 +53,11 @@ public class PizzaServiceApplication extends BaseFrameworkSystem implements Pizz } // Get all fields - String title = category.getTitle(); - Long parentId = category.getParentId(); + String title = category.getCategoryTitle(); + Category parentCategory = category.getParentCategory(); // Debug message - this.getLogger().debug(MessageFormat.format("title={0},parentId={1}", title, parentId)); //NOI18N + this.getLogger().logDebug(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 @@ -176,13 +84,13 @@ public class PizzaServiceApplication extends BaseFrameworkSystem implements Pizz throw new UnsupportedOperationException("Unfinished method."); // Trace message - //this.getLogger().trace("EXIT!"); //NOI18N + //this.getLogger().logTrace("EXIT!"); //NOI18N } @Override public void doAdminAddProduct (final Product product) throws ProductTitleAlreadyUsedException { // Trace message - this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N + this.getLogger().logTrace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N // product must not be null if (null == product) { @@ -191,13 +99,13 @@ public class PizzaServiceApplication extends BaseFrameworkSystem implements Pizz } // Get title, price and category id - String title = product.getTitle(); - Float price = product.getPrice(); - Long id = product.getId(); - Boolean available = product.getAvailable(); + String title = product.getProductTitle(); + Float price = product.getProductPrice(); + Long id = product.getProductId(); + Boolean available = product.getProductAvailability(); // Debug message - this.getLogger().debug(MessageFormat.format("title={0},price={1},id={2},available={3}", title, price, id, available)); //NOI18N + this.getLogger().logDebug(MessageFormat.format("title={0},price={1},id={2},available={3}", title, price, id, available)); //NOI18N // Check all fields if (null == title) { @@ -230,77 +138,169 @@ public class PizzaServiceApplication extends BaseFrameworkSystem implements Pizz throw new UnsupportedOperationException("Unfinished method."); // Trace message - //this.getLogger().trace("EXIT!"); //NOI18N + //this.getLogger().logTrace("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().logTrace("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().logTrace("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().logTrace("CALLED!"); //NOI18N + + // Unfinished + throw new UnsupportedOperationException("Unfinished method."); + } + + @Override + public void init () throws SQLException { + // Trace message + this.getLogger().logTrace("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().logTrace("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().logTrace(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().logTrace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N // Init title - String title = product.getTitle(); + String title = category.getCategoryTitle(); // 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().logTrace(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().logTrace(MessageFormat.format("category={0} - CALLED!", product)); //NOI18N // Init title - String title = category.getTitle(); + String title = product.getProductTitle(); // 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().logTrace(MessageFormat.format("isUsed={0} - EXIT!", isUsed)); //NOI18N // Return it - return isUsed; + //return isUsed; } }