Interface IEntity
- All Known Subinterfaces:
ICollection,IResource
public interface IEntity
IEntity interface is a base interface for ICollection and
IResource. It provides methods that are common for both interfaces.
-
Method Summary
Modifier and Type Method Description voidcopyTo(String path)Copies this entity to a collection at the specifiedpath.voidcreate()Forces this entity to be created at its current path.voiddelete()Removes this entity from the repository.booleanexists()Returns whether this entity is valid and exists on the backend.IEntityInformationgetInformation()Returns an instance ofIEntityInformationthrough which one can obtain information on the current entity.StringgetName()Returns the name of this entity.ICollectiongetParent()Returns the collection that holds this entity.StringgetPath()Returns the path of this entity.IRepositorygetRepository()Returns the repository that holds this resource.booleanisEmpty()Returns whether this entity is empty.voidmoveTo(String path)Moves this entity to a collection at the specifiedpath.voidrenameTo(String name)Changes the name of this entity to the specified value.
-
Method Details
-
getRepository
IRepository getRepository()Returns the repository that holds this resource.- Returns:
- an
IRepositoryinstance
-
getName
String getName()Returns the name of this entity.This is equal to the content of the path after the last slash in it.
- Returns:
- the name of the entity
-
getPath
String getPath()Returns the path of this entity.The result may not be
null.Example: /repository/users/test.txt
Example: /repository/articles- Returns:
- the location
-
getParent
ICollection getParent()Returns the collection that holds this entity.The result could be
nullshould there be no parent (i.e. this is the root).- Returns:
- an parent
ICollection
-
getInformation
Returns an instance ofIEntityInformationthrough which one can obtain information on the current entity.This method may not return
null, however, the contents of the returnedIEntityInformationmay returnnullindicating that a given information is not available.- Returns:
- an
IEntityInformationinstance with the meta-data of the entity - Throws:
RepositoryReadException- if for some reason a connection to the backend could not be achieved.
-
create
Forces this entity to be created at its current path.Whether the entity will be created as a resource or a collection depends on whether it is an instance of
IResourceorICollection.- Throws:
RepositoryWriteException- if for some reason a connection to the backend could not be achieved, or if an entity with this path already exists on the backend.
-
delete
Removes this entity from the repository.If no such resource exists, this method does nothing.
- Throws:
RepositoryWriteException- if for some reason a connection to the backend could not be achieved.
-
renameTo
Changes the name of this entity to the specified value.- Parameters:
name- the new name- Throws:
RepositoryWriteException- if for some reason a connection to the backend could not be achieved
-
moveTo
Moves this entity to a collection at the specifiedpath.If this entity is of type
ICollection, then all child entities are copied too.- Parameters:
path- the new location- Throws:
RepositoryWriteException- if for some reason a connection to the backend could not be achieved
-
copyTo
Copies this entity to a collection at the specifiedpath.If this entity is of type
ICollection, then all child entities are copied too.- Parameters:
path- the location ot be copied to- Throws:
RepositoryWriteException- if for some reason a connection to the backend could not be achieved
-
exists
Returns whether this entity is valid and exists on the backend.- Returns:
- whether this entity is already materialized
- Throws:
RepositoryReadException- if for some reason a connection to the backend could not be achieved.
-
isEmpty
Returns whether this entity is empty.If the entity is a collection, implementations should check to see if it has any child entities.
If the entity is a resource, implementations should check to see if it has any content.
Note: Calling this method on a resource can be slow.- Returns:
- whether this entity is empty
- Throws:
RepositoryReadException- if for some reason a connection to the backend could not be achieved.
-