Interface ICollection
- All Superinterfaces:
IEntity
public interface ICollection extends IEntity
The
ICollection interface represents a collection in the
repository.-
Method Summary
Modifier and Type Method Description ICollectioncreateCollection(String name)Creates a new collection with the specified name in this collection.IResourcecreateResource(String name, byte[] content)Create resource under this collection by recognizing the content type and binary flag by its file extension.IResourcecreateResource(String name, byte[] content, boolean isBinary, String contentType)Create resource under this collection by specifying the binary flag.List<IEntity>getChildren()List the children of this collection.ICollectiongetCollection(String name)Returns the collection with the specified name contained in this collection.List<ICollection>getCollections()Returns a list of all the child collections held by this collection.List<String>getCollectionsNames()Returns a list containing the names of all the child collections directly contained within this collection.IResourcegetResource(String name)Returns the resource with the specified name contained in this collection.List<IResource>getResources()Returns a list of all the resources held by this collection.List<String>getResourcesNames()Returns a list containing the names of all the resources directly contained in this collection.voidremoveCollection(String name)Removes the collection with the specified name contained in this collection.voidremoveCollection(ICollection collection)Removes the child collection represented by the parameter.voidremoveResource(String name)Removes the resource with the specified name from this collection.voidremoveResource(IResource resource)Removes the child resource represented by the parameter.
-
Method Details
-
getCollections
Returns a list of all the child collections held by this collection.- Returns:
- a list of
ICollectioninstances - Throws:
RepositoryReadException- in case the list ofICollectioncannot be retrieved
-
getCollectionsNames
Returns a list containing the names of all the child collections directly contained within this collection.- Returns:
- a list of
ICollectioninstances names - Throws:
RepositoryReadException- in case the names cannot be retrieved
-
createCollection
Creates a new collection with the specified name in this collection.The name should not contain any slashes.
The change is persisted to the backend.
- Parameters:
name- theICollectionname- Returns:
- an
ICollectioninstance - Throws:
RepositoryReadException- in theICollectioncannot be created
-
getCollection
Returns the collection with the specified name contained in this collection.The returned collection is just a representation. It may not exist on the backend.
- Parameters:
name- the name of the collection- Returns:
- an
ICollectioninstance. - Throws:
RepositoryReadException- in case theICollectioncannot be retrieved
-
removeCollection
Removes the collection with the specified name contained in this collection.The name should not contain any slashes.
The change is persisted to the backend.
- Parameters:
name- the name of theICollectionto be removed- Throws:
RepositoryWriteException- in case theICollectioncannot be removed
-
removeCollection
Removes the child collection represented by the parameter.- Parameters:
collection- theICollectioninstance to be removed- Throws:
RepositoryWriteException- in case theICollectioncannot be removed
-
getResources
Returns a list of all the resources held by this collection.- Returns:
- a list of
IResourceinstances - Throws:
RepositoryReadException- in case the list ofIResourcecannot be retrieved
-
getResourcesNames
Returns a list containing the names of all the resources directly contained in this collection.- Returns:
- a list of
IResourceinstances names - Throws:
RepositoryReadException- in case the list ofIResourcenames cannot be retrieved
-
getResource
Returns the resource with the specified name contained in this collection.The returned resource is just a representation. It may not exist on the backend.
- Parameters:
name- the name of theIResource- Returns:
- a
IResourceinstance - Throws:
RepositoryReadException- in case theIResourcecannot be retrieved
-
removeResource
Removes the resource with the specified name from this collection.Changes are persisted to the backend.
- Parameters:
name- the name of theIResourceinstance to be removed- Throws:
RepositoryWriteException- in case theIResourcecannot be removed
-
removeResource
Removes the child resource represented by the parameter.Changes are persisted to the backend.
- Parameters:
resource- theIResourceto be removed- Throws:
RepositoryWriteException- in case theIResourcecannot be removed
-
getChildren
List the children of this collection.- Returns:
- a list of
IEntityinstances - Throws:
RepositoryReadException- in case the list of theIEntitycannot be retrieved
-
createResource
IResource createResource(String name, byte[] content, boolean isBinary, String contentType) throws RepositoryWriteExceptionCreate resource under this collection by specifying the binary flag.- Parameters:
name- the name of theIResourcecontent- the raw contentisBinary- whether it is binarycontentType- the type of the content- Returns:
- an
IResourceinstance - Throws:
RepositoryWriteException- in case theIResourcecannot be created
-
createResource
Create resource under this collection by recognizing the content type and binary flag by its file extension.- Parameters:
name- the name of theIResourcecontent- the raw content- Returns:
- an
IResourceinstance - Throws:
RepositoryWriteException- in case theIResourcecannot be created
-