*
* @return the amount
*/
- public Long getAmount ();
+ public Long getOrderedAmount ();
/**
* Setter for item amount
*
* @param amount the amount to set
*/
- public void setAmount (final Long amount);
+ public void setOrderedAmount (final Long amount);
/**
* Getter for entry id (from database backend)
*
* @return the product
*/
- public Product getProduct ();
+ public Product getItemProduct ();
/**
* Setter fo product instance
*
* @param product the product to set
*/
- public void setProduct (final Product product);
+ public void setItemProduct (final Product product);
/**
* Hash-code calculattion
}
// Is the id the same?
- if (Objects.equals(this.getProduct(), item.getProduct())) {
+ if (Objects.equals(this.getItemProduct(), item.getItemProduct())) {
// Same id, means same item
return 0;
- } else if (this.getProduct().getProductId() > item.getProduct().getProductId()) {
+ } else if (this.getItemProduct().getProductId() > item.getItemProduct().getProductId()) {
// This id is larger than compared to
return -1;
}
AddableBasketItem item = (AddableBasketItem) object;
// Item id and type must be the same
- return ((Objects.equals(item.getProduct().getProductId(), this.getProduct().getProductId()))
+ return ((Objects.equals(item.getItemProduct().getProductId(), this.getItemProduct().getProductId()))
&& (Objects.equals(item.getItemType(), this.getItemType())));
}
@Override
public int hashCode () {
int hash = 5;
- hash = 29 * hash + Objects.hashCode(this.getProduct().getProductId());
+ hash = 29 * hash + Objects.hashCode(this.getItemProduct().getProductId());
hash = 29 * hash + Objects.hashCode(this.getItemType());
return hash;
}
@Override
public boolean isProductType () {
// Is the instance set?
- return (this.getProduct() instanceof Product);
+ return (this.getItemProduct() instanceof Product);
}
}
private static final long serialVersionUID = 52_749_158_492_581_578L;
/**
- * Item amount
+ * Item orderedAmount
*/
@Basic (optional = false)
- @Column (name = "amount", nullable = false, length = 20)
- private Long amount;
+ @Column (name = "ordered_amount", nullable = false, length = 20)
+ private Long orderedAmount;
/**
* Entry itemId (from database backend)
*/
@JoinColumn (name = "product_id", updatable = false)
@OneToOne (targetEntity = GenericProduct.class)
- private Product product;
+ private Product itemProduct;
/**
* Default constructor
// Call default constructor
this();
- // product must not be null
+ // itemProduct must not be null
if (null == product) {
// Abort here
throw new NullPointerException("product is null"); //NOI18N
this.itemType = "product"; //NOI18N
// Copy instance
- this.product = product;
+ this.itemProduct = product;
}
/**
- * Constructor for an item from given Product instance and amount.
+ * Constructor for an item from given Product instance and orderedAmount.
*
* @param product Product instance
- * @param amount Ordered amount
+ * @param amount Ordered orderedAmount
*/
public BasketItem (final Product product, final Long amount) {
// Other constructor
this(product);
- // amount must not be null
+ // orderedAmount must not be null
if (null == amount) {
// Abort here
throw new NullPointerException("amount is null"); //NOI18N
}
- // Set amount
- this.amount = amount;
+ // Set orderedAmount
+ this.orderedAmount = amount;
}
@Override
- public Long getAmount () {
- return this.amount;
+ public Long getOrderedAmount () {
+ return this.orderedAmount;
}
@Override
- public void setAmount (final Long amount) {
- this.amount = amount;
+ public void setOrderedAmount (final Long orderedAmount) {
+ this.orderedAmount = orderedAmount;
}
@Override
}
@Override
- public Product getProduct () {
- return this.product;
+ public Product getItemProduct () {
+ return this.itemProduct;
}
@Override
- public void setProduct (final Product product) {
- this.product = product;
+ public void setItemProduct (final Product itemProduct) {
+ this.itemProduct = itemProduct;
}
}