From e7033016cdc804552134aa7b50519f3070649ffc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 15 Apr 2017 19:08:25 +0200 Subject: [PATCH] Continued: - some classes, interfaces, events and exceptions were not shop-specific and can be moved out to new project jproduct-core (same later with jshop-ee-lib). - for example, jfiancials will not use shopping basket class but may only need product and category classes/interfaces. Then it is better to have these moved out to separate project. - commons-codec is now referenced as library, not a single JAR - jproduct-core added MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../commons-codec-1.10.jar | Bin lib/jproduct-core.jar | Bin 0 -> 22741 bytes lib/nblibraries.properties | 5 + nbproject/project.properties | 6 +- .../events/category/AddedCategoryEvent.java | 36 ---- .../category/ShopCategoryAddedEvent.java | 69 ------ .../events/product/AddedProductEvent.java | 36 ---- .../events/product/ShopProductAddedEvent.java | 78 ------- .../CannotAddCategoryException.java | 41 ---- .../exceptions/CannotAddProductException.java | 41 ---- .../CategoryTitleAlreadyUsedException.java | 43 ---- .../ProductTitleAlreadyUsedException.java | 43 ---- .../model/basket/AddableBasketItem.java | 2 +- .../model/basket/items/BaseItem.java | 2 +- .../model/basket/items/BasketItem.java | 6 +- .../jshopcore/model/category/Category.java | 83 -------- .../model/category/ProductCategory.java | 156 -------------- .../model/order/items/OrderItem.java | 4 +- .../jshopcore/model/payment/PaymentType.java | 43 ---- .../model/product/GenericProduct.java | 196 ------------------ .../jshopcore/model/product/Product.java | 112 ---------- 21 files changed, 16 insertions(+), 986 deletions(-) rename lib/{ => commons-codec}/commons-codec-1.10.jar (100%) create mode 100644 lib/jproduct-core.jar delete mode 100644 src/org/mxchange/jshopcore/events/category/AddedCategoryEvent.java delete mode 100644 src/org/mxchange/jshopcore/events/category/ShopCategoryAddedEvent.java delete mode 100644 src/org/mxchange/jshopcore/events/product/AddedProductEvent.java delete mode 100644 src/org/mxchange/jshopcore/events/product/ShopProductAddedEvent.java delete mode 100644 src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java delete mode 100644 src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java delete mode 100644 src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java delete mode 100644 src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java delete mode 100644 src/org/mxchange/jshopcore/model/category/Category.java delete mode 100644 src/org/mxchange/jshopcore/model/category/ProductCategory.java delete mode 100644 src/org/mxchange/jshopcore/model/payment/PaymentType.java delete mode 100644 src/org/mxchange/jshopcore/model/product/GenericProduct.java delete mode 100644 src/org/mxchange/jshopcore/model/product/Product.java diff --git a/lib/commons-codec-1.10.jar b/lib/commons-codec/commons-codec-1.10.jar similarity index 100% rename from lib/commons-codec-1.10.jar rename to lib/commons-codec/commons-codec-1.10.jar diff --git a/lib/jproduct-core.jar b/lib/jproduct-core.jar new file mode 100644 index 0000000000000000000000000000000000000000..3c8ae0768c4fa2ec6ccd58b0655001fed291653a GIT binary patch literal 22741 zcmeHPYiwM{bv}2w7EO8}ECb^VIQKH@tlcGqQvM5m^C5N&d`D%GhuC&~x zcbBqcI}ayz(#EkJ#4ZpAZGSY5(H3su$dT$zgh~@_{h}I_OX+r zeV_cCXrfTG7exoY|Legliu0!hpF+{`p_5~yBa>6T!ZV2%gkFd+mBx3^80#sT-e{gecvJu7yAdc@8V;u z>r~cEq^#I*CcBWynt2fKu8-D79Ul9><84kDJZ7@9eZ@=Es}l296LV&I)+$l7&0qA= zLN+tAn8=rSXG76jhdTgp_vU|yTYD3oBLEQLS`xW8*;x<(`7&yk`$CO@7n@E|t+|NJxi@yYsT~w!2M5kJvq8c^MT6xb48ufQ|pI~7xh;l(b zeH~`kaZsb^WM(m&utt+9OQUuVLCL`-^NOj_zF@lLTL4CxLSG7VtMAmsOI9MUQHyw# z%=ArK*`%3DK5br1S?DW`Likjnty)-vBC6&qs=+Ztx-*4&qWmVl^{=+#8~#+@!*;_( zJA-<7JW8vmOQ-G##iOXTr;f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c_>+TWst8;u2<|X{Jmb{z?T0F>MfI0WzPg4. - */ -package org.mxchange.jshopcore.events.category; - -import java.io.Serializable; -import org.mxchange.jshopcore.model.category.Category; - -/** - * An interface for added category events - *

- * @author Roland Häder - */ -public interface AddedCategoryEvent extends Serializable { - - /** - * Getter for added category instance - *

- * @return Added category instance - */ - public Category getAddedCategory (); - -} diff --git a/src/org/mxchange/jshopcore/events/category/ShopCategoryAddedEvent.java b/src/org/mxchange/jshopcore/events/category/ShopCategoryAddedEvent.java deleted file mode 100644 index 3f5ba06..0000000 --- a/src/org/mxchange/jshopcore/events/category/ShopCategoryAddedEvent.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jshopcore.events.category; - -import java.text.MessageFormat; -import org.mxchange.jshopcore.model.category.Category; - -/** - * An event fired when a new shop category has been added. - *

- * @author Roland Häder - */ -public class ShopCategoryAddedEvent implements AddedCategoryEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 83_275_471_765_091_760L; - - /** - * Category instance that has been added - */ - private final Category addedCategory; - - /** - * Constructor with added category instance - *

- * @param addedCategory Added category - */ - public ShopCategoryAddedEvent (final Category addedCategory) { - // The category should be valid - if (null == addedCategory) { - // Is NULL, throw NPE - throw new NullPointerException("addedCategory is null"); //NOI18N - } else if (addedCategory.getCategoryTitle().isEmpty()) { - // Empty title - throw new IllegalArgumentException("addedCategory.categoryTitle is empty"); //NOI18N - } else if (addedCategory.getCategoryId() == null) { - // Id is NULL - throw new NullPointerException("addedCategory.categoryId is null"); //NOI18N - } else if (addedCategory.getCategoryId() <= 0) { - // Not valid id - throw new IllegalArgumentException(MessageFormat.format("addedCategory.categoryId={0} is not valid.", addedCategory.getCategoryId())); //NOI18N - } - - // Set it here - this.addedCategory = addedCategory; - } - - @Override - public Category getAddedCategory () { - return this.addedCategory; - } - -} diff --git a/src/org/mxchange/jshopcore/events/product/AddedProductEvent.java b/src/org/mxchange/jshopcore/events/product/AddedProductEvent.java deleted file mode 100644 index eb9b51f..0000000 --- a/src/org/mxchange/jshopcore/events/product/AddedProductEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jshopcore.events.product; - -import java.io.Serializable; -import org.mxchange.jshopcore.model.product.Product; - -/** - * An interface for added product events - *

- * @author Roland Häder - */ -public interface AddedProductEvent extends Serializable { - - /** - * Getter for added product instance - *

- * @return Added product instance - */ - public Product getAddedProduct (); - -} diff --git a/src/org/mxchange/jshopcore/events/product/ShopProductAddedEvent.java b/src/org/mxchange/jshopcore/events/product/ShopProductAddedEvent.java deleted file mode 100644 index 68f80e0..0000000 --- a/src/org/mxchange/jshopcore/events/product/ShopProductAddedEvent.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jshopcore.events.product; - -import java.text.MessageFormat; -import org.mxchange.jshopcore.model.product.Product; - -/** - * An event fired when a new shop category has been added. - *

- * @author Roland Häder - */ -public class ShopProductAddedEvent implements AddedProductEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 18_567_817_669_107L; - - /** - * Product instance that has been added - */ - private final Product addedProduct; - - /** - * Constructor with added product instance - *

- * @param addedProduct Added product - */ - public ShopProductAddedEvent (final Product addedProduct) { - // The category should be valid - if (null == addedProduct) { - // Is NULL, throw NPE - throw new NullPointerException("addedProduct is null"); //NOI18N - } else if (addedProduct.getProductTitle().isEmpty()) { - // Empty title - throw new IllegalArgumentException("addedProduct.categoryTitle is empty"); //NOI18N - } else if (addedProduct.getProductId() == null) { - // Id is NULL - throw new NullPointerException("addedProduct.productId is null"); //NOI18N - } else if (addedProduct.getProductId() <= 0) { - // Not valid id - throw new IllegalArgumentException(MessageFormat.format("addedProduct.productId={0} is not valid.", addedProduct.getProductId())); //NOI18N - } else if (addedProduct.getProductCategory() == null) { - // Id is NULL - throw new NullPointerException("addedProduct.productCategory is null"); //NOI18N - } else if (addedProduct.getProductCategory().getCategoryId() == null) { - // Id is NULL - throw new NullPointerException("addedProduct.productCategory.categoryId is null"); //NOI18N - } else if (addedProduct.getProductCategory().getCategoryId() <= 0) { - // Not valid id - throw new IllegalArgumentException(MessageFormat.format("addedProduct.productCategory.categoryId={0} is not valid.", addedProduct.getProductId())); //NOI18N - } - - // Set it here - this.addedProduct = addedProduct; - } - - @Override - public Product getAddedProduct () { - return this.addedProduct; - } - -} diff --git a/src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java b/src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java deleted file mode 100644 index f1b89d7..0000000 --- a/src/org/mxchange/jshopcore/exceptions/CannotAddCategoryException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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; - -/** - * An exception thrown when the category cannot be added for a "low level" - * reason. - *

- * @author Roland Häder - */ -public class CannotAddCategoryException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 34_295_843_957_951L; - - /** - * Constructor with cause - *

- * @param cause Causing exception - */ - public CannotAddCategoryException (final Throwable cause) { - // Call super constructor - super(cause); - } -} diff --git a/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java b/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java deleted file mode 100644 index 2bcb67b..0000000 --- a/src/org/mxchange/jshopcore/exceptions/CannotAddProductException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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; - -/** - * An exception thrown when the product cannot be added for a "low level" - * reason. - *

- * @author Roland Häder - */ -public class CannotAddProductException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 48_574_857_485_748_175L; - - /** - * Constructor with cause - *

- * @param cause Causing exception - */ - public CannotAddProductException (final Throwable cause) { - // Call super constructor - super(cause); - } -} diff --git a/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java deleted file mode 100644 index 54bb530..0000000 --- a/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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.text.MessageFormat; -import org.mxchange.jshopcore.model.category.Category; - -/** - * An exception thrown when the given title is already used - *

- * @author Roland Häder - */ -public class CategoryTitleAlreadyUsedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 53_751_434_673_262L; - - /** - * Constructor with HttpServletRequest instance - *

- * @param category Category instance - */ - public CategoryTitleAlreadyUsedException (final Category category) { - // Call super constructor - super(MessageFormat.format("Title {0} is already used.", category.getCategoryTitle())); //NOI18N - } -} diff --git a/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java deleted file mode 100644 index 1c0bef3..0000000 --- a/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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.text.MessageFormat; -import org.mxchange.jshopcore.model.product.Product; - -/** - * An exception thrown when the given title is already used - *

- * @author Roland Häder - */ -public class ProductTitleAlreadyUsedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 4_252_734_834_174L; - - /** - * Constructor with HttpServletRequest instance - *

- * @param product Product instance - */ - public ProductTitleAlreadyUsedException (final Product product) { - // Call super constructor - super(MessageFormat.format("Title {0} is already used.", product.getProductTitle())); //NOI18N - } -} diff --git a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java index c7f0556..9ee92c0 100644 --- a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java +++ b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java @@ -17,7 +17,7 @@ package org.mxchange.jshopcore.model.basket; import java.io.Serializable; -import org.mxchange.jshopcore.model.product.Product; +import org.mxchange.jproduct.model.product.Product; /** * An interface for addable basket items diff --git a/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java b/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java index 734fd85..269dbc4 100644 --- a/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java +++ b/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java @@ -17,8 +17,8 @@ package org.mxchange.jshopcore.model.basket.items; import java.util.Objects; +import org.mxchange.jproduct.model.product.Product; import org.mxchange.jshopcore.model.basket.AddableBasketItem; -import org.mxchange.jshopcore.model.product.Product; /** * An item (addable to a basket) could represent a product or a discount coupon. diff --git a/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java b/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java index 6915615..fd00cc9 100644 --- a/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java +++ b/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java @@ -27,9 +27,9 @@ import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Transient; +import org.mxchange.jproduct.model.product.GenericProduct; +import org.mxchange.jproduct.model.product.Product; import org.mxchange.jshopcore.model.basket.AddableBasketItem; -import org.mxchange.jshopcore.model.product.GenericProduct; -import org.mxchange.jshopcore.model.product.Product; /** * A general basket item @@ -108,7 +108,7 @@ public class BasketItem extends BaseItem implements AddableBasketItem { * Constructor for an item from given Product instance and orderedAmount. *

* @param product Product instance - * @param amount Ordered orderedAmount + * @param amount Ordered orderedAmount */ public BasketItem (final Product product, final Long amount) { // Other constructor diff --git a/src/org/mxchange/jshopcore/model/category/Category.java b/src/org/mxchange/jshopcore/model/category/Category.java deleted file mode 100644 index 65136b7..0000000 --- a/src/org/mxchange/jshopcore/model/category/Category.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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.io.Serializable; - -/** - * An interface for categories - *

- * @author Roland Häder - */ -public interface Category extends Serializable { - - /** - * Copies all properties from other category to this - *

- * @param category Source category instance - */ - void copyAll (final Category category); - - /** - * Id number of category - *

- * @return the id - */ - Long getCategoryId (); - - /** - * Id number of category - *

- * @param id the id to set - */ - void setCategoryId (final Long id); - - /** - * Parent category - *

- * @return the parent category - */ - Category getParentCategory (); - - /** - * Parent category - *

- * @param parentCategory the parent category to set - */ - void setParentCategory (final Category parentCategory); - - /** - * Title of category - *

- * @return the title - */ - String getCategoryTitle (); - - /** - * Title of category - *

- * @param title the title to set - */ - void setCategoryTitle (final String title); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jshopcore/model/category/ProductCategory.java b/src/org/mxchange/jshopcore/model/category/ProductCategory.java deleted file mode 100644 index 3549757..0000000 --- a/src/org/mxchange/jshopcore/model/category/ProductCategory.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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.CascadeType; -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 javax.persistence.Transient; - -/** - * A product category - *

- * @author Roland Häder - */ -@Entity (name = "category") -@Table (name = "category") -@SuppressWarnings ("PersistenceUnitPresent") -public class ProductCategory implements Category { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 21_458_945_712_659L; - - /** - * Id number of category - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "category_id", nullable = false) - private Long categoryId; - - /** - * Title of category - */ - @Basic (optional = false) - @Column (name = "category_title", length = 100, nullable = false, unique = true) - private String categoryTitle; - - /** - * Parent category - */ - @JoinColumn (name = "parent_id") - @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH) - private Category parentCategory; - - /** - * Constructor which accepts all database fields - *

- * @param categoryId Id number of database record - * @param categoryTitle Category categoryTitle - * @param parentCategory Parent category - */ - public ProductCategory (final Long categoryId, final String categoryTitle, final Category parentCategory) { - // Set all here - this.categoryId = categoryId; - this.categoryTitle = categoryTitle; - this.parentCategory = parentCategory; - } - - /** - * Default constructor - */ - public ProductCategory () { - } - - @Override - public void copyAll (final Category category) { - // Copy all data - this.setParentCategory(category.getParentCategory()); - this.setCategoryTitle(category.getCategoryTitle()); - } - - @Override - public boolean equals (final Object object) { - if (this == object) { - return true; - } else if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final Category other = (Category) object; - - if (!Objects.equals(this.getCategoryTitle(), other.getCategoryTitle())) { - return false; - } else if (!Objects.equals(this.getCategoryId(), other.getCategoryId())) { - return false; - } - - return true; - } - - @Override - public int hashCode () { - int hash = 7; - hash = 13 * hash + Objects.hashCode(this.getCategoryId()); - hash = 13 * hash + Objects.hashCode(this.getCategoryTitle()); - return hash; - } - - @Override - public Long getCategoryId () { - return this.categoryId; - } - - @Override - public void setCategoryId (final Long categoryId) { - this.categoryId = categoryId; - } - - @Override - public String getCategoryTitle () { - return this.categoryTitle; - } - - @Override - public void setCategoryTitle (final String categoryTitle) { - this.categoryTitle = categoryTitle; - } - - @Override - public Category getParentCategory () { - return this.parentCategory; - } - - @Override - public void setParentCategory (final Category parentCategory) { - this.parentCategory = parentCategory; - } - -} diff --git a/src/org/mxchange/jshopcore/model/order/items/OrderItem.java b/src/org/mxchange/jshopcore/model/order/items/OrderItem.java index 4e79768..e1d24e1 100644 --- a/src/org/mxchange/jshopcore/model/order/items/OrderItem.java +++ b/src/org/mxchange/jshopcore/model/order/items/OrderItem.java @@ -29,10 +29,10 @@ import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Transient; +import org.mxchange.jproduct.model.product.GenericProduct; +import org.mxchange.jproduct.model.product.Product; 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 diff --git a/src/org/mxchange/jshopcore/model/payment/PaymentType.java b/src/org/mxchange/jshopcore/model/payment/PaymentType.java deleted file mode 100644 index 55c46bd..0000000 --- a/src/org/mxchange/jshopcore/model/payment/PaymentType.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2017 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.payment; - -/** - * Payment types - *

- * @author Roland Haeder - */ -public enum PaymentType { - - /** - * Payment type "cash" - */ - PAYMENT_TYPE_CASH, - /** - * Payment type "credit card" - */ - PAYMENT_TYPE_CREDIT_CARD, - /** - * Payment type "prepayment" - */ - PAYMENT_TYPE_PREPAYMENT, - /** - * Payment type "invoice" - */ - PAYMENT_TYPE_INVOICE; - -} diff --git a/src/org/mxchange/jshopcore/model/product/GenericProduct.java b/src/org/mxchange/jshopcore/model/product/GenericProduct.java deleted file mode 100644 index febde61..0000000 --- a/src/org/mxchange/jshopcore/model/product/GenericProduct.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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.product; - -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -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 javax.persistence.Transient; -import org.mxchange.jshopcore.model.category.Category; -import org.mxchange.jshopcore.model.category.ProductCategory; - -/** - * Generic product class - *

- * @author Roland Häder - * TODO: Find a better name - */ -@Entity (name = "products") -@Table (name = "products") -@SuppressWarnings ("PersistenceUnitPresent") -public class GenericProduct implements Product { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 54_578_571_769_283L; - - /** - * Availability of product - */ - @Column (name = "product_availability", nullable = false) - private Boolean productAvailability; - - /** - * Product productCategory - */ - @JoinColumn (name = "category_id", nullable = false, updatable = false) - @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH, optional = false) - private Category productCategory; - - /** - * Id number of product - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "product_id", nullable = false, updatable = false) - private Long productId; - - /** - * Price of product - */ - @Basic (optional = false) - @Column (name = "product_price", nullable = false) - private Float productPrice; - - /** - * Title of product - */ - @Basic (optional = false) - @Column (name = "product_title", length = 100, nullable = false) - private String productTitle; - - /** - * Default constructor - */ - public GenericProduct () { - } - - /** - * Constructor will all required data - *

- * @param productId Id number of product - * @param productTitle Name of product - * @param productPrice Price - * @param productCategory Category instance - * @param productAvailability Availability (selectable by customer) - */ - public GenericProduct (final Long productId, final String productTitle, final Float productPrice, final Category productCategory, final Boolean productAvailability) { - // Set all here - this.productId = productId; - this.productTitle = productTitle; - this.productPrice = productPrice; - this.productCategory = productCategory; - this.productAvailability = productAvailability; - } - - @Override - public void copyAll (final Product product) { - // Copy all - this.setProductAvailability(product.getProductAvailability()); - this.setProductCategory(product.getProductCategory()); - this.setProductPrice(product.getProductPrice()); - this.setProductTitle(product.getProductTitle()); - } - - @Override - public boolean equals (final Object object) { - if (this == object) { - return true; - } else if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final Product other = (Product) object; - - if (!Objects.equals(this.getProductTitle(), other.getProductTitle())) { - return false; - } - - return Objects.equals(this.getProductId(), other.getProductId()); - } - - @Override - public int hashCode () { - int hash = 7; - hash = 23 * hash + Objects.hashCode(this.getProductId()); - hash = 23 * hash + Objects.hashCode(this.getProductTitle()); - return hash; - } - - @Override - public Boolean getProductAvailability () { - return this.productAvailability; - } - - @Override - public void setProductAvailability (final Boolean productAvailability) { - this.productAvailability = productAvailability; - } - - @Override - public Category getProductCategory () { - return this.productCategory; - } - - @Override - public void setProductCategory (final Category productCategory) { - this.productCategory = productCategory; - } - - @Override - public Long getProductId () { - return this.productId; - } - - @Override - public void setProductId (final Long productId) { - this.productId = productId; - } - - @Override - public Float getProductPrice () { - return this.productPrice; - } - - @Override - public void setProductPrice (final Float productPrice) { - this.productPrice = productPrice; - } - - @Override - public String getProductTitle () { - return this.productTitle; - } - - @Override - public void setProductTitle (final String productTitle) { - this.productTitle = productTitle; - } - -} diff --git a/src/org/mxchange/jshopcore/model/product/Product.java b/src/org/mxchange/jshopcore/model/product/Product.java deleted file mode 100644 index 0347f33..0000000 --- a/src/org/mxchange/jshopcore/model/product/Product.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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.product; - -import java.io.Serializable; -import org.mxchange.jshopcore.model.category.Category; - -/** - * An interface for in database storable products - *

- * @author Roland Häder - */ -public interface Product extends Serializable { - - /** - * Copies all properties from source product to this. - *

- * @param product Source product - */ - void copyAll (final Product product); - - /** - * Getter for product availability - *

- * @return Product availability - */ - Boolean getProductAvailability (); - - /** - * Setter for product availability - *

- * @param productAvailability Product availability - */ - void setProductAvailability (final Boolean productAvailability); - - /** - * Getter for product category id - *

- * @return Product category id - */ - Category getProductCategory (); - - /** - * Setter for product category - *

- * @param productCategory Product category - */ - void setProductCategory (final Category productCategory); - - /** - * Getter for id number, suitable for form fields. - *

- * @return Id number of product - */ - Long getProductId (); - - /** - * Id number of product - *

- * @param productId the id number to set - */ - void setProductId (final Long productId); - - /** - * Getter for raw price. - *

- * @return Single price of product - */ - Float getProductPrice (); - - /** - * Price of product - *

- * @param productPrice the price to set - */ - void setProductPrice (final Float productPrice); - - /** - * Getter for title. - *

- * @return Title of product - */ - String getProductTitle (); - - /** - * Title of product - *

- * @param productTitle the title to set - */ - void setProductTitle (final String productTitle); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} -- 2.39.5