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, wait
getProducts
public AbstractProductCollection(Resource resource)
public java.lang.String getTitle()
ProductCollection
getTitle
in interface ProductCollection
public java.lang.String getDescription()
ProductCollection
getDescription
in interface ProductCollection
public java.lang.String getType()
ProductCollection
getType
in interface ProductCollection
public java.lang.String getPath()
ProductCollection
getPath
in interface ProductCollection
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
ProductCollection
getProperties
in interface ProductCollection
Map
.public <T> T getProperty(java.lang.String key, java.lang.Class<T> type)
ProductCollection
getProperty
in interface ProductCollection
key
- The name of the propertytype
- The type to which the property should be converted.public <T> T getProperty(java.lang.String key, T defaultValue)
ProductCollection
getProperty
in interface ProductCollection
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.public void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties) throws CommerceException
ProductCollection
setProperties
in interface ProductCollection
properties
- The new collection properties.CommerceException
- if setting the properties fails.public void setProperty(java.lang.String key, java.lang.Object value) throws CommerceException
ProductCollection
setProperty
in interface ProductCollection
key
- The name of the propertyvalue
- The value of the propertyCommerceException
- if setting the properties fails.public boolean contains(Product product)
ProductCollection
contains
in interface ProductCollection
product
- product to be checkedpublic java.util.Iterator<java.lang.String> getDirectReferences()
ProductCollection
ProductCollection.getProducts()
getDirectReferences
in interface ProductCollection
public boolean hasDirectReference(java.lang.String path)
ProductCollection
ProductCollection.contains(com.adobe.cq.commerce.api.Product)
.hasDirectReference
in interface ProductCollection
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.public void add(java.lang.String path) throws CommerceException
ProductCollection
add
in interface ProductCollection
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.public void remove(java.lang.String path) throws CommerceException
ProductCollection
remove
in interface ProductCollection
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 presentpublic void orderBefore(java.lang.String srcPath, java.lang.String destPath)
ProductCollection
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.orderBefore
in interface ProductCollection
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.public void checkItemType(java.lang.String path)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"