com.elasticpath.domain.catalog
Interface Product

All Superinterfaces:
java.lang.Comparable, Entity, EpDomain, LeafNode, ObjectWithLocaleDependantFields, Persistence, java.io.Serializable
All Known Implementing Classes:
ProductImpl

public interface Product
extends java.lang.Comparable, Entity, ObjectWithLocaleDependantFields, LeafNode

Product represents a merchandise product in Elastic Path. A product is likely to have one or more ProductSku belongs to it.


Method Summary
 void addCategory(Category category)
          Add this product to the specified category.
 void addOrUpdateProductAssocation(ProductAssociation productAssociation)
          Add or update the given product association to this product(as a source product).
 void addOrUpdateSku(ProductSku productSku)
          Adds or updates the given sku to the product.
 void addPrice(Price price)
          Convenience method for setting the price.
 boolean equals(java.lang.Object otherProduct)
          Returns true if the product equals this product.
 ProductAssociation getAssociationById(long associationUid)
          Return the product association with the specified UID.
 java.util.Set getAssociationsByType(int associationType)
          Returns a set of ProductAssociations with the given association type.
 java.util.Set getAssociationsByType(int associationType, boolean includeAll)
          Returns a set of ProductAssociations with the given association type.
 java.util.Set getAssociationsByType(int associationType, java.util.List filterTargetProducts)
          Returns a set of ProductAssociations with the given association type.
 AttributeValueGroup getAttributeValueGroup()
          Get the attribute value group.
 java.util.List getAttributeValues(java.util.Locale locale)
          Returns a list of AttributeValues with the given locale for those attributes have values.
 Brand getBrand()
          Returns the brand/manufacturer of the product.
 java.util.Set getCategories()
          Returns the set of Categorys containing this product.
 java.lang.String getCode()
          Returns the product code.
 Category getDefaultCategory()
          Return the default Category of this product.
 ProductSku getDefaultSku()
          Returns the default SKU corresponding to this product.
 java.util.Date getEndDate()
          Get the end date.
 java.util.List getFullAttributeValues(java.util.Locale locale)
          Returns a list of AttributeValues with the given locale for all attributes of the product type which this product belonging to.
 java.lang.String getImage()
          Get the product default image.
 java.util.Date getLastModifiedDate()
          Returns the date when the product was last modified.
 java.util.Map getLocaleDependantFieldsMap()
          Gets the all LocaleDependantFields as a map.
 Money getLowestSkuPrice(java.util.Currency currency)
          This returns the lowest price of any sku belongs to this product as a Money object.
 int getMaxFeaturedProductOrder()
          Get the max featured product order from the productCateogiers of this product.
 int getMinOrderQty()
          Get the minimum order quantity of the product.
 Price getPrice(java.util.Currency currency)
          Get the price of this product in the specified currency.
 java.util.Set getProductAssociations()
          Get the ProductAssociations for merchandising this product.
 java.util.Set getProductCategories()
          Gets all product category associations.
 ProductCategory getProductCategoryByUid(java.lang.Long categoryUid)
          Get the product category by category uid.
 java.util.Map getProductPrices()
          Get the product-price associations belong to this product.
 java.util.Map getProductSkus()
          Get the product SKUs (variations) associatied with this product.
 ProductType getProductType()
          Get the product type.
 int getSalesCount()
          Returns the total sales count of the product.
 java.lang.String getSeoUrl(java.util.Locale locale, Category category)
          Returns the seo url of the given locale following the given category.
 ProductSku getSkuByGuid(java.lang.String guid)
          Retrieve a SKU by its GUID.
 java.util.Date getStartDate()
          Get the start date that this product will become available to customers.
 TaxCode getTaxCode()
          Returns the TaxCode associated with this ProductType.
 java.lang.String getTemplate()
          Get the display template.
 java.lang.String getTemplateWithFallBack(java.lang.String defaultTemplate)
          Get the display template name of this product.
 int getUidPkInt()
          Gets the unique identifier for this domain model object.
 boolean hasMultipleSkus()
          Returns true if the product has multiple SKUs.
 boolean hasPassedRuleEngine()
          Return true if this product has passsed rule engine.
 boolean isAvailable()
          Returns true if the product is available for purchase.
 boolean isDisplayable()
          Returns true if the product can be displayed.
 boolean isHidden()
          Returns true if the product should not be displayed (e.g.
 boolean isInCategory(long categoryUid)
          Returns true if this product is in the category with the specified category uid or a child of that category.
 boolean isWithinDateRange()
          Checks if product is active.
 void removeCategory(Category category)
          Remove this product from the specified category.
 void removeSku(ProductSku productSku)
          Remove the given sku from the product.
 void setAttributeValueGroup(AttributeValueGroup attributeValueGroup)
          Set the attribute value group.
 void setBrand(Brand brand)
          Sets the brand/manufacturer of the product.
 void setCategories(java.util.Set newCategories)
          Sets product categories.
 void setCode(java.lang.String code)
          Sets the product code.
 void setDefaultCategory(Category category)
          Set the given category to be the default category of this product.
 void setDefaultSku(ProductSku defaultSku)
          Sets the default SKU for this product.
 void setEndDate(java.util.Date endDate)
          Set the end date.
 void setHasPassedRuleEngine(boolean value)
          Sets the has-passsed-rule-engine flag to the given value.
 void setHidden(boolean hidden)
          Set to true if the product should not be displayed.
 void setImage(java.lang.String image)
          Set the product default image.
 void setLastModifiedDate(java.util.Date lastModifiedDate)
          Set the date when the product was last modified.
 void setMinOrderQty(int minOrderQty)
          Set the MinOrderQty associated with this Product.
 void setProductAssociations(java.util.Set productAssociations)
          Set the ProductAssociations for merchandising this product.
 void setProductCategories(java.util.Set productCategories)
          Sets all product category associations.
 void setProductSkus(java.util.Map productSkus)
          Set the variations of this product.
 void setProductType(ProductType productType)
          Set the ProductType.
 void setSalesCount(int salesCount)
          Sets the total sales count of the product.
 void setStartDate(java.util.Date startDate)
          Set the start date that this product will become valid.
 void setTaxCode(TaxCode taxCode)
          Set the TaxCode associated with this ProductType.
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.elasticpath.domain.Entity
getGuid, setGuid
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 
Methods inherited from interface com.elasticpath.domain.catalog.ObjectWithLocaleDependantFields
addOrUpdateLocaleDependantFields, getDisplayName, getLocaleDependantFields, getLocaleDependantFieldsWithoutFallBack, setLocaleDependantFieldsMap
 
Methods inherited from interface com.elasticpath.domain.catalogview.LeafNode
getBranchNode
 

Method Detail

addCategory

void addCategory(Category category)
Add this product to the specified category.

Parameters:
category - the category

addOrUpdateProductAssocation

void addOrUpdateProductAssocation(ProductAssociation productAssociation)
Add or update the given product association to this product(as a source product).

Parameters:
productAssociation - the product association

addOrUpdateSku

void addOrUpdateSku(ProductSku productSku)
Adds or updates the given sku to the product.

Parameters:
productSku - the sku to add or update

addPrice

void addPrice(Price price)
Convenience method for setting the price. If the price exists, its amount is updated. Otherwise the price is added.

Parameters:
price - the price to be added.

equals

boolean equals(java.lang.Object otherProduct)
Returns true if the product equals this product.

Overrides:
equals in class java.lang.Object
Parameters:
otherProduct - the other product to be compared
Returns:
true if the product equals this product

getAssociationById

ProductAssociation getAssociationById(long associationUid)
Return the product association with the specified UID.

Parameters:
associationUid - the UID of the ProductAssociation to be returned.
Returns:
the corresponding ProductAssociation or null if no matching association is found.

getAssociationsByType

java.util.Set getAssociationsByType(int associationType)
Returns a set of ProductAssociations with the given association type. Only returns associations where the date range is valid for the current date.

Parameters:
associationType - the type of the association. The association type is a constant value defined on the ProductAssociation interface.
Returns:
a set of all defined associations of the specified type

getAssociationsByType

java.util.Set getAssociationsByType(int associationType,
                                    boolean includeAll)
Returns a set of ProductAssociations with the given association type.

Parameters:
associationType - the type of the association. The association type is a constant value defined on the ProductAssociation interface.
includeAll - Set to true to return associations that are not in their valid date range
Returns:
a set of all defined associations of the specified type

getAssociationsByType

java.util.Set getAssociationsByType(int associationType,
                                    java.util.List filterTargetProducts)
Returns a set of ProductAssociations with the given association type.

Parameters:
associationType - the type of the association. The association type is a constant value defined on the ProductAssociation interface.
filterTargetProducts - Excludes any provided target products from list of returned associations.
Returns:
a set of all defined associations of the specified type

getAttributeValueGroup

AttributeValueGroup getAttributeValueGroup()
Get the attribute value group.

Returns:
the domain model's AttributeValueGroup

getAttributeValues

java.util.List getAttributeValues(java.util.Locale locale)
Returns a list of AttributeValues with the given locale for those attributes have values.

Parameters:
locale - the locale
Returns:
a list of AttributeValues
See Also:
AttributeValueGroup.getAttributeValues(AttributeGroup, Locale)

getBrand

Brand getBrand()
Returns the brand/manufacturer of the product.

Returns:
the brand/manufacturer of the product

getCategories

java.util.Set getCategories()
Returns the set of Categorys containing this product.

Returns:
a set of Category objects (Not ProductCategory

getCode

java.lang.String getCode()
Returns the product code.

Returns:
the product code

getDefaultCategory

Category getDefaultCategory()
Return the default Category of this product.

Returns:
the default Category

getDefaultSku

ProductSku getDefaultSku()
Returns the default SKU corresponding to this product.

Returns:
the ProductSku

getEndDate

java.util.Date getEndDate()
Get the end date. After the end date, the product will change to unavailable to customers.

Returns:
the end date

getFullAttributeValues

java.util.List getFullAttributeValues(java.util.Locale locale)
Returns a list of AttributeValues with the given locale for all attributes of the product type which this product belonging to. If an attribute has a value, the value will be returned. Otherwise, a null value will be returned.

Parameters:
locale - the locale
Returns:
a list of AttributeValues
See Also:
AttributeValueGroup.getFullAttributeValues(AttributeGroup, Locale)

getImage

java.lang.String getImage()
Get the product default image.

Returns:
the product default image

getLastModifiedDate

java.util.Date getLastModifiedDate()
Returns the date when the product was last modified.

Returns:
the date when the product was last modified

getLocaleDependantFieldsMap

java.util.Map getLocaleDependantFieldsMap()
Gets the all LocaleDependantFields as a map.

Specified by:
getLocaleDependantFieldsMap in interface ObjectWithLocaleDependantFields
Returns:
the LocaleDependantFields map

getLowestSkuPrice

Money getLowestSkuPrice(java.util.Currency currency)
This returns the lowest price of any sku belongs to this product as a Money object.

Parameters:
currency - The currency of the price to be retrieved
Returns:
the lowest price of a SKU, or null if there are no SKUs.

getMaxFeaturedProductOrder

int getMaxFeaturedProductOrder()
Get the max featured product order from the productCateogiers of this product.

Returns:
the maximum featured product order.

getMinOrderQty

int getMinOrderQty()
Get the minimum order quantity of the product.

Returns:
the minimum order quantity of the product.

getPrice

Price getPrice(java.util.Currency currency)
Get the price of this product in the specified currency.

Parameters:
currency - the Currency of the price to be returned
Returns:
a Price object representing the price in the specified currency returns null if no price was found in the specified currency.

getProductAssociations

java.util.Set getProductAssociations()
Get the ProductAssociations for merchandising this product.

Returns:
a set of ProductAssociations

getProductCategories

java.util.Set getProductCategories()
Gets all product category associations.

Returns:
all product category associations

getProductCategoryByUid

ProductCategory getProductCategoryByUid(java.lang.Long categoryUid)
Get the product category by category uid.

Parameters:
categoryUid - the category uid
Returns:
productCategory the ProductCategory

getProductPrices

java.util.Map getProductPrices()
Get the product-price associations belong to this product.

Returns:
the set of prices corresponding to this product

getProductSkus

java.util.Map getProductSkus()
Get the product SKUs (variations) associatied with this product.

Returns:
the product's ProductSkus

getProductType

ProductType getProductType()
Get the product type.

Returns:
the product type

getSalesCount

int getSalesCount()
Returns the total sales count of the product.

Returns:
the total sales count of the product

getSeoUrl

java.lang.String getSeoUrl(java.util.Locale locale,
                           Category category)
Returns the seo url of the given locale following the given category. Since there might be multiple categories to reach a product, the category you give will be a part of the seo url generated. If you give null, the default category of the product will be used instead.

Parameters:
locale - the locale
category - the category to reach the product, give null to use the default category.
Returns:
the seo url

getSkuByGuid

ProductSku getSkuByGuid(java.lang.String guid)
Retrieve a SKU by its GUID.

Parameters:
guid - the GUID of the SKU to retrieve
Returns:
the corresponding SKU, or null if not found

getStartDate

java.util.Date getStartDate()
Get the start date that this product will become available to customers.

Returns:
the start date

getTaxCode

TaxCode getTaxCode()
Returns the TaxCode associated with this ProductType.

Returns:
the TaxCode

getTemplate

java.lang.String getTemplate()
Get the display template.

Returns:
the template

getTemplateWithFallBack

java.lang.String getTemplateWithFallBack(java.lang.String defaultTemplate)
Get the display template name of this product.

Parameters:
defaultTemplate - the default template name
Returns:
the template name if it is defined for this product, otherwise the given default template name

getUidPkInt

int getUidPkInt()
Gets the unique identifier for this domain model object. Returns an int so that it can be accessed by Drools. Will likely remove this if rulesdon't use the uid.

Returns:
the unique identifier.

hasMultipleSkus

boolean hasMultipleSkus()
Returns true if the product has multiple SKUs.

Returns:
true if the product has multiple SKUs.

hasPassedRuleEngine

boolean hasPassedRuleEngine()
Return true if this product has passsed rule engine. Otherwise, false.

Returns:
true if this product has passsed rule engine. Otherwise, false.

isAvailable

boolean isAvailable()
Returns true if the product is available for purchase. Checks whether the current date is within the product's date range and the product has at least one sku in stock.

Returns:
true if the product is available for purchase, false otherwise

isDisplayable

boolean isDisplayable()
Returns true if the product can be displayed. Checks whether the product is not hidden, the current date is within the product's date range, and the product has at least one sku in stock or if out of stock but should be visible

Returns:
true if the product can be displayed, false otherwise

isHidden

boolean isHidden()
Returns true if the product should not be displayed (e.g. in its category or as a search result).

Returns:
true if the product should not be displayed

isInCategory

boolean isInCategory(long categoryUid)
Returns true if this product is in the category with the specified category uid or a child of that category.

Parameters:
categoryUid - the category uid to check if this product is in it.
Returns:
true if the product is in the category

isWithinDateRange

boolean isWithinDateRange()
Checks if product is active.

Returns:
is active.

removeCategory

void removeCategory(Category category)
Remove this product from the specified category.

Parameters:
category - the category

removeSku

void removeSku(ProductSku productSku)
Remove the given sku from the product.

Parameters:
productSku - the sku to remove

setAttributeValueGroup

void setAttributeValueGroup(AttributeValueGroup attributeValueGroup)
Set the attribute value group.

Parameters:
attributeValueGroup - the AttributeValueGroup

setBrand

void setBrand(Brand brand)
Sets the brand/manufacturer of the product.

Parameters:
brand - the brand/manufacturer of the product

setCategories

void setCategories(java.util.Set newCategories)
Sets product categories.

Parameters:
newCategories - new set of categories

setCode

void setCode(java.lang.String code)
Sets the product code.

Parameters:
code - the product code

setDefaultCategory

void setDefaultCategory(Category category)
Set the given category to be the default category of this product. A Product should have one and only one default Category.

Parameters:
category - the category to be set as default

setDefaultSku

void setDefaultSku(ProductSku defaultSku)
Sets the default SKU for this product.

Parameters:
defaultSku - the default SKU

setEndDate

void setEndDate(java.util.Date endDate)
Set the end date.

Parameters:
endDate - the end date

setHasPassedRuleEngine

void setHasPassedRuleEngine(boolean value)
Sets the has-passsed-rule-engine flag to the given value.

Parameters:
value - the given value

setHidden

void setHidden(boolean hidden)
Set to true if the product should not be displayed.

Parameters:
hidden - true if the product should not be displayed

setImage

void setImage(java.lang.String image)
Set the product default image.

Parameters:
image - the product default image

setLastModifiedDate

void setLastModifiedDate(java.util.Date lastModifiedDate)
Set the date when the product was last modified.

Parameters:
lastModifiedDate - the date when the product was last modified

setMinOrderQty

void setMinOrderQty(int minOrderQty)
Set the MinOrderQty associated with this Product.

Parameters:
minOrderQty - - the minimum order quantity of the product.

setProductAssociations

void setProductAssociations(java.util.Set productAssociations)
Set the ProductAssociations for merchandising this product.

Parameters:
productAssociations - the set of ProductAssociations

setProductCategories

void setProductCategories(java.util.Set productCategories)
Sets all product category associations.

Parameters:
productCategories - all product category associations

setProductSkus

void setProductSkus(java.util.Map productSkus)
Set the variations of this product.

Parameters:
productSkus - the map of ProductSkus

setProductType

void setProductType(ProductType productType)
Set the ProductType.

Parameters:
productType - the ProductType

setSalesCount

void setSalesCount(int salesCount)
Sets the total sales count of the product.

Parameters:
salesCount - the total sales count of the product

setStartDate

void setStartDate(java.util.Date startDate)
Set the start date that this product will become valid.

Parameters:
startDate - the start date

setTaxCode

void setTaxCode(TaxCode taxCode)
Set the TaxCode associated with this ProductType.

Parameters:
taxCode - - the tax code for this product type, i.e. "BOOKS".