Class FileContentEntity
- java.lang.Object
-
- org.pentaho.reporting.libraries.repository.file.FileContentEntity
-
- All Implemented Interfaces:
java.io.Serializable,ContentEntity
- Direct Known Subclasses:
FileContentItem,FileContentLocation
public abstract class FileContentEntity extends java.lang.Object implements ContentEntity, java.io.Serializable
A content-entity that uses a java.io.File as backend. The entity can read theLibRepositoryBoot.SIZE_ATTRIBUTEand can read and write theLibRepositoryBoot.VERSION_ATTRIBUTE.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete()Attempts to delete the entity.java.lang.ObjectgetAttribute(java.lang.String domain, java.lang.String key)Returns a attribute value for the given domain (namespace) and attribute-name.java.lang.ObjectgetContentId()Returns a unique identifier.java.lang.StringgetName()Returns the name of the file.ContentLocationgetParent()Returns a reference to the parent location.RepositorygetRepository()Returns the current repository, to which tis entity belongs.booleansetAttribute(java.lang.String domain, java.lang.String key, java.lang.Object value)Updates the attribute value for the given attribute domain and name.
-
-
-
Method Detail
-
getRepository
public Repository getRepository()
Returns the current repository, to which tis entity belongs.- Specified by:
getRepositoryin interfaceContentEntity- Returns:
- the repository.
-
getName
public java.lang.String getName()
Returns the name of the file.- Specified by:
getNamein interfaceContentEntity- Returns:
- the name, never null.
-
getContentId
public java.lang.Object getContentId()
Returns a unique identifier. This can be canonical filename or a database key. It must be guaranteed that within the same repository the key will be unique.- Specified by:
getContentIdin interfaceContentEntity- Returns:
- the unique content ID.
-
getAttribute
public java.lang.Object getAttribute(java.lang.String domain, java.lang.String key)Returns a attribute value for the given domain (namespace) and attribute-name. Some generic attribute domains and names are defined as constants in theLibRepositoryBootclass.- Specified by:
getAttributein interfaceContentEntity- Parameters:
domain- the attribute domain.key- the name of the attribute.- Returns:
- the value or null, if the content-entity does not have a value for this attribute.
-
setAttribute
public boolean setAttribute(java.lang.String domain, java.lang.String key, java.lang.Object value)Updates the attribute value for the given attribute domain and name. If the element is not writable or the attribute could not be updated for any other reason, the method will return false. This method only returns true, if the attribute has been updated successfully.- Specified by:
setAttributein interfaceContentEntity- Parameters:
domain- the attribute domain.key- the attribute namevalue- the new attribute value.- Returns:
- true, if the update was successful, false otherwise.
-
getParent
public ContentLocation getParent()
Returns a reference to the parent location. If this entity represents the root directory, this method will return null.- Specified by:
getParentin interfaceContentEntity- Returns:
- the parent or null, if this is the root-directory.
-
delete
public boolean delete()
Attempts to delete the entity. After an entity has been deleted, any call to any of the methods of the entity may produce undefined results.- Specified by:
deletein interfaceContentEntity- Returns:
- true, if the entity was deleted and detached from the repository, false otherwise.
-
-