org.pentaho.platform.repository.content
Class ContentItem

java.lang.Object
  extended by org.pentaho.platform.engine.core.system.PentahoBase
      extended by org.pentaho.platform.repository.content.ContentItem
All Implemented Interfaces:
Serializable, ILogger, IMimeTypeListener, IContentItem, ISearchable

public class ContentItem
extends PentahoBase
implements IContentItem, ISearchable

See Also:
Serialized Form

Nested Class Summary
static class ContentItem.FilePentahoStreamSource
           
 
Field Summary
 
Fields inherited from class org.pentaho.platform.engine.core.system.PentahoBase
EMPTYLOGID, LOGID_MASK1, LOGID_MASK2, LOGID_SEPARATOR
 
Fields inherited from interface org.pentaho.platform.api.repository.IContentItem
WRITEMODE_APPEND, WRITEMODE_KEEPVERSIONS, WRITEMODE_OVERWRITE
 
Fields inherited from interface org.pentaho.platform.api.repository.ISearchable
SEARCH_TYPE_PHRASE, SEARCH_TYPE_WORDS_AND, SEARCH_TYPE_WORDS_OR
 
Fields inherited from interface org.pentaho.platform.api.engine.ILogger
ACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN
 
Method Summary
 void closeOutputStream()
           
 boolean equals(Object other)
          equals override for Hibernate
 String getActionName()
           
 IPentahoStreamSource getDataSource()
          Returns a reader from the content item.
 String getExtension()
           
 Date getFileDateTime()
           
 String getFileId()
           
 long getFileSize()
           
 List getFileVersions()
           
 String getId()
           
 InputStream getInputStream()
          Gets an input stream from the Content item.
 int getLatestVersionNum()
          Deprecated.  
 Log getLogger()
           
 List getMessages()
           
 String getMimeType()
           
 String getName()
           
 OutputStream getOutputStream(String actionName)
          The behavior of this method depends upon it's write mode (defined only at construction).
 ContentLocation getParent()
           
 String getPath()
           
 String getPhraseSearchQueryName()
           
 Reader getReader()
           
 int getRevision()
           
 String[] getSearchableColumns()
           
 String getSearchableTable()
           
 String getTitle()
           
 String getUrl()
           
 int getWriteMode()
           
 int hashCode()
          hashcode override for Hibernate
 void makeTransient()
          Removes all versions of this item from the repository and removes this item from underlying persistence layer.
 void removeAllVersions()
          Removes all version files.
 void removeVersion(ContentItemFile cif)
           
 void removeVersion(String fileId)
          Removes the file with the id specified
 void setExtension(String extension)
           
 void setId(String id)
           
 void setLatestFile(ContentItemFile latestFile)
           
 void setLatestVersionNum(int latestVersionNum)
          Deprecated.  
 void setMimeType(String mimeType)
          Sets the mime type
 void setName(String fName)
           
 void setParent(ContentLocation theParent)
           
 void setPath(String path)
           
 void setRevision(int revision)
           
 void setTitle(String title)
           
 void setUrl(String url)
           
 void setWriteMode(int writeMode)
           
 String toString()
           
 
Methods inherited from class org.pentaho.platform.engine.core.system.PentahoBase
debug, debug, error, error, fatal, fatal, genLogIdFromInfo, genLogIdFromInfo, genLogIdFromSession, getLoggingLevel, getLogId, getObjectName, info, info, setLoggingLevel, setLogId, trace, trace, warn, warn
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getMessages

public List getMessages()

getInputStream

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

Specified by:
getInputStream in interface IContentItem
Returns:
An input stream from the file system that is represented by this content item
Throws:
ContentException

getDataSource

public IPentahoStreamSource getDataSource()
Description copied from interface: IContentItem
Returns a reader from the content item. If the content item doesn't exist an exception is thrown.

Specified by:
getDataSource in interface IContentItem
Returns:
A Reader from the file system that is pointed to by this content item.

getReader

public Reader getReader()
                 throws ContentException
Specified by:
getReader in interface IContentItem
Throws:
ContentException

getOutputStream

public OutputStream getOutputStream(String actionName)
                             throws IOException
Description copied from interface: IContentItem
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.

Specified by:
getOutputStream in interface IContentItem
Parameters:
actionName - The name of the action that is obtaining the output stream.
Returns:
the OutputStream to write to
Throws:
IOException

closeOutputStream

public void closeOutputStream()
Specified by:
closeOutputStream in interface IContentItem

getActionName

public String getActionName()
Specified by:
getActionName in interface IContentItem
Returns:
The name of the action from the latest ContentItemFile class that the ContentItem contains.

getFileId

public String getFileId()
Specified by:
getFileId in interface IContentItem
Returns:
This returns the Id of the ContentItemFile class that the ContentItem contains.

getFileSize

public long getFileSize()
Specified by:
getFileSize in interface IContentItem
Returns:
The file size from the latest ContentItemFile class that the ContentItem contains.

getFileDateTime

public Date getFileDateTime()
Specified by:
getFileDateTime in interface IContentItem
Returns:
The file date/time from the latest ContentItemFile class that the ContentItem contains.

getWriteMode

public int getWriteMode()
Returns:
Returns the writeMode.

setWriteMode

public void setWriteMode(int writeMode)
Parameters:
writeMode - The writeMode to set.

equals

public boolean equals(Object other)
equals override for Hibernate

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
hashcode override for Hibernate

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getExtension

public String getExtension()
Returns:
Returns the extension.

setExtension

public void setExtension(String extension)
Parameters:
extension - The extension to set.

setLatestFile

public void setLatestFile(ContentItemFile latestFile)
Parameters:
latestFile - The latestFile to set.

getLatestVersionNum

@Deprecated
public int getLatestVersionNum()
Deprecated. 

Returns:
Returns the latestVersionNum. Don't set or get this value any more - retained for backward compatibility.

setLatestVersionNum

@Deprecated
public void setLatestVersionNum(int latestVersionNum)
Deprecated. 

Parameters:
latestVersionNum - The latestVersionNum to set. Don't set or get this value any more - retained for backward compatibility.

getRevision

public int getRevision()
Returns:
Returns the revision.

setRevision

public void setRevision(int revision)
Parameters:
revision - The revision to set.

removeVersion

public void removeVersion(ContentItemFile cif)

removeVersion

public void removeVersion(String fileId)
Description copied from interface: IContentItem
Removes the file with the id specified

Specified by:
removeVersion in interface IContentItem

removeAllVersions

public void removeAllVersions()
Removes all version files.

Specified by:
removeAllVersions in interface IContentItem

getParent

public ContentLocation getParent()
Returns:
Returns the parent.

setParent

public void setParent(ContentLocation theParent)
Parameters:
theParent - The parent to set.

getName

public String getName()
Specified by:
getName in interface IContentItem
Returns:
Returns the name.

setName

public void setName(String fName)
Specified by:
setName in interface IMimeTypeListener
Parameters:
fName - The name to set.

getId

public String getId()
Specified by:
getId in interface IContentItem
Returns:
Returns the id.

setId

public void setId(String id)
Parameters:
id - The id to set.

getMimeType

public String getMimeType()
Specified by:
getMimeType in interface IContentItem
Returns:
Returns the mimeType.

setMimeType

public void setMimeType(String mimeType)
Description copied from interface: IContentItem
Sets the mime type

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

getUrl

public String getUrl()
Specified by:
getUrl in interface IContentItem
Returns:
Returns the url.

setUrl

public void setUrl(String url)
Parameters:
url - The url to set.

getPath

public String getPath()
Specified by:
getPath in interface IContentItem
Returns:
Returns the path.

setPath

public void setPath(String path)
Parameters:
path - The path to set.

getFileVersions

public List getFileVersions()
Specified by:
getFileVersions in interface IContentItem
Returns:
Returns the fileVersions.

getTitle

public String getTitle()
Specified by:
getTitle in interface IContentItem
Returns:
Returns the title.

setTitle

public void setTitle(String title)
Parameters:
title - The title to set.

getLogger

public Log getLogger()
Specified by:
getLogger in class PentahoBase
Returns:
Returns the log.

getSearchableColumns

public String[] getSearchableColumns()
Specified by:
getSearchableColumns in interface ISearchable
Returns:
Returns an array of the char/varchar columns that can be searched.

getSearchableTable

public String getSearchableTable()
Specified by:
getSearchableTable in interface ISearchable
Returns:
Returns the name of the hibernated object which will be used in the search.

getPhraseSearchQueryName

public String getPhraseSearchQueryName()
Specified by:
getPhraseSearchQueryName in interface ISearchable
Returns:
Returns the fully-package-qualified name of a named query in the Hibernate Schema that supports a full-text search of all searchable columns. The parameter name for the search term in the query must be :searchTerm or the query will fail.

makeTransient

public void makeTransient()
Description copied from interface: IContentItem
Removes all versions of this item from the repository and removes this item from underlying persistence layer.

Specified by:
makeTransient in interface IContentItem

toString

public String toString()
Overrides:
toString in class Object