@ConsumerType public abstract class AbstractProductCollection extends java.lang.Object implements ProductCollection
ProductCollection| Constructor and Description |
|---|
AbstractProductCollection(Resource resource) |
| 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
|
void |
checkItemType(java.lang.String path)
Throws an IllegalArgumentException if the type of the resource identified by its path
is not supported by the implementation.
|
boolean |
contains(Product product)
Returns true if product reference is part of the collection.
|
boolean |
equals(java.lang.Object obj) |
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.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.
|
int |
hashCode() |
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.
|
getClass, notify, notifyAll, toString, wait, wait, waitgetProductspublic AbstractProductCollection(Resource resource)
public java.lang.String getTitle()
ProductCollectiongetTitle in interface ProductCollectionpublic java.lang.String getDescription()
ProductCollectiongetDescription in interface ProductCollectionpublic java.lang.String getType()
ProductCollectiongetType in interface ProductCollectionpublic java.lang.String getPath()
ProductCollectiongetPath in interface ProductCollectionpublic java.util.Map<java.lang.String,java.lang.Object> getProperties()
ProductCollectiongetProperties in interface ProductCollectionMap.public <T> T getProperty(java.lang.String key,
java.lang.Class<T> type)
ProductCollectiongetProperty in interface ProductCollectionkey - The name of the propertytype - The type to which the property should be converted.public <T> T getProperty(java.lang.String key,
T defaultValue)
ProductCollectiongetProperty in interface ProductCollectionkey - 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.public void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
throws CommerceException
ProductCollectionsetProperties in interface ProductCollectionproperties - The new collection properties.CommerceException - if setting the properties fails.public void setProperty(java.lang.String key,
java.lang.Object value)
throws CommerceException
ProductCollectionsetProperty in interface ProductCollectionkey - The name of the propertyvalue - The value of the propertyCommerceException - if setting the properties fails.public boolean contains(Product product)
ProductCollectioncontains in interface ProductCollectionproduct - product to be checkedpublic java.util.Iterator<java.lang.String> getDirectReferences()
ProductCollectionProductCollection.getProducts()getDirectReferences in interface ProductCollectionpublic boolean hasDirectReference(java.lang.String path)
ProductCollectionProductCollection.contains(com.adobe.cq.commerce.api.Product).hasDirectReference in interface ProductCollectionpath - 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.public void add(java.lang.String path)
throws CommerceException
ProductCollectionadd in interface ProductCollectionpath - 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.public void remove(java.lang.String path)
throws CommerceException
ProductCollectionremove in interface ProductCollectionpath - 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 presentpublic void orderBefore(java.lang.String srcPath,
java.lang.String destPath)
ProductCollectionsrcPath
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.orderBefore in interface ProductCollectionsrcPath - 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.public void checkItemType(java.lang.String path)
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2010 - 2023 Adobe. All Rights Reserved