@ProviderType public interface ResourceCollection
Resource
.
The collection does not store the actual Resources, it only points to
them.
Each entry in the collection is represented by a Resource which contains a
reference to original resource. That reference Resource can have additional
properties (creationDate, etc.)Modifier and Type | Field and Description |
---|---|
static java.lang.String |
RESOURCE_TYPE
Sling resource type for resource representing a ResourceCollection
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Resource resource)
Creates a new entry in the collection at the last position and add a reference to resource
in the entry.
|
boolean |
add(Resource resource,
java.util.Map<java.lang.String,java.lang.Object> properties)
Creates a new entry in the collection at the last position and add a reference to resource
in the entry.
|
boolean |
contains(Resource resource)
Returns true if resource reference is part of the collection.
|
java.lang.String |
getName()
Returns name of the collection.
|
java.lang.String |
getPath()
Returns path of the collection.
|
ModifiableValueMap |
getProperties(Resource resource)
Returns additional properties for a particular resource in Collection entry.
|
java.util.Iterator<Resource> |
getResources()
Returns an iterator over resources referred in the collection in the specified order.
|
void |
orderBefore(Resource srcResource,
Resource destResource)
This method inserts the referenced resource
srcResource
into the collection entry at the position immediately before the referenced resource destResource . |
boolean |
remove(Resource resource)
Removes a entry of resource from collection & returns true if successful.
|
static final java.lang.String RESOURCE_TYPE
- See Also:
- Constant Field Values
-
Method Detail
-
getName
java.lang.String getName()
Returns name of the collection.
- Returns:
- name of the collection.
-
getPath
java.lang.String getPath()
Returns path of the collection.
- Returns:
- path of the collection.
-
getResources
java.util.Iterator<Resource> getResources()
Returns an iterator over resources referred in the collection in the specified order.
- Returns:
- iterator over resources referred in collection.
-
getProperties
ModifiableValueMap getProperties(Resource resource)
Returns additional properties for a particular resource in Collection entry.
- Returns:
- properties of the Collection entry as
ModifiableValueMap
, returns null if entry found.
-
contains
boolean contains(Resource resource)
Returns true if resource reference is part of the collection.
- Parameters:
resource
- resource to be checked
- Returns:
- true if resource is part of the collection.
false otherwise
-
add
boolean add(Resource resource,
java.util.Map<java.lang.String,java.lang.Object> properties)
throws PersistenceException
Creates a new entry in the collection at the last position and add a reference to resource
in the entry.
Changes are transient & have to be saved by calling resolver.commit()
- Parameters:
resource
- resource to be added
properties
- The additional properties to be stored with the collection entry (can be null).
- Returns:
- true if addition of resource to collection was successful or
false if collection already contained the resource or resource is null.
- Throws:
{@link
- PersistenceException} if the operation fails
PersistenceException
-
add
boolean add(Resource resource)
throws PersistenceException
Creates a new entry in the collection at the last position and add a reference to resource
in the entry.
Changes are transient & have to be saved by calling resolver.commit()
- Parameters:
resource
- resource to be added
- Returns:
- true if addition of resource to collection was successful or
false if collection already contained the resource or resource is null.
- Throws:
{@link
- PersistenceException} if the operation fails
PersistenceException
-
remove
boolean remove(Resource resource)
throws PersistenceException
Removes a entry of resource from collection & returns true if successful.
Changes are transient & have to be saved by calling resolver.commit()
- Parameters:
resource
- resource reference to be removed
- Returns:
- true if resource reference was successfully removed from the collection.
false if not removed/not present
- Throws:
{@link
- PersistenceException} if the operation fails
PersistenceException
-
orderBefore
void orderBefore(Resource srcResource,
Resource destResource)
This method inserts the referenced resource srcResource
into the collection entry at the position immediately before the referenced resource destResource
.
To insert the referenced resource into last position, destResource
can be null.
- Parameters:
srcResource
- Referenced resource that needs to be moved in the order
destResource
- Referenced resource before which the srcResource
will be placed.
Copyright © 2010 - 2020 Adobe. All Rights Reserved