Interface ResourceCollectionManager
The
ResourceCollectionManager defines the API to get, create and delete
resource collections ResourceCollection.
The ResourceCollectionManager service can be retrieved by looking it up from the
service registry or by adapting a ResourceResolver.-
Method Summary
Modifier and TypeMethodDescriptioncreateCollection(Resource parentResource, String name) This method creates a resource collection with a given name under theparentResource.This method creates a resource collection with a given name under theparentResource.booleandeleteCollection(Resource resource) Removes theResourceCollectioncorresponding to the collection represented byresource.getCollection(Resource resource) This method returns a resource collection for the givenresourcethat represents aResourceCollection.
-
Method Details
-
getCollection
This method returns a resource collection for the givenresourcethat represents aResourceCollection. It returns null if given resource is not a collection- Parameters:
resource- resource that represents a collection- Returns:
- The
ResourceCollectionrepresenting the collection.
-
createCollection
ResourceCollection createCollection(Resource parentResource, String name) throws PersistenceException This method creates a resource collection with a given name under theparentResource. The changes are transient and have to be saved by resourceResolver.commit()- Parameters:
parentResource- parent resource where collection needs to be created.name- The name for collection.- Returns:
- The
ResourceCollectionrepresenting the created collection. - Throws:
PersistenceException- if the operation fails
-
createCollection
ResourceCollection createCollection(Resource parentResource, String name, Map<String, Object> properties) throws PersistenceExceptionThis method creates a resource collection with a given name under theparentResource. The changes are transient and have to be saved by resourceResolver.commit()- Parameters:
parentResource- parent resource where collection needs to be created.name- The name for collection.properties- The additional data for resource collection- Returns:
- The
ResourceCollectionrepresenting the created collection. - Throws:
PersistenceException- if the operation fails
-
deleteCollection
Removes theResourceCollectioncorresponding to the collection represented byresource. The changes are transient and have to be saved by resourceResolver.commit()- Parameters:
resource- resource representing a collection to be deleted.- Returns:
trueif the collection was successfully removed.- Throws:
PersistenceException- if the operation fails
-