RESOURCE_TYPE_PRODUCT
Constructor and Description |
---|
AbstractJcrProduct(Resource resource)
Constructor
|
Modifier and Type | Method and Description |
---|---|
<AdapterType> |
adaptTo(Class<AdapterType> type) |
boolean |
axisIsVariant(String axis)
Tests a single axis (property) for variation.
|
Product |
getBaseProduct()
Returns the product which forms the base of a set of variations.
|
String |
getDescription()
Returns the product's description.
|
ImageResource |
getImage()
Get the primary image for this product, or
null if no image was found. |
String |
getImagePath()
Deprecated.
|
List<ImageResource> |
getImages()
Get all the images for this product.
|
String |
getImageUrl()
Deprecated.
|
String |
getPagePath()
Get the path of the parent page which renders the product/variation.
|
String |
getPath()
Get the underlying resource's path.
|
Product |
getPIMProduct()
Returns the PIM Product (under /etc/commerce/products) which stores this product's
data.
|
<T> T |
getProperty(String name,
Class<T> type)
Returns a product property.
|
ImageResource |
getThumbnail()
Get a thumbnail for this product, or
null if no thumbnail was found. |
String |
getThumbnailUrl()
Deprecated.
|
String |
getThumbnailUrl(int width)
Deprecated.
|
String |
getTitle()
Returns the product's title.
|
Iterator<String> |
getVariantAxes()
Returns an iterator over the property names of the variant axes.
|
Iterator<Product> |
getVariants()
Returns an iterator over the list of all product variations to which this
particular product/variant belongs.
|
Iterator<Product> |
getVariants(VariantFilter filter)
Returns an iterator over the list of product variants for this product filtered by
the
VariantFilter . |
static boolean |
isABaseProduct(Resource resource)
Returns true if resource's cq:commerceType is "product".
|
static boolean |
isAProductOrVariant(Resource resource)
Returns true if resource's cq:commerceType is "product" or "variant".
|
static boolean |
isAVariant(Resource resource)
Returns true if resource's cq:commerceType is "variant".
|
public AbstractJcrProduct(Resource resource)
resource
- the Resource storing the product (or variant) infopublic String getPath()
Product
public String getPagePath()
Product
getPagePath
in interface Product
public String getTitle()
Product
public String getDescription()
Product
getDescription
in interface Product
@Deprecated public String getImagePath()
Product
getImagePath
in interface Product
@Deprecated public String getImageUrl()
Product
getImageUrl
in interface Product
@Deprecated public String getThumbnailUrl()
Product
getThumbnailUrl
in interface Product
@Deprecated public String getThumbnailUrl(int width)
Product
getThumbnailUrl
in interface Product
public ImageResource getImage()
Product
null
if no image was found.public List<ImageResource> getImages()
Product
public ImageResource getThumbnail()
Product
null
if no thumbnail was found.getThumbnail
in interface Product
public <T> T getProperty(String name, Class<T> type)
Product
getProperty
in interface Product
public Iterator<Product> getVariants() throws CommerceException
Product
coat/ coat-blue/ coat-blue-S coat-blue-M coat-green/ coat-green-Sit must return
[coat-blue-S, coat-blue-M, coat-green-S]
whether called
from the Product
representing coat
or coat-green-S
.getVariants
in interface Product
CommerceException
public boolean axisIsVariant(String axis)
Product
axisIsVariant
in interface Product
axis
- The name of the propertytrue
if the given axis is variantpublic Iterator<Product> getVariants(VariantFilter filter) throws CommerceException
Product
VariantFilter
.
Example usages:
To get the complete list of sizes, irrespective of color:
Iteratoriter = product.getVariants(new EnumerateAxisFilter("size"));
To get the list of sub-variants of the color "blue":
Iteratoriter = product.getVariants(new AxisFilter("color", "blue"));
getVariants
in interface Product
CommerceException
VariantFilter
,
EnumerateAxisFilter
,
AxisFilter
public Iterator<String> getVariantAxes()
Product
["color", "size"]
.getVariantAxes
in interface Product
public Product getBaseProduct() throws CommerceException
Product
Product
which is already the base, will return this
.getBaseProduct
in interface Product
Product
CommerceException
public Product getPIMProduct() throws CommerceException
Product
getPIMProduct
in interface Product
Product
CommerceException
public static boolean isAVariant(Resource resource)
resource
- public static boolean isABaseProduct(Resource resource)
resource
- public static boolean isAProductOrVariant(Resource resource)
resource
- public <AdapterType> AdapterType adaptTo(Class<AdapterType> type)
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"