com.ibm.dse.services.notes
Class Notes

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.base.Service
              |
              +--com.ibm.dse.services.notes.Notes

public class Notes
extends Service
implements java.lang.Runnable

The Notes class provides access to the Lotus Notes databases. To use this service, the notes.jar file must be added to the classpath. The keyed collection fields are used to map the fields of the database with the data fields in the context. The name of an entry in this collection is the field name in the database and its value is the data field name in the context.

See Also:
Serialized Form

Field Summary
static java.lang.String COMPID
          Trace identification for Notes
 
Fields inherited from class com.ibm.dse.base.Service
externalizer
 
Fields inherited from class com.ibm.dse.base.DSENotifier
handlersList, name
 
Constructor Summary
Notes()
          This constructor creates a Notes object.
Notes(java.lang.String aName)
          This constructor creates a Notes object with a name.
 
Method Summary
 void appendDocument(Context ctx)
          Appends a new document to the current database.
 void appendDocument(HashtableFormat htf, Context ctx)
          Appends a new document to the current database with the values specified in the HashtableFormat htf.
 void closeDatabase()
          Closes the current database.
 void closeSession()
          Terminates the current session.
 void establishSession()
          Establish a new session.
protected  void finalize()
          Provides the finalize method for this class.
 boolean getAutomaticEstablishment()
          Gets automaticEstablishment.
 java.lang.String getDatabaseName()
          Returns the name of the current database.
 KeyedCollection getDataFields()
          Returns the keyed collection fields.
 lotus.notes.DateTime getDateTime(java.lang.String dateTime)
          Converts the String dateTime to a DateTime.
 java.util.Vector getField(java.lang.String docField)
          Returns the value of the document field named docField from the current document.
 java.util.Vector getField(java.lang.String docField, int index)
          Returns the value of the document field named docField from the document at the index position.
 KeyedCollection getFields()
          Reads the fields from the current document.
 KeyedCollection getFields(int index)
          Reads the fields from the document at the index position.
 java.lang.String getServerName()
          Returns the serverName.
 java.lang.String getUniversalId()
          Returns the univesal ID of the current document.
 java.lang.String getUserName()
          Returns the userName.
 boolean getVerifyACL()
          Gets verifyACL.
 java.lang.Object initializeFrom(Tag aTag)
          Reads the tags for this service from the xml file.
protected  void initializeThread()
          Initializes the thread.
 boolean isDatabaseOpened()
          Returns true if the database is opened.
 boolean isSessionEstablished()
          Returns true if the session is established.
 boolean isVerifyACL()
          Returns true if it is necessary to check the ACL.
 void modifyDocument(Context ctx)
          Modifies the current document.
 void modifyDocument(HashtableFormat htf, Context ctx)
          Modifies the current document by taking the values from the HashtableFormat htf.
 int numOfDocuments()
          Returns the number of documents in the current database.
 void openDatabase()
          Opens the database and selects the first document.
 void openDatabase(int index)
          Opens the database and selects the document at the index position.
 void readDocument(Context ctx)
          Reads the current document from the database.
 void readDocument(HashtableFormat htf, Context ctx)
          Reads the fields specified in the hash table from the current document and copies the values into the context.
 void removeDocument()
          Removes the current document from the database.
 void run()
          Provides the main thread.
 void searchDocuments(java.lang.String q)
          Selects a document collection which documents match with the query string q.
 boolean selectDocument(int index)
          Selects the document at the index position.
 void selectDocumentByUniversalId(java.lang.String uniId)
          Selects a document by its universal identification.
 void selectDocuments(java.lang.String q)
          Selects a documents collection and compares it with the query string q.
 boolean selectFirstDocument()
          Selects the first document from the database.
 boolean selectLastDocument()
          Selects the last document from the current database.
 boolean selectNextDocument()
          Selects the next document from the current database.
 boolean selectPrevDocument()
          Selects the previous document from the current database.
 void setAutomaticEstablishment(boolean b)
          Sets automaticEstablishment.
 void setDatabaseName(java.lang.String name)
          Sets the name of the database.
 void setFields(KeyedCollection kc)
          Sets the keyed collection fields.
 void setServerName(java.lang.String name)
          Sets the server name.
 void setUserName(java.lang.String user)
          Sets the userName.
 void setVerifyACL(boolean b)
          Sets the value of verifyACL.
 void terminate()
          Stops the main thread.
 Vector toStrings()
          Returns an xml representation of this service.
 
Methods inherited from class com.ibm.dse.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, toString, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.dse.base.DSENotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMPID

public static final java.lang.String COMPID
Trace identification for Notes
Constructor Detail

Notes

public Notes()
      throws DSENotesSessionNotEstablishedException
This constructor creates a Notes object.

Notes

public Notes(java.lang.String aName)
      throws java.io.IOException,
             DSENotesSessionNotEstablishedException
This constructor creates a Notes object with a name.
Method Detail

appendDocument

public void appendDocument(Context ctx)
                    throws DSENotesSessionNotEstablishedException,
                           DSENotesException,
                           DSEObjectNotFoundException,
                           DSEInvalidArgumentException,
                           java.lang.Exception
Appends a new document to the current database.
Parameters:
ctx - com.ibm.dse.base.Context

appendDocument

public void appendDocument(HashtableFormat htf,
                           Context ctx)
                    throws DSENotesSessionNotEstablishedException,
                           DSENotesException,
                           DSEObjectNotFoundException,
                           DSEInvalidArgumentException,
                           java.lang.Exception
Appends a new document to the current database with the values specified in the HashtableFormat htf.
Parameters:
htf - com.ibm.dse.base.HashtableFormat
ctx - com.ibm.dse.base.Context

closeDatabase

public void closeDatabase()
                   throws java.lang.Exception
Closes the current database.

closeSession

public void closeSession()
                  throws java.lang.Exception
Terminates the current session. It stops the notes thread.

establishSession

public void establishSession()
                      throws DSENotesSessionNotEstablishedException,
                             java.lang.Exception
Establish a new session.

finalize

protected void finalize()
Provides the finalize method for this class. It purges all of the attributes from memory.
Overrides:
finalize in class java.lang.Object

getAutomaticEstablishment

public boolean getAutomaticEstablishment()
Gets automaticEstablishment.
Returns:
boolean

getDatabaseName

public java.lang.String getDatabaseName()
Returns the name of the current database.
Returns:
java.lang.String

getDataFields

public KeyedCollection getDataFields()
Returns the keyed collection fields.
Returns:
com.ibm.dse.base.KeyedCollection

getDateTime

public lotus.notes.DateTime getDateTime(java.lang.String dateTime)
                                 throws DSENotesException,
                                        java.lang.Exception
Converts the String dateTime to a DateTime. The class DateTime is used in Notes to work with dates and time.
Parameters:
dateTime - java.lang.String
Returns:
lotus.notes.DateTime

getField

public java.util.Vector getField(java.lang.String docField)
                          throws DSENotesSessionNotEstablishedException,
                                 DSENotesException,
                                 java.lang.Exception
Returns the value of the document field named docField from the current document.
Parameters:
docField - java.lang.String
Returns:
java.util.Vector

getField

public java.util.Vector getField(java.lang.String docField,
                                 int index)
                          throws DSENotesSessionNotEstablishedException,
                                 DSENotesException,
                                 java.lang.Exception
Returns the value of the document field named docField from the document at the index position.
Parameters:
docField - java.lang.String
index - int
Returns:
java.util.Vector

getFields

public KeyedCollection getFields()
                          throws DSENotesSessionNotEstablishedException,
                                 DSENotesException,
                                 java.lang.Exception
Reads the fields from the current document.
Returns:
java.util.Vector

getFields

public KeyedCollection getFields(int index)
                          throws DSENotesSessionNotEstablishedException,
                                 DSENotesException,
                                 java.lang.Exception
Reads the fields from the document at the index position.
Parameters:
index - int
Returns:
com.ibm.dse.base.KeyedCollection

getServerName

public java.lang.String getServerName()
Returns the serverName.
Returns:
java.lang.String

getUniversalId

public java.lang.String getUniversalId()
                                throws DSENotesException,
                                       java.lang.Exception
Returns the univesal ID of the current document.
Returns:
lotus.notes.String.

getUserName

public java.lang.String getUserName()
Returns the userName.
Returns:
java.lang.String

getVerifyACL

public boolean getVerifyACL()
Gets verifyACL.
Returns:
boolean

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws DSENotesSessionNotEstablishedException
Reads the tags for this service from the xml file.
Overrides:
initializeFrom in class Service
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object

initializeThread

protected void initializeThread()
                         throws java.lang.Exception
Initializes the thread.

isDatabaseOpened

public boolean isDatabaseOpened()
Returns true if the database is opened.
Returns:
boolean

isSessionEstablished

public boolean isSessionEstablished()
Returns true if the session is established.
Returns:
boolean

isVerifyACL

public boolean isVerifyACL()
Returns true if it is necessary to check the ACL.
Returns:
boolean

modifyDocument

public void modifyDocument(Context ctx)
                    throws DSENotesException,
                           DSENotesSessionNotEstablishedException,
                           DSEObjectNotFoundException,
                           DSEInvalidArgumentException,
                           java.lang.Exception
Modifies the current document.
Parameters:
ctx - com.ibm.dse.base.Context

modifyDocument

public void modifyDocument(HashtableFormat htf,
                           Context ctx)
                    throws DSENotesException,
                           DSENotesSessionNotEstablishedException,
                           DSEObjectNotFoundException,
                           DSEInvalidArgumentException,
                           java.lang.Exception
Modifies the current document by taking the values from the HashtableFormat htf.
Parameters:
htf - com.ibm.dse.base.HashtableFormat
ctx - com.ibm.dse.base.Context

numOfDocuments

public int numOfDocuments()
                   throws lotus.notes.NotesException,
                          java.lang.Exception
Returns the number of documents in the current database.
Returns:
int

openDatabase

public void openDatabase()
                  throws DSENotesSessionNotEstablishedException,
                         DSENotesException,
                         java.lang.Exception
Opens the database and selects the first document.

openDatabase

public void openDatabase(int index)
                  throws DSENotesSessionNotEstablishedException,
                         DSENotesException,
                         java.lang.Exception
Opens the database and selects the document at the index position. The database documents indexes starts at position 1.
Parameters:
index - int

readDocument

public void readDocument(Context ctx)
                  throws DSENotesSessionNotEstablishedException,
                         DSENotesException,
                         DSEObjectNotFoundException,
                         DSEInvalidArgumentException,
                         java.lang.Exception
Reads the current document from the database.
Parameters:
ctx - com.ibm.dse.base.Context

readDocument

public void readDocument(HashtableFormat htf,
                         Context ctx)
                  throws DSENotesSessionNotEstablishedException,
                         DSENotesException,
                         DSEObjectNotFoundException,
                         DSEInvalidArgumentException,
                         java.lang.Exception
Reads the fields specified in the hash table from the current document and copies the values into the context.
Parameters:
htf - com.ibm.dse.base.HashtableFormat
ctx - com.ibm.dse.base.Context

removeDocument

public void removeDocument()
                    throws DSENotesSessionNotEstablishedException,
                           DSENotesException,
                           java.lang.Exception
Removes the current document from the database.

run

public void run()
Provides the main thread.
Specified by:
run in interface java.lang.Runnable

searchDocuments

public void searchDocuments(java.lang.String q)
                     throws DSENotesSessionNotEstablishedException,
                            DSENotesException,
                            java.lang.Exception
Selects a document collection which documents match with the query string q.
Parameters:
q - java.lang.String

selectDocument

public boolean selectDocument(int index)
                       throws DSENotesSessionNotEstablishedException,
                              DSENotesException,
                              java.lang.Exception
Selects the document at the index position.
Parameters:
index - int
Returns:
boolean

selectDocumentByUniversalId

public void selectDocumentByUniversalId(java.lang.String uniId)
                                 throws DSENotesSessionNotEstablishedException,
                                        DSENotesException,
                                        java.lang.Exception
Selects a document by its universal identification.
Parameters:
uniId - java.lang.String

selectDocuments

public void selectDocuments(java.lang.String q)
                     throws DSENotesSessionNotEstablishedException,
                            DSENotesException,
                            java.lang.Exception
Selects a documents collection and compares it with the query string q.
Parameters:
q - java.lang.String

selectFirstDocument

public boolean selectFirstDocument()
                            throws DSENotesSessionNotEstablishedException,
                                   DSENotesException,
                                   java.lang.Exception
Selects the first document from the database.
Returns:
boolean

selectLastDocument

public boolean selectLastDocument()
                           throws DSENotesSessionNotEstablishedException,
                                  DSENotesException,
                                  java.lang.Exception
Selects the last document from the current database.
Returns:
boolean

selectNextDocument

public boolean selectNextDocument()
                           throws DSENotesSessionNotEstablishedException,
                                  DSENotesException,
                                  java.lang.Exception
Selects the next document from the current database.
Returns:
boolean

selectPrevDocument

public boolean selectPrevDocument()
                           throws DSENotesSessionNotEstablishedException,
                                  DSENotesException,
                                  java.lang.Exception
Selects the previous document from the current database.
Returns:
boolean

setAutomaticEstablishment

public void setAutomaticEstablishment(boolean b)
Sets automaticEstablishment.
Parameters:
b - boolean

setDatabaseName

public void setDatabaseName(java.lang.String name)
Sets the name of the database.
Parameters:
name - java.lang.String

setFields

public void setFields(KeyedCollection kc)
Sets the keyed collection fields.
Parameters:
kc - com.ibm.dse.base.KeyedCollection

setServerName

public void setServerName(java.lang.String name)
Sets the server name.
Parameters:
name - java.lang.String

setUserName

public void setUserName(java.lang.String user)
Sets the userName.
Parameters:
name - java.lang.String

setVerifyACL

public void setVerifyACL(boolean b)
Sets the value of verifyACL.
Parameters:
b - boolean

terminate

public void terminate()
Stops the main thread.
Overrides:
terminate in class Service

toStrings

public Vector toStrings()
Returns an xml representation of this service.
Overrides:
toStrings in class Service
Returns:
java.lang.String