com.ibm.xsp.model.domino
Class DominoUtils

java.lang.Object
  extended by com.ibm.xsp.model.domino.DominoUtils

public class DominoUtils
extends java.lang.Object

DominoUtils is a library of helper methods for working with Domino Databases, Sessons, and Documents, etc.


Nested Class Summary
static class DominoUtils.HtmlConverterWrapper
          Simple wrapper for HtmlConverter.
 
Field Summary
static int DB_SLOT
           
static short FIND_ACCENT_INSENSITIVE
           
static short FIND_CASE_INSENSITIVE
           
static short FIND_COMPARE_MASK
           
static short FIND_EQUAL
           
static short FIND_FIRST_EQUAL
           
static short FIND_GREATER_THAN
           
static short FIND_LAST_EQUAL
           
static short FIND_LESS_THAN
           
static short FIND_NONCATEGORY_ONLY
           
static short FIND_PARTIAL
           
static short FIND_RANGE_OVERLAP
           
static short FIND_RETURN_ANY_NON_CATEGORY_MATCH
           
static short FIND_RETURN_DWORD
           
static short FIND_UPDATE_IF_NOT_FOUND
           
static java.lang.String SERVER_DB_DELIMITER
          Domino Server Database delimiter is !!
static int SERVER_SLOT
           
 
Constructor Summary
DominoUtils()
           
 
Method Summary
static boolean computeWithForm(lotus.domino.Document doc, boolean doDataTypes, boolean raiseError)
          ComputeWithForm
static lotus.domino.ViewColumn findColumnPosition(java.util.Vector<lotus.domino.ViewColumn> viewColumns, java.lang.String name)
          Helper method that gets a column by name
static lotus.domino.Database getCurrentDatabase()
          Return the lotus.domino.Database object
static lotus.domino.Database getCurrentDatabase(javax.faces.context.FacesContext context)
          Return the current database from the Request Map
static lotus.domino.Session getCurrentSession()
          Return the lotus.domino.Session object
static lotus.domino.Session getCurrentSession(javax.faces.context.FacesContext context)
          Return the current session from the Request Map
static java.lang.String getDbNameByReplicaID(java.lang.String serverName, java.lang.String repId)
          Retunr the Database Name for the specified Replica Id
static java.lang.String[] getDbNameParts(java.lang.String dbString)
          Return database name parts that may include server prefix e.g.
static SessionCloner getDesignerSessionCloner(boolean fullAdminAccess)
          Create a session cloner for the designer user.
static lotus.domino.Document getDocumentById(lotus.domino.Database db, java.lang.String id)
          Loads a document by id.
static lotus.domino.Document getDocumentById(lotus.domino.Database db, java.lang.String id, boolean allowDeletedDocuments)
          Loads a document by id, optionally allowing soft deleted document to be opened.
static int getEnvironmentInt(java.lang.String varName)
          Read a environment variable (notes.ini) as an integer.
static long getEnvironmentLong(java.lang.String varName)
          Read a environment variable (notes.ini) as a long integer.
static java.lang.String getEnvironmentString(java.lang.String varName)
          Read a environment variable (notes.ini) as a String.
static java.lang.String getFilePath(lotus.domino.Database db)
          Return the relative Database File Path for the specified Database
static SessionCloner getSessionCloner()
          Create a session cloner for the current user.
static lotus.domino.ViewEntry getViewEntryByKeyWithOptions(lotus.domino.View view, java.lang.Object startKeys, int options)
          Find a view entry using a key.
static java.lang.String getXPagesForDocument(lotus.domino.Document doc)
          Gets the Xpage associated with a document.
static boolean hasReplicaID(java.lang.String replicaID)
          Check if database part of specified Replica id is valid Replica id
static boolean isCurrentDatabase(lotus.domino.Database db)
          Check if the database is the current database.
static boolean isDBSegment(java.lang.String seg)
          Return true if potential valid database name is part of input
static boolean isKeysEmpty(java.lang.Object keys)
          Return true if keys is null, or is empty string, everything else is false
static boolean isReplicaID(java.lang.String replicaID)
          Check if this string is a valid form of a replica id ? This will be a 16 byte hexadecimal number in string form
static boolean isUNID(java.lang.String id)
          Check if the id is an UNID or the basic Note ID.
static java.lang.String normalizeReplicaID(java.lang.String replicaID)
          Normalise replica id to form with out separating ':' and uppercase all
static lotus.domino.Database openDatabase()
          Open the current database
static lotus.domino.Database openDatabaseByName(lotus.domino.Session session, java.lang.String dbName)
          Open the database in the session
static lotus.domino.Database openDatabaseByName(java.lang.String dbName)
          Open the specified database, can also be a Replica Id
static lotus.domino.Database openDatabaseByReplicaID(lotus.domino.Session session, java.lang.String dbString)
          Open database in the specified session
static lotus.domino.Database openDatabaseByReplicaID(java.lang.String dbString)
          Open database in the current session
static lotus.domino.Session openSession()
          Get the current session
static java.lang.String prefixServerToDatabaseName(java.lang.String dbName)
          SPR#JQUL8AGFQ5 Prefix Server Name for remote apps (Notes Client only) Helper method for XPages in Notes Client.
static void recycle(java.util.Vector<?> v)
          Recycling a Vector of Domino objects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_DB_DELIMITER

public static java.lang.String SERVER_DB_DELIMITER
Domino Server Database delimiter is !!


SERVER_SLOT

public static final int SERVER_SLOT
See Also:
Constant Field Values

DB_SLOT

public static final int DB_SLOT
See Also:
Constant Field Values

FIND_PARTIAL

public static final short FIND_PARTIAL
See Also:
Constant Field Values

FIND_CASE_INSENSITIVE

public static final short FIND_CASE_INSENSITIVE
See Also:
Constant Field Values

FIND_RETURN_DWORD

public static final short FIND_RETURN_DWORD
See Also:
Constant Field Values

FIND_ACCENT_INSENSITIVE

public static final short FIND_ACCENT_INSENSITIVE
See Also:
Constant Field Values

FIND_UPDATE_IF_NOT_FOUND

public static final short FIND_UPDATE_IF_NOT_FOUND
See Also:
Constant Field Values

FIND_LESS_THAN

public static final short FIND_LESS_THAN
See Also:
Constant Field Values

FIND_FIRST_EQUAL

public static final short FIND_FIRST_EQUAL
See Also:
Constant Field Values

FIND_LAST_EQUAL

public static final short FIND_LAST_EQUAL
See Also:
Constant Field Values

FIND_GREATER_THAN

public static final short FIND_GREATER_THAN
See Also:
Constant Field Values

FIND_EQUAL

public static final short FIND_EQUAL
See Also:
Constant Field Values

FIND_COMPARE_MASK

public static final short FIND_COMPARE_MASK
See Also:
Constant Field Values

FIND_RANGE_OVERLAP

public static final short FIND_RANGE_OVERLAP
See Also:
Constant Field Values

FIND_RETURN_ANY_NON_CATEGORY_MATCH

public static final short FIND_RETURN_ANY_NON_CATEGORY_MATCH
See Also:
Constant Field Values

FIND_NONCATEGORY_ONLY

public static final short FIND_NONCATEGORY_ONLY
See Also:
Constant Field Values
Constructor Detail

DominoUtils

public DominoUtils()
Method Detail

getCurrentSession

public static lotus.domino.Session getCurrentSession()
Return the lotus.domino.Session object

Returns:
lotus.domino.Session object

getCurrentDatabase

public static lotus.domino.Database getCurrentDatabase()
Return the lotus.domino.Database object

Returns:
lotus.domino.Database object

isCurrentDatabase

public static boolean isCurrentDatabase(lotus.domino.Database db)
Check if the database is the current database.

Returns:
lotus.domino.Database object

getCurrentSession

public static lotus.domino.Session getCurrentSession(javax.faces.context.FacesContext context)
Return the current session from the Request Map

Parameters:
context -
Returns:
lotus.domino.Session object

getCurrentDatabase

public static lotus.domino.Database getCurrentDatabase(javax.faces.context.FacesContext context)
Return the current database from the Request Map

Parameters:
context -
Returns:
lotus.domino.Database object

prefixServerToDatabaseName

public static java.lang.String prefixServerToDatabaseName(java.lang.String dbName)
SPR#JQUL8AGFQ5 Prefix Server Name for remote apps (Notes Client only) Helper method for XPages in Notes Client. If the database name, e.g. myapps\appOne.nsf is stored on Domino server, then database name should be myServer!!myapps\appOne.nsf to avoid XPages in Notes Client attempting to open local version/replica of myapps\appOne.nsf

Parameters:
dbName -
Returns:
Returns a DatabaseName, prepended

openDatabase

public static lotus.domino.Database openDatabase()
                                          throws lotus.domino.NotesException
Open the current database

Parameters:
FacesContext -
Returns:
wrapper object for lotus.domino.database
Throws:
lotus.domino.NotesException

openDatabaseByName

public static lotus.domino.Database openDatabaseByName(java.lang.String dbName)
                                                throws lotus.domino.NotesException
Open the specified database, can also be a Replica Id

Parameters:
FacesContext -
dbName -
Returns:
wrapper object for lotus.domino.Database
Throws:
lotus.domino.NotesException

openDatabaseByName

public static lotus.domino.Database openDatabaseByName(lotus.domino.Session session,
                                                       java.lang.String dbName)
                                                throws lotus.domino.NotesException
Open the database in the session

Parameters:
session -
dbName -
Returns:
Throws:
lotus.domino.NotesException

openSession

public static lotus.domino.Session openSession()
Get the current session

Parameters:
context -
Returns:
lotus.domino.Session object
Throws:
ResourcesPoolException

openDatabaseByReplicaID

public static lotus.domino.Database openDatabaseByReplicaID(java.lang.String dbString)
                                                     throws lotus.domino.NotesException
Open database in the current session

Parameters:
dbString - containing a replica id
Returns:
wrapper object for lotus.domino.Database
Throws:
lotus.domino.NotesException

openDatabaseByReplicaID

public static lotus.domino.Database openDatabaseByReplicaID(lotus.domino.Session session,
                                                            java.lang.String dbString)
                                                     throws lotus.domino.NotesException
Open database in the specified session

Parameters:
session -
dbString -
Returns:
Throws:
lotus.domino.NotesException

isReplicaID

public static boolean isReplicaID(java.lang.String replicaID)
Check if this string is a valid form of a replica id ? This will be a 16 byte hexadecimal number in string form


hasReplicaID

public static boolean hasReplicaID(java.lang.String replicaID)
Check if database part of specified Replica id is valid Replica id

Parameters:
replicaID -
Returns:

normalizeReplicaID

public static java.lang.String normalizeReplicaID(java.lang.String replicaID)
Normalise replica id to form with out separating ':' and uppercase all

Parameters:
replicaID -
Returns:

getDbNameParts

public static java.lang.String[] getDbNameParts(java.lang.String dbString)
Return database name parts that may include server prefix e.g. "server!!db.nsf"

Parameters:
dbString - -- may include server prefix e.g. "server!!db.nsf"
Returns:
array with server name in 1st slot and db name in 2nd slot

isUNID

public static boolean isUNID(java.lang.String id)
Check if the id is an UNID or the basic Note ID.


getDocumentById

public static lotus.domino.Document getDocumentById(lotus.domino.Database db,
                                                    java.lang.String id)
                                             throws lotus.domino.NotesException
Loads a document by id. This function can even use a NOTEDID or a UNID.

Throws:
lotus.domino.NotesException

getDocumentById

public static lotus.domino.Document getDocumentById(lotus.domino.Database db,
                                                    java.lang.String id,
                                                    boolean allowDeletedDocuments)
                                             throws lotus.domino.NotesException
Loads a document by id, optionally allowing soft deleted document to be opened. This function can even use a NOTEDID or a UNID.

Throws:
lotus.domino.NotesException

computeWithForm

public static boolean computeWithForm(lotus.domino.Document doc,
                                      boolean doDataTypes,
                                      boolean raiseError)
                               throws lotus.domino.NotesException
ComputeWithForm

Returns:
Throws:
lotus.domino.NotesException

getXPagesForDocument

public static java.lang.String getXPagesForDocument(lotus.domino.Document doc)
                                             throws lotus.domino.NotesException
Gets the Xpage associated with a document.

Throws:
lotus.domino.NotesException

findColumnPosition

public static lotus.domino.ViewColumn findColumnPosition(java.util.Vector<lotus.domino.ViewColumn> viewColumns,
                                                         java.lang.String name)
                                                  throws lotus.domino.NotesException
Helper method that gets a column by name

Parameters:
viewColumns -
name -
Returns:
Throws:
lotus.domino.NotesException

isDBSegment

public static boolean isDBSegment(java.lang.String seg)
Return true if potential valid database name is part of input

Parameters:
seg -
Returns:

getFilePath

public static java.lang.String getFilePath(lotus.domino.Database db)
                                    throws lotus.domino.NotesException
Return the relative Database File Path for the specified Database

Parameters:
db - Database
Returns:
Database File Path
Throws:
lotus.domino.NotesException

getDbNameByReplicaID

public static java.lang.String getDbNameByReplicaID(java.lang.String serverName,
                                                    java.lang.String repId)
Retunr the Database Name for the specified Replica Id

Parameters:
serverName - server
repId - replica id
Returns:
databas name

recycle

public static void recycle(java.util.Vector<?> v)
                    throws lotus.domino.NotesException
Recycling a Vector of Domino objects

Throws:
lotus.domino.NotesException

getViewEntryByKeyWithOptions

public static lotus.domino.ViewEntry getViewEntryByKeyWithOptions(lotus.domino.View view,
                                                                  java.lang.Object startKeys,
                                                                  int options)
                                                           throws lotus.domino.NotesException
Find a view entry using a key.

Throws:
lotus.domino.NotesException

isKeysEmpty

public static boolean isKeysEmpty(java.lang.Object keys)
Return true if keys is null, or is empty string, everything else is false

Parameters:
keys -
Returns:

getEnvironmentString

public static java.lang.String getEnvironmentString(java.lang.String varName)
Read a environment variable (notes.ini) as a String.

Parameters:
varName - the name of the variable to read
Returns:
null if the variable is not defined of if an error occurred

getEnvironmentInt

public static int getEnvironmentInt(java.lang.String varName)
Read a environment variable (notes.ini) as an integer.

Parameters:
varName - the name of the variable to read
Returns:
0 if the variable is not defined of if an error occurred

getEnvironmentLong

public static long getEnvironmentLong(java.lang.String varName)
Read a environment variable (notes.ini) as a long integer.

Parameters:
varName - the name of the variable to read
Returns:
null if the variable is not defined of if an error occurred

getSessionCloner

public static SessionCloner getSessionCloner()
Create a session cloner for the current user. The session cloner will return a session object that is similar to the global session object.

Returns:
the session cloner

getDesignerSessionCloner

public static SessionCloner getDesignerSessionCloner(boolean fullAdminAccess)
Create a session cloner for the designer user. The session cloner will return a session object that is similar to the global sessionAsDesigner or sessionAsSignerWithFullAccess objects.

Parameters:
fullAdminAccess - if full admin access is requested.
Returns:
the session cloner