de.bea.domingo.http
Class DocumentHttp

java.lang.Object
  extended by de.bea.domingo.monitor.AbstractMonitorEnabled
      extended by de.bea.domingo.http.BaseHttp
          extended by de.bea.domingo.http.BaseDocumentHttp
              extended by de.bea.domingo.http.DocumentHttp
All Implemented Interfaces:
DBase, DBaseDocument, DDocument, MonitorEnabled, java.io.Serializable

public final class DocumentHttp
extends BaseDocumentHttp
implements DDocument

Http implementation of a Domingo document.

Author:
Kurt Riede
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class de.bea.domingo.http.BaseHttp
BaseHttp.BaseHandler
 
Field Summary
 
Fields inherited from class de.bea.domingo.http.BaseHttp
DATETIME_STRING_LENGTH, MAX_DATETIME_LENGTH, NUM_DATETIME_VALUES
 
Constructor Summary
protected DocumentHttp(NotesHttpFactory factory, DBase parent, DNotesMonitor monitor)
          Private Constructor for this class.
protected DocumentHttp(NotesHttpFactory factory, DBase parent, java.lang.String unid, DNotesMonitor monitor)
          Private Constructor for this class.
 
Method Summary
 DDocument copyToDatabase(DDatabase database)
          Copies a document to a specified database.
 java.util.List getFolderReferences()
          The names of the folders containing a document.
 int getFTSearchScore()
          The full-text search score of a document, if it was retrieved as part of a full-text search.
 java.lang.String getHttpURL()
          The Domino URL of a form when HTTP protocols are in effect.
(package private) static DDocument getInstance(NotesHttpFactory factory, DBase parent, DNotesMonitor monitor)
          Factory method for instances of this class.
(package private) static DDocument getInstance(NotesHttpFactory theFactory, DBase theParent, java.lang.String unid, DNotesMonitor monitor)
          Factory method for instances of this class.
 java.lang.String getNoteID()
          The note ID of a document, which is a hexadecimal value of up to 8 characters that uniquely identifies a document within a particular database.
 java.lang.String getNotesURL()
          The Domino URL of a form when Notes protocols are in effect.
 DDocument getParentDocument()
          The parent document if the document is a response document.
 java.lang.String getParentDocumentUNID()
          The universal ID of a document's parent, if the document is a response.
 DView getParentView()
          The view from which a document was retrieved, if any.
 java.util.Iterator getResponses()
          The immediate responses to a document.
 java.lang.String getUniversalID()
          The universal ID, which uniquely identifies a document across all replicas of a database.
 java.lang.String getURL()
          Returns the Domino URL for its parent object.
 boolean isNewNote()
          Indicates whether a document is new.
 boolean isResponse()
          Indicates whether a document is a response to another document.
 void makeResponse(DDocument doc)
          Makes one document a response to another.
 void putInFolder(java.lang.String s)
          Adds a document to a folder.
 void putInFolder(java.lang.String s, boolean flag)
          Adds a document to a folder.
 void removeFromFolder(java.lang.String s)
          Removes a document from a folder.
 void replaceHTML(java.lang.String name, java.lang.String value)
          Replaces a MIMEEntity item with a new item with the given HTML code.
 boolean save(boolean force, boolean makeresponse)
          Saves any changes you have made to a document.
 void send(java.util.List recipients)
          Mails a document.
 void send(java.lang.String recipient)
          Mails a document.
 void setEncryptOnSend(boolean flag)
          Indicates if a document is encrypted when mailed.
 void setSaveMessageOnSend(boolean flag)
          Indicates if a document is saved to a database when mailed.
 void setSignOnSend(boolean flag)
          Indicates if a document is signed when mailed.
 void sign()
          Signs a document.
 
Methods inherited from class de.bea.domingo.http.BaseDocumentHttp
appendItemValue, appendItemValue, appendItemValue, appendItemValue, appendItemValue, appendItemValue, computeWithForm, computeWithForm, copyAllItems, copyItem, copyItem, createReplyMessage, createRichTextItem, encrypt, generateXML, generateXML, getAttachment, getAttachments, getAuthors, getColumnValues, getCreated, getEmbeddedObjects, getEncryptionKeys, getFirstItem, getItems, getItemValue, getItemValueCustomData, getItemValueCustomData, getItemValueCustomDataBytes, getItemValueDate, getItemValueDateRange, getItemValueDateTimeArray, getItemValueDouble, getItemValueInteger, getItemValueSize, getItemValueString, getLastAccessed, getLastModified, getLockHolders, getParentDatabase, getReceivedItemText, getSigner, getSize, getVerifier, hasEmbedded, hasItem, isDeleted, isEncrypted, isEncryptOnSend, isProfile, isSaveMessageOnSend, isSentByAgent, isSigned, isSignOnSend, isValid, lock, lock, lock, lock, lock, lock, lockProvisional, lockProvisional, lockProvisional, recycle, remove, remove, removeItem, removePermanently, renderToRTItem, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValueCustomData, replaceItemValueCustomData, replaceItemValueCustomDataBytes, save, save, setEncryptionKeys, setUniversalID, toString, unlock
 
Methods inherited from class de.bea.domingo.http.BaseHttp
execute, execute, executeDomingoDatabaseUrl, executeUrl, getDSession, getFactory, getParent, parseViewEntryDateTime, postDXL, toStringIntern
 
Methods inherited from class de.bea.domingo.monitor.AbstractMonitorEnabled
getMonitor, setMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.bea.domingo.DBaseDocument
appendItemValue, appendItemValue, appendItemValue, appendItemValue, appendItemValue, appendItemValue, computeWithForm, computeWithForm, copyAllItems, copyItem, copyItem, createReplyMessage, createRichTextItem, encrypt, generateXML, generateXML, getAttachment, getAttachments, getAuthors, getColumnValues, getCreated, getEmbeddedObjects, getEncryptionKeys, getFirstItem, getItems, getItemValue, getItemValueCustomData, getItemValueCustomData, getItemValueCustomDataBytes, getItemValueDate, getItemValueDateRange, getItemValueDateTimeArray, getItemValueDouble, getItemValueInteger, getItemValueSize, getItemValueString, getLastAccessed, getLastModified, getLockHolders, getParentDatabase, getReceivedItemText, getSigner, getSize, getVerifier, hasEmbedded, hasItem, isDeleted, isEncrypted, isEncryptOnSend, isProfile, isSaveMessageOnSend, isSentByAgent, isSigned, isSignOnSend, isValid, lock, lock, lock, lock, lock, lock, lockProvisional, lockProvisional, lockProvisional, recycle, remove, remove, removeItem, removePermanently, renderToRTItem, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValue, replaceItemValueCustomData, replaceItemValueCustomData, replaceItemValueCustomDataBytes, save, save, setEncryptionKeys, setUniversalID, unlock
 
Methods inherited from interface de.bea.domingo.DBase
equals, hashCode, toString
 

Constructor Detail

DocumentHttp

protected DocumentHttp(NotesHttpFactory factory,
                       DBase parent,
                       java.lang.String unid,
                       DNotesMonitor monitor)
Private Constructor for this class.

Parameters:
factory - the controlling factory
parent - the parent object
unid - the universal ID of the document
monitor - the monitor that handles logging
See Also:
Database

DocumentHttp

protected DocumentHttp(NotesHttpFactory factory,
                       DBase parent,
                       DNotesMonitor monitor)
Private Constructor for this class.

Parameters:
factory - the controlling factory
parent - the parent object
monitor - the monitor that handles logging
See Also:
Database
Method Detail

getInstance

static DDocument getInstance(NotesHttpFactory theFactory,
                             DBase theParent,
                             java.lang.String unid,
                             DNotesMonitor monitor)
Factory method for instances of this class.

Parameters:
theFactory - the controlling factory
theParent - the session that produced the database
unid - the universal id of a Notes document
monitor - the monitor that handles logging
Returns:
Returns a DDatabase instance of type DatabaseProxy

getInstance

static DDocument getInstance(NotesHttpFactory factory,
                             DBase parent,
                             DNotesMonitor monitor)
Factory method for instances of this class.

Parameters:
factory - the controlling factory
parent - the session that produced the database
monitor - the monitor that handles logging
Returns:
Returns a DDatabase instance of type DatabaseProxy

isNewNote

public boolean isNewNote()
Indicates whether a document is new. A document is new if it has not been saved.

Specified by:
isNewNote in interface DDocument
Returns:
Boolean true if the document was created, but has not been saved
See Also:
DDocument.isNewNote()

getUniversalID

public java.lang.String getUniversalID()
The universal ID, which uniquely identifies a document across all replicas of a database.

In character format, the universal ID is a 32-character combination of hexadecimal digits (0-9, A-F). The universal ID is also known as the unique ID or UNID.

Specified by:
getUniversalID in interface DDocument
Returns:
String
See Also:
DDocument.getUniversalID()

getNoteID

public java.lang.String getNoteID()
The note ID of a document, which is a hexadecimal value of up to 8 characters that uniquely identifies a document within a particular database.

A typical note ID looks like this: 20FA. A note ID represents the location of a document within a specific database file, so documents that are replicas of one another generally have different note IDs. A note ID does not change, unless the document is deleted.

Specified by:
getNoteID in interface DDocument
Returns:
the notes ID
See Also:
DDocument.getNoteID()

save

public boolean save(boolean force,
                    boolean makeresponse)
             throws DNotesRuntimeException
Saves any changes you have made to a document.

Note If the document is a DProfileDocument, a call to the save method is only successful to a newly created document if a item was appended.

Specified by:
save in interface DBaseDocument
Parameters:
force - If true, the document is saved even if someone else edits and saves the document while the program is running. The last version of the document that was saved wins; the earlier version is discarded. If false, and someone else edits the document while the program is running, the makeresponse argument determines what happens.
makeresponse - If true, the current document becomes a response to the original document (this is what the replicator does when there's a replication conflict). If false, the save is canceled. If the force parameter is true, the makeresponse parameter has no effect.
Returns:
true of successfully saved, else false
Throws:
java.io.IOException
DNotesRuntimeException - if the document cannot be saved
See Also:
DBaseDocument.save(boolean, boolean)

send

public void send(java.lang.String recipient)
Mails a document.

The following rules apply to specification of the recipient or recipients:

If you have only Reader access to a database, you can run an agent that creates and sends a document, but the agent will not work if you attach a file to that document.

Two kinds of items can affect the mailing of the document when you use send:

The IsSaveMessageOnSend property controls whether the sent document is saved in the database. If IsSaveMessageOnSend is true and you attach the form to the document, the form is saved with the document.

The send method automatically creates an item called $AssistMail on the sent document. The SentByAgent property uses this item to determine if a document was mailed by an agent.

If a program runs on a workstation, the mailed document contains the current user's name in the From item. If a program runs as an agent on a server, the mailed document contains the server's name in the From item.

Specified by:
send in interface DDocument
Parameters:
recipient - name of recipient
See Also:
DDocument.send(java.lang.String)

send

public void send(java.util.List recipients)
Mails a document.

Specified by:
send in interface DDocument
Parameters:
recipients - list of Strings with recipients
See Also:
DDocument.send(java.util.List)

copyToDatabase

public DDocument copyToDatabase(DDatabase database)
Copies a document to a specified database.

Specified by:
copyToDatabase in interface DDocument
Parameters:
database - The database to which you want to copy the document. Cannot be null.
Returns:
The new document in the specified database or null if the document cannot be created
See Also:
DDocument.copyToDatabase(de.bea.domingo.DDatabase)

isResponse

public boolean isResponse()
Indicates whether a document is a response to another document.

Specified by:
isResponse in interface DDocument
Returns:
true if the document is a response to another document, else false
See Also:
DDocument.isResponse()

getParentDocumentUNID

public java.lang.String getParentDocumentUNID()
The universal ID of a document's parent, if the document is a response. Returns an empty string if a document doesn't have a parent.

Specified by:
getParentDocumentUNID in interface DDocument
Returns:
the universal ID
See Also:
DDocument.getParentDocumentUNID()

getParentDocument

public DDocument getParentDocument()
The parent document if the document is a response document.

Specified by:
getParentDocument in interface DDocument
Returns:
the parent document or null if the document is not a response document.
See Also:
DDocument.getParentDocument()

makeResponse

public void makeResponse(DDocument doc)
Makes one document a response to another. The two documents must be in the same database.

Specified by:
makeResponse in interface DDocument
Parameters:
doc - The document to which the current document becomes a response.
See Also:
DDocument.makeResponse(de.bea.domingo.DDocument)

getResponses

public java.util.Iterator getResponses()
The immediate responses to a document.

Each document returned is an immediate response to the first document. Responses-to-responses are not included. If the current document has no responses, the vector contains zero documents.

Responses-to-Responses
This property returns only immediate responses to a document, but you can write a recursive sub or function to access all the descendants of a particular document. A recursive sub calls itself in the same way that a non-recursive sub calls any other sub or function.

Specified by:
getResponses in interface DDocument
Returns:
The immediate responses to a document.
See Also:
DDocument.getResponses()

setSaveMessageOnSend

public void setSaveMessageOnSend(boolean flag)
Indicates if a document is saved to a database when mailed. Applies only to new documents that have not yet been saved.

When SaveMessageOnSend is true, the document is saved just after being mailed.

Specified by:
setSaveMessageOnSend in interface DDocument
Parameters:
flag - true if the document is saved when mailed, else false.
See Also:
DDocument.setSaveMessageOnSend(boolean)

setEncryptOnSend

public void setEncryptOnSend(boolean flag)
Indicates if a document is encrypted when mailed.

To encrypt a document when mailed, this method looks for the public key of each recipient in the Domino Directory. If it cannot find a recipient's public key, the method sends an unencrypted copy of the document to that recipient. All other recipients receive an encrypted copy of the document.

This property has no effect on whether a document is encrypted when saved to a database.

Specified by:
setEncryptOnSend in interface DDocument
Parameters:
flag - true if the document is encrypted when mailed, else false.
See Also:
DDocument.setEncryptOnSend(boolean)

setSignOnSend

public void setSignOnSend(boolean flag)
Indicates if a document is signed when mailed.

Specified by:
setSignOnSend in interface DDocument
Parameters:
flag - true if the document is signed when mailed; else false.
See Also:
DDocument.setSignOnSend(boolean)

sign

public void sign()
Signs a document.

If you want the signature to be saved, you must call the Save method after signing the document.

If the program is running on a server, this method has no effect.

Specified by:
sign in interface DDocument
See Also:
DDocument.sign()

replaceHTML

public void replaceHTML(java.lang.String name,
                        java.lang.String value)
Replaces a MIMEEntity item with a new item with the given HTML code.

If the document does not contain an item with the specified name, this method creates a new MIMEEntity item and adds it to the document.

Specified by:
replaceHTML in interface DDocument
Parameters:
name - name of an item
value - HTML code for the new item
See Also:
DDocument.replaceHTML(java.lang.String, java.lang.String)

getFTSearchScore

public int getFTSearchScore()
The full-text search score of a document, if it was retrieved as part of a full-text search.

Usage

The score is determined by the number of target words that are found in the document, the term weights assigned to the target words, and any proximity operators in the search query. If the document is not retrieved as part of a full-text search, returns 0. If the document is retrieved using an FTSearch method on a database without a full-text index, returns an unpredictable number.

If a document is in more than one DocumentCollection or ViewEntryCollection, its score is that of the last collection from which it was retrieved. The score is correct unless you get the score from the current object after retrieving the same document from another collection.

Documents added to a collection have a search score of 0.

Documents deleted from a view have a search score of 0.

Specified by:
getFTSearchScore in interface DDocument
Returns:
The full-text search score of a document, if it was retrieved as part of a full-text search
See Also:
DDocument.getFTSearchScore()

getParentView

public DView getParentView()
The view from which a document was retrieved, if any.

If the document was retrieved directly from the database or a document collection, getParentView returns null.

Specified by:
getParentView in interface DDocument
Returns:
view from which a document was retrieved
See Also:
DDocument.getParentView()

getFolderReferences

public java.util.List getFolderReferences()
The names of the folders containing a document.

The database must have the hidden views $FolderInfo and $FolderRefInfo to support folder references. These views can be copied from the mail template. This property does not return view references.

Folder references must be enabled for the database. See the FolderReferencesEnabled property of Database.

Specified by:
getFolderReferences in interface DDocument
Returns:
names of the folders containing a document
See Also:
DDocument.getFolderReferences()

putInFolder

public void putInFolder(java.lang.String s)
Adds a document to a folder. If the folder does not exist, it is created.

If the document is already inside the folder you specify, putInFolder does nothing. If you specify a path to a folder, and none of the folders exists, the method creates all of them for you. For example:

doc.putInFolder( "Vehicles\\Bikes" );

If neither Vehicles nor Bikes exists, putInFolder creates both, placing the Bikes folder inside the Vehicles folder.

This method cannot add the first document to a folder that is "Shared, Personal on first use."

Specified by:
putInFolder in interface DDocument
Parameters:
s - The name of the folder in which to place the document. The folder may be personal if the program is running on a workstation. If the folder is within another folder, specify a path to it, separating folder names with backslashes. For example: "Vehicles\\Bikes"
See Also:
DDocument.putInFolder(java.lang.String)

putInFolder

public void putInFolder(java.lang.String s,
                        boolean flag)
Adds a document to a folder. If the folder does not exist, it is created.

If the document is already inside the folder you specify, putInFolder does nothing. If you specify a path to a folder, and none of the folders exists, the method creates all of them for you. For example:

doc.putInFolder( "Vehicles\\Bikes" );

If neither Vehicles nor Bikes exists, putInFolder creates both, placing the Bikes folder inside the Vehicles folder.

This method cannot add the first document to a folder that is "Shared, Personal on first use."

Specified by:
putInFolder in interface DDocument
Parameters:
s - The name of the folder in which to place the document. The folder may be personal if the program is running on a workstation. If the folder is within another folder, specify a path to it, separating folder names with backslashes. For example: "Vehicles\\Bikes"
flag - If true (default), creates the folder if it does not exist.
See Also:
DDocument.putInFolder(java.lang.String, boolean)

removeFromFolder

public void removeFromFolder(java.lang.String s)
Removes a document from a folder.

The method does nothing if the document is not in the folder you specify, or if the folder you specify does not exist.

Specified by:
removeFromFolder in interface DDocument
Parameters:
s - The name of the folder from which to remove the document. The folder may be personal if the program is running on a workstation. If the folder is within another folder, specify a path to it, separating folder names with backslashes. For example: "Vehicles\\Bikes"
See Also:
DDocument.removeFromFolder(java.lang.String)

getURL

public java.lang.String getURL()
Returns the Domino URL for its parent object.

See DSession.resolve(String) for additional information and examples.

Specified by:
getURL in interface DDocument
Returns:
Domino URL
See Also:
DDocument.getURL()

getNotesURL

public java.lang.String getNotesURL()
The Domino URL of a form when Notes protocols are in effect.

If Notes protocols are not available, this property returns an empty string.

See DSession.resolve(String) for additional information and examples.

Specified by:
getNotesURL in interface DDocument
Returns:
Domino Notes URL
See Also:
DDocument.getNotesURL()

getHttpURL

public java.lang.String getHttpURL()
The Domino URL of a form when HTTP protocols are in effect.

If HTTP protocols are not available, this property returns an empty string.

See DSession.resolve(String) for additional information and examples.

Specified by:
getHttpURL in interface DDocument
Returns:
The Domino HTTP URL
See Also:
DDocument.getHttpURL()


Domingo Java-API