com.ibm.xsp.model.domino.wrapped
Class DominoRichTextItem

java.lang.Object
  extended by com.ibm.xsp.model.domino.wrapped.DominoRichTextItem
All Implemented Interfaces:
IMimeMultipart, java.io.Serializable

public class DominoRichTextItem
extends java.lang.Object
implements IMimeMultipart, java.io.Serializable

DominoRichTextItem represents a RichTextItem field in a Document. This value is returned by the DominoDocument when the item is actually a rich text. This tells the other classes, like the FileDownload or the rich text editor that they are dealing with a RichText element...

  1. an nsf rich text item (aka field) can be declared to store Mime, or not (in which case it stores the Notes editor structures, often called 'cd records') (which isn't exactly correct since mime also is stored in a cd records)
  2. regardless of its declaration, Mime is the only type stored in the rich text item by the Domino web server
  3. document.getFirstItem() return Items of type MIME_PARTS, and also RichTextItems when type RICHTEXT.

See Also:
Serialized Form

Constructor Summary
DominoRichTextItem(DominoDocument parent, lotus.domino.MIMEEntity wrappedObject, java.lang.String name)
          Create a new DominoRichTextItem wrapper
DominoRichTextItem(DominoDocument parent, lotus.domino.RichTextItem wrappedObject)
          Create a new DominoRichTextItem wrapper
 
Method Summary
 void addAttachment(com.ibm.xsp.persistence.PersistedContent pc, java.io.File content, DominoDocument.AttachmentValueHolder att)
           
 boolean addRichTextItem()
          Add the RichTextItem to the parent Document
 void applyAttachments()
          Add and Remove the current set of attachments to the document as necessary
 void clearCachedData(java.lang.String _persistenceFolder)
          Clear cached data from persistance folder
 void closeMIMEEntities(boolean persist)
          Closes MIME processing associated with items matching the name associated with the DominoRichTextItem.
 java.lang.String computeUniqueAttachmentName(java.lang.String attachmentName)
          Compute unique attachment name
static IMimeMultipart convertToMime(java.lang.Object value)
           
 java.util.List<DominoDocument.AttachmentValueHolder> getAttachmentList(javax.faces.context.FacesContext context)
           
 java.lang.String getContentAsText()
          Return the text content as simple text.
 long getContentLength()
          Returns the content length for the file
 DominoDocument.AttachmentValueHolder getEmbeddedImage(java.lang.String cidStr)
          Get an embedded image associated with this RichTextItem specified by cidStr
 java.util.ArrayList<DominoDocument.AttachmentValueHolder> getEmbeddedImagesList()
           
 java.lang.String getHTML()
          Returns an HTML representation of the MIME
 lotus.domino.Item getItem()
           
 java.lang.String getItemName()
          Returns the name of the RichTextItem field (non-Javadoc)
 lotus.domino.MIMEEntity getMIMEEntity()
           
 long[] getMimeLengths()
          Returns an array of content lengths for the files
 IMimePart[] getMimeParts()
          Returns an array of IMimeParts
 java.lang.String[] getMimeTypes()
          Returns an array of content types for the files
 java.lang.String getName()
           
 IMimeMultipart getNewValue()
          Return the MIME entity ot be added to the RichTextItem
 DominoDocument getParent()
          Get the rich text item parent document.
 com.ibm.xsp.persistence.PersistedContent getPersistedContent(javax.faces.context.FacesContext context, java.lang.String fieldName, java.lang.String attachmentName)
           
 lotus.domino.RichTextItem getRichTextItem()
          Check if the item is a RichTextItem.
 java.lang.String getText()
           
 boolean hasAttachmentsToSave()
          Return true is there are attachments yet to be saved to the RichTextItem
 boolean hasEmbeddedImagesToSave()
           
 boolean isDiscarded()
           
 boolean isHTMLConverted()
          Returns true if the HTML is the result of a conversion that requires a user prompt
 boolean isMime()
           
 boolean isSameAs(IMimeMultipart rval)
          Returns the position
 void persistEmbeddedImage(UIInputRichText.EmbeddedImage embeddedImage)
          create new persistent file for Embedded Image.
 void persistFile(UIFileuploadEx.UploadedFile file)
          Create persistent file for Domino attachment
 void reActivate(DominoDocument curParent, lotus.domino.Item curItem)
          Reuse this DominoRichTextItem for the specidied Document and RichTextItem.
 void reActivate(DominoDocument curParent, lotus.domino.RichTextItem curItem)
          Reuse this DominoRichTextItem for the specidied Document and RichTextItem Set discarded false
 boolean reAddAttachments()
           
 boolean reAddEmbeddedImages()
          Marks all ebmedded images that are currently in STATE_INDOCUMENT to STATE_ADDED
 void removeAllAttachments()
          Remove all attachment from this RichTextItem
 void removeAttachment(java.lang.String attachmentName, java.util.Vector<lotus.domino.EmbeddedObject> ve)
          Remove the attachment, specified by attachmentName.
 void replaceNewValue(IMimeMultipart newValue)
          Create a new MIME entity to be replace existing to the RichTextItem
 void setDiscarded(boolean discarded)
          If the DominoRichTextItem has not already been discareded, recycle the wrapped MIME Entiry object nas set it to null
 void setEmbeddedImages(java.lang.String cidStr, DominoDocument.AttachmentValueHolder av)
          Add an embedded image specified by cidStr to this RichTextItem
 void setHTMLConverted(boolean isConverted)
          Records if the HTML is the result of a conversion that requires a user prompt
 void setNewValue(IMimeMultipart newValue)
          Create a new MIME entity to be added to the RichTextItem
 java.lang.String toString()
           
 boolean updateRichTextItem(int curOperation)
          Update the RichTextItem in the actual Document that this is a wrapper for.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DominoRichTextItem

public DominoRichTextItem(DominoDocument parent,
                          lotus.domino.RichTextItem wrappedObject)
                   throws lotus.domino.NotesException
Create a new DominoRichTextItem wrapper

Parameters:
parent - The DominoDocument wrapper that contains the RichText
wrappedObject - The lotus.domio.RichTextItem to be wrapped
Throws:
lotus.domino.NotesException

DominoRichTextItem

public DominoRichTextItem(DominoDocument parent,
                          lotus.domino.MIMEEntity wrappedObject,
                          java.lang.String name)
                   throws lotus.domino.NotesException
Create a new DominoRichTextItem wrapper

Parameters:
parent - The DominoDocument wrapper that contains the RichText
wrappedObject - The lotus.domio.RichTextItem to be wrapped
name - Name of the RIchTextItem field.
Throws:
lotus.domino.NotesException
Method Detail

getName

public java.lang.String getName()

getParent

public DominoDocument getParent()
Get the rich text item parent document.

Returns:
Throws:
lotus.domino.NotesException

getRichTextItem

public lotus.domino.RichTextItem getRichTextItem()
                                          throws lotus.domino.NotesException

Check if the item is a RichTextItem.

Returns:
boolean
Throws:
lotus.domino.NotesException

getItem

public lotus.domino.Item getItem()
                          throws lotus.domino.NotesException
Returns:
the Item corresponding to this DominoRichTextItem (based on the name)
Throws:
lotus.domino.NotesException

getMIMEEntity

public lotus.domino.MIMEEntity getMIMEEntity()
                                      throws lotus.domino.NotesException
Returns:
the MIMEEntity that represents this RichTextItem
Throws:
lotus.domino.NotesException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A HTML represenataion of this DominoRichTextItem

getHTML

public java.lang.String getHTML()
Description copied from interface: IMimeMultipart
Returns an HTML representation of the MIME

Specified by:
getHTML in interface IMimeMultipart
Returns:
A HTML represenataion of this DominoRichTextItem

getContentAsText

public java.lang.String getContentAsText()
Description copied from interface: IMimeMultipart
Return the text content as simple text.

Specified by:
getContentAsText in interface IMimeMultipart

isSameAs

public boolean isSameAs(IMimeMultipart rval)
Description copied from interface: IMimeMultipart
Returns the position

Specified by:
isSameAs in interface IMimeMultipart

getText

public java.lang.String getText()
                         throws lotus.domino.NotesException
Returns:
Return the Notes RichTextItem data as text.
Throws:
lotus.domino.NotesException

isMime

public boolean isMime()
Returns:
true if RichTextItem storage format is MIME

convertToMime

public static IMimeMultipart convertToMime(java.lang.Object value)
Parameters:
value -
Returns:
Returns value as a com.ibm.xsp.http.MimeMultipart

getContentLength

public long getContentLength()
Description copied from interface: IMimeMultipart
Returns the content length for the file

Specified by:
getContentLength in interface IMimeMultipart
Returns:
Returns 0

getItemName

public java.lang.String getItemName()
Returns the name of the RichTextItem field (non-Javadoc)

Specified by:
getItemName in interface IMimeMultipart
See Also:
IMimeMultipart.getItemName()

getMimeLengths

public long[] getMimeLengths()
Description copied from interface: IMimeMultipart
Returns an array of content lengths for the files

Specified by:
getMimeLengths in interface IMimeMultipart
Returns:
Returns null (non-Javadoc)
See Also:
IMimeMultipart.getMimeLengths()

getMimeParts

public IMimePart[] getMimeParts()
Description copied from interface: IMimeMultipart
Returns an array of IMimeParts

Specified by:
getMimeParts in interface IMimeMultipart
Returns:
Returns null (non-Javadoc)
See Also:
IMimeMultipart.getMimeParts()

getMimeTypes

public java.lang.String[] getMimeTypes()
Description copied from interface: IMimeMultipart
Returns an array of content types for the files

Specified by:
getMimeTypes in interface IMimeMultipart
Returns:
Returns null (non-Javadoc)
See Also:
IMimeMultipart.getMimeTypes()

addRichTextItem

public boolean addRichTextItem()
                        throws lotus.domino.NotesException
Add the RichTextItem to the parent Document

Returns:
true is successful
Throws:
lotus.domino.NotesException

updateRichTextItem

public boolean updateRichTextItem(int curOperation)
                           throws lotus.domino.NotesException
Update the RichTextItem in the actual Document that this is a wrapper for. Apply attachments if required.

Parameters:
curOperation - operation such as ITEM_ADD_OPERATION
Returns:
trus is successful
Throws:
lotus.domino.NotesException

getAttachmentList

public java.util.List<DominoDocument.AttachmentValueHolder> getAttachmentList(javax.faces.context.FacesContext context)
                                                                       throws lotus.domino.NotesException
Parameters:
context -
Returns:
list of Attachements
Throws:
lotus.domino.NotesException

getEmbeddedImagesList

public java.util.ArrayList<DominoDocument.AttachmentValueHolder> getEmbeddedImagesList()
Returns:
list of embedded images in the RichTextItem

removeAttachment

public void removeAttachment(java.lang.String attachmentName,
                             java.util.Vector<lotus.domino.EmbeddedObject> ve)
                      throws lotus.domino.NotesException
Remove the attachment, specified by attachmentName. Will use the ve list of attachement if the RichTextItem is not MIME.

Parameters:
attachmentName -
ve -
Throws:
lotus.domino.NotesException

removeAllAttachments

public void removeAllAttachments()
                          throws lotus.domino.NotesException
Remove all attachment from this RichTextItem

Throws:
lotus.domino.NotesException

addAttachment

public void addAttachment(com.ibm.xsp.persistence.PersistedContent pc,
                          java.io.File content,
                          DominoDocument.AttachmentValueHolder att)
                   throws lotus.domino.NotesException
Throws:
lotus.domino.NotesException

getEmbeddedImage

public DominoDocument.AttachmentValueHolder getEmbeddedImage(java.lang.String cidStr)
Get an embedded image associated with this RichTextItem specified by cidStr

Parameters:
cidStr -
Returns:

setEmbeddedImages

public void setEmbeddedImages(java.lang.String cidStr,
                              DominoDocument.AttachmentValueHolder av)
Add an embedded image specified by cidStr to this RichTextItem

Parameters:
cidStr -
av -

hasEmbeddedImagesToSave

public boolean hasEmbeddedImagesToSave()
Returns:
true if there are embedded image in the RichTextItem wrapper that have yet to be save to the document RichTextItem field.

reAddEmbeddedImages

public boolean reAddEmbeddedImages()
Marks all ebmedded images that are currently in STATE_INDOCUMENT to STATE_ADDED

Returns:
true is there were embedded images to save

reAddAttachments

public boolean reAddAttachments()
                         throws lotus.domino.NotesException
Returns:
Throws:
lotus.domino.NotesException

isDiscarded

public boolean isDiscarded()
Returns:

closeMIMEEntities

public void closeMIMEEntities(boolean persist)
                       throws lotus.domino.NotesException
Closes MIME processing associated with items matching the name associated with the DominoRichTextItem.

Parameters:
persist - Whether MIME entity content and header changes are saved in the associated in-memory items.
  • true retains changes to MIME entity content and headers.
  • false (default) discards changes to MIME entity content and headers.
Throws:
lotus.domino.NotesException

setDiscarded

public void setDiscarded(boolean discarded)
If the DominoRichTextItem has not already been discareded, recycle the wrapped MIME Entiry object nas set it to null

Parameters:
discarded -

reActivate

public void reActivate(DominoDocument curParent,
                       lotus.domino.RichTextItem curItem)
Reuse this DominoRichTextItem for the specidied Document and RichTextItem Set discarded false

Parameters:
curParent -
curItem -

reActivate

public void reActivate(DominoDocument curParent,
                       lotus.domino.Item curItem)
                throws lotus.domino.NotesException
Reuse this DominoRichTextItem for the specidied Document and RichTextItem. Set the wrapped Object to be a MIMEEntity Set discarded false

Parameters:
curParent -
curItem -
Throws:
lotus.domino.NotesException

clearCachedData

public void clearCachedData(java.lang.String _persistenceFolder)
Clear cached data from persistance folder

Parameters:
_persistenceFolder -

applyAttachments

public void applyAttachments()
                      throws lotus.domino.NotesException
Add and Remove the current set of attachments to the document as necessary

Throws:
lotus.domino.NotesException

persistFile

public void persistFile(UIFileuploadEx.UploadedFile file)
                 throws lotus.domino.NotesException
Create persistent file for Domino attachment

Parameters:
file -
Throws:
lotus.domino.NotesException

persistEmbeddedImage

public void persistEmbeddedImage(UIInputRichText.EmbeddedImage embeddedImage)
                          throws lotus.domino.NotesException
create new persistent file for Embedded Image.

Parameters:
embeddedImage -
Throws:
lotus.domino.NotesException

computeUniqueAttachmentName

public java.lang.String computeUniqueAttachmentName(java.lang.String attachmentName)
Compute unique attachment name

Parameters:
attachmentName -
Returns:

getPersistedContent

public com.ibm.xsp.persistence.PersistedContent getPersistedContent(javax.faces.context.FacesContext context,
                                                                    java.lang.String fieldName,
                                                                    java.lang.String attachmentName)
                                                             throws java.io.IOException
Parameters:
context -
fieldName -
attachmentName -
Returns:
Throws:
java.io.IOException

hasAttachmentsToSave

public boolean hasAttachmentsToSave()
Return true is there are attachments yet to be saved to the RichTextItem

Returns:

getNewValue

public IMimeMultipart getNewValue()
Return the MIME entity ot be added to the RichTextItem

Returns:

setNewValue

public void setNewValue(IMimeMultipart newValue)
Create a new MIME entity to be added to the RichTextItem

Parameters:
newValue -

replaceNewValue

public void replaceNewValue(IMimeMultipart newValue)
                     throws lotus.domino.NotesException
Create a new MIME entity to be replace existing to the RichTextItem

Parameters:
newValue -
Throws:
lotus.domino.NotesException

isHTMLConverted

public boolean isHTMLConverted()
Returns true if the HTML is the result of a conversion that requires a user prompt

Specified by:
isHTMLConverted in interface IMimeMultipart

setHTMLConverted

public void setHTMLConverted(boolean isConverted)
Records if the HTML is the result of a conversion that requires a user prompt

Specified by:
setHTMLConverted in interface IMimeMultipart