Class Product
- java.lang.Object
-
- edu.cnm.deepdive.albuquirky.model.entity.Product
-
@Entity public class Product extends Object
This is theProductentity class, which declares the attributes needed for products which includes, the product ID, username, product description (not required),name,price,stock,postedDateand theProfileid which is annotated by a @ManyToOne. Two attributes which are annotated by a @OneToMany areproductImageswhich gives a list ofImagefor aProductand order items which gives a list of items ofProductOnOrder.
-
-
Constructor Summary
Constructors Constructor Description Product()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDescription()Gets the product description.LonggetId()Gets theidStringgetName()Gets thenameList<ProductOnOrder>getOrderItems()Gets a list of products on anOrder.DategetPostedDate()Gets the creation timestamp for the product.intgetPrice()Gets the product price.List<Image>getProductImages()Gets a list ofImageobjects for the product.ProfilegetProfile()Gets theProfileselling the product.intgetStock()Gets the remaining inventory for the product.voidsetDescription(String description)SetsdescriptionvoidsetName(String name)SetsnamevoidsetPrice(int price)SetspricevoidsetProfile(Profile profile)SetsProfilevoidsetStock(int stock)Setsstock
-
-
-
Method Detail
-
getDescription
public String getDescription()
Gets the product description.- Returns:
- The product description.
-
setDescription
public void setDescription(String description)
Setsdescription- Parameters:
description- - String
-
getPrice
public int getPrice()
Gets the product price.- Returns:
- The product's price.
-
setPrice
public void setPrice(int price)
Setsprice- Parameters:
price- - int
-
getStock
public int getStock()
Gets the remaining inventory for the product.- Returns:
- The current quantity remaining in-stock for the product.
-
setStock
public void setStock(int stock)
Setsstock- Parameters:
stock- - int
-
getPostedDate
@NonNull public Date getPostedDate()
Gets the creation timestamp for the product.- Returns:
- The timestamp for when the product was first posted.
-
getProfile
@NonNull public Profile getProfile()
Gets theProfileselling the product.- Returns:
- The seller
Profile.
-
setProfile
public void setProfile(@NonNull Profile profile)SetsProfile- Parameters:
profile- - Profile
-
getProductImages
@NonNull public List<Image> getProductImages()
Gets a list ofImageobjects for the product.- Returns:
- List of productImages
-
getOrderItems
@NonNull public List<ProductOnOrder> getOrderItems()
Gets a list of products on anOrder.- Returns:
- List of orderItems
-
-