oracle.ifs.beans
Class ContentObjectDefinition


java.lang.Object

  |

  +--oracle.ifs.beans.LibraryObjectDefinition

        |

        +--oracle.ifs.beans.SystemObjectDefinition

              |

              +--oracle.ifs.beans.ContentObjectDefinition


public class ContentObjectDefinition
extends SystemObjectDefinition

The ContentObjectDefinition class is used to construct a ContentObject object. This subclass of PublicObjectDefinition sets the default ClassObject to "CONTENTOBJECT"

An instance of a ContentObjectDefinition is passed to LibrarySession.createContentObject() to actually construct the new document.

There are at least five ways to specify content: by local file path, by String, by InputStream, by Reader, or by existing content. Setting any one of these will override any other previously set content on the definition. Note that LocalFile means local relative to the machine on which the beans API is running.

If you extend ContentObjectDefinition in order to provide for a different type of content (e.g., Float), then your setContent method must convert your content into one of the supported types. The supported types are InputStream, Reader, String, Existing ContentObject, or path to a file to which the API has access.


Constructor Summary
ContentObjectDefinition(LibrarySession session)
          Constructs a ContentObjectDefinition explicitly capturing the session.
 
Method Summary
 java.lang.String getContent()
          Gets the content String as set in this definition, or null if no String was specified.
 java.lang.String getContentPath()
          Gets the path of the local file content, or null if no local file was specified.
 java.io.Reader getContentReader()
          Gets the Reader from which this content will be loaded.
 java.io.InputStream getContentStream()
          Gets the InputStream from which this content will be loaded.
 Format getFormat(LibrarySession sess)
          Returns the Format object representing the format of the content.
 void setContent(java.lang.String content)
          Sets the content as a String.
 void setContentPath(java.lang.String contentPath)
          Sets the path of the local file from which this content will be loaded/created.
 void setContentReader(java.io.Reader contentReader)
          Sets the content Reader from which the content will be loaded/created.
 void setContentStream(java.io.InputStream contentStream)
          Sets the content InputStream from which the content will be loaded/created.
 void setEmptyContent()
          This method indicates to the server that content should be created, but with zero length.
 void setFormat(Format format)
          Sets the Format object describing the type of content.
 
Methods inherited from class oracle.ifs.beans.LibraryObjectDefinition
clone, getAttribute, getAttributes, getClassObject, getOption, getOptionKeys, removeAttribute, removeOption, setAttribute, setAttribute, setAttributeByUpperCaseName, setAttributes, setClassObject, setOption
 

Constructor Detail


ContentObjectDefinition


public ContentObjectDefinition(LibrarySession session)
                        throws IfsException
Constructs a ContentObjectDefinition explicitly capturing the session.
Parameters:
session - the session
Throws:
IfsException - if the operation fails
Method Detail

setFormat


public void setFormat(Format format)
               throws IfsException
Sets the Format object describing the type of content.
Parameters:
format - the desired Format object.
Throws:
IfsException - if the operation fails.

setContentPath


public void setContentPath(java.lang.String contentPath)
                    throws IfsException
Sets the path of the local file from which this content will be loaded/created. This will always transfer content down as a stream. If you want to transfer it as a Reader, then you need to pass a FileReader to setContentReader().
Parameters:
contentPath - the file from which content will be loaded/created.
Throws:
IfsException - if the operation fails.

setContentStream


public void setContentStream(java.io.InputStream contentStream)
                      throws IfsException
Sets the content InputStream from which the content will be loaded/created.
Parameters:
contentStream - an InputStream from which content will be loaded/created.
Throws:
IfsException - if the operation fails.

setContentReader


public void setContentReader(java.io.Reader contentReader)
                      throws IfsException
Sets the content Reader from which the content will be loaded/created.
Parameters:
contentReader - an Reader from which content will be loaded/created.
Throws:
IfsException - if the operation fails.

setContent


public void setContent(java.lang.String content)
                throws IfsException
Sets the content as a String. This is converted internally to a StringReader so equivalent to setContentReader.
Parameters:
content - A String which contains the content that will be loaded into the new content object.
Throws:
IfsException - if the operation fails.

setEmptyContent


public void setEmptyContent()
                     throws IfsException
This method indicates to the server that content should be created, but with zero length.
Throws:
IfsException - if the operation fails.

getFormat


public Format getFormat(LibrarySession sess)
                 throws IfsException
Returns the Format object representing the format of the content.
Parameters:
sess - current LibrarySession
Returns:
the Format object
Throws:
IfsException - if the operation fails.

getContentPath


public java.lang.String getContentPath()
                                throws IfsException
Gets the path of the local file content, or null if no local file was specified.
Returns:
the local content path
Throws:
IfsException - if the operation fails.

getContent


public java.lang.String getContent()
                            throws IfsException
Gets the content String as set in this definition, or null if no String was specified.
Returns:
the content String
Throws:
IfsException - if the operation fails.

getContentStream


public java.io.InputStream getContentStream()
                                     throws IfsException
Gets the InputStream from which this content will be loaded. or null if no InputStream was specified.
Returns:
the content InputStream
Throws:
IfsException - if the operation fails.

getContentReader


public java.io.Reader getContentReader()
                                throws IfsException
Gets the Reader from which this content will be loaded. or null if no Reader was specified.
Returns:
the content Reader
Throws:
IfsException - if the operation fails.