]> git.mxchange.org Git - jproduct-core.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Thu, 24 Sep 2015 13:11:09 +0000 (15:11 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 24 Sep 2015 13:11:09 +0000 (15:11 +0200)
- auto-reformatted many files
- got rid of some superflous classes
- updated jar
Signed-off-by:Roland Häder <roland@mxchange.org>

29 files changed:
lib/jcore.jar
lib/jcoreee.jar
src/org/mxchange/jcore/model/contact/CustomerContact.java [deleted file]
src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java
src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java
src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java
src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java
src/org/mxchange/jshopcore/exceptions/CustomerAlreadyRegisteredException.java
src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java
src/org/mxchange/jshopcore/exceptions/QueryNotExecutedException.java [deleted file]
src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java
src/org/mxchange/jshopcore/model/basket/BaseBasket.java
src/org/mxchange/jshopcore/model/basket/Basket.java
src/org/mxchange/jshopcore/model/basket/ShopBasket.java
src/org/mxchange/jshopcore/model/basket/items/BaseItem.java
src/org/mxchange/jshopcore/model/basket/items/BasketItem.java
src/org/mxchange/jshopcore/model/category/BaseCategory.java [deleted file]
src/org/mxchange/jshopcore/model/category/Category.java
src/org/mxchange/jshopcore/model/category/ProductCategory.java
src/org/mxchange/jshopcore/model/customer/Customer.java
src/org/mxchange/jshopcore/model/customer/ShopCustomer.java
src/org/mxchange/jshopcore/model/order/Orderable.java
src/org/mxchange/jshopcore/model/order/ShopOrder.java
src/org/mxchange/jshopcore/model/order/items/OrderItem.java
src/org/mxchange/jshopcore/model/product/BaseProduct.java [deleted file]
src/org/mxchange/jshopcore/model/product/GenericProduct.java
src/org/mxchange/jshopcore/model/product/Product.java
src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java
src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java

index 57dc0a07e9ad739e6f82121851bb5ecdf7291de2..c0bdbee1e02a1d6bf6ef6af3c07a3bd7c43e06fe 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index 884b0d96ea6bf9165d0544762c053be8168aa340..d550fe018c1a514bef85d93ba1e622042048b6e6 100644 (file)
Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ
diff --git a/src/org/mxchange/jcore/model/contact/CustomerContact.java b/src/org/mxchange/jcore/model/contact/CustomerContact.java
deleted file mode 100644 (file)
index 8f02c12..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcore.model.contact;
-
-/**
- * Customer contact class
- *
- * @author Roland Haeder
- */
-public class CustomerContact extends BaseContact {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 47_895_786_328_781L;
-}
index ca4cbeb1847869d9a92ce05e8a9e043000f5f83b..053d7fbe620f39f03c1b1369d9b0780644abca3f 100644 (file)
@@ -20,11 +20,13 @@ import java.text.MessageFormat;
 import org.mxchange.jshopcore.model.basket.AddableBasketItem;
 
 /**
- * An exception thrown when the given item is already added to the basketController.
+ * An exception thrown when the given item is already added to the
+ * basketController.
  *
  * @author Roland Haeder
  */
 public class BasketItemAlreadyAddedException extends Exception {
+
        /**
         * Serial number
         */
@@ -36,7 +38,7 @@ public class BasketItemAlreadyAddedException extends Exception {
         * @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) {
+       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));
        }
index 1322005551c99050ecc1f19a8d2bb49e4db72383..45247a45e258faab275cc77dcdc48949d46d5606 100644 (file)
@@ -23,6 +23,7 @@ package org.mxchange.jshopcore.exceptions;
  * @author Roland Haeder
  */
 public class CannotAddCategoryException extends Exception {
+
        /**
         * Serial number
         */
index feef839fe02de5f82f2ad8876e8f25c8e0182bfc..7dd1acc1768fbb1164533a219464620571bc8a5c 100644 (file)
@@ -23,6 +23,7 @@ package org.mxchange.jshopcore.exceptions;
  * @author Roland Haeder
  */
 public class CannotAddProductException extends Exception {
+
        /**
         * Serial number
         */
index 1718f0102dd2474528940cb68375d43dba101eb9..e9a1230beb347b7b27b37f56b26702fdf18cf99a 100644 (file)
@@ -21,10 +21,11 @@ import org.mxchange.jshopcore.model.category.Category;
 
 /**
  * An exception thrown when the given title is already used
- * 
+ *
  * @author Roland Haeder<roland@mxchange.org>
  */
 public class CategoryTitleAlreadyUsedException extends Exception {
+
        /**
         * Serial number
         */
index eb93d4912c7f386fd018bc9b892b68f1e23b9304..f095b5bb916b556faf2f0bc7e259b1bcdaf5b2d8 100644 (file)
@@ -25,6 +25,7 @@ import org.mxchange.jshopcore.model.customer.Customer;
  * @author Roland Haeder
  */
 public class CustomerAlreadyRegisteredException extends Exception {
+
        /**
         * Serial number
         */
index dffa4b706cd34570e1c24aaf5191d0b1e11fd90e..278e6811e37f6aa875be8c0d0f8a3a3f3b8afefb 100644 (file)
@@ -21,10 +21,11 @@ import org.mxchange.jshopcore.model.product.Product;
 
 /**
  * An exception thrown when the given title is already used
- * 
+ *
  * @author Roland Haeder<roland@mxchange.org>
  */
 public class ProductTitleAlreadyUsedException extends Exception {
+
        /**
         * Serial number
         */
diff --git a/src/org/mxchange/jshopcore/exceptions/QueryNotExecutedException.java b/src/org/mxchange/jshopcore/exceptions/QueryNotExecutedException.java
deleted file mode 100644 (file)
index a92211e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore.exceptions;
-
-import java.sql.SQLWarning;
-import java.text.MessageFormat;
-
-/**
- * This exception is thrown when a query could not be executed
- *
- * @author Roland Haeder
- * @deprecated No longer used
- */
-@Deprecated
-public class QueryNotExecutedException extends Exception {
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 97_548_375_847_581L;
-
-       /**
-        * Prepares exception with given sql warnings
-        *
-        * @param warnings SQL warnings
-        */
-       public QueryNotExecutedException (final SQLWarning warnings) {
-               // Call super contructor
-               super(MessageFormat.format("SQL statement did not execute: {0} with state: {1}", warnings.getMessage(), warnings.getSQLState()), warnings.getCause());
-       }
-}
index 1c299784f131d9ab1f36034da176d041555e0ca0..4257d1792e9be398a1d7905b35dc37c464ca10ac 100644 (file)
@@ -26,6 +26,14 @@ import org.mxchange.jshopcore.model.product.Product;
  */
 public interface AddableBasketItem extends Serializable {
 
+       /**
+        * Check equality on item instance
+        *
+        * @param object Other object to check
+        */
+       @Override
+       public boolean equals (final Object object);
+
        /**
         * Getter for item amount
         *
@@ -45,28 +53,14 @@ public interface AddableBasketItem extends Serializable {
         *
         * @return the id
         */
-       public Long getId ();
+       public Long getItemId ();
 
        /**
         * Setter for entry id (from database backend)
         *
         * @param id the id to set
         */
-       public void setId (final Long id);
-
-       /**
-        * Getter for product id
-        *
-        * @return Product id
-        */
-       public Long getProductId ();
-
-       /**
-        * Setter for product id
-        *
-        * @param productId Product id
-        */
-       public void setProductId (final Long productId);
+       public void setItemId (final Long id);
 
        /**
         * Getter for item type
@@ -97,23 +91,15 @@ public interface AddableBasketItem extends Serializable {
        public void setProduct (final Product product);
 
        /**
-        * Determines whether the item has a Product instance set
-        *
-        * @return Whether a Product instance is set
-        */
-       public boolean isProductType ();
-
-       /**
-        * Check equality on item instance
-        *
-        * @param object Other object to check
+        * Hash-code calculattion
         */
        @Override
-       public boolean equals (final Object object);
+       public int hashCode ();
 
        /**
-        * Hash-code calculattion
+        * Determines whether the item has a Product instance set
+        *
+        * @return Whether a Product instance is set
         */
-       @Override
-       public int hashCode ();
+       public boolean isProductType ();
 }
index bf476b98744f2d6defe599ac87e3d0b45d83b8d7..4d8e7c4480073f3463e808a0f1dd9ab2c9e8b053 100644 (file)
@@ -29,6 +29,7 @@ import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
  * @param <T> Any instance that implements AddableBasketItem
  */
 public abstract class BaseBasket<T extends AddableBasketItem> implements Basket<T> {
+
        /**
         * Serial number
         */
@@ -63,9 +64,9 @@ public abstract class BaseBasket<T extends AddableBasketItem> implements Basket<
        }
 
        @Override
-       public boolean isEmpty () {
-               // Deligate call to frontend
-               return this.deque.isEmpty();
+       public void clear () {
+               // Deligate to deque
+               this.deque.clear();
        }
 
        @Override
@@ -132,8 +133,8 @@ public abstract class BaseBasket<T extends AddableBasketItem> implements Basket<
        }
 
        @Override
-       public void clear () {
-               // Deligate to deque
-               this.deque.clear();
+       public boolean isEmpty () {
+               // Deligate call to frontend
+               return this.deque.isEmpty();
        }
 }
index ea7e899778a5e361eb4839877e56d9ee8ea6cbc1..1a9dabec835c2e6e1e8cec6bd1bf967d7125af1f 100644 (file)
@@ -30,9 +30,10 @@ public interface Basket<T extends AddableBasketItem> extends Serializable {
 
        /**
         * Adds given item instance to this basket
-        * 
+        *
         * @param item Item instance to add
-        * @throws org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException If the item instance has already been added
+        * @throws org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException
+        * If the item instance has already been added
         */
        public void addItem (final T item) throws BasketItemAlreadyAddedException;
 
@@ -41,22 +42,6 @@ public interface Basket<T extends AddableBasketItem> extends Serializable {
         */
        public void clear ();
 
-       /**
-        * Checks whether the given item has already been added by checking the
-        * item's id.
-        *
-        * @param item Item instance to check
-        * @return Whether the given item has been found
-        */
-       public boolean isAdded (final T item);
-
-       /**
-        * Checks if the basket is empty
-        *
-        * @return Whether the basket is empty
-        */
-       public boolean isEmpty ();
-
        /**
         * Some "getter" for all entries in this basket
         *
@@ -73,8 +58,24 @@ public interface Basket<T extends AddableBasketItem> extends Serializable {
 
        /**
         * Getter for last num rows
-        * 
+        *
         * @return Last num rows
         */
        public int getLastNumRows ();
+
+       /**
+        * Checks whether the given item has already been added by checking the
+        * item's id.
+        *
+        * @param item Item instance to check
+        * @return Whether the given item has been found
+        */
+       public boolean isAdded (final T item);
+
+       /**
+        * Checks if the basket is empty
+        *
+        * @return Whether the basket is empty
+        */
+       public boolean isEmpty ();
 }
index c24221b063363e9bfe33474f794c9038cdbff5d7..635f55cc4aba697baab3b95a4d577ce4621aa127 100644 (file)
@@ -22,6 +22,7 @@ package org.mxchange.jshopcore.model.basket;
  * @author Roland Haeder<roland@mxchange.org>
  */
 public class ShopBasket extends BaseBasket<AddableBasketItem> implements Basket<AddableBasketItem> {
+
        /**
         * Serial number
         */
index de2f2c01d1c6e9cc7730f67134581da12bf3bcd3..d0e790144df5ce34385a4266353d3bfe88589d74 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Roland Haeder
+ * Copyright (C) 2015 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
 package org.mxchange.jshopcore.model.basket.items;
 
 import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Transient;
 import org.mxchange.jshopcore.model.basket.AddableBasketItem;
 import org.mxchange.jshopcore.model.product.Product;
 
@@ -32,7 +26,6 @@ import org.mxchange.jshopcore.model.product.Product;
  *
  * @author Roland Haeder<roland@mxchange.org>
  */
-@Entity(name = "item")
 public abstract class BaseItem implements AddableBasketItem, Comparable<AddableBasketItem> {
 
        /**
@@ -40,38 +33,6 @@ public abstract class BaseItem implements AddableBasketItem, Comparable<AddableB
         */
        private static final long serialVersionUID = 24_348_671_457_829_156L;
 
-       /**
-        * Entry id (from database backend)
-        */
-       @Id
-       @GeneratedValue
-       private Long id;
-
-       /**
-        * Item amount
-        */
-       @Basic(optional = false)
-       private Long amount;
-
-       /**
-        * Product id
-        */
-       @Column(name = "product_id", length = 20)
-       private Long productId;
-
-       /**
-        * Item type
-        */
-       @Basic(optional = false)
-       @Column(name = "item_type", length = 20)
-       private String itemType;
-
-       /**
-        * Product instance
-        */
-       @Transient
-       private Product product;
-
        @Override
        public int compareTo (final AddableBasketItem item) {
                // item should not be null
@@ -80,10 +41,10 @@ public abstract class BaseItem implements AddableBasketItem, Comparable<AddableB
                }
 
                // Is the id the same?
-               if (Objects.equals(this.getProductId(), item.getProductId())) {
+               if (Objects.equals(this.getProduct(), item.getProduct())) {
                        // Same id, means same item
                        return 0;
-               } else if (this.getProductId() > item.getProductId()) {
+               } else if (this.getProduct().getId() > item.getProduct().getId()) {
                        // This id is larger than compared to
                        return -1;
                }
@@ -92,56 +53,6 @@ public abstract class BaseItem implements AddableBasketItem, Comparable<AddableB
                return 1;
        }
 
-       @Override
-       public Long getAmount () {
-               return this.amount;
-       }
-
-       @Override
-       public void setAmount (final Long amount) {
-               this.amount = amount;
-       }
-
-       @Override
-       public Long getId () {
-               return this.id;
-       }
-
-       @Override
-       public void setId (final Long id) {
-               this.id = id;
-       }
-
-       @Override
-       public Long getProductId () {
-               return this.productId;
-       }
-
-       @Override
-       public void setProductId (final Long productId) {
-               this.productId = productId;
-       }
-
-       @Override
-       public String getItemType () {
-               return this.itemType;
-       }
-
-       @Override
-       public void setItemType (final String itemType) {
-               this.itemType = itemType;
-       }
-
-       @Override
-       public Product getProduct () {
-               return this.product;
-       }
-
-       @Override
-       public void setProduct (final Product product) {
-               this.product = product;
-       }
-
        @Override
        public boolean equals (final Object object) {
                // Is it same type?
@@ -157,14 +68,14 @@ public abstract class BaseItem implements AddableBasketItem, Comparable<AddableB
                AddableBasketItem item = (AddableBasketItem) object;
 
                // Item id and type must be the same
-               return ((Objects.equals(item.getProductId(), this.getProductId()))
+               return ((Objects.equals(item.getProduct().getId(), this.getProduct().getId()))
                                && (Objects.equals(item.getItemType(), this.getItemType())));
        }
 
        @Override
        public int hashCode () {
                int hash = 5;
-               hash = 29 * hash + Objects.hashCode(this.getProductId());
+               hash = 29 * hash + Objects.hashCode(this.getProduct().getId());
                hash = 29 * hash + Objects.hashCode(this.getItemType());
                return hash;
        }
index 1ff3aea6b8f42ad78869a4d3489c3be2115743f8..d6cf05c775a6ff9ae3f18108370303aec7d7c685 100644 (file)
  */
 package org.mxchange.jshopcore.model.basket.items;
 
+import javax.persistence.Basic;
+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 org.mxchange.jshopcore.model.basket.AddableBasketItem;
+import org.mxchange.jshopcore.model.product.GenericProduct;
 import org.mxchange.jshopcore.model.product.Product;
 
 /**
@@ -24,12 +34,44 @@ import org.mxchange.jshopcore.model.product.Product;
  *
  * @author Roland Haeder<roland@mxchange.org>
  */
+@Entity (name = "basket_items")
+@Table (name = "basket_items")
 public class BasketItem extends BaseItem implements AddableBasketItem {
+
        /**
         * Serial number
         */
        private static final long serialVersionUID = 52_749_158_492_581_578L;
 
+       /**
+        * Item amount
+        */
+       @Basic (optional = false)
+       @Column (name = "amount", nullable = false, length = 20)
+       private Long amount;
+
+       /**
+        * Entry itemId (from database backend)
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "item_id", nullable = false, updatable = false)
+       private Long itemId;
+
+       /**
+        * Item type
+        */
+       @Basic (optional = false)
+       @Column (name = "item_type", nullable = false, length = 20)
+       private String itemType;
+
+       /**
+        * Product instance
+        */
+       @JoinColumn (name = "product_id", updatable = false)
+       @OneToOne (targetEntity = GenericProduct.class)
+       private Product product;
+
        /**
         * Default constructor
         */
@@ -38,7 +80,7 @@ public class BasketItem extends BaseItem implements AddableBasketItem {
 
        /**
         * Constructor for an item from given Product instance
-        * 
+        *
         * @param product Product instance
         */
        public BasketItem (final Product product) {
@@ -52,16 +94,15 @@ public class BasketItem extends BaseItem implements AddableBasketItem {
                }
 
                // Copy all neccessary values
-               this.setProductId(product.getId());
-               this.setItemType("product"); //NOI18N
+               this.itemType = "product"; //NOI18N
 
                // Copy instance
-               this.setProduct(product);
+               this.product = product;
        }
 
        /**
         * Constructor for an item from given Product instance and amount.
-        * 
+        *
         * @param product Product instance
         * @param amount Ordered amount
         */
@@ -76,6 +117,46 @@ public class BasketItem extends BaseItem implements AddableBasketItem {
                }
 
                // Set amount
-               this.setAmount(amount);
+               this.amount = amount;
+       }
+
+       @Override
+       public Long getAmount () {
+               return this.amount;
+       }
+
+       @Override
+       public void setAmount (final Long amount) {
+               this.amount = amount;
+       }
+
+       @Override
+       public Long getItemId () {
+               return this.itemId;
+       }
+
+       @Override
+       public void setItemId (final Long itemId) {
+               this.itemId = itemId;
+       }
+
+       @Override
+       public String getItemType () {
+               return this.itemType;
+       }
+
+       @Override
+       public void setItemType (final String itemType) {
+               this.itemType = itemType;
+       }
+
+       @Override
+       public Product getProduct () {
+               return this.product;
+       }
+
+       @Override
+       public void setProduct (final Product product) {
+               this.product = product;
        }
 }
diff --git a/src/org/mxchange/jshopcore/model/category/BaseCategory.java b/src/org/mxchange/jshopcore/model/category/BaseCategory.java
deleted file mode 100644 (file)
index 6b2e824..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore.model.category;
-
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- * A general product category class
- *
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Entity(name = "category")
-@Table(name = "category")
-public abstract class BaseCategory implements Category, Comparable<Category> {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 38_472_937_685_901L;
-
-       /**
-        * Id number of category
-        */
-       @Id
-       @GeneratedValue
-       @Column
-       private Long id;
-
-       /**
-        * Parent category id
-        */
-       @Column(name = "parent_id", length = 20)
-       private Long parentId;
-
-       /**
-        * Title of category
-        */
-       @Basic(optional = false)
-       @Column(length = 100, nullable = false, unique = true)
-       private String title;
-
-       /**
-        * Constructor which accepts all database fields
-        *
-        * @param id Id number of database record
-        * @param title Category title
-        * @param parentId Parent id
-        */
-       protected BaseCategory (final Long id, final String title, final Long parentId) {
-               // Set all here
-               this.id = id;
-               this.title = title;
-               this.parentId = parentId;
-       }
-
-       /**
-        * Default constructor
-        */
-       protected BaseCategory () {
-       }
-
-       /**
-        * Compares two categories with each other
-        *
-        * @param category Category comparator
-        * @return Comparison value
-        */
-       @Override
-       public int compareTo (final Category category) {
-               // category should not be null
-               if (null == category) {
-                       throw new NullPointerException("category is null"); //NOI18N
-               }
-
-               // Is the id the same?
-               if (Objects.equals(this.getId(), category.getId())) {
-                       // Same id, means same category
-                       return 0;
-               } else if (this.getId() > category.getId()) {
-                       // This id is larger than compared to
-                       return -1;
-               }
-
-               // The other id is larger
-               return 1;
-       }
-
-       @Override
-       public void copyAll (final Category category) {
-               // Copy all data
-               this.setParentId(category.getParentId());
-               this.setTitle(category.getTitle());
-       }
-
-       /**
-        * Id number of category
-        *
-        * @return the id
-        */
-       @Override
-       public Long getId () {
-               return this.id;
-       }
-
-       /**
-        * Id number of category
-        *
-        * @param id the id to set
-        */
-       @Override
-       public void setId (final Long id) {
-               this.id = id;
-       }
-
-       /**
-        * Parent category id
-        *
-        * @return the parentId
-        */
-       @Override
-       public Long getParentId () {
-               return this.parentId;
-       }
-
-       /**
-        * Parent category id
-        *
-        * @param parentId the parentId to set
-        */
-       @Override
-       public void setParentId (final Long parentId) {
-               this.parentId = parentId;
-       }
-
-       /**
-        * Title of category
-        *
-        * @return the title
-        */
-       @Override
-       public String getTitle () {
-               return this.title;
-       }
-
-       /**
-        * Title of category
-        *
-        * @param title the title to set
-        */
-       @Override
-       public void setTitle (final String title) {
-               this.title = title;
-       }
-}
index 5f871c657284d95973c00b33c81e290fe68b2282..c20acbc54c9e657e4ae9d5c1cd8daf6118335925 100644 (file)
@@ -34,36 +34,42 @@ public interface Category extends Serializable {
 
        /**
         * Id number of category
+        *
         * @return the id
         */
-       public Long getId ();
+       public Long getCategoryId ();
 
        /**
         * Id number of category
+        *
         * @param id the id to set
         */
-       public void setId (final Long id);
+       public void setCategoryId (final Long id);
 
        /**
-        * Parent category id
-        * @return the parent
+        * Parent category
+        *
+        * @return the parent category
         */
-       public Long getParentId ();
+       public Category getParentCategory ();
 
        /**
-        * Parent category id
-        * @param parent the parent to set
+        * Parent category
+        *
+        * @param parentCategory the parent category to set
         */
-       public void setParentId (final Long parent);
+       public void setParentCategory (final Category parentCategory);
 
        /**
         * Title of category
+        *
         * @return the title
         */
        public String getTitle ();
 
        /**
         * Title of category
+        *
         * @param title the title to set
         */
        public void setTitle (final String title);
index d89077f6711436beb9a50cd74305a7eda95fc997..65a40c8bf26959643e4a0562e56a23e79217e8a7 100644 (file)
  */
 package org.mxchange.jshopcore.model.category;
 
+import java.util.Objects;
+import javax.persistence.Basic;
+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;
+
 /**
  * A product category
+ *
  * @author Roland Haeder<roland@mxchange.org>
  */
-public class ProductCategory extends BaseCategory {
+@Entity (name = "category")
+@Table (name = "category")
+public class ProductCategory implements Category, Comparable<Category> {
+
        /**
         * Serial number
         */
        private static final long serialVersionUID = 21_458_945_712_659L;
 
+       /**
+        * Id number of category
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "category_id", length = 20, nullable = false)
+       private Long categoryId;
+
+       /**
+        * Parent category categoryId
+        */
+       @JoinColumn (name = "parent_id")
+       @OneToOne (targetEntity = ProductCategory.class)
+       private Category parentCategory;
+
+       /**
+        * Title of category
+        */
+       @Basic (optional = false)
+       @Column (name = "title", length = 100, nullable = false, unique = true)
+       private String title;
+
        /**
         * Constructor which accepts all database fields
         *
-        * @param id Id number of database record
+        * @param categoryId Id number of database record
         * @param title Category title
-        * @param parent Parent id
+        * @param parentCategory Parent category
         */
-       public ProductCategory (final Long id, final String title, final Long parent) {
-               // Call parent constructor
-               super(id, title, parent);
+       public ProductCategory (final Long categoryId, final String title, final Category parentCategory) {
+               // Set all here
+               this.categoryId = categoryId;
+               this.title = title;
+               this.parentCategory = parentCategory;
        }
 
        /**
@@ -43,4 +82,61 @@ public class ProductCategory extends BaseCategory {
         */
        public ProductCategory () {
        }
+
+       @Override
+       public int compareTo (final Category category) {
+               // category should not be null
+               if (null == category) {
+                       throw new NullPointerException("category is null"); //NOI18N
+               }
+
+               // Is the categoryId the same?
+               if (Objects.equals(this.getCategoryId(), category.getCategoryId())) {
+                       // Same categoryId, means same category
+                       return 0;
+               } else if (this.getCategoryId() > category.getCategoryId()) {
+                       // This categoryId is larger than compared to
+                       return -1;
+               }
+
+               // The other categoryId is larger
+               return 1;
+       }
+
+       @Override
+       public void copyAll (final Category category) {
+               // Copy all data
+               this.setParentCategory(category.getParentCategory());
+               this.setTitle(category.getTitle());
+       }
+
+       @Override
+       public Long getCategoryId () {
+               return this.categoryId;
+       }
+
+       @Override
+       public void setCategoryId (final Long categoryId) {
+               this.categoryId = categoryId;
+       }
+
+       @Override
+       public Category getParentCategory () {
+               return this.parentCategory;
+       }
+
+       @Override
+       public void setParentCategory (final Category parentCategory) {
+               this.parentCategory = parentCategory;
+       }
+
+       @Override
+       public String getTitle () {
+               return this.title;
+       }
+
+       @Override
+       public void setTitle (final String title) {
+               this.title = title;
+       }
 }
index 9cee5f74c5adaa090d472301d47040a721776c1e..cbfe4263b392e3684c8d20ebc86c9c82b2875ec2 100644 (file)
@@ -35,18 +35,18 @@ public interface Customer extends Serializable {
        public void copyAll (final Customer customer);
 
        /**
-        * Setter for contact instance
+        * Getter for contact instance
         *
-        * @param contact Contact instance
+        * @return Contact id number
         */
-       public void setContact (final Contact contact);
+       public Contact getContact ();
 
        /**
-        * Getter for contact instance
+        * Setter for contact instance
         *
-        * @return Contact id number
+        * @param contact Contact instance
         */
-       public Contact getContact();
+       public void setContact (final Contact contact);
 
        /**
         * Getter for confirmation key
@@ -76,6 +76,20 @@ public interface Customer extends Serializable {
         */
        public void setCustomerCreated (final Calendar customerCreated);
 
+       /**
+        * Getter for customer id number
+        *
+        * @return Customer id number
+        */
+       public Long getCustomerId ();
+
+       /**
+        * Settte for customer id number
+        *
+        * @param customerId Customer id number
+        */
+       public void setCustomerId (final Long customerId);
+
        /**
         * Getter for "locked" timestamp
         *
@@ -91,18 +105,18 @@ public interface Customer extends Serializable {
        public void setCustomerLocked (final Calendar customerLocked);
 
        /**
-        * Setter for customer number
+        * Getter for customer number
         *
-        * @param customerNumber Customer number
+        * @return Customer number
         */
-       public void setCustomerNumber (final String customerNumber);
+       public String getCustomerNumber ();
 
        /**
-        * Getter for customer number
+        * Setter for customer number
         *
-        * @return Customer number
+        * @param customerNumber Customer number
         */
-       public String getCustomerNumber ();
+       public void setCustomerNumber (final String customerNumber);
 
        /**
         * Getter for password hash
@@ -131,18 +145,4 @@ public interface Customer extends Serializable {
         * @param customerStatus Account status
         */
        public void setCustomerStatus (final String customerStatus);
-
-       /**
-        * Getter for customer id number
-        *
-        * @return Customer id number
-        */
-       public Long getCustomerId ();
-
-       /**
-        * Settte for customer id number
-        *
-        * @param customerId Customer id number
-        */
-       public void setCustomerId (final Long customerId);
 }
index 42811374a2be73cc0f4a8c40ae1861634f6915e1..7544264a03fa7105a9d4638d5661aa78592f0061 100644 (file)
@@ -28,15 +28,15 @@ import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
-import org.mxchange.jcore.model.contact.BaseContact;
 import org.mxchange.jcore.model.contact.Contact;
+import org.mxchange.jcore.model.contact.UserContact;
 
 /**
  * A shop customer class.
  *
  * @author Roland Haeder<roland@mxchange.org>
  */
-@Entity (name = "Customer")
+@Entity (name = "customer")
 @Table (name = "customer")
 public class ShopCustomer implements Customer {
 
@@ -45,19 +45,11 @@ public class ShopCustomer implements Customer {
         */
        private static final long serialVersionUID = 4_328_454_581_751L;
 
-       /**
-        * Customer id
-        */
-       @Id
-       @Column (name = "id", nullable = false, length = 20)
-       @GeneratedValue(strategy = GenerationType.IDENTITY)
-       private Long customerId;
-
        /**
         * Id number from "contacts" table
         */
-       @JoinColumn (table = "contacts", referencedColumnName = "customer_contact_id", name = "id", nullable = false, updatable = false, unique = true)
-       @OneToOne (optional = false, targetEntity = BaseContact.class, orphanRemoval = true)
+       @JoinColumn (name = "contact_id", nullable = false, updatable = false, unique = true)
+       @OneToOne (optional = false, targetEntity = UserContact.class)
        private Contact contact;
 
        /**
@@ -69,11 +61,19 @@ public class ShopCustomer implements Customer {
        /**
         * "created" timestamp
         */
-       @Basic(optional = false)
+       @Basic (optional = false)
        @Temporal (TemporalType.TIMESTAMP)
        @Column (name = "customer_created", nullable = false)
        private Calendar customerCreated;
 
+       /**
+        * Customer id
+        */
+       @Id
+       @Column (name = "customer_id", nullable = false, length = 20, updatable = false)
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       private Long customerId;
+
        /**
         * "locked" timestamp
         */
@@ -96,9 +96,16 @@ public class ShopCustomer implements Customer {
        /**
         * Account status
         */
+       @Basic (optional = false)
        @Column (name = "customer_status", nullable = false)
        private String customerStatus;
 
+       /**
+        * Default constructor
+        */
+       public ShopCustomer () {
+       }
+
        @Override
        public void copyAll (final Customer customer) {
                // Copy also contact data
@@ -143,6 +150,16 @@ public class ShopCustomer implements Customer {
                this.customerCreated = customerCreated;
        }
 
+       @Override
+       public Long getCustomerId () {
+               return this.customerId;
+       }
+
+       @Override
+       public void setCustomerId (final Long customerId) {
+               this.customerId = customerId;
+       }
+
        @Override
        public Calendar getCustomerLocked () {
                return this.customerLocked;
@@ -182,14 +199,4 @@ public class ShopCustomer implements Customer {
        public void setCustomerStatus (final String customerStatus) {
                this.customerStatus = customerStatus;
        }
-
-       @Override
-       public Long getCustomerId () {
-               return this.customerId;
-       }
-
-       @Override
-       public void setCustomerId (final Long customerId) {
-               this.customerId = customerId;
-       }
 }
index 47f60edb48db0df6f2a6175643ce1af3022460bb..4722d455c3315f418609cb1963e40430dcb31d3a 100644 (file)
@@ -44,18 +44,18 @@ public interface Orderable extends Serializable {
        public void setAccessKey (final String accessKey);
 
        /**
-        * Getter for order id
+        * Getter for created timestamp
         *
-        * @return Order id
+        * @return Created timestamp
         */
-       public Long getId ();
+       public Calendar getCreated ();
 
        /**
-        * Setter for order id
+        * Setter for created timestamp
         *
-        * @param id Order id
+        * @param created Created timestamp
         */
-       public void setId (final Long id);
+       public void setCreated (final Calendar created);
 
        /**
         * Getter for customer instance
@@ -72,18 +72,18 @@ public interface Orderable extends Serializable {
        public void setCustomer (final Customer customer);
 
        /**
-        * Getter for created timestamp
+        * Getter for order id
         *
-        * @return Created timestamp
+        * @return Order id
         */
-       public Calendar getCreated ();
+       public Long getOrderId ();
 
        /**
-        * Setter for created timestamp
+        * Setter for order id
         *
-        * @param created Created timestamp
+        * @param id Order id
         */
-       public void setCreated (final Calendar created);
+       public void setOrderId (final Long id);
 
        /**
         * Getter for list of ordered basket items
index 0aaa1a0438ca21e0aa11cc0656b14e79a729c388..addcf8de0058c8069849695d4dc9c2b33df142e7 100644 (file)
@@ -25,20 +25,21 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
-import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 import org.mxchange.jshopcore.model.basket.AddableBasketItem;
 import org.mxchange.jshopcore.model.customer.Customer;
+import org.mxchange.jshopcore.model.customer.ShopCustomer;
 
 /**
  * An entity class for shop orders
  *
  * @author Roland Haeder
  */
-@Entity (name = "Orders")
+@Entity (name = "orders")
 @Table (name = "orders")
 public class ShopOrder implements Orderable {
 
@@ -47,21 +48,6 @@ public class ShopOrder implements Orderable {
         */
        private static final long serialVersionUID = 19_728_938_459_834L;
 
-       /**
-        * Order id
-        */
-       @Id
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       private Long id;
-
-       /**
-        * Customer instance
-        */
-       @Basic (optional = false)
-       @OneToMany
-       @JoinColumn (table = "customer", referencedColumnName = "id", name = "customer_id", nullable = false, updatable = false)
-       private Customer customer;
-
        /**
         * Access key
         */
@@ -74,15 +60,30 @@ public class ShopOrder implements Orderable {
         */
        @Basic (optional = false)
        @Temporal (TemporalType.TIMESTAMP)
-       @Column (nullable = false)
+       @Column (name = "created", nullable = false)
        private Calendar created;
 
+       /**
+        * Customer instance
+        */
+       @JoinColumn (name = "customer_id", nullable = false, updatable = false)
+       @OneToOne (targetEntity = ShopCustomer.class, optional = false)
+       private Customer customer;
+
        /**
         * Item list, don't save this
         */
        @Transient
        private List<AddableBasketItem> itemList;
 
+       /**
+        * Order orderId
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "order_id", length = 20)
+       private Long orderId;
+
        @Override
        public String getAccessKey () {
                return this.accessKey;
@@ -114,13 +115,13 @@ public class ShopOrder implements Orderable {
        }
 
        @Override
-       public Long getId () {
-               return this.id;
+       public Long getOrderId () {
+               return this.orderId;
        }
 
        @Override
-       public void setId (final Long id) {
-               this.id = id;
+       public void setOrderId (final Long orderId) {
+               this.orderId = orderId;
        }
 
        @Override
index c12cf50aa5d937fee1efe62f6d7b1d4f62dda4c3..5defb8f7ab0d3a7a595ef3841f983e783e3ec36e 100644 (file)
  */
 package org.mxchange.jshopcore.model.order.items;
 
+import javax.persistence.Basic;
+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 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
  *
  * @author Roland Haeder<roland@mxchange.org>
  */
-@Table(name = "ordered_items")
+@Entity (name = "ordered_item")
+@Table (name = "ordered_items")
 public class OrderItem extends BaseItem implements AddableBasketItem {
+
        /**
         * Serial number
         */
        private static final long serialVersionUID = 44_189_562_738_723_581L;
 
+       /**
+        * Item amount
+        */
+       @Basic (optional = false)
+       @Column (name = "amount", length = 20, nullable = false)
+       private Long amount;
+
+       /**
+        * Entry id (from database backend)
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "id", nullable = false, length = 20)
+       private Long id;
+
+       /**
+        * Item type
+        */
+       @Basic (optional = false)
+       @Column (name = "item_type", length = 20)
+       private String itemType;
+
+       /**
+        * Product instance
+        */
+       @JoinColumn (name = "product_id", updatable = false)
+       @OneToOne (targetEntity = GenericProduct.class)
+       private Product product;
+
        /**
         * Default constructor
         */
        public OrderItem () {
        }
+
+       @Override
+       public Long getAmount () {
+               return this.amount;
+       }
+
+       @Override
+       public void setAmount (final Long amount) {
+               this.amount = amount;
+       }
+
+       @Override
+       public Long getItemId () {
+               return this.id;
+       }
+
+       @Override
+       public void setItemId (final Long id) {
+               this.id = id;
+       }
+
+       @Override
+       public String getItemType () {
+               return this.itemType;
+       }
+
+       @Override
+       public void setItemType (final String itemType) {
+               this.itemType = itemType;
+       }
+
+       @Override
+       public Product getProduct () {
+               return this.product;
+       }
+
+       @Override
+       public void setProduct (final Product product) {
+               this.product = product;
+       }
 }
diff --git a/src/org/mxchange/jshopcore/model/product/BaseProduct.java b/src/org/mxchange/jshopcore/model/product/BaseProduct.java
deleted file mode 100644 (file)
index 2b3d81c..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.mxchange.jshopcore.model.product;
-
-import java.util.Objects;
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- * A general product class
- *
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Entity(name = "product")
-@Table (name = "products")
-public abstract class BaseProduct implements Product, Comparable<Product> {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 48_379_575_267_451L;
-
-       /**
-        * Availability of product
-        */
-       @Column
-       private Boolean available;
-
-       /**
-        * Product category
-        */
-       @Basic(optional = false)
-       @Column(name = "category_id", length = 20, nullable = false)
-       private Long categoryId;
-
-       /**
-        * Id number of product
-        */
-       @Id
-       @GeneratedValue
-       @Column
-       private Long id;
-
-       /**
-        * Price of product
-        */
-       @Basic(optional = false)
-       @Column(nullable = false)
-       private Float price;
-
-       /**
-        * Title of product
-        */
-       @Basic(optional = false)
-       @Column(length = 100, nullable = false)
-       private String title;
-
-       @Override
-       public int compareTo (final Product product) {
-               // category should not be null
-               if (null == product) {
-                       throw new NullPointerException("product is null"); //NOI18N
-               }
-
-               // Is the id the same?
-               if (Objects.equals(this.getId(), product.getId())) {
-                       // Same id, means same category
-                       return 0;
-               } else if (this.getId() > product.getId()) {
-                       // This id is larger than compared to
-                       return 1;
-               }
-
-               // The other id is larger
-               return -1;
-       }
-
-       @Override
-       public void copyAll (final Product product) {
-               // Copy all
-               this.setAvailable(product.getAvailable());
-               this.setCategoryId(product.getCategoryId());
-               this.setPrice(product.getPrice());
-               this.setTitle(product.getTitle());
-       }
-
-       @Override
-       public Boolean getAvailable () {
-               return this.available;
-       }
-
-       @Override
-       public void setAvailable (final Boolean available) {
-               this.available = available;
-       }
-
-       @Override
-       public Long getCategoryId () {
-               return this.categoryId;
-       }
-
-       @Override
-       public void setCategoryId (final Long categoryId) {
-               this.categoryId = categoryId;
-       }
-
-       @Override
-       public Long getId () {
-               return this.id;
-       }
-
-       @Override
-       public void setId (final Long id) {
-               this.id = id;
-       }
-
-       @Override
-       public Float getPrice () {
-               return this.price;
-       }
-
-       @Override
-       public void setPrice (final Float price) {
-               this.price = price;
-       }
-
-       @Override
-       public String getTitle () {
-               return this.title;
-       }
-
-       @Override
-       public void setTitle (final String title) {
-               this.title = title;
-       }
-}
index a7e8f88a1c99444edcaf3405cfa57508fe65be0d..e794f2142e41534e720f3ab04f04321c14b1f3b4 100644 (file)
  */
 package org.mxchange.jshopcore.model.product;
 
+import java.util.Objects;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.mxchange.jshopcore.model.category.Category;
+
 /**
  * Generic product class
  *
  * @author Roland Haeder<roland@mxchange.org>
  * TODO: Find a better name
  */
-public class GenericProduct extends BaseProduct implements Product {
+@Entity (name = "products")
+@Table (name = "products")
+public class GenericProduct implements Product, Comparable<Product> {
+
        /**
         * Serial number
         */
        private static final long serialVersionUID = 54_578_571_769_283L;
 
+       /**
+        * Availability of product
+        */
+       @Column (name = "available", nullable = false)
+       private Boolean available;
+
+       /**
+        * Product category
+        */
+       @Basic (optional = false)
+       @Column (name = "category_id", length = 20, nullable = false)
+       private Category category;
+
+       /**
+        * Id number of product
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column(name = "product_id", length = 20, nullable = false, updatable = false)
+       private Long id;
+
+       /**
+        * Price of product
+        */
+       @Basic (optional = false)
+       @Column (name = "price", nullable = false)
+       private Float price;
+
+       /**
+        * Title of product
+        */
+       @Basic (optional = false)
+       @Column (name = "title", length = 100, nullable = false)
+       private String title;
+
        /**
         * Default constructor
         */
@@ -40,15 +88,94 @@ public class GenericProduct extends BaseProduct implements Product {
         * @param id Id number of product
         * @param title Name of product
         * @param price Price
-        * @param categoryId Category id
+        * @param category Category instance
         * @param available Availability (selectable by customer)
         */
-       public GenericProduct (final Long id, final String title, final Float price, final Long categoryId, final Boolean available) {
+       public GenericProduct (final Long id, final String title, final Float price, final Category category, final Boolean available) {
                // Set all here
-               this.setId(id);
-               this.setTitle(title);
-               this.setPrice(price);
-               this.setCategoryId(categoryId);
-               this.setAvailable(available);
+               this.id = id;
+               this.title = title;
+               this.price = price;
+               this.category = category;
+               this.available = available;
+       }
+
+       @Override
+       public int compareTo (final Product product) {
+               // category should not be null
+               if (null == product) {
+                       throw new NullPointerException("product is null"); //NOI18N
+               }
+               
+               // Is the id the same?
+               if (Objects.equals(this.getId(), product.getId())) {
+                       // Same id, means same category
+                       return 0;
+               } else if (this.getId() > product.getId()) {
+                       // This id is larger than compared to
+                       return 1;
+               }
+               
+               // The other id is larger
+               return -1;
+       }
+
+       @Override
+       public void copyAll (final Product product) {
+               // Copy all
+               this.setAvailable(product.getAvailable());
+               this.setCategory(product.getCategory());
+               this.setPrice(product.getPrice());
+               this.setTitle(product.getTitle());
+       }
+
+       @Override
+       public Boolean getAvailable () {
+               return this.available;
+       }
+
+       @Override
+       public void setAvailable (final Boolean available) {
+               this.available = available;
+       }
+
+       @Override
+       public Category getCategory () {
+               return this.category;
+       }
+
+       @Override
+       public void setCategory (final Category category) {
+               this.category = category;
+       }
+
+       @Override
+       public Long getId () {
+               return this.id;
+       }
+
+       @Override
+       public void setId (final Long id) {
+               this.id = id;
+       }
+
+       @Override
+       public Float getPrice () {
+               return this.price;
+       }
+
+       @Override
+       public void setPrice (final Float price) {
+               this.price = price;
+       }
+
+       @Override
+       public String getTitle () {
+               return this.title;
+       }
+
+       @Override
+       public void setTitle (final String title) {
+               this.title = title;
        }
 }
index a48499da1c2dd19c9e30592f54bd498290d1285a..5f0087602632840d26c75498ca73ca7db5b6717f 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jshopcore.model.product;
 
 import java.io.Serializable;
+import org.mxchange.jshopcore.model.category.Category;
 
 /**
  * An interface for in database storable products
@@ -33,69 +34,72 @@ public interface Product extends Serializable {
        public void copyAll (final Product product);
 
        /**
-        * Getter for id number, suitable for form fields.
-        * 
-        * @return Id number of product
+        * Getter for product availability
+        *
+        * @return Product availability
         */
-       public Long getId ();
+       public Boolean getAvailable ();
 
        /**
-        * Id number of product
-        * @param id the id number to set
+        * Setter for product availability
+        *
+        * @param available Product availability
         */
-       public void setId (final Long id);
+       public void setAvailable (final Boolean available);
 
        /**
-        * Getter for title.
-        * 
-        * @return Title of product
+        * Getter for product category id
+        *
+        * @return Product category id
         */
-       public String getTitle ();
+       public Category getCategory ();
 
        /**
-        * Title of product
-        * @param title the title to set
+        * Setter for product category
+        *
+        * @param category Product category
         */
-       public void setTitle (final String title);
+       public void setCategory (final Category category);
 
        /**
-        * Getter for raw price.
-        * 
-        * @return Single price of product
+        * Getter for id number, suitable for form fields.
+        *
+        * @return Id number of product
         */
-       public Float getPrice ();
+       public Long getId ();
 
        /**
-        * Price of product
-        * @param price the price to set
+        * Id number of product
+        *
+        * @param id the id number to set
         */
-       public void setPrice (final Float price);
+       public void setId (final Long id);
 
        /**
-        * Getter for product category id
+        * Getter for raw price.
         *
-        * @return Product category id
+        * @return Single price of product
         */
-       public Long getCategoryId ();
+       public Float getPrice ();
 
        /**
-        * Setter for product category
+        * Price of product
         *
-        * @param categoryId Product category
+        * @param price the price to set
         */
-       public void setCategoryId (final Long categoryId);
+       public void setPrice (final Float price);
 
        /**
-        * Getter for product availability
+        * Getter for title.
         *
-        * @return Product availability
+        * @return Title of product
         */
-       public Boolean getAvailable ();
+       public String getTitle ();
 
        /**
-        * Setter for product availability
+        * Title of product
         *
-        * @param available Product availability
+        * @param title the title to set
         */
-       public void setAvailable (final Boolean available);
+       public void setTitle (final String title);
 }
index 7a70470573c8551d9adbd00065fb41cf9a190caf..6bfe3c5fe32fc9ceb9487b18c1d57a209c4416a7 100644 (file)
@@ -26,6 +26,7 @@ import org.mxchange.jshopcore.model.customer.Customer;
  * @author Roland Haeder
  */
 public class CheckoutWrapper implements WrapableCheckout {
+
        /**
         * Serial number
         */
index 7d5d9db7cc9464ffd56cd76fa939e2310dd79474..1ad5a9f60010bfbb63673cc3a01774d7a6a7d4cd 100644 (file)
@@ -37,18 +37,21 @@ public interface WrapableCheckout extends Serializable {
 
        /**
         * Setter for customer instance
+        *
         * @param customer Customer instance
         */
        public void setCustomer (final Customer customer);
 
        /**
         * Getter for a List of AddableBasktem instances
+        *
         * @return List with AddableBasketItem instances
         */
        public List<AddableBasketItem> getList ();
 
        /**
         * Setter for a List of AddableBasktem instances
+        *
         * @param list List with AddableBasketItem instances
         */
        public void setList (final List<AddableBasketItem> list);