public class ResourceCollectionImpl extends Object implements ResourceCollection
ResourceCollection| Constructor and Description |
|---|
ResourceCollectionImpl(org.apache.sling.api.resource.Resource resource)
Creates a new collection from the given resource
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(org.apache.sling.api.resource.Resource res)
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 res,
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 res)
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.
|
String |
getType()
Returns the sling resource type on content node of collection
|
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 res)
Removes a entry of resource from collection & returns true if successful.
|
void |
setType(String type)
Sets the sling resource type on content node of collection
|
public ResourceCollectionImpl(org.apache.sling.api.resource.Resource resource)
resource - the resourcepublic String getName()
getName in interface ResourceCollectionpublic String getPath()
getPath in interface ResourceCollectionpublic boolean add(org.apache.sling.api.resource.Resource res,
Map<String,Object> properties)
throws org.apache.sling.api.resource.PersistenceException
add in interface ResourceCollectionres - resource to be addedproperties - The additional properties to be stored with the collection entry (can be null).org.apache.sling.api.resource.PersistenceExceptionpublic boolean add(org.apache.sling.api.resource.Resource res)
throws org.apache.sling.api.resource.PersistenceException
add in interface ResourceCollectionres - resource to be addedorg.apache.sling.api.resource.PersistenceExceptionpublic Iterator<org.apache.sling.api.resource.Resource> getResources()
getResources in interface ResourceCollectionpublic String getType()
sling:resourceType for the collection resourcepublic boolean contains(org.apache.sling.api.resource.Resource res)
contains in interface ResourceCollectionres - resource to be checkedpublic boolean remove(org.apache.sling.api.resource.Resource res)
throws org.apache.sling.api.resource.PersistenceException
remove in interface ResourceCollectionres - resource reference to be removedorg.apache.sling.api.resource.PersistenceExceptionpublic void setType(String type) throws org.apache.sling.api.resource.PersistenceException
type - sling:resourceType to be set on the content nodeorg.apache.sling.api.resource.PersistenceExceptionpublic void orderBefore(org.apache.sling.api.resource.Resource srcResource,
org.apache.sling.api.resource.Resource destResource)
ResourceCollectionsrcResource
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.orderBefore in interface ResourceCollectionsrcResource - Referenced resource that needs to be moved in the orderdestResource - Referenced resource before which the srcResource will be placed.public org.apache.sling.api.resource.ModifiableValueMap getProperties(org.apache.sling.api.resource.Resource resource)
ResourceCollectiongetProperties in interface ResourceCollectionModifiableValueMap, returns null if entry found.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.