de.bea.domingo.proxy
Class BaseProxy

java.lang.Object
  extended by de.bea.domingo.monitor.AbstractMonitorEnabled
      extended by de.bea.domingo.proxy.BaseProxy
All Implemented Interfaces:
DBase, MonitorEnabled, java.io.Serializable
Direct Known Subclasses:
AgentContextProxy, AgentProxy, BaseCollectionProxy, BaseDocumentProxy, BaseItemProxy, BaseProxy.DocumentCollectionIterator, DatabaseProxy, DxlExporterProxy, EmbeddedObjectProxy, FormProxy, LogProxy, SessionProxy, ViewColumnProxy, ViewEntryProxy

public abstract class BaseProxy
extends AbstractMonitorEnabled
implements DBase

Abstract base class for all implementations of interfaces derived from DBase.

Author:
Kurt Riede
See Also:
Serialized Form

Nested Class Summary
static class BaseProxy.DocumentCollectionIterator
          Iterator for collections of documents.
 
Field Summary
protected static int DATETIME_STRING_LENGTH
          Number of characters needed to represent a date/time value.
protected static java.lang.String EMPTY_STRING
          The empty string.
protected static int MAX_DATETIME_LENGTH
          maximum number of characters to parse in method getItemValues().
protected static int NUM_DATETIME_VALUES
          Maximum number of items supported in method getItemValues().
protected static Resources RESOURCES
          Internationalized resources.
 
Constructor Summary
protected BaseProxy(NotesProxyFactory theFactory, DBase theParent, lotus.domino.Base object, DNotesMonitor monitor)
          Creates a new DBaseImpl object.
 
Method Summary
protected  void checkSession(lotus.domino.DateTime dateTime)
          Checks and monitors an error if a DateTime object doesn't have a parent session.
protected  void clearNotesObject()
          Clears the associated notes object, used during dispose/recycle operations.
protected  java.util.List convertCalendarsToNotesDateTime(java.util.List list)
          Converts every occurrence of a java.util.Calendar or java.util.Date in a List to a DateTime instance.
protected  java.util.Vector convertListToVector(java.util.List list)
          Convert List to Vector.
protected  java.util.List convertNotesDateTimesToCalendar(java.util.List list)
          Converts every occurrence of a DateTime object to a java.util.Calendar instance.
protected  java.util.List convertVectorToList(java.util.Vector vector)
          Deprecated. the usage of the method convertVectorToList() is not needed and impacts performance
protected  java.util.Calendar createCalendar(lotus.domino.DateTime dateTime)
          Converts a Notes DateTime object into a Calendar.
protected  lotus.domino.DateRange createDateRange(java.util.Calendar calendar1, java.util.Calendar calendar2)
          Creates a Notes DateRange instance from two java.util.Calendars.
protected  lotus.domino.DateTime createDateTime(java.util.Calendar calendar)
          Creates a Notes DateTime instance from a java.util.Calendar.
static int decrementDateTimeCounter()
          Decrements the global counter for DateTime objects.
protected  void finalize()
           
static int getCountDateTime()
          Returns the global counter for DateTime objects.
protected  SessionProxy getDSession()
          Returns the Domingo session that created the current object.
protected  NotesProxyFactory getFactory()
          Returns the factory corresponding to this instance.
protected  lotus.domino.Base getNotesObject()
          Returns the Notes object associated with an instance.
protected  DBase getParent()
          Returns the parent object.
static int incrementDateTimeCounter()
          Increments the global counter for DateTime objects.
protected  DNotesException newException(lotus.domino.NotesException e)
          Creates and returns a new exception wrapping a given NotesException.
protected  DNotesException newException(java.lang.String message)
          Creates and returns a new exception with the given message.
protected  DNotesException newException(java.lang.String message, lotus.domino.NotesException e)
          Creates and returns a new exception wrapping a given NotesException.
protected  DNotesRuntimeException newRuntimeException(lotus.domino.NotesException e)
          Creates and returns a new runtime exception wrapping a given NotesException.
protected  DNotesRuntimeException newRuntimeException(java.lang.String message)
          Creates and returns a new runtime exception with the given message.
protected  DNotesRuntimeException newRuntimeException(java.lang.String message, java.lang.Exception e)
          Creates and returns a new runtime exception with the given message.
protected  void recycleDateTimeList(java.util.List list)
          Recycles all Notes DateTime objects in a list.
 int refereceHashCode()
          Returns the hashCode of the referenced Notes object.
 java.lang.String toStringGeneric()
          Utility method for the toString method of derived classes.
static java.lang.String toStringIntern(java.lang.Object object)
          Returns a string representation of the object.
 
Methods inherited from class de.bea.domingo.monitor.AbstractMonitorEnabled
getMonitor, setMonitor
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.bea.domingo.DBase
equals, hashCode, toString
 

Field Detail

RESOURCES

protected static final Resources RESOURCES
Internationalized resources.


DATETIME_STRING_LENGTH

protected static final int DATETIME_STRING_LENGTH
Number of characters needed to represent a date/time value.

See Also:
Constant Field Values

NUM_DATETIME_VALUES

protected static final int NUM_DATETIME_VALUES
Maximum number of items supported in method getItemValues().

See Also:
Constant Field Values

MAX_DATETIME_LENGTH

protected static final int MAX_DATETIME_LENGTH
maximum number of characters to parse in method getItemValues().

See Also:
Constant Field Values

EMPTY_STRING

protected static final java.lang.String EMPTY_STRING
The empty string.

See Also:
Constant Field Values
Constructor Detail

BaseProxy

protected BaseProxy(NotesProxyFactory theFactory,
                    DBase theParent,
                    lotus.domino.Base object,
                    DNotesMonitor monitor)
Creates a new DBaseImpl object.

Parameters:
theFactory - the controlling factory
theParent - the parent object
object - the notes object
monitor - the monitor
Method Detail

getNotesObject

protected final lotus.domino.Base getNotesObject()
Returns the Notes object associated with an instance.

Returns:
associated Notes object

clearNotesObject

protected final void clearNotesObject()
Clears the associated notes object, used during dispose/recycle operations.


getParent

protected final DBase getParent()
Returns the parent object.

Returns:
the parent object or null if no parent available

getFactory

protected final NotesProxyFactory getFactory()
Returns the factory corresponding to this instance.

Returns:
the corresponding factory

toStringGeneric

public final java.lang.String toStringGeneric()
Utility method for the toString method of derived classes. Returns a string representation of the object.

Returns:
string representation of the object
See Also:
Object.toString()

convertListToVector

protected final java.util.Vector convertListToVector(java.util.List list)
Convert List to Vector.

If the implementation of the List interface is a Vector, this vector is used unchanged, else the references of elements of the List are copied to a new result Vector.

Parameters:
list - a list
Returns:
a Vector containing the elements of the list argument

convertVectorToList

protected final java.util.List convertVectorToList(java.util.Vector vector)
Deprecated. the usage of the method convertVectorToList() is not needed and impacts performance

Convert Vector to List. A Vector does also implement the List interface. But it is synchronized. Therefore this conversion method provides a real List that is not synchronized.

Parameters:
vector - a vector
Returns:
a List

convertNotesDateTimesToCalendar

protected final java.util.List convertNotesDateTimesToCalendar(java.util.List list)
Converts every occurrence of a DateTime object to a java.util.Calendar instance.

The created DateTime objects must get recycled somewhen later, when they are not needed anymore. To ensure this, the calling method must call the method recycleDateTimeList() after usage.

Lists are processed recursivly; this is e.g. needed for column values that might contain value lists in the list of column values.

Parameters:
list - the list to convert its content
Returns:
List a new List with the same elements in same order, but converted dates

convertCalendarsToNotesDateTime

protected final java.util.List convertCalendarsToNotesDateTime(java.util.List list)
Converts every occurrence of a java.util.Calendar or java.util.Date in a List to a DateTime instance.

ATTENTION:
The created DateTime objects must get recycled somewhen later, when they are not needed anymore. To ensure this, the calling method must call the method recycleDateTimeList() after usage.

Example

 List keys;
 // initialize and fill list with Date objects and others
 List convertedList = convertDatesToNotesDateTime(keys);
 // now the list contains Notes DateTime objects.
 // do something with the list
 recycleDateTimeList(convertedKeys);
 

Parameters:
list - the list to convert its content
Returns:
List a new List with the same elements in same order, but converted dates

recycleDateTimeList

protected final void recycleDateTimeList(java.util.List list)
Recycles all Notes DateTime objects in a list.

The list can have mixed content and must not contain only DateTime objects. But only DateTime objects are recycled.

Parameters:
list - any list implementation

getDSession

protected final SessionProxy getDSession()
Returns the Domingo session that created the current object.

Returns:
Domingo session of current object

createDateTime

protected final lotus.domino.DateTime createDateTime(java.util.Calendar calendar)
Creates a Notes DateTime instance from a java.util.Calendar. Adapter to InternationalProxy. This is a convenience method to allow every object to convert dates.

Parameters:
calendar - the calendar to convert
Returns:
DateTime object representing the same point in time

createDateRange

protected final lotus.domino.DateRange createDateRange(java.util.Calendar calendar1,
                                                       java.util.Calendar calendar2)
Creates a Notes DateRange instance from two java.util.Calendars. Adapter to InternationalProxy. This is a convenience method to allow every object to convert dates.

Parameters:
calendar1 - the start calendar to convert
calendar2 - the end calendar to convert
Returns:
DateTime object representing the same point in time
See Also:
InternationalProxy.createDateRange(Calendar, Calendar)

createCalendar

protected final java.util.Calendar createCalendar(lotus.domino.DateTime dateTime)
Converts a Notes DateTime object into a Calendar.

Milli seconds are cleared in all cases.

Adapter to InternationalProxy. This is a convenience method to allow every object to convert dates.

Parameters:
dateTime - a Notes DateTime object
Returns:
a Calendar
See Also:
InternationalProxy.createCalendar(DateTime)

checkSession

protected final void checkSession(lotus.domino.DateTime dateTime)
Checks and monitors an error if a DateTime object doesn't have a parent session.

Parameters:
dateTime - the DateTime object to check

finalize

protected final void finalize()
                       throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - the Exception raised by this method
See Also:
Object.finalize()

refereceHashCode

public final int refereceHashCode()
Returns the hashCode of the referenced Notes object.

Returns:
hashCode of referenced Notes object
See Also:
Object.hashCode()

toStringIntern

public static java.lang.String toStringIntern(java.lang.Object object)
Returns a string representation of the object. This method returns a string that "textually represents" this object. The result is a concise but informative representation that is easy for a person to read.

The toStringIntern method returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 object.getClass().getName() + '@' + Integer.toHexString(object.hashCode())
 

Parameters:
object - the reference object to use.
Returns:
a string representation of the object.
See Also:
Object.toString()

getCountDateTime

public static int getCountDateTime()
Returns the global counter for DateTime objects.

Returns:
global counter for DateTime objects.

incrementDateTimeCounter

public static int incrementDateTimeCounter()
Increments the global counter for DateTime objects.

Returns:
new value of the counter after incrementation

decrementDateTimeCounter

public static int decrementDateTimeCounter()
Decrements the global counter for DateTime objects.

Returns:
new value of the counter after decrementation

newException

protected final DNotesException newException(lotus.domino.NotesException e)
Creates and returns a new exception wrapping a given NotesException.

Parameters:
e - the NotesException, can be null
Returns:
new DNotesException

newException

protected final DNotesException newException(java.lang.String message)
Creates and returns a new exception with the given message.

Parameters:
message - the message
Returns:
new DNotesException

newException

protected final DNotesException newException(java.lang.String message,
                                             lotus.domino.NotesException e)
Creates and returns a new exception wrapping a given NotesException.

Parameters:
message - the message
e - the NotesException, can be null
Returns:
new DNotesException

newRuntimeException

protected final DNotesRuntimeException newRuntimeException(lotus.domino.NotesException e)
Creates and returns a new runtime exception wrapping a given NotesException.

Parameters:
e - the NotesException, can be null
Returns:
new DNotesRuntimeException

newRuntimeException

protected final DNotesRuntimeException newRuntimeException(java.lang.String message)
Creates and returns a new runtime exception with the given message.

Parameters:
message - the message
Returns:
new DNotesRuntimeException

newRuntimeException

protected final DNotesRuntimeException newRuntimeException(java.lang.String message,
                                                           java.lang.Exception e)
Creates and returns a new runtime exception with the given message.

Parameters:
message - the message
e - the NotesException, can be null
Returns:
new DNotesRuntimeException


Domingo Java-API