* 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;
}
public void copyAll (final Category category) {
// Copy all data
this.setParentCategory(category.getParentCategory());
- this.setTitle(category.getTitle());
+ this.setCategoryTitle(category.getCategoryTitle());
}
@Override
}
@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;
}
}
/**
* 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
@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
/**
* 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;
}
}
*
* @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);
}