From e8f0175feb8e5dd1d5ba09054400f6df6b2f2804 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 24 Sep 2015 15:11:09 +0200 Subject: [PATCH] =?utf8?q?Continued:=20-=20auto-reformatted=20many=20files?= =?utf8?q?=20-=20got=20rid=20of=20some=20superflous=20classes=20-=20update?= =?utf8?q?d=20jar=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/jcore.jar | Bin 31729 -> 32092 bytes lib/jcoreee.jar | Bin 17745 -> 17745 bytes .../jcore/model/contact/CustomerContact.java | 30 --- .../BasketItemAlreadyAddedException.java | 6 +- .../CannotAddCategoryException.java | 1 + .../exceptions/CannotAddProductException.java | 1 + .../CategoryTitleAlreadyUsedException.java | 3 +- .../CustomerAlreadyRegisteredException.java | 1 + .../ProductTitleAlreadyUsedException.java | 3 +- .../exceptions/QueryNotExecutedException.java | 44 ----- .../model/basket/AddableBasketItem.java | 46 ++--- .../jshopcore/model/basket/BaseBasket.java | 13 +- .../jshopcore/model/basket/Basket.java | 39 ++-- .../jshopcore/model/basket/ShopBasket.java | 1 + .../model/basket/items/BaseItem.java | 99 +--------- .../model/basket/items/BasketItem.java | 93 +++++++++- .../model/category/BaseCategory.java | 174 ------------------ .../jshopcore/model/category/Category.java | 22 ++- .../model/category/ProductCategory.java | 108 ++++++++++- .../jshopcore/model/customer/Customer.java | 52 +++--- .../model/customer/ShopCustomer.java | 53 +++--- .../jshopcore/model/order/Orderable.java | 24 +-- .../jshopcore/model/order/ShopOrder.java | 45 ++--- .../model/order/items/OrderItem.java | 83 ++++++++- .../jshopcore/model/product/BaseProduct.java | 143 -------------- .../model/product/GenericProduct.java | 143 +++++++++++++- .../jshopcore/model/product/Product.java | 70 +++---- .../jshopcore/wrapper/CheckoutWrapper.java | 1 + .../jshopcore/wrapper/WrapableCheckout.java | 3 + 29 files changed, 612 insertions(+), 689 deletions(-) delete mode 100644 src/org/mxchange/jcore/model/contact/CustomerContact.java delete mode 100644 src/org/mxchange/jshopcore/exceptions/QueryNotExecutedException.java delete mode 100644 src/org/mxchange/jshopcore/model/category/BaseCategory.java delete mode 100644 src/org/mxchange/jshopcore/model/product/BaseProduct.java diff --git a/lib/jcore.jar b/lib/jcore.jar index 57dc0a07e9ad739e6f82121851bb5ecdf7291de2..c0bdbee1e02a1d6bf6ef6af3c07a3bd7c43e06fe 100644 GIT binary patch delta 8715 zcma)C34D~*wLf>3%#tr;-^jj_Om;#-LVyIq4q*#h0D%z35DXK{3=lTwsh}vJ;I$x2 zm9{PwtwjO}tAJ>=)>>L=^;KKzd#$yv)ym?d`c&TkeBYO3GECm@!Ef$8_ug~Q`QLN5 zbMBX`H^qlv3uWe1qsdNWB`ROPN69smt=}_zp8@pcR8FtuB9%#^h_mUUinAS}oU=<} z1ZTIzaLy_WwVZ7+lyP?4Fp9J5hH=*N^%WC$TuSoDYU4Ozms^dgEx~j@ZMD)i3q4?` z2WdN(AF|TJR@z~uofg_e)pTUNJtoG8g9!Gq+^;N+lgg-+5b zc{DiMdYU>EIzwmWFM|{6&nff@omc1rOOExl-Q{$-b08#l)TWXxJ+duyQK47ql0qY> zN}&p>RA>#|tl%7fp>}f1mz68hmXh9i zCFDLKw}ljlLU}cIuyk6Zf=p?cQoGy{`mI^eM4BYu3d78Y_*Vu_&PvO{HlNWTHBnt_!@Mf>f?@78qeO zog;gLF|Yn41)n0tKqBv13aW|-IjS}f@^8*N3b962c?_9BZ-!DYCD6T;OxrNa+vOjk zV!bnHCe+PRc||hx&!&1!zeptu5D@KB6@;2~{SBu4UJPd_tRXMIo5H6TbWy}PiX34w zmYYFG?WfXsQ#6y&^=khZt$(!nB*oS@nBq;Qp%7DmvBVi@t64mE>ur@UUgL{5z0$*Y zk_PJv<;Rgx-tW<1?7U1mNCk8VOZF)mPCtNApQc87j+*HOdYE2PjXYX|-)rPuG>7J5 za2OKJ17(1e7Mf2BV5b6FMh&zO1}LUGXb~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{G;^`8Pi?W-|3NQOk)P~Xkihzu!32-6M8Q{?>58BhNm@uUw-EP zjjgGH6v8+n9~`E2bCNaY!LSB}v{CCA?R%A}VrH;X=3 p&hFNUj#s_YtJQ0}^`KyFmJi*nU1j{L-S$G9KDFvi_HET${{Vr)sNetq delta 634 zcmY+BO-xfk5Xb+!edV>}Nn4vV2*th{gSMsWL#?gQ_Vu*{3@Q~8<b&Z4^1m$JrxDb=w> zuWLGeldT-KD~BTKMt<<>{MVtd2Cy8XolHBe`VDu|Ck1K8tMpmR(0wH#|HT6)dJP;z z)PRX3-SGEmaiI+1B;9p?ryx`BJ(GiuJR;~vJAfFZ(j7RYgjWZ;a2Ns!W&0o^(7aUJ zEl0%w2|Y@W^=N>9^+wxSbyxH)J#rg&a2K<ULVYEyWCiIDrsO zs`^f&N0pGnc@$L{b(Amx2Tcs9e+*&<7w}BQJjWHhz$jkfnmdx0f}a^H{LvI?tW;3r zqo*ZrJR7A`?3CpKqgbvmX3E2icjY=GVP9uV+oOBCIQ_7_VNTm|8mZ*iJ6jp|%H@I4 qm&&F6K2g8p-Cl8S?e~M)s*m{6eDx;dSM`B+#O2det;xRa+SEVm=AiZf diff --git a/src/org/mxchange/jcore/model/contact/CustomerContact.java b/src/org/mxchange/jcore/model/contact/CustomerContact.java deleted file mode 100644 index 8f02c12..0000000 --- a/src/org/mxchange/jcore/model/contact/CustomerContact.java +++ /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 . - */ -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; -} diff --git a/src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java b/src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java index ca4cbeb..053d7fb 100644 --- a/src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java +++ b/src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java @@ -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 Any item that is or extends the interface * @param item An instance of a T item */ - public BasketItemAlreadyAddedException (final T item) { + public 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 index 1322005..45247a4 100644 --- a/src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java +++ b/src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java @@ -23,6 +23,7 @@ package org.mxchange.jshopcore.exceptions; * @author Roland Haeder */ public class CannotAddCategoryException extends Exception { + /** * Serial number */ diff --git a/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java b/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java index feef839..7dd1acc 100644 --- a/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java +++ b/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java @@ -23,6 +23,7 @@ package org.mxchange.jshopcore.exceptions; * @author Roland Haeder */ public class CannotAddProductException extends Exception { + /** * Serial number */ diff --git a/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java index 1718f01..e9a1230 100644 --- a/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java +++ b/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java @@ -21,10 +21,11 @@ import org.mxchange.jshopcore.model.category.Category; /** * An exception thrown when the given title is already used - * + * * @author Roland Haeder */ public class CategoryTitleAlreadyUsedException extends Exception { + /** * Serial number */ diff --git a/src/org/mxchange/jshopcore/exceptions/CustomerAlreadyRegisteredException.java b/src/org/mxchange/jshopcore/exceptions/CustomerAlreadyRegisteredException.java index eb93d49..f095b5b 100644 --- a/src/org/mxchange/jshopcore/exceptions/CustomerAlreadyRegisteredException.java +++ b/src/org/mxchange/jshopcore/exceptions/CustomerAlreadyRegisteredException.java @@ -25,6 +25,7 @@ import org.mxchange.jshopcore.model.customer.Customer; * @author Roland Haeder */ public class CustomerAlreadyRegisteredException extends Exception { + /** * Serial number */ diff --git a/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java index dffa4b7..278e681 100644 --- a/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java +++ b/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java @@ -21,10 +21,11 @@ import org.mxchange.jshopcore.model.product.Product; /** * An exception thrown when the given title is already used - * + * * @author Roland Haeder */ 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 index a92211e..0000000 --- a/src/org/mxchange/jshopcore/exceptions/QueryNotExecutedException.java +++ /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 . - */ -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()); - } -} diff --git a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java index 1c29978..4257d17 100644 --- a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java +++ b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java @@ -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 (); } diff --git a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java index bf476b9..4d8e7c4 100644 --- a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java +++ b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java @@ -29,6 +29,7 @@ import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException; * @param Any instance that implements AddableBasketItem */ public abstract class BaseBasket implements Basket { + /** * Serial number */ @@ -63,9 +64,9 @@ public abstract class BaseBasket 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 implements Basket< } @Override - public void clear () { - // Deligate to deque - this.deque.clear(); + public boolean isEmpty () { + // Deligate call to frontend + return this.deque.isEmpty(); } } diff --git a/src/org/mxchange/jshopcore/model/basket/Basket.java b/src/org/mxchange/jshopcore/model/basket/Basket.java index ea7e899..1a9dabe 100644 --- a/src/org/mxchange/jshopcore/model/basket/Basket.java +++ b/src/org/mxchange/jshopcore/model/basket/Basket.java @@ -30,9 +30,10 @@ public interface Basket 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 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 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 (); } diff --git a/src/org/mxchange/jshopcore/model/basket/ShopBasket.java b/src/org/mxchange/jshopcore/model/basket/ShopBasket.java index c24221b..635f55c 100644 --- a/src/org/mxchange/jshopcore/model/basket/ShopBasket.java +++ b/src/org/mxchange/jshopcore/model/basket/ShopBasket.java @@ -22,6 +22,7 @@ package org.mxchange.jshopcore.model.basket; * @author Roland Haeder */ public class ShopBasket extends BaseBasket implements Basket { + /** * Serial number */ diff --git a/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java b/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java index de2f2c0..d0e7901 100644 --- a/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java +++ b/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java @@ -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 @@ -17,12 +17,6 @@ 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 */ -@Entity(name = "item") public abstract class BaseItem implements AddableBasketItem, Comparable { /** @@ -40,38 +33,6 @@ public abstract class BaseItem implements AddableBasketItem, Comparable 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 */ +@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 index 6b2e824..0000000 --- a/src/org/mxchange/jshopcore/model/category/BaseCategory.java +++ /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 . - */ -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 - */ -@Entity(name = "category") -@Table(name = "category") -public abstract class BaseCategory implements Category, Comparable { - - /** - * 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; - } -} diff --git a/src/org/mxchange/jshopcore/model/category/Category.java b/src/org/mxchange/jshopcore/model/category/Category.java index 5f871c6..c20acbc 100644 --- a/src/org/mxchange/jshopcore/model/category/Category.java +++ b/src/org/mxchange/jshopcore/model/category/Category.java @@ -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); diff --git a/src/org/mxchange/jshopcore/model/category/ProductCategory.java b/src/org/mxchange/jshopcore/model/category/ProductCategory.java index d89077f..65a40c8 100644 --- a/src/org/mxchange/jshopcore/model/category/ProductCategory.java +++ b/src/org/mxchange/jshopcore/model/category/ProductCategory.java @@ -16,26 +16,65 @@ */ 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 */ -public class ProductCategory extends BaseCategory { +@Entity (name = "category") +@Table (name = "category") +public class ProductCategory implements Category, Comparable { + /** * 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; + } } diff --git a/src/org/mxchange/jshopcore/model/customer/Customer.java b/src/org/mxchange/jshopcore/model/customer/Customer.java index 9cee5f7..cbfe426 100644 --- a/src/org/mxchange/jshopcore/model/customer/Customer.java +++ b/src/org/mxchange/jshopcore/model/customer/Customer.java @@ -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); } diff --git a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java index 4281137..7544264 100644 --- a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java +++ b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java @@ -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 */ -@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; - } } diff --git a/src/org/mxchange/jshopcore/model/order/Orderable.java b/src/org/mxchange/jshopcore/model/order/Orderable.java index 47f60ed..4722d45 100644 --- a/src/org/mxchange/jshopcore/model/order/Orderable.java +++ b/src/org/mxchange/jshopcore/model/order/Orderable.java @@ -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 diff --git a/src/org/mxchange/jshopcore/model/order/ShopOrder.java b/src/org/mxchange/jshopcore/model/order/ShopOrder.java index 0aaa1a0..addcf8d 100644 --- a/src/org/mxchange/jshopcore/model/order/ShopOrder.java +++ b/src/org/mxchange/jshopcore/model/order/ShopOrder.java @@ -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 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 diff --git a/src/org/mxchange/jshopcore/model/order/items/OrderItem.java b/src/org/mxchange/jshopcore/model/order/items/OrderItem.java index c12cf50..5defb8f 100644 --- a/src/org/mxchange/jshopcore/model/order/items/OrderItem.java +++ b/src/org/mxchange/jshopcore/model/order/items/OrderItem.java @@ -16,25 +16,106 @@ */ 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 */ -@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 index 2b3d81c..0000000 --- a/src/org/mxchange/jshopcore/model/product/BaseProduct.java +++ /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 - */ -@Entity(name = "product") -@Table (name = "products") -public abstract class BaseProduct implements Product, Comparable { - - /** - * 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; - } -} diff --git a/src/org/mxchange/jshopcore/model/product/GenericProduct.java b/src/org/mxchange/jshopcore/model/product/GenericProduct.java index a7e8f88..e794f21 100644 --- a/src/org/mxchange/jshopcore/model/product/GenericProduct.java +++ b/src/org/mxchange/jshopcore/model/product/GenericProduct.java @@ -16,18 +16,66 @@ */ 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 * TODO: Find a better name */ -public class GenericProduct extends BaseProduct implements Product { +@Entity (name = "products") +@Table (name = "products") +public class GenericProduct implements Product, Comparable { + /** * 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; } } diff --git a/src/org/mxchange/jshopcore/model/product/Product.java b/src/org/mxchange/jshopcore/model/product/Product.java index a48499d..5f00876 100644 --- a/src/org/mxchange/jshopcore/model/product/Product.java +++ b/src/org/mxchange/jshopcore/model/product/Product.java @@ -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); } diff --git a/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java index 7a70470..6bfe3c5 100644 --- a/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java +++ b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java @@ -26,6 +26,7 @@ import org.mxchange.jshopcore.model.customer.Customer; * @author Roland Haeder */ public class CheckoutWrapper implements WrapableCheckout { + /** * Serial number */ diff --git a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java index 7d5d9db..1ad5a9f 100644 --- a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java +++ b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java @@ -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 getList (); /** * Setter for a List of AddableBasktem instances + * * @param list List with AddableBasketItem instances */ public void setList (final List list); -- 2.39.5