+++ /dev/null
-/*
- * Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore;
-
-import org.mxchange.jcore.BaseFrameworkSystem;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * A general shop class
- *
- * @author Roland Haeder
- */
-public class BaseShopCore extends BaseFrameworkSystem implements ShopInterface {
- /**
- * Item instance
- */
- private Product product;
-
- /**
- * @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;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2015 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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore;
-
-import org.mxchange.jcore.FrameworkInterface;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * A general shop interface
- *
- * @author Roland Haeder
- */
-public interface ShopInterface extends FrameworkInterface {
- /**
- * @return the product
- */
- public Product getProduct ();
-
- /**
- * @param product the product to set
- */
- public void setProduct (final Product product);
-}
/**
* Serial number
*/
- private static final long serialVersionUID = 53751434673262L;
+ private static final long serialVersionUID = 53_751_434_673_262L;
/**
* Constructor with HttpServletRequest instance
/**
* Serial number
*/
- private static final long serialVersionUID = 4252734834174L;
+ private static final long serialVersionUID = 4_252_734_834_174L;
/**
* Constructor with HttpServletRequest instance
import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.Map;
-import org.mxchange.jshopcore.BaseShopCore;
+import org.mxchange.jcore.BaseFrameworkSystem;
import org.mxchange.jshopcore.model.item.AddableBasketItem;
/**
* @author Roland Haeder
* @param <T> Any instance that implements AddableBasketItem
*/
-public class BaseBasket<T extends AddableBasketItem> extends BaseShopCore implements Basket<T>, Serializable {
+public abstract class BaseBasket<T extends AddableBasketItem> extends BaseFrameworkSystem implements Basket<T>, Serializable {
/**
* Serial number
*/
- private static final long serialVersionUID = 784396762230845717L;
+ private static final long serialVersionUID = 784_396_762_230_845_717L;
/**
* Protected constructor with session instance
this.getLogger().trace("CALLED!"); //NOI18N
// Is the bundle initialized?
- if (!BaseShopCore.isBundledInitialized()) {
+ if (!BaseFrameworkSystem.isBundledInitialized()) {
// Temporary initialize default bundle
// TODO The enum Gender uses this
this.initBundle();
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.Map;
-import org.mxchange.jshopcore.ShopInterface;
+import org.mxchange.jcore.FrameworkInterface;
import org.mxchange.jshopcore.model.item.AddableBasketItem;
/**
* @author Roland Haeder
* @param <T> Any addable basket items
*/
-public interface Basket<T extends AddableBasketItem> extends Serializable, ShopInterface {
+public interface Basket<T extends AddableBasketItem> extends FrameworkInterface, Serializable {
/**
* Adds given item instance to this basket
/**
* Serial number
*/
- private static final long serialVersionUID = 4384123923163957L;
+ private static final long serialVersionUID = 4_384_123_923_163_957L;
/**
* Default constructor to be able to throw exceptions from super constructor
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
import java.util.Objects;
-import org.mxchange.jshopcore.BaseShopCore;
+import org.mxchange.jcore.BaseFrameworkSystem;
/**
* A general product category class
*
* @author Roland Haeder
*/
-public class BaseCategory extends BaseShopCore implements Category {
+public abstract class BaseCategory extends BaseFrameworkSystem implements Category {
/**
* Id number of category
*/
protected BaseCategory (final Long categoryId, final String title, final Long parentId) {
// Set all here
- this.setCategoryId(categoryId);
- this.setTitle(title);
- this.setParentId(parentId);
+ this.categoryId = categoryId;
+ this.title = title;
+ this.parentId = parentId;
}
/**
* @return Decoded title
*/
@Override
- public final String getDecodedTitle () throws UnsupportedEncodingException {
+ public String getDecodedTitle () throws UnsupportedEncodingException {
// Get title
byte[] t = this.getTitle().getBytes();
* @return the categoryId
*/
@Override
- public final Long getCategoryId () {
+ public Long getCategoryId () {
return this.categoryId;
}
* @param categoryId the categoryId to set
*/
@Override
- public final void setCategoryId (final Long categoryId) {
+ public void setCategoryId (final Long categoryId) {
this.categoryId = categoryId;
}
* @return the parentId
*/
@Override
- public final Long getParentId () {
+ public Long getParentId () {
return this.parentId;
}
* @param parentId the parentId to set
*/
@Override
- public final void setParentId (final Long parentId) {
+ public void setParentId (final Long parentId) {
this.parentId = parentId;
}
* @return the title
*/
@Override
- public final String getTitle () {
+ public String getTitle () {
return this.title;
}
* @param title the title to set
*/
@Override
- public final void setTitle (final String title) {
+ public void setTitle (final String title) {
this.title = title;
}
}
package org.mxchange.jshopcore.model.category;
import java.io.UnsupportedEncodingException;
-import org.mxchange.jshopcore.ShopInterface;
+import org.mxchange.jcore.FrameworkInterface;
/**
* An interface for categories
*
* @author Roland Haeder
*/
-public interface Category extends ShopInterface, Comparable<Category> {
+public interface Category extends FrameworkInterface, Comparable<Category> {
/**
* Id number of category
*/
package org.mxchange.jshopcore.model.item;
-import org.mxchange.jshopcore.ShopInterface;
+import org.mxchange.jcore.FrameworkInterface;
+import org.mxchange.jshopcore.model.product.Product;
/**
* An interface for addable basket items
*
* @author Roland Haeder
*/
-public interface AddableBasketItem extends ShopInterface, Comparable<AddableBasketItem> {
+public interface AddableBasketItem extends FrameworkInterface, Comparable<AddableBasketItem> {
/**
* Item amount
*/
public Float calculateTotalPrice ();
+ /**
+ * @return the product
+ */
+ public Product getProduct ();
+
+ /**
+ * @param product the product to set
+ */
+ public void setProduct (final Product product);
+
/**
* Compare method
* @param item Item to compare to
import java.text.MessageFormat;
import java.util.Objects;
-import org.mxchange.jshopcore.BaseShopCore;
+import org.mxchange.jcore.BaseFrameworkSystem;
+import org.mxchange.jshopcore.model.product.Product;
/**
* An item (addedable to a basket) could respresent a product or a discount
*
* @author Roland Haeder
*/
-public class BaseItem extends BaseShopCore implements AddableBasketItem {
+public abstract class BaseItem extends BaseFrameworkSystem implements AddableBasketItem {
/**
* Entry id (from database backend)
*/
*/
private String itemType;
+ /**
+ * Item instance
+ */
+ private Product product;
+
@Override
public Float calculateTotalPrice () {
// product should be set
}
@Override
- public final Long getAmount () {
+ public Long getAmount () {
return this.amount;
}
@Override
- public final void setAmount (final Long amount) {
+ public void setAmount (final Long amount) {
this.amount = amount;
}
@Override
- public final Long getId () {
+ public Long getId () {
return this.id;
}
@Override
- public final void setId (final Long id) {
+ public void setId (final Long id) {
this.id = id;
}
@Override
- public final Long getItemId () {
+ public Long getItemId () {
return this.itemId;
}
@Override
- public final void setItemId( final Long itemId) {
+ public void setItemId( final Long itemId) {
this.itemId = itemId;
}
@Override
- public final String getItemType () {
+ public String getItemType () {
return this.itemType;
}
@Override
- public final void setItemType (final String itemType) {
+ public void setItemType (final String itemType) {
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;
+ }
}
import java.text.MessageFormat;
import java.util.Objects;
-import org.mxchange.jshopcore.BaseShopCore;
+import org.mxchange.jcore.BaseFrameworkSystem;
/**
*
* @author Roland Haeder
*/
-public class BaseProduct extends BaseShopCore implements Product {
+public abstract class BaseProduct extends BaseFrameworkSystem implements Product {
/**
* Availability of product
*/
}
@Override
- public final Boolean getAvailable () {
+ public Boolean getAvailable () {
return this.available;
}
@Override
- public final void setAvailable (final Boolean available) {
+ public void setAvailable (final Boolean available) {
this.available = available;
}
@Override
- public final Long getCategoryId () {
+ public Long getCategoryId () {
return this.categoryId;
}
@Override
- public final void setCategoryId (final Long categoryId) {
+ public void setCategoryId (final Long categoryId) {
this.categoryId = categoryId;
}
@Override
- public final Long getItemId () {
+ public Long getItemId () {
return this.itemId;
}
@Override
- public final void setItemId (final Long itemId) {
+ public void setItemId (final Long itemId) {
this.itemId = itemId;
}
@Override
- public final Float getPrice () {
+ public Float getPrice () {
return this.price;
}
@Override
- public final void setPrice (final Float price) {
+ public void setPrice (final Float price) {
this.price = price;
}
@Override
- public final String getTitle () {
+ public String getTitle () {
return this.title;
}
@Override
- public final void setTitle (final String title) {
+ public void setTitle (final String title) {
this.title = title;
}
}
*/
package org.mxchange.jshopcore.model.product;
-import org.mxchange.jshopcore.ShopInterface;
+import org.mxchange.jcore.FrameworkInterface;
/**
* An interface for in database storable products
*
* @author Roland Haeder
*/
-public interface Product extends ShopInterface, Comparable<Product> {
+public interface Product extends FrameworkInterface, Comparable<Product> {
/**
* Getter for id number, suitable for form fields.
*
* Generic product class
*
* @author Roland Haeder
+ * TODO: Find a better name
*/
public class GenericProduct extends BaseProduct implements Product {
/**