@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 String |
RESOURCE_TYPE
Sling resource type for resource representing a
ResourceCollection |
Modifier and Type | Method and Description |
---|---|
boolean |
add(org.apache.sling.api.resource.Resource resource)
Creates a new entry in the collection at the last position and add a reference to resource
in the entry.
|
boolean |
add(org.apache.sling.api.resource.Resource resource,
Map<String,Object> properties)
Creates a new entry in the collection at the last position and add a reference to resource
in the entry.
|
boolean |
contains(org.apache.sling.api.resource.Resource resource)
Returns true if resource reference is part of the collection.
|
String |
getName()
Returns name of the collection.
|
String |
getPath()
Returns path of the collection.
|
org.apache.sling.api.resource.ModifiableValueMap |
getProperties(org.apache.sling.api.resource.Resource resource)
Returns additional properties for a particular resource in Collection entry.
|
Iterator<org.apache.sling.api.resource.Resource> |
getResources()
Returns an iterator over resources referred in the collection in the specified order.
|
org.apache.sling.api.resource.ValueMap |
getValueMap(org.apache.sling.api.resource.Resource resource)
Returns additional properties for a particular resource in Collection entry.
|
void |
orderBefore(org.apache.sling.api.resource.Resource srcResource,
org.apache.sling.api.resource.Resource destResource)
This method inserts the referenced resource
srcResource
into the collection entry at the position immediately before the referenced resource destResource . |
boolean |
remove(org.apache.sling.api.resource.Resource resource)
Removes a entry of resource from collection & returns true if successful.
|
static final String RESOURCE_TYPE
ResourceCollection
String getName()
String getPath()
Iterator<org.apache.sling.api.resource.Resource> getResources()
org.apache.sling.api.resource.ValueMap getValueMap(org.apache.sling.api.resource.Resource resource)
resource
- resource for which to get the propertiesValueMap
which will not be nullorg.apache.sling.api.resource.ModifiableValueMap getProperties(org.apache.sling.api.resource.Resource resource)
resource
- resource for which to get the propertiesModifiableValueMap
, returns null if no entry found
or the entry cannot be adapted to a ModifiableValueMapboolean contains(org.apache.sling.api.resource.Resource resource)
resource
- resource to be checkedboolean add(org.apache.sling.api.resource.Resource resource, Map<String,Object> properties) throws org.apache.sling.api.resource.PersistenceException
resource
- resource to be addedproperties
- The additional properties to be stored with the collection entry (can be null).org.apache.sling.api.resource.PersistenceException
- if the operation failsboolean add(org.apache.sling.api.resource.Resource resource) throws org.apache.sling.api.resource.PersistenceException
resource
- resource to be addedorg.apache.sling.api.resource.PersistenceException
- if the operation failsboolean remove(org.apache.sling.api.resource.Resource resource) throws org.apache.sling.api.resource.PersistenceException
resource
- resource reference to be removedorg.apache.sling.api.resource.PersistenceException
- if the operation failsvoid orderBefore(org.apache.sling.api.resource.Resource srcResource, org.apache.sling.api.resource.Resource destResource)
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.srcResource
- Referenced resource that needs to be moved in the orderdestResource
- Referenced resource before which the srcResource
will be placed.Copyright © 2007–2022 The Apache Software Foundation. All rights reserved.