X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Fjshopcore%2Fmodel%2Fitem%2FBaseItem.java;h=d2895c6533a071246e7db34c659f7af2f496f4b8;hb=ea2ac9942269d6155aaf6dc62213791c1bb15984;hp=213ac7fc9f41d3620c91348ca5f63fdc0869f68a;hpb=6b9f17d0a9ac8377e24651fb9f48e2d3ce7de94e;p=jcustomer-core.git diff --git a/src/org/mxchange/jshopcore/model/item/BaseItem.java b/src/org/mxchange/jshopcore/model/item/BaseItem.java index 213ac7f..d2895c6 100644 --- a/src/org/mxchange/jshopcore/model/item/BaseItem.java +++ b/src/org/mxchange/jshopcore/model/item/BaseItem.java @@ -18,7 +18,8 @@ package org.mxchange.jshopcore.model.item; import java.text.MessageFormat; import java.util.Objects; -import org.mxchange.jcore.BaseFrameworkSystem; +import org.mxchange.jcoreee.BaseEeSystem; +import org.mxchange.jshopcore.model.basket.AddableBasketItem; import org.mxchange.jshopcore.model.product.Product; /** @@ -27,7 +28,12 @@ import org.mxchange.jshopcore.model.product.Product; * * @author Roland Haeder */ -public abstract class BaseItem extends BaseFrameworkSystem implements AddableBasketItem { +public abstract class BaseItem extends BaseEeSystem implements AddableBasketItem, Comparable { + /** + * Serial number + */ + private static final long serialVersionUID = 24_348_671_457_829_156L; + /** * Entry id (from database backend) */ @@ -53,23 +59,10 @@ public abstract class BaseItem extends BaseFrameworkSystem implements AddableBas */ private Product product; - @Override - public Float calculateTotalPrice () { - // product should be set - if (this.getProduct() == null) { - // Abort here - throw new NullPointerException("product is null"); //NOI18N - } - - // Calculate and return it - // TODO: If later other purchaseable items (other than products) are handled through this class, this needs expansion - return (this.getAmount() * this.getProduct().getPrice()); - } - @Override public int compareTo (final AddableBasketItem item) { // Trace message - this.getLogger().trace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N + this.getLogger().logTrace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N // item should not be null if (null == item) { @@ -77,7 +70,7 @@ public abstract class BaseItem extends BaseFrameworkSystem implements AddableBas } // Debug message - this.getLogger().debug(MessageFormat.format("this.itemId={0},item.itemId={1}", this.getItemId(), item.getItemId())); //NOI18N + this.getLogger().logDebug(MessageFormat.format("this.itemId={0},item.itemId={1}", this.getItemId(), item.getItemId())); //NOI18N // Is the id the same? if (Objects.equals(this.getItemId(), item.getItemId())) { @@ -132,17 +125,11 @@ public abstract class BaseItem extends BaseFrameworkSystem implements AddableBas this.itemType = itemType; } - /** - * @return the product - */ @Override public Product getProduct () { return this.product; } - /** - * @param product the product to set - */ @Override public void setProduct (final Product product) { this.product = product;