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;
/**
*
* @author Roland Haeder
*/
-public abstract class BaseItem extends BaseFrameworkSystem implements AddableBasketItem {
+public abstract class BaseItem extends BaseEeSystem implements AddableBasketItem, Comparable<AddableBasketItem> {
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 24_348_671_457_829_156L;
+
/**
* Entry id (from database backend)
*/
*/
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) {
}
// 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())) {
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;