public class ResourceCollectionManagerImpl extends Object implements ResourceCollectionManager
ResourceCollectionManger
interface. And provides
create, delete, get apis for ResourceCollection.
This service can be retrieved by looking it up from the
service registry or by adapting a ResourceResolver
.Constructor and Description |
---|
ResourceCollectionManagerImpl() |
Modifier and Type | Method and Description |
---|---|
ResourceCollection |
createCollection(org.apache.sling.api.resource.Resource parentResource,
String name)
This method creates a resource collection with a given name under the
parentResource . |
ResourceCollection |
createCollection(org.apache.sling.api.resource.Resource parentResource,
String name,
Map<String,Object> properties)
This method creates a resource collection with a given name under the
parentResource . |
boolean |
deleteCollection(org.apache.sling.api.resource.Resource resource)
Removes the
ResourceCollection corresponding to the collection represented by
resource . |
ResourceCollection |
getCollection(org.apache.sling.api.resource.Resource resource)
This method returns a resource collection for the given
resource
that represents a ResourceCollection . |
public ResourceCollection getCollection(org.apache.sling.api.resource.Resource resource)
resource
that represents a ResourceCollection
.
It returns null if given resource is not a collectiongetCollection
in interface ResourceCollectionManager
resource
- resource that represents a collectionResourceCollection
representing the collection.public ResourceCollection createCollection(org.apache.sling.api.resource.Resource parentResource, String name) throws org.apache.sling.api.resource.PersistenceException
parentResource
.
The changes are transient and have to be saved by resourceResolver.commit()createCollection
in interface ResourceCollectionManager
parentResource
- parent resource where collection needs to be created.name
- The name for collection.ResourceCollection
representing the created collection.org.apache.sling.api.resource.PersistenceException
public ResourceCollection createCollection(org.apache.sling.api.resource.Resource parentResource, String name, Map<String,Object> properties) throws org.apache.sling.api.resource.PersistenceException
parentResource
.
The changes are transient and have to be saved by resourceResolver.commit()createCollection
in interface ResourceCollectionManager
parentResource
- parent resource where collection needs to be created.name
- The name for collection.properties
- The additional data for resource collectionResourceCollection
representing the created collection.org.apache.sling.api.resource.PersistenceException
public boolean deleteCollection(org.apache.sling.api.resource.Resource resource) throws org.apache.sling.api.resource.PersistenceException
ResourceCollection
corresponding to the collection represented by
resource
.
The changes are transient and have to be saved by resourceResolver.commit()deleteCollection
in interface ResourceCollectionManager
resource
- resource representing a collection to be deleted.true
if the collection was successfully removed.org.apache.sling.api.resource.PersistenceException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.