]> git.mxchange.org Git - jproduct-core.git/commitdiff
New project emerged:
authorRoland Häder <roland@mxchange.org>
Sat, 15 Apr 2017 17:11:24 +0000 (19:11 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 15 Apr 2017 18:49:37 +0000 (20:49 +0200)
- this project has emerged from jshop-core as these events, classes, interfaces
  and exceptions are generic enough to be moved out
- no need for commons-codec JAR

Signed-off-by: Roland Häder <roland@mxchange.org>
44 files changed:
build.xml
lib/commons-codec-1.10.jar [deleted file]
nbproject/build-impl.xml
nbproject/project.properties
nbproject/project.xml
src/org/mxchange/jproduct/events/category/AddedCategoryEvent.java [new file with mode: 0644]
src/org/mxchange/jproduct/events/category/CategoryAddedEvent.java [new file with mode: 0644]
src/org/mxchange/jproduct/events/product/AddedProductEvent.java [new file with mode: 0644]
src/org/mxchange/jproduct/events/product/ProductAddedEvent.java [new file with mode: 0644]
src/org/mxchange/jproduct/exceptions/CannotAddCategoryException.java [new file with mode: 0644]
src/org/mxchange/jproduct/exceptions/CannotAddProductException.java [new file with mode: 0644]
src/org/mxchange/jproduct/exceptions/CategoryTitleAlreadyUsedException.java [new file with mode: 0644]
src/org/mxchange/jproduct/exceptions/ProductTitleAlreadyUsedException.java [new file with mode: 0644]
src/org/mxchange/jproduct/model/category/Category.java [new file with mode: 0644]
src/org/mxchange/jproduct/model/category/ProductCategory.java [new file with mode: 0644]
src/org/mxchange/jproduct/model/payment/PaymentType.java [new file with mode: 0644]
src/org/mxchange/jproduct/model/product/GenericProduct.java [new file with mode: 0644]
src/org/mxchange/jproduct/model/product/Product.java [new file with mode: 0644]
src/org/mxchange/jshopcore/events/category/AddedCategoryEvent.java [deleted file]
src/org/mxchange/jshopcore/events/category/ShopCategoryAddedEvent.java [deleted file]
src/org/mxchange/jshopcore/events/product/AddedProductEvent.java [deleted file]
src/org/mxchange/jshopcore/events/product/ShopProductAddedEvent.java [deleted file]
src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java [deleted file]
src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java [deleted file]
src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java [deleted file]
src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java [deleted file]
src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java [deleted file]
src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java [deleted file]
src/org/mxchange/jshopcore/model/basket/BaseBasket.java [deleted file]
src/org/mxchange/jshopcore/model/basket/Basket.java [deleted file]
src/org/mxchange/jshopcore/model/basket/ShopBasket.java [deleted file]
src/org/mxchange/jshopcore/model/basket/items/BaseItem.java [deleted file]
src/org/mxchange/jshopcore/model/basket/items/BasketItem.java [deleted file]
src/org/mxchange/jshopcore/model/category/Category.java [deleted file]
src/org/mxchange/jshopcore/model/category/ProductCategory.java [deleted file]
src/org/mxchange/jshopcore/model/customer/CustomerUtils.java [deleted file]
src/org/mxchange/jshopcore/model/order/Orderable.java [deleted file]
src/org/mxchange/jshopcore/model/order/ShopOrder.java [deleted file]
src/org/mxchange/jshopcore/model/order/items/OrderItem.java [deleted file]
src/org/mxchange/jshopcore/model/payment/PaymentType.java [deleted file]
src/org/mxchange/jshopcore/model/product/GenericProduct.java [deleted file]
src/org/mxchange/jshopcore/model/product/Product.java [deleted file]
src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java [deleted file]
src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java [deleted file]

index c213c8a302f76649479023aafb2343d7675897eb..610bf0e6b1601cdf9da8475b89750878007a8b73 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -7,8 +7,8 @@
 <!-- the Compile on Save feature is turned off for the project. -->
 <!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
 <!-- in the project's Project Properties dialog box.-->
-<project name="jshop-core" default="default" basedir=".">
-    <description>Builds, tests, and runs the project jshop-core.</description>
+<project name="jproduct-core" default="default" basedir=".">
+    <description>Builds, tests, and runs the project jproduct-core.</description>
     <import file="nbproject/build-impl.xml"/>
     <!--
 
@@ -58,7 +58,7 @@
 
     An example of overriding the target for project execution could look like this:
 
-        <target name="run" depends="jshop-core-impl.jar">
+        <target name="run" depends="jproduct-core-impl.jar">
             <exec dir="bin" executable="launcher.exe">
                 <arg file="${dist.jar}"/>
             </exec>
diff --git a/lib/commons-codec-1.10.jar b/lib/commons-codec-1.10.jar
deleted file mode 100644 (file)
index 1d7417c..0000000
Binary files a/lib/commons-codec-1.10.jar and /dev/null differ
index 25a9570cb8d24423ab4962362016419fbeb58d79..1297ab8d7b77f0136720a14af907c7f1d268528f 100644 (file)
@@ -19,7 +19,7 @@ is divided into following sections:
   - cleanup
 
 -->
-<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="jshop-core-impl">
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="jproduct-core-impl">
        <fail message="Please build using Ant 1.8.0 or higher.">
                <condition>
                        <not>
@@ -468,7 +468,7 @@ is divided into following sections:
                                        </fileset>
                                </union>
                                <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
-                               <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="jshop-core" testname="TestNG tests" workingDir="${work.dir}">
+                               <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="jproduct-core" testname="TestNG tests" workingDir="${work.dir}">
                                        <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
                                        <propertyset>
                                                <propertyref prefix="test-sys-prop."/>
@@ -619,7 +619,7 @@ is divided into following sections:
                                <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
                                        <isset property="test.method"/>
                                </condition>
-                               <condition else="-suitename jshop-core -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
+                               <condition else="-suitename jproduct-core -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
                                        <matches pattern=".*\.xml" string="@{testClass}"/>
                                </condition>
                                <delete dir="${build.test.results.dir}" quiet="true"/>
@@ -911,7 +911,7 @@ is divided into following sections:
                <delete file="${built-jar.properties}" quiet="true"/>
        </target>
        <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
-               <echo level="warn" message="Cycle detected: jshop-core was already built"/>
+               <echo level="warn" message="Cycle detected: jproduct-core was already built"/>
        </target>
        <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
                <mkdir dir="${build.dir}"/>
@@ -1396,7 +1396,7 @@ is divided into following sections:
                <delete file="${built-clean.properties}" quiet="true"/>
        </target>
        <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
-               <echo level="warn" message="Cycle detected: jshop-core was already built"/>
+               <echo level="warn" message="Cycle detected: jproduct-core was already built"/>
        </target>
        <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
                <mkdir dir="${build.dir}"/>
index 35e8bbe885fced7580f79401315a18eb530f934d..ca363dbd36934b5bb424ceca7bce94660bc6430b 100644 (file)
@@ -3,7 +3,7 @@ annotation.processing.enabled.in.editor=true
 annotation.processing.processors.list=
 annotation.processing.run.all.processors=true
 annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=jshop-core
+application.title=jproduct-core
 application.vendor=Roland H\u00e4der
 auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
 build.classes.dir=${build.dir}/classes
@@ -26,11 +26,10 @@ debug.test.classpath=\
 dist.archive.excludes=
 # This directory is removed when the project is cleaned:
 dist.dir=dist
-dist.jar=${dist.dir}/jshop-core.jar
+dist.jar=${dist.dir}/jproduct-core.jar
 dist.javadoc.dir=${dist.dir}/javadoc
 endorsed.classpath=
 excludes=
-file.reference.commons-codec-1.10.jar=lib/commons-codec-1.10.jar
 file.reference.jcontacts-core.jar=lib/jcontacts-core.jar
 file.reference.jcore.jar=lib/jcore.jar
 file.reference.jcoreee.jar=lib/jcoreee.jar
@@ -44,7 +43,6 @@ javac.classpath=\
     ${file.reference.jcoreee.jar}:\
     ${file.reference.jcontacts-core.jar}:\
     ${file.reference.jcustomer-core.jar}:\
-    ${file.reference.commons-codec-1.10.jar}:\
     ${libs.javaee-api-7.0.classpath}
 # Space-separated list of extra javac options
 javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
@@ -69,7 +67,7 @@ javadoc.private=true
 javadoc.splitindex=true
 javadoc.use=true
 javadoc.version=true
-javadoc.windowtitle=Java Shop Core
+javadoc.windowtitle=JProduct Core
 jnlp.codebase.type=no.codebase
 jnlp.descriptor=application
 jnlp.enabled=false
index 5c51ec69c8cb002cc01744360280026bc2aeb34d..f9786af86ebed1e8eb4d175008510df7ee7c9d8d 100644 (file)
@@ -3,7 +3,7 @@
        <type>org.netbeans.modules.java.j2seproject</type>
        <configuration>
                <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
-                       <name>jshop-core</name>
+                       <name>jproduct-core</name>
                        <source-roots>
                                <root id="src.dir"/>
                        </source-roots>
diff --git a/src/org/mxchange/jproduct/events/category/AddedCategoryEvent.java b/src/org/mxchange/jproduct/events/category/AddedCategoryEvent.java
new file mode 100644 (file)
index 0000000..7441fa1
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.events.category;
+
+import java.io.Serializable;
+import org.mxchange.jproduct.model.category.Category;
+
+/**
+ * An interface for added category events
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface AddedCategoryEvent extends Serializable {
+
+       /**
+        * Getter for added category instance
+        * <p>
+        * @return Added category instance
+        */
+       public Category getAddedCategory ();
+
+}
diff --git a/src/org/mxchange/jproduct/events/category/CategoryAddedEvent.java b/src/org/mxchange/jproduct/events/category/CategoryAddedEvent.java
new file mode 100644 (file)
index 0000000..da077d3
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.events.category;
+
+import java.text.MessageFormat;
+import org.mxchange.jproduct.model.category.Category;
+
+/**
+ * An event fired when a new shop category has been added.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class ShopCategoryAddedEvent implements AddedCategoryEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 83_275_471_765_091_760L;
+
+       /**
+        * Category instance that has been added
+        */
+       private final Category addedCategory;
+
+       /**
+        * Constructor with added category instance
+        * <p>
+        * @param addedCategory Added category
+        */
+       public ShopCategoryAddedEvent (final Category addedCategory) {
+               // The category should be valid
+               if (null == addedCategory) {
+                       // Is NULL, throw NPE
+                       throw new NullPointerException("addedCategory is null"); //NOI18N
+               } else if (addedCategory.getCategoryTitle().isEmpty()) {
+                       // Empty title
+                       throw new IllegalArgumentException("addedCategory.categoryTitle is empty"); //NOI18N
+               } else if (addedCategory.getCategoryId() == null) {
+                       // Id is NULL
+                       throw new NullPointerException("addedCategory.categoryId is null"); //NOI18N
+               } else if (addedCategory.getCategoryId() <= 0) {
+                       // Not valid id
+                       throw new IllegalArgumentException(MessageFormat.format("addedCategory.categoryId={0} is not valid.", addedCategory.getCategoryId())); //NOI18N
+               }
+
+               // Set it here
+               this.addedCategory = addedCategory;
+       }
+
+       @Override
+       public Category getAddedCategory () {
+               return this.addedCategory;
+       }
+
+}
diff --git a/src/org/mxchange/jproduct/events/product/AddedProductEvent.java b/src/org/mxchange/jproduct/events/product/AddedProductEvent.java
new file mode 100644 (file)
index 0000000..c2ce703
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.events.product;
+
+import java.io.Serializable;
+import org.mxchange.jproduct.model.product.Product;
+
+/**
+ * An interface for added product events
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface AddedProductEvent extends Serializable {
+
+       /**
+        * Getter for added product instance
+        * <p>
+        * @return Added product instance
+        */
+       public Product getAddedProduct ();
+
+}
diff --git a/src/org/mxchange/jproduct/events/product/ProductAddedEvent.java b/src/org/mxchange/jproduct/events/product/ProductAddedEvent.java
new file mode 100644 (file)
index 0000000..ddc5f32
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.events.product;
+
+import java.text.MessageFormat;
+import org.mxchange.jproduct.model.product.Product;
+
+/**
+ * An event fired when a new shop category has been added.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class ProductAddedEvent implements AddedProductEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 18_567_817_669_107L;
+
+       /**
+        * Product instance that has been added
+        */
+       private final Product addedProduct;
+
+       /**
+        * Constructor with added product instance
+        * <p>
+        * @param addedProduct Added product
+        */
+       public ProductAddedEvent (final Product addedProduct) {
+               // The category should be valid
+               if (null == addedProduct) {
+                       // Is NULL, throw NPE
+                       throw new NullPointerException("addedProduct is null"); //NOI18N
+               } else if (addedProduct.getProductTitle().isEmpty()) {
+                       // Empty title
+                       throw new IllegalArgumentException("addedProduct.categoryTitle is empty"); //NOI18N
+               } else if (addedProduct.getProductId() == null) {
+                       // Id is NULL
+                       throw new NullPointerException("addedProduct.productId is null"); //NOI18N
+               } else if (addedProduct.getProductId() <= 0) {
+                       // Not valid id
+                       throw new IllegalArgumentException(MessageFormat.format("addedProduct.productId={0} is not valid.", addedProduct.getProductId())); //NOI18N
+               } else if (addedProduct.getProductCategory() == null) {
+                       // Id is NULL
+                       throw new NullPointerException("addedProduct.productCategory is null"); //NOI18N
+               } else if (addedProduct.getProductCategory().getCategoryId() == null) {
+                       // Id is NULL
+                       throw new NullPointerException("addedProduct.productCategory.categoryId is null"); //NOI18N
+               } else if (addedProduct.getProductCategory().getCategoryId() <= 0) {
+                       // Not valid id
+                       throw new IllegalArgumentException(MessageFormat.format("addedProduct.productCategory.categoryId={0} is not valid.", addedProduct.getProductId())); //NOI18N
+               }
+
+               // Set it here
+               this.addedProduct = addedProduct;
+       }
+
+       @Override
+       public Product getAddedProduct () {
+               return this.addedProduct;
+       }
+
+}
diff --git a/src/org/mxchange/jproduct/exceptions/CannotAddCategoryException.java b/src/org/mxchange/jproduct/exceptions/CannotAddCategoryException.java
new file mode 100644 (file)
index 0000000..fbd7ca7
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * 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.jproduct.exceptions;
+
+/**
+ * An exception thrown when the category cannot be added for a "low level"
+ * reason.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class CannotAddCategoryException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 34_295_843_957_951L;
+
+       /**
+        * Constructor with cause
+        * <p>
+        * @param cause Causing exception
+        */
+       public CannotAddCategoryException (final Throwable cause) {
+               // Call super constructor
+               super(cause);
+       }
+}
diff --git a/src/org/mxchange/jproduct/exceptions/CannotAddProductException.java b/src/org/mxchange/jproduct/exceptions/CannotAddProductException.java
new file mode 100644 (file)
index 0000000..5be8645
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * 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.jproduct.exceptions;
+
+/**
+ * An exception thrown when the product cannot be added for a "low level"
+ * reason.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class CannotAddProductException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 48_574_857_485_748_175L;
+
+       /**
+        * Constructor with cause
+        * <p>
+        * @param cause Causing exception
+        */
+       public CannotAddProductException (final Throwable cause) {
+               // Call super constructor
+               super(cause);
+       }
+}
diff --git a/src/org/mxchange/jproduct/exceptions/CategoryTitleAlreadyUsedException.java b/src/org/mxchange/jproduct/exceptions/CategoryTitleAlreadyUsedException.java
new file mode 100644 (file)
index 0000000..087bed9
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * 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.jproduct.exceptions;
+
+import java.text.MessageFormat;
+import org.mxchange.jproduct.model.category.Category;
+
+/**
+ * An exception thrown when the given title is already used
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class CategoryTitleAlreadyUsedException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 53_751_434_673_262L;
+
+       /**
+        * Constructor with HttpServletRequest instance
+        * <p>
+        * @param category Category instance
+        */
+       public CategoryTitleAlreadyUsedException (final Category category) {
+               // Call super constructor
+               super(MessageFormat.format("Title {0} is already used.", category.getCategoryTitle())); //NOI18N
+       }
+}
diff --git a/src/org/mxchange/jproduct/exceptions/ProductTitleAlreadyUsedException.java b/src/org/mxchange/jproduct/exceptions/ProductTitleAlreadyUsedException.java
new file mode 100644 (file)
index 0000000..ca1bf24
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * 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.jproduct.exceptions;
+
+import java.text.MessageFormat;
+import org.mxchange.jproduct.model.product.Product;
+
+/**
+ * An exception thrown when the given title is already used
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class ProductTitleAlreadyUsedException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 4_252_734_834_174L;
+
+       /**
+        * Constructor with HttpServletRequest instance
+        * <p>
+        * @param product Product instance
+        */
+       public ProductTitleAlreadyUsedException (final Product product) {
+               // Call super constructor
+               super(MessageFormat.format("Title {0} is already used.", product.getProductTitle())); //NOI18N
+       }
+}
diff --git a/src/org/mxchange/jproduct/model/category/Category.java b/src/org/mxchange/jproduct/model/category/Category.java
new file mode 100644 (file)
index 0000000..7606fc6
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * 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.jproduct.model.category;
+
+import java.io.Serializable;
+
+/**
+ * An interface for categories
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface Category extends Serializable {
+
+       /**
+        * Copies all properties from other category to this
+        * <p>
+        * @param category Source category instance
+        */
+       void copyAll (final Category category);
+
+       /**
+        * Id number of category
+        * <p>
+        * @return the id
+        */
+       Long getCategoryId ();
+
+       /**
+        * Id number of category
+        * <p>
+        * @param id the id to set
+        */
+       void setCategoryId (final Long id);
+
+       /**
+        * Parent category
+        * <p>
+        * @return the parent category
+        */
+       Category getParentCategory ();
+
+       /**
+        * Parent category
+        * <p>
+        * @param parentCategory the parent category to set
+        */
+       void setParentCategory (final Category parentCategory);
+
+       /**
+        * Title of category
+        * <p>
+        * @return the title
+        */
+       String getCategoryTitle ();
+
+       /**
+        * Title of category
+        * <p>
+        * @param title the title to set
+        */
+       void setCategoryTitle (final String title);
+
+       @Override
+       boolean equals (final Object object);
+
+       @Override
+       int hashCode ();
+
+}
diff --git a/src/org/mxchange/jproduct/model/category/ProductCategory.java b/src/org/mxchange/jproduct/model/category/ProductCategory.java
new file mode 100644 (file)
index 0000000..90f17d0
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * 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.jproduct.model.category;
+
+import java.util.Objects;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+/**
+ * A product category
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Entity (name = "category")
+@Table (name = "category")
+@SuppressWarnings ("PersistenceUnitPresent")
+public class ProductCategory implements Category {
+
+       /**
+        * Serial number
+        */
+       @Transient
+       private static final long serialVersionUID = 21_458_945_712_659L;
+
+       /**
+        * Id number of category
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "category_id", nullable = false)
+       private Long categoryId;
+
+       /**
+        * Title of category
+        */
+       @Basic (optional = false)
+       @Column (name = "category_title", length = 100, nullable = false, unique = true)
+       private String categoryTitle;
+
+       /**
+        * Parent category
+        */
+       @JoinColumn (name = "parent_id")
+       @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH)
+       private Category parentCategory;
+
+       /**
+        * Constructor which accepts all database fields
+        * <p>
+        * @param categoryId     Id number of database record
+        * @param categoryTitle  Category categoryTitle
+        * @param parentCategory Parent category
+        */
+       public ProductCategory (final Long categoryId, final String categoryTitle, final Category parentCategory) {
+               // Set all here
+               this.categoryId = categoryId;
+               this.categoryTitle = categoryTitle;
+               this.parentCategory = parentCategory;
+       }
+
+       /**
+        * Default constructor
+        */
+       public ProductCategory () {
+       }
+
+       @Override
+       public void copyAll (final Category category) {
+               // Copy all data
+               this.setParentCategory(category.getParentCategory());
+               this.setCategoryTitle(category.getCategoryTitle());
+       }
+
+       @Override
+       public boolean equals (final Object object) {
+               if (this == object) {
+                       return true;
+               } else if (null == object) {
+                       return false;
+               } else if (this.getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final Category other = (Category) object;
+
+               if (!Objects.equals(this.getCategoryTitle(), other.getCategoryTitle())) {
+                       return false;
+               } else if (!Objects.equals(this.getCategoryId(), other.getCategoryId())) {
+                       return false;
+               }
+
+               return true;
+       }
+
+       @Override
+       public int hashCode () {
+               int hash = 7;
+               hash = 13 * hash + Objects.hashCode(this.getCategoryId());
+               hash = 13 * hash + Objects.hashCode(this.getCategoryTitle());
+               return hash;
+       }
+
+       @Override
+       public Long getCategoryId () {
+               return this.categoryId;
+       }
+
+       @Override
+       public void setCategoryId (final Long categoryId) {
+               this.categoryId = categoryId;
+       }
+
+       @Override
+       public String getCategoryTitle () {
+               return this.categoryTitle;
+       }
+
+       @Override
+       public void setCategoryTitle (final String categoryTitle) {
+               this.categoryTitle = categoryTitle;
+       }
+
+       @Override
+       public Category getParentCategory () {
+               return this.parentCategory;
+       }
+
+       @Override
+       public void setParentCategory (final Category parentCategory) {
+               this.parentCategory = parentCategory;
+       }
+
+}
diff --git a/src/org/mxchange/jproduct/model/payment/PaymentType.java b/src/org/mxchange/jproduct/model/payment/PaymentType.java
new file mode 100644 (file)
index 0000000..f8b0d76
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 Roland Haeder<roland@mxchange.org>
+ *
+ * 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.jproduct.model.payment;
+
+/**
+ * Payment types
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public enum PaymentType {
+
+       /**
+        * Payment type "cash"
+        */
+       PAYMENT_TYPE_CASH,
+       /**
+        * Payment type "credit card"
+        */
+       PAYMENT_TYPE_CREDIT_CARD,
+       /**
+        * Payment type "prepayment"
+        */
+       PAYMENT_TYPE_PREPAYMENT,
+       /**
+        * Payment type "invoice"
+        */
+       PAYMENT_TYPE_INVOICE;
+
+}
diff --git a/src/org/mxchange/jproduct/model/product/GenericProduct.java b/src/org/mxchange/jproduct/model/product/GenericProduct.java
new file mode 100644 (file)
index 0000000..4dc700d
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * 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.jproduct.model.product;
+
+import java.util.Objects;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import org.mxchange.jproduct.model.category.Category;
+import org.mxchange.jproduct.model.category.ProductCategory;
+
+/**
+ * Generic product class
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ * TODO: Find a better name
+ */
+@Entity (name = "products")
+@Table (name = "products")
+@SuppressWarnings ("PersistenceUnitPresent")
+public class GenericProduct implements Product {
+
+       /**
+        * Serial number
+        */
+       @Transient
+       private static final long serialVersionUID = 54_578_571_769_283L;
+
+       /**
+        * Availability of product
+        */
+       @Column (name = "product_availability", nullable = false)
+       private Boolean productAvailability;
+
+       /**
+        * Product productCategory
+        */
+       @JoinColumn (name = "category_id", nullable = false, updatable = false)
+       @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH, optional = false)
+       private Category productCategory;
+
+       /**
+        * Id number of product
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "product_id", nullable = false, updatable = false)
+       private Long productId;
+
+       /**
+        * Price of product
+        */
+       @Basic (optional = false)
+       @Column (name = "product_price", nullable = false)
+       private Float productPrice;
+
+       /**
+        * Title of product
+        */
+       @Basic (optional = false)
+       @Column (name = "product_title", length = 100, nullable = false)
+       private String productTitle;
+
+       /**
+        * Default constructor
+        */
+       public GenericProduct () {
+       }
+
+       /**
+        * Constructor will all required data
+        * <p>
+        * @param productId           Id number of product
+        * @param productTitle        Name of product
+        * @param productPrice        Price
+        * @param productCategory     Category instance
+        * @param productAvailability Availability (selectable by customer)
+        */
+       public GenericProduct (final Long productId, final String productTitle, final Float productPrice, final Category productCategory, final Boolean productAvailability) {
+               // Set all here
+               this.productId = productId;
+               this.productTitle = productTitle;
+               this.productPrice = productPrice;
+               this.productCategory = productCategory;
+               this.productAvailability = productAvailability;
+       }
+
+       @Override
+       public void copyAll (final Product product) {
+               // Copy all
+               this.setProductAvailability(product.getProductAvailability());
+               this.setProductCategory(product.getProductCategory());
+               this.setProductPrice(product.getProductPrice());
+               this.setProductTitle(product.getProductTitle());
+       }
+
+       @Override
+       public boolean equals (final Object object) {
+               if (this == object) {
+                       return true;
+               } else if (null == object) {
+                       return false;
+               } else if (this.getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final Product other = (Product) object;
+
+               if (!Objects.equals(this.getProductTitle(), other.getProductTitle())) {
+                       return false;
+               }
+
+               return Objects.equals(this.getProductId(), other.getProductId());
+       }
+
+       @Override
+       public int hashCode () {
+               int hash = 7;
+               hash = 23 * hash + Objects.hashCode(this.getProductId());
+               hash = 23 * hash + Objects.hashCode(this.getProductTitle());
+               return hash;
+       }
+
+       @Override
+       public Boolean getProductAvailability () {
+               return this.productAvailability;
+       }
+
+       @Override
+       public void setProductAvailability (final Boolean productAvailability) {
+               this.productAvailability = productAvailability;
+       }
+
+       @Override
+       public Category getProductCategory () {
+               return this.productCategory;
+       }
+
+       @Override
+       public void setProductCategory (final Category productCategory) {
+               this.productCategory = productCategory;
+       }
+
+       @Override
+       public Long getProductId () {
+               return this.productId;
+       }
+
+       @Override
+       public void setProductId (final Long productId) {
+               this.productId = productId;
+       }
+
+       @Override
+       public Float getProductPrice () {
+               return this.productPrice;
+       }
+
+       @Override
+       public void setProductPrice (final Float productPrice) {
+               this.productPrice = productPrice;
+       }
+
+       @Override
+       public String getProductTitle () {
+               return this.productTitle;
+       }
+
+       @Override
+       public void setProductTitle (final String productTitle) {
+               this.productTitle = productTitle;
+       }
+
+}
diff --git a/src/org/mxchange/jproduct/model/product/Product.java b/src/org/mxchange/jproduct/model/product/Product.java
new file mode 100644 (file)
index 0000000..e300703
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * 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.jproduct.model.product;
+
+import java.io.Serializable;
+import org.mxchange.jproduct.model.category.Category;
+
+/**
+ * An interface for in database storable products
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface Product extends Serializable {
+
+       /**
+        * Copies all properties from source product to this.
+        * <p>
+        * @param product Source product
+        */
+       void copyAll (final Product product);
+
+       /**
+        * Getter for product availability
+        * <p>
+        * @return Product availability
+        */
+       Boolean getProductAvailability ();
+
+       /**
+        * Setter for product availability
+        * <p>
+        * @param productAvailability Product availability
+        */
+       void setProductAvailability (final Boolean productAvailability);
+
+       /**
+        * Getter for product category id
+        * <p>
+        * @return Product category id
+        */
+       Category getProductCategory ();
+
+       /**
+        * Setter for product category
+        * <p>
+        * @param productCategory Product category
+        */
+       void setProductCategory (final Category productCategory);
+
+       /**
+        * Getter for id number, suitable for form fields.
+        * <p>
+        * @return Id number of product
+        */
+       Long getProductId ();
+
+       /**
+        * Id number of product
+        * <p>
+        * @param productId the id number to set
+        */
+       void setProductId (final Long productId);
+
+       /**
+        * Getter for raw price.
+        * <p>
+        * @return Single price of product
+        */
+       Float getProductPrice ();
+
+       /**
+        * Price of product
+        * <p>
+        * @param productPrice the price to set
+        */
+       void setProductPrice (final Float productPrice);
+
+       /**
+        * Getter for title.
+        * <p>
+        * @return Title of product
+        */
+       String getProductTitle ();
+
+       /**
+        * Title of product
+        * <p>
+        * @param productTitle the title to set
+        */
+       void setProductTitle (final String productTitle);
+
+       @Override
+       boolean equals (final Object object);
+
+       @Override
+       int hashCode ();
+
+}
diff --git a/src/org/mxchange/jshopcore/events/category/AddedCategoryEvent.java b/src/org/mxchange/jshopcore/events/category/AddedCategoryEvent.java
deleted file mode 100644 (file)
index d553cef..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore.events.category;
-
-import java.io.Serializable;
-import org.mxchange.jshopcore.model.category.Category;
-
-/**
- * An interface for added category events
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface AddedCategoryEvent extends Serializable {
-
-       /**
-        * Getter for added category instance
-        * <p>
-        * @return Added category instance
-        */
-       public Category getAddedCategory ();
-
-}
diff --git a/src/org/mxchange/jshopcore/events/category/ShopCategoryAddedEvent.java b/src/org/mxchange/jshopcore/events/category/ShopCategoryAddedEvent.java
deleted file mode 100644 (file)
index 3f5ba06..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore.events.category;
-
-import java.text.MessageFormat;
-import org.mxchange.jshopcore.model.category.Category;
-
-/**
- * An event fired when a new shop category has been added.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class ShopCategoryAddedEvent implements AddedCategoryEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 83_275_471_765_091_760L;
-
-       /**
-        * Category instance that has been added
-        */
-       private final Category addedCategory;
-
-       /**
-        * Constructor with added category instance
-        * <p>
-        * @param addedCategory Added category
-        */
-       public ShopCategoryAddedEvent (final Category addedCategory) {
-               // The category should be valid
-               if (null == addedCategory) {
-                       // Is NULL, throw NPE
-                       throw new NullPointerException("addedCategory is null"); //NOI18N
-               } else if (addedCategory.getCategoryTitle().isEmpty()) {
-                       // Empty title
-                       throw new IllegalArgumentException("addedCategory.categoryTitle is empty"); //NOI18N
-               } else if (addedCategory.getCategoryId() == null) {
-                       // Id is NULL
-                       throw new NullPointerException("addedCategory.categoryId is null"); //NOI18N
-               } else if (addedCategory.getCategoryId() <= 0) {
-                       // Not valid id
-                       throw new IllegalArgumentException(MessageFormat.format("addedCategory.categoryId={0} is not valid.", addedCategory.getCategoryId())); //NOI18N
-               }
-
-               // Set it here
-               this.addedCategory = addedCategory;
-       }
-
-       @Override
-       public Category getAddedCategory () {
-               return this.addedCategory;
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/events/product/AddedProductEvent.java b/src/org/mxchange/jshopcore/events/product/AddedProductEvent.java
deleted file mode 100644 (file)
index eb9b51f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore.events.product;
-
-import java.io.Serializable;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An interface for added product events
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface AddedProductEvent extends Serializable {
-
-       /**
-        * Getter for added product instance
-        * <p>
-        * @return Added product instance
-        */
-       public Product getAddedProduct ();
-
-}
diff --git a/src/org/mxchange/jshopcore/events/product/ShopProductAddedEvent.java b/src/org/mxchange/jshopcore/events/product/ShopProductAddedEvent.java
deleted file mode 100644 (file)
index 68f80e0..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore.events.product;
-
-import java.text.MessageFormat;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An event fired when a new shop category has been added.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class ShopProductAddedEvent implements AddedProductEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 18_567_817_669_107L;
-
-       /**
-        * Product instance that has been added
-        */
-       private final Product addedProduct;
-
-       /**
-        * Constructor with added product instance
-        * <p>
-        * @param addedProduct Added product
-        */
-       public ShopProductAddedEvent (final Product addedProduct) {
-               // The category should be valid
-               if (null == addedProduct) {
-                       // Is NULL, throw NPE
-                       throw new NullPointerException("addedProduct is null"); //NOI18N
-               } else if (addedProduct.getProductTitle().isEmpty()) {
-                       // Empty title
-                       throw new IllegalArgumentException("addedProduct.categoryTitle is empty"); //NOI18N
-               } else if (addedProduct.getProductId() == null) {
-                       // Id is NULL
-                       throw new NullPointerException("addedProduct.productId is null"); //NOI18N
-               } else if (addedProduct.getProductId() <= 0) {
-                       // Not valid id
-                       throw new IllegalArgumentException(MessageFormat.format("addedProduct.productId={0} is not valid.", addedProduct.getProductId())); //NOI18N
-               } else if (addedProduct.getProductCategory() == null) {
-                       // Id is NULL
-                       throw new NullPointerException("addedProduct.productCategory is null"); //NOI18N
-               } else if (addedProduct.getProductCategory().getCategoryId() == null) {
-                       // Id is NULL
-                       throw new NullPointerException("addedProduct.productCategory.categoryId is null"); //NOI18N
-               } else if (addedProduct.getProductCategory().getCategoryId() <= 0) {
-                       // Not valid id
-                       throw new IllegalArgumentException(MessageFormat.format("addedProduct.productCategory.categoryId={0} is not valid.", addedProduct.getProductId())); //NOI18N
-               }
-
-               // Set it here
-               this.addedProduct = addedProduct;
-       }
-
-       @Override
-       public Product getAddedProduct () {
-               return this.addedProduct;
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java b/src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java
deleted file mode 100644 (file)
index d5e8512..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.exceptions;
-
-import java.text.MessageFormat;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-
-/**
- * An exception thrown when the given item is already added to the
- * basketController.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class BasketItemAlreadyAddedException extends Exception {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 64_828_391_485_785_167L;
-
-       /**
-        * Constructor with item instance T
-        * <p>
-        * @param <T> Any item that is or extends the interface
-        * @param item An instance of a T item
-        */
-       public <T extends AddableBasketItem> BasketItemAlreadyAddedException (final T item) {
-               // Create message and pass it along
-               super(MessageFormat.format("Item {0} has already been added. Did you miss to call isAdded()?", item));
-       }
-}
diff --git a/src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java b/src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java
deleted file mode 100644 (file)
index f1b89d7..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.exceptions;
-
-/**
- * An exception thrown when the category cannot be added for a "low level"
- * reason.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class CannotAddCategoryException extends Exception {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 34_295_843_957_951L;
-
-       /**
-        * Constructor with cause
-        * <p>
-        * @param cause Causing exception
-        */
-       public CannotAddCategoryException (final Throwable cause) {
-               // Call super constructor
-               super(cause);
-       }
-}
diff --git a/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java b/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java
deleted file mode 100644 (file)
index 2bcb67b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.exceptions;
-
-/**
- * An exception thrown when the product cannot be added for a "low level"
- * reason.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class CannotAddProductException extends Exception {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 48_574_857_485_748_175L;
-
-       /**
-        * Constructor with cause
-        * <p>
-        * @param cause Causing exception
-        */
-       public CannotAddProductException (final Throwable cause) {
-               // Call super constructor
-               super(cause);
-       }
-}
diff --git a/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java
deleted file mode 100644 (file)
index 54bb530..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.exceptions;
-
-import java.text.MessageFormat;
-import org.mxchange.jshopcore.model.category.Category;
-
-/**
- * An exception thrown when the given title is already used
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class CategoryTitleAlreadyUsedException extends Exception {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 53_751_434_673_262L;
-
-       /**
-        * Constructor with HttpServletRequest instance
-        * <p>
-        * @param category Category instance
-        */
-       public CategoryTitleAlreadyUsedException (final Category category) {
-               // Call super constructor
-               super(MessageFormat.format("Title {0} is already used.", category.getCategoryTitle())); //NOI18N
-       }
-}
diff --git a/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java
deleted file mode 100644 (file)
index 1c0bef3..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.exceptions;
-
-import java.text.MessageFormat;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An exception thrown when the given title is already used
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class ProductTitleAlreadyUsedException extends Exception {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 4_252_734_834_174L;
-
-       /**
-        * Constructor with HttpServletRequest instance
-        * <p>
-        * @param product Product instance
-        */
-       public ProductTitleAlreadyUsedException (final Product product) {
-               // Call super constructor
-               super(MessageFormat.format("Title {0} is already used.", product.getProductTitle())); //NOI18N
-       }
-}
diff --git a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java
deleted file mode 100644 (file)
index c7f0556..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.basket;
-
-import java.io.Serializable;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An interface for addable basket items
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface AddableBasketItem extends Serializable {
-
-       /**
-        * Getter for item amount
-        * <p>
-        * @return the amount
-        */
-       Long getOrderedAmount ();
-
-       /**
-        * Setter for item amount
-        * <p>
-        * @param amount the amount to set
-        */
-       void setOrderedAmount (final Long amount);
-
-       /**
-        * Getter for entry id (from database backend)
-        * <p>
-        * @return the id
-        */
-       Long getItemId ();
-
-       /**
-        * Setter for entry id (from database backend)
-        * <p>
-        * @param id the id to set
-        */
-       void setItemId (final Long id);
-
-       /**
-        * Getter for item type
-        * <p>
-        * @return the type
-        */
-       String getItemType ();
-
-       /**
-        * Setter for item type
-        * <p>
-        * @param type the type to set
-        */
-       void setItemType (final String type);
-
-       /**
-        * Getter for product instance
-        * <p>
-        * @return the product
-        */
-       Product getItemProduct ();
-
-       /**
-        * Setter for product instance
-        * <p>
-        * @param product the product to set
-        */
-       void setItemProduct (final Product product);
-
-       /**
-        * Determines whether the item has a Product instance set
-        * <p>
-        * @return Whether a Product instance is set
-        */
-       boolean isProductType ();
-
-       @Override
-       boolean equals (final Object object);
-
-       @Override
-       int hashCode ();
-}
diff --git a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java
deleted file mode 100644 (file)
index 3e7f278..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.basket;
-
-import java.util.Deque;
-import java.util.LinkedList;
-import java.util.List;
-import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
-
-/**
- * A general basket class. This class does not store any properties, it only
- * contains logic for handling the items (T).
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- * @param <T> Any instance that implements AddableBasketItem
- */
-public abstract class BaseBasket<T extends AddableBasketItem> implements Basket<T> {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 782_396_762_230_845_717L;
-
-       /**
-        * Ordered item list
-        */
-       private final Deque<T> deque;
-
-       /**
-        * Protected constructor with session instance
-        */
-       protected BaseBasket () {
-               // Init queue
-               this.deque = new LinkedList<>();
-       }
-
-       @Override
-       public void addItem (final T item) throws BasketItemAlreadyAddedException {
-               // item must not be null
-               if (null == item) {
-                       // Then abort here
-                       throw new NullPointerException("item is null"); //NOI18N
-               } else if (this.isAdded(item)) {
-                       // Already been added
-                       throw new BasketItemAlreadyAddedException(item); //NOI18N
-               }
-
-               // Add it here
-               this.deque.add(item);
-       }
-
-       @Override
-       public void clear () {
-               // Deligate to deque
-               this.deque.clear();
-       }
-
-       @Override
-       public List<T> getAll () {
-               // Init map
-               List<T> list = new LinkedList<>();
-
-               // Iterate over full item list
-               for (final T item : this.deque) {
-                       // item should not be null
-                       if (null == item) {
-                               // Abort here
-                               throw new NullPointerException("item is null"); //NOI18N
-                       }
-
-                       // Add to map, use the item's id as key
-                       list.add(item);
-               }
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       public T getLast () {
-               // Deligate to list
-               return this.deque.getLast();
-       }
-
-       @Override
-       public boolean isAdded (final T item) {
-               // item must not be null
-               if (null == item) {
-                       // Then abort here
-                       throw new NullPointerException("item is null"); //NOI18N
-               }
-
-               // Get all items
-               List<T> list = this.getAll();
-
-               // Default is not found
-               boolean isAdded = false;
-
-               // Loop through list
-               for (final T i : list) {
-                       // Compare id
-                       if (i.equals(item)) {
-                               // Okay, found it
-                               isAdded = true;
-                               break;
-                       }
-               }
-               // Return it
-               return isAdded;
-       }
-
-       @Override
-       public boolean isEmpty () {
-               // Deligate call to frontend
-               return this.deque.isEmpty();
-       }
-
-       @Override
-       public int size () {
-               // Is the list empty?
-               assert this.isEmpty() : "deque is empty"; //NOI18N
-
-               // It is size-1
-               return this.deque.size();
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/model/basket/Basket.java b/src/org/mxchange/jshopcore/model/basket/Basket.java
deleted file mode 100644 (file)
index 9b70fc3..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.basket;
-
-import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
-
-/**
- * An interface for baskets
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- * @param <T> Any addable basket items
- */
-public interface Basket<T extends AddableBasketItem> extends Serializable {
-
-       /**
-        * Adds given item instance to this basket
-        * <p>
-        * @param item Item instance to add
-        * <p>
-        * @throws org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException
-        *                                                                           If
-        *                                                                           the
-        *                                                                           item
-        *                                                                           instance
-        *                                                                           has
-        *                                                                           already
-        *                                                                           been
-        *                                                                           added
-        */
-       void addItem (final T item) throws BasketItemAlreadyAddedException;
-
-       /**
-        * Clears the basket instance
-        */
-       void clear ();
-
-       /**
-        * Some "getter" for all entries in this basket
-        * <p>
-        * @return Map on all basket items
-        */
-       List<T> getAll ();
-
-       /**
-        * Getter for last entry
-        * <p>
-        * @return Last added item in basket
-        */
-       T getLast ();
-
-       /**
-        * Getter for basket size
-        * <p>
-        * @return Basket size
-        */
-       int size ();
-
-       /**
-        * Checks whether the given item has already been added by checking the
-        * item's id.
-        * <p>
-        * @param item Item instance to check
-        * <p>
-        * @return Whether the given item has been found
-        */
-       boolean isAdded (final T item);
-
-       /**
-        * Checks if the basket is empty
-        * <p>
-        * @return Whether the basket is empty
-        */
-       boolean isEmpty ();
-
-       @Override
-       boolean equals (final Object object);
-
-       @Override
-       int hashCode ();
-
-}
diff --git a/src/org/mxchange/jshopcore/model/basket/ShopBasket.java b/src/org/mxchange/jshopcore/model/basket/ShopBasket.java
deleted file mode 100644 (file)
index 572d7e7..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.basket;
-
-/**
- * A basket for orderable items
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class ShopBasket extends BaseBasket<AddableBasketItem> implements Basket<AddableBasketItem> {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 4_384_123_923_163_957L;
-
-       /**
-        * Default constructor to be able to throw exceptions from super constructor
-        */
-       public ShopBasket () {
-               // Call super constructor
-               super();
-       }
-}
diff --git a/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java b/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java
deleted file mode 100644 (file)
index 734fd85..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2016 KLC
- *
- * 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.jshopcore.model.basket.items;
-
-import java.util.Objects;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An item (addable to a basket) could represent a product or a discount coupon.
- * This depends on the type of the item.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public abstract class BaseItem implements AddableBasketItem {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 24_348_671_457_829_156L;
-
-       @Override
-       public boolean equals (final Object object) {
-               // Is it same type?
-               if (!(object instanceof BaseItem)) {
-                       // Not equal types
-                       return false;
-               } else if (!(object instanceof AddableBasketItem)) {
-                       // Not correct interface
-                       return false;
-               }
-
-               // Securely cast to wanted interface
-               AddableBasketItem item = (AddableBasketItem) object;
-
-               // Item id and type must be the same
-               return ((Objects.equals(item.getItemProduct().getProductId(), this.getItemProduct().getProductId())) &&
-                               (Objects.equals(item.getItemType(), this.getItemType())));
-       }
-
-       @Override
-       public int hashCode () {
-               int hash = 5;
-               hash = 29 * hash + Objects.hashCode(this.getItemProduct().getProductId());
-               hash = 29 * hash + Objects.hashCode(this.getItemType());
-               return hash;
-       }
-
-       @Override
-       public boolean isProductType () {
-               // Is the instance set?
-               return (this.getItemProduct() instanceof Product);
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java b/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java
deleted file mode 100644 (file)
index 6915615..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.basket.items;
-
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-import org.mxchange.jshopcore.model.product.GenericProduct;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * A general basket item
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Entity (name = "basket_items")
-@Table (name = "basket_items")
-@SuppressWarnings ("PersistenceUnitPresent")
-public class BasketItem extends BaseItem implements AddableBasketItem {
-
-       /**
-        * Serial number
-        */
-       @Transient
-       private static final long serialVersionUID = 52_749_158_492_581_578L;
-
-       /**
-        * Entry itemId (from database backend)
-        */
-       @Id
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       @Column (name = "item_id", nullable = false, updatable = false)
-       private Long itemId;
-
-       /**
-        * Product instance
-        */
-       @JoinColumn (name = "product_id", updatable = false)
-       @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.REFRESH)
-       private Product itemProduct;
-
-       /**
-        * Item type
-        */
-       @Basic (optional = false)
-       @Column (name = "item_type", nullable = false, length = 20)
-       private String itemType;
-
-       /**
-        * Item orderedAmount
-        */
-       @Basic (optional = false)
-       @Column (name = "ordered_amount", nullable = false, length = 20)
-       private Long orderedAmount;
-
-       /**
-        * Default constructor
-        */
-       public BasketItem () {
-       }
-
-       /**
-        * Constructor for an item from given Product instance
-        * <p>
-        * @param product Product instance
-        */
-       public BasketItem (final Product product) {
-               // Call default constructor
-               this();
-
-               // itemProduct must not be null
-               if (null == product) {
-                       // Abort here
-                       throw new NullPointerException("product is null"); //NOI18N
-               }
-
-               // Copy all neccessary values
-               this.itemType = "product"; //NOI18N
-
-               // Copy instance
-               this.itemProduct = product;
-       }
-
-       /**
-        * Constructor for an item from given Product instance and orderedAmount.
-        * <p>
-        * @param product Product instance
-        * @param amount Ordered orderedAmount
-        */
-       public BasketItem (final Product product, final Long amount) {
-               // Other constructor
-               this(product);
-
-               // orderedAmount must not be null
-               if (null == amount) {
-                       // Abort here
-                       throw new NullPointerException("amount is null"); //NOI18N
-               }
-
-               // Set orderedAmount
-               this.orderedAmount = amount;
-       }
-
-       @Override
-       public Long getItemId () {
-               return this.itemId;
-       }
-
-       @Override
-       public void setItemId (final Long itemId) {
-               this.itemId = itemId;
-       }
-
-       @Override
-       public Product getItemProduct () {
-               return this.itemProduct;
-       }
-
-       @Override
-       public void setItemProduct (final Product itemProduct) {
-               this.itemProduct = itemProduct;
-       }
-
-       @Override
-       public String getItemType () {
-               return this.itemType;
-       }
-
-       @Override
-       public void setItemType (final String itemType) {
-               this.itemType = itemType;
-       }
-
-       @Override
-       public Long getOrderedAmount () {
-               return this.orderedAmount;
-       }
-
-       @Override
-       public void setOrderedAmount (final Long orderedAmount) {
-               this.orderedAmount = orderedAmount;
-       }
-}
diff --git a/src/org/mxchange/jshopcore/model/category/Category.java b/src/org/mxchange/jshopcore/model/category/Category.java
deleted file mode 100644 (file)
index 65136b7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.category;
-
-import java.io.Serializable;
-
-/**
- * An interface for categories
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface Category extends Serializable {
-
-       /**
-        * Copies all properties from other category to this
-        * <p>
-        * @param category Source category instance
-        */
-       void copyAll (final Category category);
-
-       /**
-        * Id number of category
-        * <p>
-        * @return the id
-        */
-       Long getCategoryId ();
-
-       /**
-        * Id number of category
-        * <p>
-        * @param id the id to set
-        */
-       void setCategoryId (final Long id);
-
-       /**
-        * Parent category
-        * <p>
-        * @return the parent category
-        */
-       Category getParentCategory ();
-
-       /**
-        * Parent category
-        * <p>
-        * @param parentCategory the parent category to set
-        */
-       void setParentCategory (final Category parentCategory);
-
-       /**
-        * Title of category
-        * <p>
-        * @return the title
-        */
-       String getCategoryTitle ();
-
-       /**
-        * Title of category
-        * <p>
-        * @param title the title to set
-        */
-       void setCategoryTitle (final String title);
-
-       @Override
-       boolean equals (final Object object);
-
-       @Override
-       int hashCode ();
-
-}
diff --git a/src/org/mxchange/jshopcore/model/category/ProductCategory.java b/src/org/mxchange/jshopcore/model/category/ProductCategory.java
deleted file mode 100644 (file)
index 3549757..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.category;
-
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-/**
- * A product category
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Entity (name = "category")
-@Table (name = "category")
-@SuppressWarnings ("PersistenceUnitPresent")
-public class ProductCategory implements Category {
-
-       /**
-        * Serial number
-        */
-       @Transient
-       private static final long serialVersionUID = 21_458_945_712_659L;
-
-       /**
-        * Id number of category
-        */
-       @Id
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       @Column (name = "category_id", nullable = false)
-       private Long categoryId;
-
-       /**
-        * Title of category
-        */
-       @Basic (optional = false)
-       @Column (name = "category_title", length = 100, nullable = false, unique = true)
-       private String categoryTitle;
-
-       /**
-        * Parent category
-        */
-       @JoinColumn (name = "parent_id")
-       @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH)
-       private Category parentCategory;
-
-       /**
-        * Constructor which accepts all database fields
-        * <p>
-        * @param categoryId     Id number of database record
-        * @param categoryTitle  Category categoryTitle
-        * @param parentCategory Parent category
-        */
-       public ProductCategory (final Long categoryId, final String categoryTitle, final Category parentCategory) {
-               // Set all here
-               this.categoryId = categoryId;
-               this.categoryTitle = categoryTitle;
-               this.parentCategory = parentCategory;
-       }
-
-       /**
-        * Default constructor
-        */
-       public ProductCategory () {
-       }
-
-       @Override
-       public void copyAll (final Category category) {
-               // Copy all data
-               this.setParentCategory(category.getParentCategory());
-               this.setCategoryTitle(category.getCategoryTitle());
-       }
-
-       @Override
-       public boolean equals (final Object object) {
-               if (this == object) {
-                       return true;
-               } else if (null == object) {
-                       return false;
-               } else if (this.getClass() != object.getClass()) {
-                       return false;
-               }
-
-               final Category other = (Category) object;
-
-               if (!Objects.equals(this.getCategoryTitle(), other.getCategoryTitle())) {
-                       return false;
-               } else if (!Objects.equals(this.getCategoryId(), other.getCategoryId())) {
-                       return false;
-               }
-
-               return true;
-       }
-
-       @Override
-       public int hashCode () {
-               int hash = 7;
-               hash = 13 * hash + Objects.hashCode(this.getCategoryId());
-               hash = 13 * hash + Objects.hashCode(this.getCategoryTitle());
-               return hash;
-       }
-
-       @Override
-       public Long getCategoryId () {
-               return this.categoryId;
-       }
-
-       @Override
-       public void setCategoryId (final Long categoryId) {
-               this.categoryId = categoryId;
-       }
-
-       @Override
-       public String getCategoryTitle () {
-               return this.categoryTitle;
-       }
-
-       @Override
-       public void setCategoryTitle (final String categoryTitle) {
-               this.categoryTitle = categoryTitle;
-       }
-
-       @Override
-       public Category getParentCategory () {
-               return this.parentCategory;
-       }
-
-       @Override
-       public void setParentCategory (final Category parentCategory) {
-               this.parentCategory = parentCategory;
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java b/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java
deleted file mode 100644 (file)
index c68aa71..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.customer;
-
-import java.sql.SQLException;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityNotFoundException;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.codec.digest.Sha2Crypt;
-import org.mxchange.jcore.BaseFrameworkSystem;
-import org.mxchange.jcustomercore.model.customer.Customer;
-import org.mxchange.jshopcore.model.order.Orderable;
-import org.mxchange.jshopcore.model.order.ShopOrder;
-
-/**
- * An utilities class for customers
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class CustomerUtils extends BaseFrameworkSystem {
-
-       /**
-        * Generates an unique access key.
-        * <p>
-        * @param em Entity manager instance
-        * @param customer Customer instance
-        * <p>
-        * @return An unique access key
-        */
-       public static String generateAccessKey (final EntityManager em, final Customer customer) {
-               // Trace message
-               // TODO: utils.getLogger().logTrace(MessageFormat.format("generateAccessKey: connection={0} - CALLED!", connection));
-
-               // em cannot be null
-               if (null == em) {
-                       // Abort here
-                       throw new NullPointerException("em is null"); //NOI18N
-               } else if (!em.isOpen()) {
-                       // Not open
-                       throw new IllegalStateException("Entity manager is closed.");
-               }
-
-               // Generate fake order instance
-               Orderable orderable = null;
-
-               // Generate access keyy
-               String accessKey = null;
-
-               // Default is found
-               boolean isFound = true;
-
-               // Is the number used?
-               while (isFound) {
-                       // Both number parts
-                       String randString = String.format("%s:%s:%s", Long.toHexString(Math.round(Math.random() * 1_000_000)), em, customer.getCustomerNumber());
-
-                       // Generate access key, use SHA512 hashing and BASE64-encoding for strong key generation
-                       accessKey = Base64.encodeBase64String(Sha2Crypt.sha512Crypt(randString.getBytes()).getBytes()).substring(0, 100);
-
-                       // Try this
-                       try {
-                               // Get reference
-                               orderable = em.getReference(ShopOrder.class, accessKey);
-                       } catch (final EntityNotFoundException ex) {
-                               // Not found, so abort loop here
-                               isFound = false;
-                       }
-               }
-
-               // Trace message
-               // TODO: utils.getLogger().logTrace(MessageFormat.format("generateAccessKey: accessKey={0} - EXIT!", accessKey));
-               // Found one
-               return accessKey;
-       }
-
-       /**
-        * Generates an unique customer number by checking is existence
-        * <p>
-        * @param em Entity manager instance
-        * <p>
-        * @return Generated customer number (not used before)
-        * <p>
-        * @throws java.sql.SQLException If any SQL error occured
-        */
-       public static String generateCustomerNumber (final EntityManager em) throws SQLException {
-               // Trace message
-               // TODO: utils.getLogger().logTrace(MessageFormat.format("generateCustomerNumber: connection={0} - CALLED!", connection));
-
-               // em cannot be null
-               if (null == em) {
-                       // Abort here
-                       throw new NullPointerException("em is null"); //NOI18N
-               } else if (!em.isOpen()) {
-                       // Not open
-                       throw new IllegalStateException("Entity manager is closed.");
-               }
-
-               // Generate number
-               String customerNumber = null;
-
-               // Default is found
-               boolean isFound = true;
-
-               // Is the number used?
-               while (isFound) {
-                       // Both number parts
-                       long part1 = Math.round(Math.random() * 100_000);
-                       long part2 = Math.round(Math.random() * 1_000);
-
-                       // Generate new number
-                       customerNumber = String.format("%s-%s", part1, part2); //NOI18N
-
-                       // Try it
-                       try {
-                               // Get instance
-                               Customer customer = em.getReference(Customer.class, customerNumber);
-                       } catch (final EntityNotFoundException ex) {
-                               // Not found
-                               isFound = false;
-                       }
-               }
-
-               // Trace message
-               // TODO: utils.getLogger().logTrace(MessageFormat.format("generateCustomerNumber: customerNumber={0} - EXIT!", customerNumber));
-               // Found one
-               return customerNumber;
-       }
-
-       /**
-        * No instance from this class
-        */
-       private CustomerUtils () {
-       }
-}
diff --git a/src/org/mxchange/jshopcore/model/order/Orderable.java b/src/org/mxchange/jshopcore/model/order/Orderable.java
deleted file mode 100644 (file)
index 172642d..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.order;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import java.util.List;
-import org.mxchange.jcustomercore.model.customer.Customer;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-
-/**
- * An interface for customer orders
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface Orderable extends Serializable {
-
-       /**
-        * Getter for access key
-        * <p>
-        * @return Access key
-        */
-       String getAccessKey ();
-
-       /**
-        * Setter for access key
-        * <p>
-        * @param accessKey Access key
-        */
-       void setAccessKey (final String accessKey);
-
-       /**
-        * Getter for created timestamp
-        * <p>
-        * @return Created timestamp
-        */
-       Calendar getOrderCreated ();
-
-       /**
-        * Setter for created timestamp
-        * <p>
-        * @param created Created timestamp
-        */
-       void setOrderCreated (final Calendar created);
-
-       /**
-        * Getter for customer instance
-        * <p>
-        * @return Customer instance
-        */
-       Customer getCustomer ();
-
-       /**
-        * Setter for customer instance
-        * <p>
-        * @param customer Customer instance
-        */
-       void setCustomer (final Customer customer);
-
-       /**
-        * Getter for order id
-        * <p>
-        * @return Order id
-        */
-       Long getOrderId ();
-
-       /**
-        * Setter for order id
-        * <p>
-        * @param id Order id
-        */
-       void setOrderId (final Long id);
-
-       /**
-        * Getter for list of ordered basket items
-        * <p>
-        * @return List of items
-        */
-       List<AddableBasketItem> getOrderedItems ();
-
-       /**
-        * Setter for list of ordered basket items
-        * <p>
-        * @param orderedItems List of ordered items
-        */
-       void setOrderedItems (final List<AddableBasketItem> orderedItems);
-
-       @Override
-       boolean equals (final Object object);
-
-       @Override
-       int hashCode ();
-
-}
diff --git a/src/org/mxchange/jshopcore/model/order/ShopOrder.java b/src/org/mxchange/jshopcore/model/order/ShopOrder.java
deleted file mode 100644 (file)
index a11b733..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.order;
-
-import java.util.Calendar;
-import java.util.List;
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-import org.mxchange.jcustomercore.model.customer.Customer;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-
-/**
- * An entity class for shop orders
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Entity (name = "orders")
-@Table (name = "orders")
-@SuppressWarnings ("PersistenceUnitPresent")
-public class ShopOrder implements Orderable {
-
-       /**
-        * Serial number
-        */
-       @Transient
-       private static final long serialVersionUID = 19_728_938_459_834L;
-
-       /**
-        * Access key
-        */
-       @Basic (optional = false)
-       @Column (name = "access_key", length = 100, nullable = false, unique = true)
-       private String accessKey;
-
-       /**
-        * Customer instance
-        */
-       @JoinColumn (name = "customer_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = Customer.class, cascade = CascadeType.REFRESH, optional = false)
-       private Customer customer;
-
-       /**
-        * Created timestamp
-        */
-       @Basic (optional = false)
-       @Temporal (TemporalType.TIMESTAMP)
-       @Column (name = "order_created", nullable = false)
-       private Calendar orderCreated;
-
-       /**
-        * Order orderId
-        */
-       @Id
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       @Column (name = "order_id", length = 20)
-       private Long orderId;
-
-       /**
-        * Item list, don't save this
-        */
-       @Transient
-       private List<AddableBasketItem> orderedItems;
-
-       @Override
-       public boolean equals (final Object object) {
-               if (this == object) {
-                       return true;
-               } else if (null == object) {
-                       return false;
-               } else if (this.getClass() != object.getClass()) {
-                       return false;
-               }
-
-               final Orderable other = (Orderable) object;
-
-               if (!Objects.equals(this.getAccessKey(), other.getAccessKey())) {
-                       return false;
-               } else if (!Objects.equals(this.getCustomer(), other.getCustomer())) {
-                       return false;
-               } else if (!Objects.equals(this.getOrderId(), other.getOrderId())) {
-                       return false;
-               } else if (!Objects.equals(this.getOrderedItems(), other.getOrderedItems())) {
-                       return false;
-               }
-
-               return true;
-       }
-
-       @Override
-       public int hashCode () {
-               int hash = 7;
-               hash = 61 * hash + Objects.hashCode(this.getAccessKey());
-               hash = 61 * hash + Objects.hashCode(this.getCustomer());
-               hash = 61 * hash + Objects.hashCode(this.getOrderId());
-               hash = 61 * hash + Objects.hashCode(this.getOrderedItems());
-               return hash;
-       }
-
-       @Override
-       public String getAccessKey () {
-               return this.accessKey;
-       }
-
-       @Override
-       public void setAccessKey (final String accessKey) {
-               this.accessKey = accessKey;
-       }
-
-       @Override
-       public Customer getCustomer () {
-               return this.customer;
-       }
-
-       @Override
-       public void setCustomer (final Customer customer) {
-               this.customer = customer;
-       }
-
-       @Override
-       public Calendar getOrderCreated () {
-               return this.orderCreated;
-       }
-
-       @Override
-       public void setOrderCreated (final Calendar orderCreated) {
-               this.orderCreated = orderCreated;
-       }
-
-       @Override
-       public Long getOrderId () {
-               return this.orderId;
-       }
-
-       @Override
-       public void setOrderId (final Long orderId) {
-               this.orderId = orderId;
-       }
-
-       @Override
-       public List<AddableBasketItem> getOrderedItems () {
-               return this.orderedItems;
-       }
-
-       @Override
-       public void setOrderedItems (final List<AddableBasketItem> orderedItems) {
-               this.orderedItems = orderedItems;
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/model/order/items/OrderItem.java b/src/org/mxchange/jshopcore/model/order/items/OrderItem.java
deleted file mode 100644 (file)
index 4e79768..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.order.items;
-
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-import org.mxchange.jshopcore.model.basket.items.BaseItem;
-import org.mxchange.jshopcore.model.product.GenericProduct;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * A general basket item
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Entity (name = "ordered_item")
-@Table (
-               name = "ordered_items",
-               indexes = {
-                       @Index (name = "product", columnList = "order_product_id")
-               }
-)
-@SuppressWarnings ("PersistenceUnitPresent")
-public class OrderItem extends BaseItem implements AddableBasketItem {
-
-       /**
-        * Serial number
-        */
-       @Transient
-       private static final long serialVersionUID = 44_189_562_738_723_581L;
-
-       /**
-        * Entry id (from database backend)
-        */
-       @Id
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       @Column (name = "order_id", nullable = false, length = 20)
-       private Long itemId;
-
-       /**
-        * Item type
-        */
-       @Basic (optional = false)
-       @Column (name = "order_item_type", length = 20)
-       private String itemType;
-
-       /**
-        * Item amount
-        */
-       @Basic (optional = false)
-       @Column (name = "order_amount", nullable = false)
-       private Long orderedAmount;
-
-       /**
-        * Product instance
-        */
-       @JoinColumn (name = "order_product_id", updatable = false)
-       @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.REFRESH)
-       private Product product;
-
-       /**
-        * Default constructor
-        */
-       public OrderItem () {
-       }
-
-       @Override
-       public boolean equals (final Object object) {
-               if (this == object) {
-                       return true;
-               } else if (null == object) {
-                       return false;
-               } else if (this.getClass() != object.getClass()) {
-                       return false;
-               }
-
-               final AddableBasketItem item = (AddableBasketItem) object;
-
-               if (!Objects.equals(this.itemType, item.getItemType())) {
-                       return false;
-               } else if (!Objects.equals(this.orderedAmount, item.getOrderedAmount())) {
-                       return false;
-               }
-
-               return Objects.equals(this.product, item.getItemProduct());
-       }
-
-       @Override
-       public int hashCode () {
-               int hash = 3;
-               hash = 53 * hash + Objects.hashCode(this.getItemType());
-               hash = 53 * hash + Objects.hashCode(this.getOrderedAmount());
-               hash = 53 * hash + Objects.hashCode(this.getItemProduct());
-               return hash;
-       }
-
-       @Override
-       public Long getItemId () {
-               return this.itemId;
-       }
-
-       @Override
-       public void setItemId (final Long itemId) {
-               this.itemId = itemId;
-       }
-
-       @Override
-       public Product getItemProduct () {
-               return this.product;
-       }
-
-       @Override
-       public void setItemProduct (final Product product) {
-               this.product = product;
-       }
-
-       @Override
-       public String getItemType () {
-               return this.itemType;
-       }
-
-       @Override
-       public void setItemType (final String itemType) {
-               this.itemType = itemType;
-       }
-
-       @Override
-       public Long getOrderedAmount () {
-               return this.orderedAmount;
-       }
-
-       @Override
-       public void setOrderedAmount (final Long orderedAmount) {
-               this.orderedAmount = orderedAmount;
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/model/payment/PaymentType.java b/src/org/mxchange/jshopcore/model/payment/PaymentType.java
deleted file mode 100644 (file)
index 55c46bd..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2017 Roland Haeder<roland@mxchange.org>
- *
- * 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.jshopcore.model.payment;
-
-/**
- * Payment types
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public enum PaymentType {
-
-       /**
-        * Payment type "cash"
-        */
-       PAYMENT_TYPE_CASH,
-       /**
-        * Payment type "credit card"
-        */
-       PAYMENT_TYPE_CREDIT_CARD,
-       /**
-        * Payment type "prepayment"
-        */
-       PAYMENT_TYPE_PREPAYMENT,
-       /**
-        * Payment type "invoice"
-        */
-       PAYMENT_TYPE_INVOICE;
-
-}
diff --git a/src/org/mxchange/jshopcore/model/product/GenericProduct.java b/src/org/mxchange/jshopcore/model/product/GenericProduct.java
deleted file mode 100644 (file)
index febde61..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.product;
-
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.category.ProductCategory;
-
-/**
- * Generic product class
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- * TODO: Find a better name
- */
-@Entity (name = "products")
-@Table (name = "products")
-@SuppressWarnings ("PersistenceUnitPresent")
-public class GenericProduct implements Product {
-
-       /**
-        * Serial number
-        */
-       @Transient
-       private static final long serialVersionUID = 54_578_571_769_283L;
-
-       /**
-        * Availability of product
-        */
-       @Column (name = "product_availability", nullable = false)
-       private Boolean productAvailability;
-
-       /**
-        * Product productCategory
-        */
-       @JoinColumn (name = "category_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH, optional = false)
-       private Category productCategory;
-
-       /**
-        * Id number of product
-        */
-       @Id
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       @Column (name = "product_id", nullable = false, updatable = false)
-       private Long productId;
-
-       /**
-        * Price of product
-        */
-       @Basic (optional = false)
-       @Column (name = "product_price", nullable = false)
-       private Float productPrice;
-
-       /**
-        * Title of product
-        */
-       @Basic (optional = false)
-       @Column (name = "product_title", length = 100, nullable = false)
-       private String productTitle;
-
-       /**
-        * Default constructor
-        */
-       public GenericProduct () {
-       }
-
-       /**
-        * Constructor will all required data
-        * <p>
-        * @param productId           Id number of product
-        * @param productTitle        Name of product
-        * @param productPrice        Price
-        * @param productCategory     Category instance
-        * @param productAvailability Availability (selectable by customer)
-        */
-       public GenericProduct (final Long productId, final String productTitle, final Float productPrice, final Category productCategory, final Boolean productAvailability) {
-               // Set all here
-               this.productId = productId;
-               this.productTitle = productTitle;
-               this.productPrice = productPrice;
-               this.productCategory = productCategory;
-               this.productAvailability = productAvailability;
-       }
-
-       @Override
-       public void copyAll (final Product product) {
-               // Copy all
-               this.setProductAvailability(product.getProductAvailability());
-               this.setProductCategory(product.getProductCategory());
-               this.setProductPrice(product.getProductPrice());
-               this.setProductTitle(product.getProductTitle());
-       }
-
-       @Override
-       public boolean equals (final Object object) {
-               if (this == object) {
-                       return true;
-               } else if (null == object) {
-                       return false;
-               } else if (this.getClass() != object.getClass()) {
-                       return false;
-               }
-
-               final Product other = (Product) object;
-
-               if (!Objects.equals(this.getProductTitle(), other.getProductTitle())) {
-                       return false;
-               }
-
-               return Objects.equals(this.getProductId(), other.getProductId());
-       }
-
-       @Override
-       public int hashCode () {
-               int hash = 7;
-               hash = 23 * hash + Objects.hashCode(this.getProductId());
-               hash = 23 * hash + Objects.hashCode(this.getProductTitle());
-               return hash;
-       }
-
-       @Override
-       public Boolean getProductAvailability () {
-               return this.productAvailability;
-       }
-
-       @Override
-       public void setProductAvailability (final Boolean productAvailability) {
-               this.productAvailability = productAvailability;
-       }
-
-       @Override
-       public Category getProductCategory () {
-               return this.productCategory;
-       }
-
-       @Override
-       public void setProductCategory (final Category productCategory) {
-               this.productCategory = productCategory;
-       }
-
-       @Override
-       public Long getProductId () {
-               return this.productId;
-       }
-
-       @Override
-       public void setProductId (final Long productId) {
-               this.productId = productId;
-       }
-
-       @Override
-       public Float getProductPrice () {
-               return this.productPrice;
-       }
-
-       @Override
-       public void setProductPrice (final Float productPrice) {
-               this.productPrice = productPrice;
-       }
-
-       @Override
-       public String getProductTitle () {
-               return this.productTitle;
-       }
-
-       @Override
-       public void setProductTitle (final String productTitle) {
-               this.productTitle = productTitle;
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/model/product/Product.java b/src/org/mxchange/jshopcore/model/product/Product.java
deleted file mode 100644 (file)
index 0347f33..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.model.product;
-
-import java.io.Serializable;
-import org.mxchange.jshopcore.model.category.Category;
-
-/**
- * An interface for in database storable products
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface Product extends Serializable {
-
-       /**
-        * Copies all properties from source product to this.
-        * <p>
-        * @param product Source product
-        */
-       void copyAll (final Product product);
-
-       /**
-        * Getter for product availability
-        * <p>
-        * @return Product availability
-        */
-       Boolean getProductAvailability ();
-
-       /**
-        * Setter for product availability
-        * <p>
-        * @param productAvailability Product availability
-        */
-       void setProductAvailability (final Boolean productAvailability);
-
-       /**
-        * Getter for product category id
-        * <p>
-        * @return Product category id
-        */
-       Category getProductCategory ();
-
-       /**
-        * Setter for product category
-        * <p>
-        * @param productCategory Product category
-        */
-       void setProductCategory (final Category productCategory);
-
-       /**
-        * Getter for id number, suitable for form fields.
-        * <p>
-        * @return Id number of product
-        */
-       Long getProductId ();
-
-       /**
-        * Id number of product
-        * <p>
-        * @param productId the id number to set
-        */
-       void setProductId (final Long productId);
-
-       /**
-        * Getter for raw price.
-        * <p>
-        * @return Single price of product
-        */
-       Float getProductPrice ();
-
-       /**
-        * Price of product
-        * <p>
-        * @param productPrice the price to set
-        */
-       void setProductPrice (final Float productPrice);
-
-       /**
-        * Getter for title.
-        * <p>
-        * @return Title of product
-        */
-       String getProductTitle ();
-
-       /**
-        * Title of product
-        * <p>
-        * @param productTitle the title to set
-        */
-       void setProductTitle (final String productTitle);
-
-       @Override
-       boolean equals (final Object object);
-
-       @Override
-       int hashCode ();
-
-}
diff --git a/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java
deleted file mode 100644 (file)
index 8dd12b4..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.wrapper;
-
-import java.util.List;
-import org.mxchange.jcustomercore.model.customer.Customer;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-
-/**
- * A wrapper for checkouts (customer, ordered items)
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class CheckoutWrapper implements WrapableCheckout {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 94_358_758_475_481_781L;
-
-       /**
-        * Customer instance
-        */
-       private Customer customer;
-
-       /**
-        * List instance
-        */
-       private List<AddableBasketItem> list;
-
-       /**
-        * Default constructor
-        */
-       public CheckoutWrapper () {
-       }
-
-       @Override
-       public Customer getCustomer () {
-               return this.customer;
-       }
-
-       @Override
-       public void setCustomer (final Customer customer) {
-               this.customer = customer;
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<AddableBasketItem> getList () {
-               return this.list;
-       }
-
-       @Override
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setList (final List<AddableBasketItem> list) {
-               this.list = list;
-       }
-
-}
diff --git a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java
deleted file mode 100644 (file)
index cd69138..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * 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.jshopcore.wrapper;
-
-import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcustomercore.model.customer.Customer;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-
-/**
- * An interface for checkout wrapper
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface WrapableCheckout extends Serializable {
-
-       /**
-        * Getter for customer instance
-        * <p>
-        * @return Customer indstance
-        */
-       Customer getCustomer ();
-
-       /**
-        * Setter for customer instance
-        * <p>
-        * @param customer Customer instance
-        */
-       void setCustomer (final Customer customer);
-
-       /**
-        * Getter for a List of AddableBasktem instances
-        * <p>
-        * @return List with AddableBasketItem instances
-        */
-       List<AddableBasketItem> getList ();
-
-       /**
-        * Setter for a List of AddableBasktem instances
-        * <p>
-        * @param list List with AddableBasketItem instances
-        */
-       void setList (final List<AddableBasketItem> list);
-}