From 5732496c13f13fec19c7630530ba2c448f53cf28 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 10 Sep 2015 15:39:44 +0200 Subject: [PATCH] =?utf8?q?Updated=20author=20(email=20address)=20+=20jars?= =?utf8?q?=20+=20implemented=20very=20basic=20basket=20Signed-off-by:Rolan?= =?utf8?q?d=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/jcore-ee-logger.jar | Bin 8032 -> 8032 bytes lib/jcoreee.jar | Bin 16551 -> 13934 bytes .../BasketItemAlreadyAddedException.java | 43 ++++++++++++ .../CategoryTitleAlreadyUsedException.java | 12 +++- .../ProductTitleAlreadyUsedException.java | 12 +++- .../model/basket/AddableBasketItem.java | 24 +++++-- .../jshopcore/model/basket/BaseBasket.java | 62 +++++++++++------- .../jshopcore/model/basket/Basket.java | 12 ++-- .../jshopcore/model/basket/ShopBasket.java | 7 +- .../model/category/BaseCategory.java | 2 +- .../jshopcore/model/category/Category.java | 2 +- .../model/category/ProductCategory.java | 2 +- .../jshopcore/model/customer/Customer.java | 2 +- .../model/customer/ShopCustomer.java | 2 +- .../jshopcore/model/item/BaseItem.java | 2 +- .../jshopcore/model/item/BasketItem.java | 2 +- .../jshopcore/model/product/BaseProduct.java | 2 +- .../model/product/GenericProduct.java | 2 +- .../jshopcore/model/product/Product.java | 2 +- 19 files changed, 137 insertions(+), 55 deletions(-) create mode 100644 src/org/mxchange/jshopcore/exceptions/BasketItemAlreadyAddedException.java diff --git a/lib/jcore-ee-logger.jar b/lib/jcore-ee-logger.jar index 5ebf6d07bb973bde224c28c9e8403af3719390fe..c65212243809f11f3ffb24a9b60a199155e03c07 100644 GIT binary patch delta 212 zcmaE0_rQ)Pz?+$ci-CcIfuXf}B9A6hOZ7za=}bWO1qBfKNfSs;mSr>tQDKa>AZjY3 zGl;sy=mn%Ut1-neg6I}zWfl;C5tQDKa>AZjY3 zGl;sy=mn%Ut1-neg6I}zWf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k^1I8%F1|9gno9NS@OePhSs$$l`H4V6fuX23k6~

$C)|Mu_@4rpFXZlvzMnP6!vcg;5LbnU7svdghLbx4N^rdCn0=SId94~5Z!q(rx` zVTlIXSjP>lk#}v?o*`bQDYchwTk%JRb1eoz13!nDVS#CxwU5e)0%L>GN*fdv#nm`0 z#~!-4$5X>KxHI2o5NPxTDbgO1pZg7B4LMICcX*xj1ZR~^9T=>n6B5^KnU zazTBuIcsuCm~?4mzgSJa;fVbjOuI(xHSGVu>)8hs{}w4k|EZ40^YG3QlmSsz;B=p#YuBTJ+D z8(79@yq=e5lr}?sWEM9)i}j&=VBJ0QWrO0$c~yObW7RhowAaEu6@g!&M3t3x1fHr6 zPa4?ziuBze(HE$$G*e@VQ2p3Le729u#~?M26t#{SUOh%#<7p}yU#DvEA`#giQBg7Ynr##(IAX+nGMbVS$xTx!TXd6qqSHuh-pe+(aLo7MAE=;g z5)B1^s}vg_aVLn#7>DmhP{%$Mn2YK-pyL)D2X!hlOxYp|;n=}<(fU5i>+V_k1OhAt zg|6V|vrK!?S&Bj*`R1~}-%jB~KGma8`(=xxJTqPig?7o2+hz%FZ}wx0E-05h7G!6& z>1g*Wd4xf7KXyvSU4HD=v4ubtM5RpU%ln_$GvJGlu6p)iw_Q__L_F&WTBbsM<4R_B9 z@1imn|1HB$I^}!rbyNGz)Iw3WcT=T+{Cn|n3DC?HEqYURzRJC-to)J6|B~OrXXYzG z(B}M;5%vK1`;qDqTpF_C$kt~qaBje9>G*>xxik8jiS zdD|?pSo@z0?=w}~v^SaZ!76{LHE;XH$A4JKvWSMIueg>QEq`6GVDz6Te!6x+g*V{r z. + */ +package org.mxchange.jshopcore.exceptions; + +import java.text.MessageFormat; +import org.mxchange.jshopcore.model.basket.AddableBasketItem; + +/** + * An exception thrown when the given item is already added to the basket. + * + * @author Roland Haeder + */ +public class BasketItemAlreadyAddedException extends Exception { + /** + * Serial number + */ + private static final long serialVersionUID = 64_828_391_485_785_167L; + + /** + * Constructor with item instance T + * + * @param Any item that is or extends the interface + * @param item An instance of a 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/CategoryTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java index 4936d65..fa290f4 100644 --- a/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java +++ b/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java @@ -22,7 +22,7 @@ import org.mxchange.jshopcore.model.category.Category; /** * An exception thrown when the given title is already used * - * @author Roland Haeder + * @author Roland Haeder */ public class CategoryTitleAlreadyUsedException extends Exception { /** @@ -39,4 +39,14 @@ public class CategoryTitleAlreadyUsedException extends Exception { // Call super constructor super(MessageFormat.format("Title {0} is already used.", category.getTitle())); //NOI18N } + + /** + * Constructor with HttpServletRequest instance + * + * @param cause Cause for this exception + */ + public CategoryTitleAlreadyUsedException (final Throwable cause) { + // Call super constructor + super(cause); + } } diff --git a/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java index 3191646..53ec406 100644 --- a/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java +++ b/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java @@ -22,7 +22,7 @@ import org.mxchange.jshopcore.model.product.Product; /** * An exception thrown when the given title is already used * - * @author Roland Haeder + * @author Roland Haeder */ public class ProductTitleAlreadyUsedException extends Exception { /** @@ -39,4 +39,14 @@ public class ProductTitleAlreadyUsedException extends Exception { // Call super constructor super(MessageFormat.format("Title {0} is already used.", product.getTitle())); //NOI18N } + + /** + * Constructor with HttpServletRequest instance + * + * @param cause Cause for this exception + */ + public ProductTitleAlreadyUsedException (final Throwable cause) { + // Call super constructor + super(cause); //NOI18N + } } diff --git a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java index db0855a..24997a8 100644 --- a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java +++ b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java @@ -22,66 +22,76 @@ import org.mxchange.jshopcore.model.product.Product; /** * An interface for addable basket items * - * @author Roland Haeder + * @author Roland Haeder */ public interface AddableBasketItem extends Serializable { /** - * Item amount + * Getter for item amount * * @return the amount */ public Long getAmount (); /** - * Item amount + * Setter for item amount * * @param amount the amount to set */ public void setAmount (final Long amount); /** - * Entry id (from database backend) + * Getter for entry id (from database backend) * * @return the id */ public Long getId (); /** - * Entry id (from database backend) + * Setter for entry id (from database backend) * * @param id the id to set */ public void setId (final Long id); /** + * Getter for item id (e.g. from product) + * * @return the id */ public Long getItemId (); /** + * Setter for item id (e.g. from product) + * * @param id the id to set */ public void setItemId (final Long id); /** + * Getter for item type + * * @return the type */ public String getItemType (); /** + * Setter for item type + * * @param type the type to set */ public void setItemType (final String type); /** + * Getter for product instance + * * @return the product */ public Product getProduct (); /** - * Product instance - * + * Setter fo product instance + * * @param product the product to set */ public void setProduct (final Product product); diff --git a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java index 54ac276..f510552 100644 --- a/src/org/mxchange/jshopcore/model/basket/BaseBasket.java +++ b/src/org/mxchange/jshopcore/model/basket/BaseBasket.java @@ -16,13 +16,17 @@ */ package org.mxchange.jshopcore.model.basket; +import java.util.Deque; +import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.Map; +import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException; /** * A general basket class. This class does not store any properties, it only * contains logic for handling the items (T). * - * @author Roland Haeder + * @author Roland Haeder * @param Any instance that implements AddableBasketItem */ public abstract class BaseBasket implements Basket { @@ -31,43 +35,56 @@ public abstract class BaseBasket implements Basket< */ private static final long serialVersionUID = 782_396_762_230_845_717L; + /** + * Ordered item list + */ + private final Deque deque; + /** * Protected constructor with session instance */ protected BaseBasket () { + // Init queue + this.deque = new LinkedList<>(); } @Override - public void init () { - } - - @Override - public void addItem (final T item) { + public void addItem (final T item) throws BasketItemAlreadyAddedException { // item must not be null if (null == item) { // Then abort here throw new NullPointerException("item is null"); //NOI18N } else if (this.isAdded(item)) { // Already been added - throw new IllegalArgumentException("item has already been added. Did you miss to call isAdded()?"); //NOI18N + throw new BasketItemAlreadyAddedException(item); //NOI18N } - // Add item to database - // TODO: ((BasketFrontend) this.getFrontend()).addItem(item, this.getSessionId()); + // Add it here + this.deque.add(item); } @Override public boolean isEmpty () { // Deligate call to frontend - // TODO: return ((BasketFrontend) this.getFrontend()).isEmpty(); - throw new UnsupportedOperationException("Not yet implmeneted."); + return this.deque.isEmpty(); } @Override public Map getAll () { // Init map - // TODO: Map map = ((BasketFrontend) this.getFrontend()).getAll(); - Map map = null; + Map map = new LinkedHashMap<>(this.deque.size()); + + // Iterate over full item list + for (T item : this.deque) { + // item should not be null + if (null == item) { + // Abort here + throw new NullPointerException("item is null"); //NOI18N + } + + // Add to map, use the item's id as key + map.put(item.getItemId(), item); + } // Return it return map; @@ -75,16 +92,17 @@ public abstract class BaseBasket implements Basket< @Override public T getLast () { - // Deligate to frontend - // TODO: return ((BasketFrontend) this.getFrontend()).getLast(); - throw new UnsupportedOperationException("Not yet implmeneted."); + // Deligate to list + return this.deque.getLast(); } @Override public int getLastNumRows () { - // Deligate to frontend - // TODO: return this.getFrontend().getLastNumRows(); - throw new UnsupportedOperationException("Not yet implmeneted."); + // Is the list empty? + assert this.isEmpty() : "deque is empty"; //NOI18N + + // It is size-1 + return (this.deque.size() - 1); } @Override @@ -95,11 +113,7 @@ public abstract class BaseBasket implements Basket< throw new NullPointerException("item is null"); //NOI18N } - // Call map's method - // TODO: boolean isAdded = ((BasketFrontend) this.getFrontend()).isAdded(item, this.getSessionId()); - boolean isAdded = true; - // Return it - return isAdded; + return this.deque.contains(item); } } diff --git a/src/org/mxchange/jshopcore/model/basket/Basket.java b/src/org/mxchange/jshopcore/model/basket/Basket.java index 72d9e07..51f4a58 100644 --- a/src/org/mxchange/jshopcore/model/basket/Basket.java +++ b/src/org/mxchange/jshopcore/model/basket/Basket.java @@ -18,20 +18,23 @@ package org.mxchange.jshopcore.model.basket; import java.io.Serializable; import java.util.Map; +import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException; /** * An interface for baskets * - * @author Roland Haeder + * @author Roland Haeder * @param Any addable basket items */ 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 */ - public void addItem (final T item); + public void addItem (final T item) throws BasketItemAlreadyAddedException; /** * Checks whether the given item as already been added. If the product's @@ -49,11 +52,6 @@ public interface Basket extends Serializable { */ public boolean isEmpty (); - /** - * Initializes this instance with given ServletContext - */ - public void init (); - /** * Some "getter" for all entries in this basket * diff --git a/src/org/mxchange/jshopcore/model/basket/ShopBasket.java b/src/org/mxchange/jshopcore/model/basket/ShopBasket.java index fa5213b..c24221b 100644 --- a/src/org/mxchange/jshopcore/model/basket/ShopBasket.java +++ b/src/org/mxchange/jshopcore/model/basket/ShopBasket.java @@ -16,12 +16,10 @@ */ package org.mxchange.jshopcore.model.basket; -import java.sql.SQLException; - /** * A basket for orderable items * - * @author Roland Haeder + * @author Roland Haeder */ public class ShopBasket extends BaseBasket implements Basket { /** @@ -31,9 +29,8 @@ public class ShopBasket extends BaseBasket implements Basket< /** * Default constructor to be able to throw exceptions from super constructor - * @throws java.sql.SQLException If an SQL error occurs */ - public ShopBasket () throws SQLException { + public ShopBasket () { // Call super constructor super(); } diff --git a/src/org/mxchange/jshopcore/model/category/BaseCategory.java b/src/org/mxchange/jshopcore/model/category/BaseCategory.java index fe5f491..b83b6bb 100644 --- a/src/org/mxchange/jshopcore/model/category/BaseCategory.java +++ b/src/org/mxchange/jshopcore/model/category/BaseCategory.java @@ -21,7 +21,7 @@ import java.util.Objects; /** * A general product category class * - * @author Roland Haeder + * @author Roland Haeder */ public abstract class BaseCategory implements Category, Comparable { /** diff --git a/src/org/mxchange/jshopcore/model/category/Category.java b/src/org/mxchange/jshopcore/model/category/Category.java index d0432fd..a1c4962 100644 --- a/src/org/mxchange/jshopcore/model/category/Category.java +++ b/src/org/mxchange/jshopcore/model/category/Category.java @@ -21,7 +21,7 @@ import java.io.Serializable; /** * An interface for categories * - * @author Roland Haeder + * @author Roland Haeder */ public interface Category extends Serializable { diff --git a/src/org/mxchange/jshopcore/model/category/ProductCategory.java b/src/org/mxchange/jshopcore/model/category/ProductCategory.java index 9bd2a61..d89077f 100644 --- a/src/org/mxchange/jshopcore/model/category/ProductCategory.java +++ b/src/org/mxchange/jshopcore/model/category/ProductCategory.java @@ -18,7 +18,7 @@ package org.mxchange.jshopcore.model.category; /** * A product category - * @author Roland Haeder + * @author Roland Haeder */ public class ProductCategory extends BaseCategory { /** diff --git a/src/org/mxchange/jshopcore/model/customer/Customer.java b/src/org/mxchange/jshopcore/model/customer/Customer.java index 4524d65..21cf303 100644 --- a/src/org/mxchange/jshopcore/model/customer/Customer.java +++ b/src/org/mxchange/jshopcore/model/customer/Customer.java @@ -21,7 +21,7 @@ import org.mxchange.jcore.model.contact.Contact; /** * A customer interface * - * @author Roland Haeder + * @author Roland Haeder */ public interface Customer extends Contact { } diff --git a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java index 209dd71..3e0e0cf 100644 --- a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java +++ b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java @@ -21,7 +21,7 @@ import org.mxchange.jcore.model.contact.BaseContact; /** * A shop customer class. * - * @author Roland Haeder + * @author Roland Haeder */ public class ShopCustomer extends BaseContact implements Customer { /** diff --git a/src/org/mxchange/jshopcore/model/item/BaseItem.java b/src/org/mxchange/jshopcore/model/item/BaseItem.java index b788238..7a8d50c 100644 --- a/src/org/mxchange/jshopcore/model/item/BaseItem.java +++ b/src/org/mxchange/jshopcore/model/item/BaseItem.java @@ -24,7 +24,7 @@ import org.mxchange.jshopcore.model.product.Product; * An item (addedable to a basket) could respresent a product or a discount * coupon. This depends on the type of the item. * - * @author Roland Haeder + * @author Roland Haeder */ public abstract class BaseItem implements AddableBasketItem, Comparable { diff --git a/src/org/mxchange/jshopcore/model/item/BasketItem.java b/src/org/mxchange/jshopcore/model/item/BasketItem.java index a56ccc2..0e19354 100644 --- a/src/org/mxchange/jshopcore/model/item/BasketItem.java +++ b/src/org/mxchange/jshopcore/model/item/BasketItem.java @@ -22,7 +22,7 @@ import org.mxchange.jshopcore.model.product.Product; /** * A general basket item * - * @author Roland Haeder + * @author Roland Haeder */ public class BasketItem extends BaseItem implements AddableBasketItem { /** diff --git a/src/org/mxchange/jshopcore/model/product/BaseProduct.java b/src/org/mxchange/jshopcore/model/product/BaseProduct.java index a2fb9b2..1120636 100644 --- a/src/org/mxchange/jshopcore/model/product/BaseProduct.java +++ b/src/org/mxchange/jshopcore/model/product/BaseProduct.java @@ -10,7 +10,7 @@ import java.util.Objects; /** * A general product class * - * @author Roland Haeder + * @author Roland Haeder */ public abstract class BaseProduct implements Product, Comparable { diff --git a/src/org/mxchange/jshopcore/model/product/GenericProduct.java b/src/org/mxchange/jshopcore/model/product/GenericProduct.java index ecd215a..a7e8f88 100644 --- a/src/org/mxchange/jshopcore/model/product/GenericProduct.java +++ b/src/org/mxchange/jshopcore/model/product/GenericProduct.java @@ -19,7 +19,7 @@ package org.mxchange.jshopcore.model.product; /** * Generic product class * - * @author Roland Haeder + * @author Roland Haeder * TODO: Find a better name */ public class GenericProduct extends BaseProduct implements Product { diff --git a/src/org/mxchange/jshopcore/model/product/Product.java b/src/org/mxchange/jshopcore/model/product/Product.java index efcdd7b..79b94f9 100644 --- a/src/org/mxchange/jshopcore/model/product/Product.java +++ b/src/org/mxchange/jshopcore/model/product/Product.java @@ -21,7 +21,7 @@ import java.io.Serializable; /** * An interface for in database storable products * - * @author Roland Haeder + * @author Roland Haeder */ public interface Product extends Serializable { /** -- 2.39.5