com.wm.app.tn.doc
Class BizDocContentPart

java.lang.Object
  extended by com.wm.app.tn.util.TNFixedData
      extended by com.wm.app.tn.doc.BizDocContentPart
All Implemented Interfaces:
com.wm.data.IData, java.lang.Cloneable

public class BizDocContentPart
extends TNFixedData

Represents the content part that is associated with a BizDocEnvelope. Each BizDocEnvelope can have 0 or more content parts. BizDocContentPart can be used to represent small or large document parts. Some notes about small and large document parts:

In general, there are setters and getters for all the fields. None of the setters will modify the contents of the database unless explicitly stated otherwise: this means it's a bad idea to update documents after they've been saved.

See Also:
BizDocEnvelope

Nested Class Summary
 
Nested classes/interfaces inherited from class com.wm.app.tn.util.TNFixedData
TNFixedData.TreeCursor
 
Field Summary
static java.lang.String STORAGE_TYPE_DB
          constant to indicate storage type "database"
static java.lang.String STORAGE_TYPE_SHARED_DISK
           
static java.lang.String STORAGE_TYPE_TSPACE
          constant to indicate storage type "tspace"
 
Constructor Summary
BizDocContentPart(java.lang.String partName, java.lang.String mimeType, byte[] bytes, int partIndex)
          Costructor for BizDocContentPart (used for constructing small content parts)
BizDocContentPart(java.lang.String partName, java.lang.String mimeType, byte[] bytes, int partIndex, int length, java.lang.String storageType, java.lang.Object storageRef)
          Costructor for BizDocContentPart (can be used for constructing small or large content parts)
BizDocContentPart(java.lang.String partName, java.lang.String mimeType, byte[] bytes, int partIndex, int length, java.lang.String storageType, java.lang.Object storageRef, boolean largePart)
          For internal use only (use either the 4-argument or 6-argument constructor)
BizDocContentPart(java.lang.String partName, java.lang.String mimeType, int partIndex, int length, java.lang.String storageType, java.lang.Object storageRef)
          Costructor for BizDocContentPart (used for constructing large content parts)
 
Method Summary
static BizDocContentPart[] addContentPart(BizDocContentPart[] ary, BizDocContentPart part)
          Append to an array of BizDocContentParts
static BizDocContentPart[] arrayCast(java.lang.Object[] ary)
          For internal use only
static com.wm.data.IData create()
           
static BizDocContentPart createLargeContentPart(java.lang.String partName, java.lang.String mimeType, int partIndex, java.io.InputStream contentStream, int contentLength)
           
 byte[] getBytes()
           
 java.lang.Object getContent()
          For Internal use only
 java.lang.Object getContent(java.lang.String docId)
          For Internal use only
static java.lang.String getFromMimeType(java.lang.String mimeType, java.lang.String key)
          For internal use only
 int getLength()
           
 java.lang.String getMimeType()
           
 int getPartIndex()
           
 java.lang.String getPartName()
           
 java.lang.Object getStorageRef()
           
 java.lang.String getStorageType()
           
 boolean isLargePart()
           
 void setBytes(byte[] bytes)
          sets content of this part (applicable for small documents only)
 void setLargePart(boolean largePart)
           
 void setLength(int length)
          for internal use only
 void setMimeType(java.lang.String mimeType)
          sets the mime type of this part (mime tyupe may contain information about the content-type and encodings of the part)
 void setPartIndex(int partIndex)
          sets the index this part
 void setPartName(java.lang.String partName)
          sets the part name of this content part
 void setStorageRef(java.lang.Object storageRef)
          sets the storage reference object of this part (applicable only for large documents)
 void setStorageType(java.lang.String storageType)
          Sets the storage type of this part (applicable only for large documents)
 
Methods inherited from class com.wm.app.tn.util.TNFixedData
clone, dataSize, get, get, getCursor, getHashCursor, getIndexCursor, getKey, getSharedCursor, getTreeCursor, indexOf, merge, set, set, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STORAGE_TYPE_TSPACE

public static final java.lang.String STORAGE_TYPE_TSPACE
constant to indicate storage type "tspace"

See Also:
Constant Field Values

STORAGE_TYPE_SHARED_DISK

public static final java.lang.String STORAGE_TYPE_SHARED_DISK
See Also:
Constant Field Values

STORAGE_TYPE_DB

public static final java.lang.String STORAGE_TYPE_DB
constant to indicate storage type "database"

See Also:
Constant Field Values
Constructor Detail

BizDocContentPart

public BizDocContentPart(java.lang.String partName,
                         java.lang.String mimeType,
                         byte[] bytes,
                         int partIndex)
Costructor for BizDocContentPart (used for constructing small content parts)

Parameters:
partName - the part name of the content part
mimeType - contains information about the content part such as content-type, encoding and etc.
bytes - the actual content of the content part in the form of byte[]
partIndex - indicates the index of this part in the content part array that is added to the BizDocEnvelope

BizDocContentPart

public BizDocContentPart(java.lang.String partName,
                         java.lang.String mimeType,
                         int partIndex,
                         int length,
                         java.lang.String storageType,
                         java.lang.Object storageRef)
Costructor for BizDocContentPart (used for constructing large content parts)

Parameters:
partName - the part name of the content part
mimeType - contains information about the content part such as content-type, encoding and etc.
partIndex - indicates the index of this part in the content part array that is added to the BizDocEnvelope
length - indicates the length of this content part in number of bytes
storageType - indicates the storage type of this content part. use STORAGE_TYPE_TSPACE or STORAGE_TYPE_DB constants of this class
storageRef - contains the storage reference object of the content part. if the storageType is STORAGE_TYPE_TSPACE, storageRef contains an object of com.wm.util.tspace.Reservation class.

BizDocContentPart

public BizDocContentPart(java.lang.String partName,
                         java.lang.String mimeType,
                         byte[] bytes,
                         int partIndex,
                         int length,
                         java.lang.String storageType,
                         java.lang.Object storageRef)
Costructor for BizDocContentPart (can be used for constructing small or large content parts)

Parameters:
partName - is the part name of the content part
mimeType - contains information about the content part such as content-type, encoding and etc.
bytes - contains the content of the content part. if this represents a large content part then this field is left empty and the storageType and storageRef fields are populated
partIndex - indicates the index of this part in the content part array that is added to the BizDocEnvelope
length - indicates the length of this content part in number of bytes.
storageType - - indicates the storage type of this content part. use STORAGE_TYPE_TSPACE or STORAGE_TYPE_DB constants of this class.
storageRef - contains the storage reference object of the content part. if the storageType is STORAGE_TYPE_TSPACE, storageRef contains an object of com.wm.util.tspace.Reservation class.

BizDocContentPart

public BizDocContentPart(java.lang.String partName,
                         java.lang.String mimeType,
                         byte[] bytes,
                         int partIndex,
                         int length,
                         java.lang.String storageType,
                         java.lang.Object storageRef,
                         boolean largePart)
For internal use only (use either the 4-argument or 6-argument constructor)

Method Detail

create

public static com.wm.data.IData create()

getPartName

public java.lang.String getPartName()
Returns:
the name of this part

getMimeType

public java.lang.String getMimeType()
Returns:
the mime type information of this part (i.e. the content-type, encoding and etc.)

getLength

public int getLength()
Returns:
the length(in number of bytes) of this part

getBytes

public byte[] getBytes()
Returns:
the content of this part; returns null if this a large content part

getPartIndex

public int getPartIndex()
Returns:
the index of this part in the BizDocEnvelope content part array

getStorageType

public java.lang.String getStorageType()
Returns:
the storage type of the content part; may be null for small documents; for large documents it may contain the value of constant STORAGE_TYPE_TSPACE

getStorageRef

public java.lang.Object getStorageRef()
Returns:
the storage refrence of the content part; may be null for small documents; for large documents this returns an object of com.wm.util.tspace.Reservation

isLargePart

public boolean isLargePart()
Returns:
is this a large content part?

setPartName

public final void setPartName(java.lang.String partName)
sets the part name of this content part


setMimeType

public final void setMimeType(java.lang.String mimeType)
sets the mime type of this part (mime tyupe may contain information about the content-type and encodings of the part)


setLength

public final void setLength(int length)
for internal use only


setBytes

public final void setBytes(byte[] bytes)
sets content of this part (applicable for small documents only)


setPartIndex

public final void setPartIndex(int partIndex)
sets the index this part


setStorageType

public final void setStorageType(java.lang.String storageType)
Sets the storage type of this part (applicable only for large documents)

Parameters:
storageType - indicates the storage type. For large documents storageType contains the value of constant STORAGE_TYPE_TSPACE

setStorageRef

public final void setStorageRef(java.lang.Object storageRef)
sets the storage reference object of this part (applicable only for large documents)

Parameters:
storageRef - contains the storage reference. For large documents storageRef is an object of com.wm.util.tspace.Reservation

setLargePart

public void setLargePart(boolean largePart)

getContent

public final java.lang.Object getContent()
                                  throws java.io.IOException
For Internal use only

Throws:
java.io.IOException

getContent

public final java.lang.Object getContent(java.lang.String docId)
                                  throws java.io.IOException
For Internal use only

Throws:
java.io.IOException

addContentPart

public static BizDocContentPart[] addContentPart(BizDocContentPart[] ary,
                                                 BizDocContentPart part)
Append to an array of BizDocContentParts


arrayCast

public static BizDocContentPart[] arrayCast(java.lang.Object[] ary)
For internal use only


createLargeContentPart

public static BizDocContentPart createLargeContentPart(java.lang.String partName,
                                                       java.lang.String mimeType,
                                                       int partIndex,
                                                       java.io.InputStream contentStream,
                                                       int contentLength)
                                                throws java.io.IOException,
                                                       com.wm.util.tspace.ReservationException
Throws:
java.io.IOException
com.wm.util.tspace.ReservationException

getFromMimeType

public static java.lang.String getFromMimeType(java.lang.String mimeType,
                                               java.lang.String key)
For internal use only