de.bea.domingo.map
Class BaseDatabase

java.lang.Object
  extended by de.bea.domingo.map.BaseDatabase
Direct Known Subclasses:
MailDatabase, NamesDatabase

public abstract class BaseDatabase
extends java.lang.Object

Abstract base class for concrete databases.

Author:
Kurt Riede

Constructor Summary
BaseDatabase(DDatabase database)
          Constructor.
BaseDatabase(DSession session, NotesLocation location)
          Constructor.
BaseDatabase(NotesLocation location)
          Constructor.
BaseDatabase(java.lang.String locationUri)
          Constructor.
 
Method Summary
 java.lang.Object create(java.lang.Class clazz)
          Creates a new instance of a business object with a given class.
protected  DDatabase getDatabase()
          Returns the database specified by the current location.
protected  DSession getSession(NotesLocation location)
          Creates and returns a new domingo session for a given location.
 java.lang.String getTitle()
          The title of a database.
 void map(DDocument document, java.lang.Object object)
          Maps a domingo document to a business object.
 void map(DViewEntry viewEntry, java.lang.Object object)
          Maps a Domingo ViewEntry to a business object.
 void map(java.lang.Object object, DDocument document)
          Maps a business object to a domingo document.
protected  void register(java.lang.Class mapperClass)
          Registers a mapper in the mapper factory.
protected abstract  void registerMappers()
          Implemented by derived class; must register all mappers.
 void save(java.lang.Object object)
          Saves a business object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseDatabase

public BaseDatabase(DSession session,
                    NotesLocation location)
             throws DNotesException
Constructor.

Parameters:
session - an existing domingo session
location - location of database.
Throws:
DNotesException - if the uri is invalid or the database cannot be opened

BaseDatabase

public BaseDatabase(java.lang.String locationUri)
             throws DNotesException
Constructor.

Parameters:
locationUri - URI of location of database.
Throws:
DNotesException - if the uri is invalid or the database cannot be opened

BaseDatabase

public BaseDatabase(NotesLocation location)
             throws DNotesException
Constructor.

Parameters:
location - location of database.
Throws:
DNotesException - if the uri is invalid or the database cannot be opened

BaseDatabase

public BaseDatabase(DDatabase database)
             throws DNotesException
Constructor.

Parameters:
database - a notes database
Throws:
DNotesException - if the database is invalid or cannot be opened
Method Detail

getSession

protected final DSession getSession(NotesLocation location)
                             throws DNotesException
Creates and returns a new domingo session for a given location.

Parameters:
location - location of database.
Returns:
domingo session
Throws:
DNotesException - if the uri is invalid or the database cannot be opened

registerMappers

protected abstract void registerMappers()
                                 throws MapperRegistrationException
Implemented by derived class; must register all mappers.

Throws:
MapperRegistrationException - if an error occurred during registering a mapper

register

protected final void register(java.lang.Class mapperClass)
                       throws MapperRegistrationException
Registers a mapper in the mapper factory.

Parameters:
mapperClass - the class of the new mapper
Throws:
MapperRegistrationException - if an error occurred during registering a mapper

getDatabase

protected final DDatabase getDatabase()
Returns the database specified by the current location.

Returns:
Notes database at current location

create

public final java.lang.Object create(java.lang.Class clazz)
Creates a new instance of a business object with a given class.

Parameters:
clazz - class of business object
Returns:
new business object

save

public final void save(java.lang.Object object)
                throws MappingException
Saves a business object.

Parameters:
object - business object to save
Throws:
MappingException - if an error occurred during mapping

map

public final void map(java.lang.Object object,
                      DDocument document)
               throws MappingException
Maps a business object to a domingo document.

Parameters:
object - the business object
document - the domingo document to map to
Throws:
MappingException - if an error occurred during mapping
See Also:
Mapper.map(java.lang.Object, de.bea.domingo.DDocument)

map

public final void map(DDocument document,
                      java.lang.Object object)
               throws MappingException
Maps a domingo document to a business object.

Parameters:
document - the domingo document to map
object - the business object
Throws:
MappingException - if an error occurred during mapping
See Also:
Mapper.map(de.bea.domingo.DDocument, java.lang.Object)

map

public final void map(DViewEntry viewEntry,
                      java.lang.Object object)
               throws MappingException
Maps a Domingo ViewEntry to a business object.

Parameters:
viewEntry - the domingo ViewEntry
object - the business object
Throws:
MappingException - if an error occurred during mapping
See Also:
DMapper.map(DViewEntry, Object)

getTitle

public final java.lang.String getTitle()
The title of a database.

Returns:
database title.
See Also:
DDatabase.getTitle()


Domingo Java-API