2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
6 package org.mxchange.jshopcore.model.product;
8 import java.text.MessageFormat;
9 import java.util.Objects;
10 import org.mxchange.jcoreee.BaseEeSystem;
13 * A general product class
15 * @author Roland Haeder
17 public abstract class BaseProduct extends BaseEeSystem implements Product, Comparable<Product> {
21 private static final long serialVersionUID = 48_379_575_267_451L;
24 * Availability of product
26 private Boolean available;
31 private Long categoryId;
34 * Id number of product item
49 public int compareTo (final Product product) {
51 this.getLogger().logTrace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
53 // category should not be null
54 if (null == product) {
55 throw new NullPointerException("product is null"); //NOI18N
59 this.getLogger().logDebug(MessageFormat.format("this.id={0},product.id={1}", this.getItemId(), product.getItemId())); //NOI18N
61 // Is the id the same?
62 if (Objects.equals(this.getItemId(), product.getItemId())) {
63 // Same id, means same category
65 } else if (this.getItemId() > product.getItemId()) {
66 // This id is larger than compared to
70 // The other id is larger
75 public Boolean getAvailable () {
76 return this.available;
80 public void setAvailable (final Boolean available) {
81 this.available = available;
85 public Long getCategoryId () {
86 return this.categoryId;
90 public void setCategoryId (final Long categoryId) {
91 this.categoryId = categoryId;
95 public Long getItemId () {
100 public void setItemId (final Long itemId) {
101 this.itemId = itemId;
105 public Float getPrice () {
110 public void setPrice (final Float price) {
115 public String getTitle () {
120 public void setTitle (final String title) {