org.pentaho.platform.api.repository
Interface IContentItem

All Superinterfaces:
IMimeTypeListener
All Known Implementing Classes:
BufferedContentItem, ContentItem, HttpContentItem, MultiContentItem, SimpleContentItem

public interface IContentItem
extends IMimeTypeListener

Construction of a new ContentItem is managed by ContentLocation.newContentItem. This is because there is a parent-child relationship between ContentLocations and content items. To avoid having a content item reach back into it's parent to add itself to the children list, you instead call the content location to construct a content item. A content item cannot exist without a content location.

Author:
mbatchel
See Also:
ContentLocation

Field Summary
static int WRITEMODE_APPEND
          Append to existing file when request for a new output stream is received.
static int WRITEMODE_KEEPVERSIONS
          Keep multiple versions when request for an output stream is received
static int WRITEMODE_OVERWRITE
          Overwrite each time a request for a new output stream is received.
 
Method Summary
 void closeOutputStream()
           
 String getActionName()
           
 IPentahoStreamSource getDataSource()
          Returns a reader from the content item.
 Date getFileDateTime()
           
 String getFileId()
           
 long getFileSize()
           
 List getFileVersions()
           
 String getId()
           
 InputStream getInputStream()
          Gets an input stream from the Content item.
 String getMimeType()
           
 String getName()
           
 OutputStream getOutputStream(String actionName)
          The behavior of this method depends upon it's write mode (defined only at construction).
 String getPath()
           
 Reader getReader()
           
 String getTitle()
           
 String getUrl()
           
 void makeTransient()
          Removes all versions of this item from the repository and removes this item from underlying persistence layer.
 void removeAllVersions()
          Removes all the version from Hibernate
 void removeVersion(String fileId)
          Removes the file with the id specified
 void setMimeType(String mimeType)
          Sets the mime type
 
Methods inherited from interface org.pentaho.platform.api.engine.IMimeTypeListener
setName
 

Field Detail

WRITEMODE_KEEPVERSIONS

static final int WRITEMODE_KEEPVERSIONS
Keep multiple versions when request for an output stream is received

See Also:
Constant Field Values

WRITEMODE_OVERWRITE

static final int WRITEMODE_OVERWRITE
Overwrite each time a request for a new output stream is received.

See Also:
Constant Field Values

WRITEMODE_APPEND

static final int WRITEMODE_APPEND
Append to existing file when request for a new output stream is received.

See Also:
Constant Field Values
Method Detail

getId

String getId()
Returns:
The ContentItem Id

getPath

String getPath()
Returns:
The ContentItem path

getName

String getName()
Returns:
The name of the content item

getTitle

String getTitle()
Returns:
The title of the content item

getMimeType

String getMimeType()
Returns:
The MimeType of the content item.

getUrl

String getUrl()
Returns:
The URL (optional) of the content item

getFileVersions

List getFileVersions()
Returns:
If this is a multiple-versioned style of content item, return the whole list for admin purposes

removeAllVersions

void removeAllVersions()
Removes all the version from Hibernate


removeVersion

void removeVersion(String fileId)
Removes the file with the id specified


getInputStream

InputStream getInputStream()
                           throws ContentException
Gets an input stream from the Content item. If the content item doesn't exist on disk, throws an exception

Returns:
An input stream from the file system that is represented by this content item
Throws:
ContentException

getDataSource

IPentahoStreamSource getDataSource()
Returns a reader from the content item. If the content item doesn't exist an exception is thrown.

Returns:
A Reader from the file system that is pointed to by this content item.
Throws:
ContentException

getReader

Reader getReader()
                 throws ContentException
Throws:
ContentException

getOutputStream

OutputStream getOutputStream(String actionName)
                             throws IOException
The behavior of this method depends upon it's write mode (defined only at construction). If the write mode is WRITEMODE_KEEPVERSIONS, this method will create a new file on the disk, and add it to it's internal list of files, and return an output stream. If the write mode is WRITEMODE_OVERWRITE, this method will create an output stream and overwrite the existing file on the disk if it's found, or will create the file if it doesn't exist. If the write mode is WRITEMODE_APPEND, this method will append to the existing file on disk (if it exists), or create it if it doesn't exist.

Parameters:
actionName - The name of the action that is obtaining the output stream.
Returns:
the OutputStream to write to
Throws:
IOException

closeOutputStream

void closeOutputStream()

getActionName

String getActionName()
Returns:
The name of the action from the latest ContentItemFile class that the ContentItem contains.

getFileId

String getFileId()
Returns:
This returns the Id of the ContentItemFile class that the ContentItem contains.

getFileSize

long getFileSize()
Returns:
The file size from the latest ContentItemFile class that the ContentItem contains.

getFileDateTime

Date getFileDateTime()
Returns:
The file date/time from the latest ContentItemFile class that the ContentItem contains.

setMimeType

void setMimeType(String mimeType)
Sets the mime type

Specified by:
setMimeType in interface IMimeTypeListener
Parameters:
mimeType - The mime type to set.

makeTransient

void makeTransient()
Removes all versions of this item from the repository and removes this item from underlying persistence layer.