@ProviderType
public interface ProductCollection
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String path)
Creates a new entry (product or collection) in the collection at the last position
|
boolean |
contains(Product product)
Returns true if product reference is part of the collection.
|
java.lang.String |
getDescription()
Returns the description of the collection.
|
java.util.Iterator<java.lang.String> |
getDirectReferences()
Returns an iterator over product or collection paths/IDs directly referenced in the collection.
|
java.lang.String |
getPath()
Returns the path of the collection if represented in the repository.
|
java.util.Iterator<Product> |
getProducts()
Returns an iterator over products referred in the collection in the specified order.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns the collection properties.
|
<T> T |
getProperty(java.lang.String key,
java.lang.Class<T> type)
Returns a named collection property converted to a given type.
|
<T> T |
getProperty(java.lang.String key,
T defaultValue)
Returns a named collection property or a default value if the property can not be retrieved.
|
java.lang.String |
getTitle()
Returns the title of the collection.
|
java.lang.String |
getType()
Returns the type of the collection.
|
boolean |
hasDirectReference(java.lang.String path)
Returns true if the product or the collection referenced by the path/ID is directly referenced in the collection.
|
void |
orderBefore(java.lang.String srcPath,
java.lang.String destPath)
Inserts the referenced product or collection
srcPath
into the collection entry at the position immediately before the referenced product
or collection destPath . |
void |
remove(java.lang.String path)
Removes an entry of product or collection from collection.
|
void |
setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
Sets the collection properties.
|
void |
setProperty(java.lang.String key,
java.lang.Object value)
Sets a collection property.
|
java.lang.String getTitle()
java.lang.String getDescription()
java.lang.String getType()
java.lang.String getPath()
java.util.Map<java.lang.String,java.lang.Object> getProperties()
Map
.<T> T getProperty(java.lang.String key, java.lang.Class<T> type)
key
- The name of the propertytype
- The type to which the property should be converted.<T> T getProperty(java.lang.String key, T defaultValue)
key
- The name of the propertydefaultValue
- The default value to use if the named property does
not exist or cannot be converted to the requested type. The
default value is also used to define the type to convert the
value to. If this is null
any existing property is
not converted.void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties) throws CommerceException
properties
- The new collection properties.CommerceException
- if setting the properties fails.void setProperty(java.lang.String key, java.lang.Object value) throws CommerceException
key
- The name of the propertyvalue
- The value of the propertyCommerceException
- if setting the properties fails.java.util.Iterator<java.lang.String> getDirectReferences()
getProducts()
boolean hasDirectReference(java.lang.String path)
contains(com.adobe.cq.commerce.api.Product)
.path
- product or collection path to be added, if the product/collection is represented in the repository.
Otherwise, it is an ID uniquely identifying the product/collection to the external commerce engine.java.util.Iterator<Product> getProducts()
boolean contains(Product product)
product
- product to be checkedvoid add(java.lang.String path) throws CommerceException
path
- product or collection path to be added, if the product/collection is represented in the repository.
Otherwise, it is an ID uniquely identifying the product/collection to the external commerce engine.CommerceException
- if the operation fails, if collection already contained
the product/collection or product/collection is null.void remove(java.lang.String path) throws CommerceException
path
- product or collection path to be added, if the product/collection is represented in the repository.
Otherwise, it is an ID uniquely identifying the product/collection to the external commerce engine.CommerceException
- if the operation fails, or if product/collection reference was
not removed / not presentvoid orderBefore(java.lang.String srcPath, java.lang.String destPath) throws CommerceException
srcPath
into the collection entry at the position immediately before the referenced product
or collection destPath
.
To insert the referenced product/collection into last position, destPath
can be null.srcPath
- Referenced product/collection path/ID that needs to be moved in the orderdestPath
- Referenced product/collection path/ID before which the srcPath
will be placed.CommerceException
- if the operation failsCopyright © 2010 - 2020 Adobe. All Rights Reserved