From: Roland Haeder Date: Fri, 25 Sep 2015 08:21:41 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d3f71973e2b363d96c1be922e32f1f660ab188f7;p=jcustomer-core.git Continued: - renamed many fields/attributes to nicer names including database columns, getters/setters - updated jar Signed-off-by:Roland Häder --- diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index 7b5dcd3..1b1ad2a 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java b/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java index e9a1230..33db0d6 100644 --- a/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java +++ b/src/org/mxchange/jshopcore/exceptions/CategoryTitleAlreadyUsedException.java @@ -38,6 +38,6 @@ public class CategoryTitleAlreadyUsedException extends Exception { */ public CategoryTitleAlreadyUsedException (final Category category) { // Call super constructor - super(MessageFormat.format("Title {0} is already used.", category.getTitle())); //NOI18N + 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 index 278e681..0a1989a 100644 --- a/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java +++ b/src/org/mxchange/jshopcore/exceptions/ProductTitleAlreadyUsedException.java @@ -38,6 +38,6 @@ public class ProductTitleAlreadyUsedException extends Exception { */ public ProductTitleAlreadyUsedException (final Product product) { // Call super constructor - super(MessageFormat.format("Title {0} is already used.", product.getTitle())); //NOI18N + super(MessageFormat.format("Title {0} is already used.", product.getProductTitle())); //NOI18N } } diff --git a/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java b/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java index d0e7901..e2ac620 100644 --- a/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java +++ b/src/org/mxchange/jshopcore/model/basket/items/BaseItem.java @@ -44,7 +44,7 @@ public abstract class BaseItem implements AddableBasketItem, Comparable item.getProduct().getId()) { + } else if (this.getProduct().getProductId() > item.getProduct().getProductId()) { // This id is larger than compared to return -1; } @@ -68,14 +68,14 @@ public abstract class BaseItem implements AddableBasketItem, Comparable { * Title of category */ @Basic (optional = false) - @Column (name = "title", length = 100, nullable = false, unique = true) - private String title; + @Column (name = "category_title", length = 100, nullable = false, unique = true) + private String categoryTitle; /** * Constructor which accepts all database fields * * @param categoryId Id number of database record - * @param title Category title + * @param categoryTitle Category categoryTitle * @param parentCategory Parent category */ - public ProductCategory (final Long categoryId, final String title, final Category parentCategory) { + public ProductCategory (final Long categoryId, final String categoryTitle, final Category parentCategory) { // Set all here this.categoryId = categoryId; - this.title = title; + this.categoryTitle = categoryTitle; this.parentCategory = parentCategory; } @@ -107,7 +107,7 @@ public class ProductCategory implements Category, Comparable { public void copyAll (final Category category) { // Copy all data this.setParentCategory(category.getParentCategory()); - this.setTitle(category.getTitle()); + this.setCategoryTitle(category.getCategoryTitle()); } @Override @@ -131,12 +131,12 @@ public class ProductCategory implements Category, Comparable { } @Override - public String getTitle () { - return this.title; + public String getCategoryTitle () { + return this.categoryTitle; } @Override - public void setTitle (final String title) { - this.title = title; + public void setCategoryTitle (final String categoryTitle) { + this.categoryTitle = categoryTitle; } } diff --git a/src/org/mxchange/jshopcore/model/order/Orderable.java b/src/org/mxchange/jshopcore/model/order/Orderable.java index 4722d45..d490f6a 100644 --- a/src/org/mxchange/jshopcore/model/order/Orderable.java +++ b/src/org/mxchange/jshopcore/model/order/Orderable.java @@ -48,14 +48,14 @@ public interface Orderable extends Serializable { * * @return Created timestamp */ - public Calendar getCreated (); + public Calendar getOrderCreated (); /** * Setter for created timestamp * * @param created Created timestamp */ - public void setCreated (final Calendar created); + public void setOrderCreated (final Calendar created); /** * Getter for customer instance diff --git a/src/org/mxchange/jshopcore/model/order/ShopOrder.java b/src/org/mxchange/jshopcore/model/order/ShopOrder.java index addcf8d..57f25ce 100644 --- a/src/org/mxchange/jshopcore/model/order/ShopOrder.java +++ b/src/org/mxchange/jshopcore/model/order/ShopOrder.java @@ -60,8 +60,8 @@ public class ShopOrder implements Orderable { */ @Basic (optional = false) @Temporal (TemporalType.TIMESTAMP) - @Column (name = "created", nullable = false) - private Calendar created; + @Column (name = "order_created", nullable = false) + private Calendar orderCreated; /** * Customer instance @@ -95,13 +95,13 @@ public class ShopOrder implements Orderable { } @Override - public Calendar getCreated () { - return this.created; + public Calendar getOrderCreated () { + return this.orderCreated; } @Override - public void setCreated (final Calendar created) { - this.created = created; + public void setOrderCreated (final Calendar orderCreated) { + this.orderCreated = orderCreated; } @Override diff --git a/src/org/mxchange/jshopcore/model/product/GenericProduct.java b/src/org/mxchange/jshopcore/model/product/GenericProduct.java index e794f21..99ba27c 100644 --- a/src/org/mxchange/jshopcore/model/product/GenericProduct.java +++ b/src/org/mxchange/jshopcore/model/product/GenericProduct.java @@ -44,15 +44,15 @@ public class GenericProduct implements Product, Comparable { /** * Availability of product */ - @Column (name = "available", nullable = false) - private Boolean available; + @Column (name = "product_availability", nullable = false) + private Boolean productAvailability; /** - * Product category + * Product productCategory */ @Basic (optional = false) @Column (name = "category_id", length = 20, nullable = false) - private Category category; + private Category productCategory; /** * Id number of product @@ -60,21 +60,21 @@ public class GenericProduct implements Product, Comparable { @Id @GeneratedValue (strategy = GenerationType.IDENTITY) @Column(name = "product_id", length = 20, nullable = false, updatable = false) - private Long id; + private Long productId; /** * Price of product */ @Basic (optional = false) - @Column (name = "price", nullable = false) - private Float price; + @Column (name = "product_price", nullable = false) + private Float productPrice; /** * Title of product */ @Basic (optional = false) - @Column (name = "title", length = 100, nullable = false) - private String title; + @Column (name = "product_title", length = 100, nullable = false) + private String productTitle; /** * Default constructor @@ -85,97 +85,97 @@ public class GenericProduct implements Product, Comparable { /** * Constructor will all required data * - * @param id Id number of product - * @param title Name of product - * @param price Price - * @param category Category instance - * @param available Availability (selectable by customer) + * @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 id, final String title, final Float price, final Category category, final Boolean available) { + public GenericProduct (final Long productId, final String productTitle, final Float productPrice, final Category productCategory, final Boolean productAvailability) { // Set all here - this.id = id; - this.title = title; - this.price = price; - this.category = category; - this.available = available; + this.productId = productId; + this.productTitle = productTitle; + this.productPrice = productPrice; + this.productCategory = productCategory; + this.productAvailability = productAvailability; } @Override public int compareTo (final Product product) { - // category should not be null + // productCategory should not be null if (null == product) { throw new NullPointerException("product is null"); //NOI18N } - // Is the id the same? - if (Objects.equals(this.getId(), product.getId())) { - // Same id, means same category + // Is the productId the same? + if (Objects.equals(this.getProductId(), product.getProductId())) { + // Same productId, means same productCategory return 0; - } else if (this.getId() > product.getId()) { - // This id is larger than compared to + } else if (this.getProductId() > product.getProductId()) { + // This productId is larger than compared to return 1; } - // The other id is larger + // The other productId is larger return -1; } @Override public void copyAll (final Product product) { // Copy all - this.setAvailable(product.getAvailable()); - this.setCategory(product.getCategory()); - this.setPrice(product.getPrice()); - this.setTitle(product.getTitle()); + this.setProductAvailability(product.getProductAvailability()); + this.setProductCategory(product.getProductCategory()); + this.setProductPrice(product.getProductPrice()); + this.setProductTitle(product.getProductTitle()); } @Override - public Boolean getAvailable () { - return this.available; + public Boolean getProductAvailability () { + return this.productAvailability; } @Override - public void setAvailable (final Boolean available) { - this.available = available; + public void setProductAvailability (final Boolean productAvailability) { + this.productAvailability = productAvailability; } @Override - public Category getCategory () { - return this.category; + public Category getProductCategory () { + return this.productCategory; } @Override - public void setCategory (final Category category) { - this.category = category; + public void setProductCategory (final Category productCategory) { + this.productCategory = productCategory; } @Override - public Long getId () { - return this.id; + public Long getProductId () { + return this.productId; } @Override - public void setId (final Long id) { - this.id = id; + public void setProductId (final Long productId) { + this.productId = productId; } @Override - public Float getPrice () { - return this.price; + public Float getProductPrice () { + return this.productPrice; } @Override - public void setPrice (final Float price) { - this.price = price; + public void setProductPrice (final Float productPrice) { + this.productPrice = productPrice; } @Override - public String getTitle () { - return this.title; + public String getProductTitle () { + return this.productTitle; } @Override - public void setTitle (final String title) { - this.title = title; + 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 index 5f00876..140dd70 100644 --- a/src/org/mxchange/jshopcore/model/product/Product.java +++ b/src/org/mxchange/jshopcore/model/product/Product.java @@ -38,68 +38,68 @@ public interface Product extends Serializable { * * @return Product availability */ - public Boolean getAvailable (); + public Boolean getProductAvailability (); /** * Setter for product availability * - * @param available Product availability + * @param productAvailability Product availability */ - public void setAvailable (final Boolean available); + public void setProductAvailability (final Boolean productAvailability); /** * Getter for product category id * * @return Product category id */ - public Category getCategory (); + public Category getProductCategory (); /** * Setter for product category * - * @param category Product category + * @param productCategory Product category */ - public void setCategory (final Category category); + public void setProductCategory (final Category productCategory); /** * Getter for id number, suitable for form fields. * * @return Id number of product */ - public Long getId (); + public Long getProductId (); /** * Id number of product * - * @param id the id number to set + * @param productId the id number to set */ - public void setId (final Long id); + public void setProductId (final Long productId); /** * Getter for raw price. * * @return Single price of product */ - public Float getPrice (); + public Float getProductPrice (); /** * Price of product * - * @param price the price to set + * @param productPrice the price to set */ - public void setPrice (final Float price); + public void setProductPrice (final Float productPrice); /** * Getter for title. * * @return Title of product */ - public String getTitle (); + public String getProductTitle (); /** * Title of product * - * @param title the title to set + * @param productTitle the title to set */ - public void setTitle (final String title); + public void setProductTitle (final String productTitle); }