wt.pom
Class PersistentObjectManager

java.lang.Object
  extended bywt.pom.PersistentObjectManager
All Implemented Interfaces:
POMIfc

public class PersistentObjectManager
extends Object
implements POMIfc

PersistentObjectManager provides datastore independent persistence interfaces. This class brokers persist requests and forwards them to a PersistentDataService to handle the actual persistence operation.

Supported API: false

Extendable: false

See Also:
WTConnection, TransactionManager, DataServicesRegistry

Nested Class Summary
(package private) static interface PersistentObjectManager.FirePOMOperationListener
           
(package private) static class PersistentObjectManager.NotifyCreateListener
           
(package private) static class PersistentObjectManager.NotifyDeleteListener
           
(package private) static class PersistentObjectManager.NotifyLockListener
           
(package private) static class PersistentObjectManager.NotifyRefreshListener
           
(package private) static class PersistentObjectManager.NotifyUpdateListener
           
 
Field Summary
private static String CLASSNAME
           
(package private) static PersistentObjectManager.NotifyCreateListener CREATE
           
static boolean DEBUG
           
(package private) static PersistentObjectManager.NotifyDeleteListener DELETE
           
private static int INVALID_PAGINGSESSION
           
private static int[] LINK_FROM_INDEX
           
private static ClassAttribute LINK_ID
           
(package private) static PersistentObjectManager.NotifyLockListener LOCK
           
private static DebugWriter LOG
           
private static AccessController NOOP_ACCESS_CONTROLLER
           
static Object OID_REUSE
           
private static OIDPool oidPool
           
private  ArrayList operationListeners
           
(package private) static PersistentObjectManager.NotifyRefreshListener REFRESH
           
private static String RESOURCE
           
(package private) static String ROLE_A
           
private static ConstantExpression ROLE_A_CONSTANT
           
(package private) static String ROLE_B
           
private static ConstantExpression ROLE_B_CONSTANT
           
private static String sortName
           
private static AccessController STANDARD_ACCESS_CONTROLLER
           
private static ClassAttribute TARGET_CLASSNAME
           
private static int[] TARGET_FROM_INDEX
           
private static ClassAttribute TARGET_ID
           
(package private) static PersistentObjectManager.NotifyUpdateListener UPDATE
           
private static HashMap VALID_LINK_ROLE_MAP
           
 
Constructor Summary
PersistentObjectManager()
          PersistentObjectManager constructor
 
Method Summary
static void addLocalOperationListener(POMOperationListener listener)
          Add a listener for POM operations.
 void addOperationListener(POMOperationListener a_listener)
          Add a listener for local POM operations.
 void addTransactionListener(TransactionListener listener)
          Add a listener to the current transaction
 void commitTransaction(int aHandle)
          Commit a transaction flushing changes to the datastore.
private  int[] computeGroupCount(int a_groupIndex, Vector a_resultVector, int a_range, int a_offset)
           
 WTConnection connect()
          Connection to a datastore.
 void disconnect(WTConnection aConnection)
          Disconnect from a datastore.
 int execute(AbstractBatchSpec a_batchSpec, WTSet a_objects, boolean a_fullObjects)
          Executes the specified statements in from the datastore.
 Object executeCall(String a_procedureName, Object[] a_argumentValues, int[] a_argumentTypes, Integer a_outputType)
          This method executes a call to a database stored procedure.
 Object executeCall(String a_procedureName, StatementParameter[] a_argumentValues, StatementParameter a_outputType)
          This method executes a call to a database stored procedure.
 QueryResult expand(Persistable a_source, String a_otherSideRole, Class a_linkClass, boolean a_onlyOtherSide, AccessControllerProcessor a_accessControllerProcessor)
          Expand the given persistent object by retrieving the links from the datastore given the role that the object plays in the association and and the target association class.
 QueryResult expand(Persistable a_source, String a_otherSideRole, Class a_linkClass, boolean a_onlyOtherSide, AccessControllerProcessor a_accessControllerProcessor, boolean a_sorted)
          Expand the given persistent object by retrieving the links from the datastore given the role that the object plays in the association and and the target association class with added argument for sorting.
 QueryResult expand(Persistable a_source, String a_otherSideRole, QuerySpec a_querySpec, boolean a_onlyOtherSide, AccessControllerProcessor a_accessControllerProcessor)
          Expand the given persistent object by retrieving the links from the datastore given the role that the object plays in the association, the target association class and the selection criteria provided.
private  QueryResult expandAllRoles(Persistable a_source, Class a_linkClass, QuerySpec a_querySpec, boolean a_onlyOtherSide, AccessControllerProcessor a_accessControllerProcessor, boolean a_sorted)
           
(package private) static void firePOMOperationListener(List a_listeners, Object a_obj, boolean a_attributeUpdate, PersistentObjectManager.FirePOMOperationListener a_fireListener)
           
(package private) static void firePOMOperationListener(List a_listeners, Object a_obj, PersistentObjectManager.FirePOMOperationListener a_fireListener)
           
(package private) static void freeUserConnection()
           
private static void freeUserConnection(WTConnection conn)
           
protected static String getDatastore(Class aClass)
           
 InputStream getLob(LobLocator aLobLocator)
          Get a LOB from the datastore as an input stream.
 String getNextSequence(String sequenceName)
          Get the next Sequence number - sequence must already exist
private static OIDPool getOidPool()
           
protected static PDSIfc getPds(Class aClass)
           
static PersistentObjectManager getPom()
           
private  QuerySpec getRoleSpec(Persistable a_source, QuerySpec a_querySpec, RoleDescriptor a_role, boolean a_onlyOtherSide)
           
static TransactionManager getTransactionManager()
          Returns TransactionManager instance associated with this MethodContext.
protected static TransactionManager getTransactionManager(WTConnection conn)
           
(package private) static WTConnection getUserConnection()
           
 void insert(Persistable aPersistentObj)
          Insert a persistent object in a datastore.
private  void insert(PersistableList a_list)
          Insert a persistent objects in a datastore.
 void insert(Persistable aPersistentObj, Timestamp createDate, Timestamp modifyDate)
          Insert a persistent object in a datastore.
 void insert(WTCollection objs, Timestamp createDate, Timestamp modifyDate)
          Insert an array of persistent objects in a datastore.
 boolean isTransactionActive()
          isTransactionActive
 boolean isTransactionActive(WTConnection conn)
          isTransactionActive
 void lock(Object className)
          Lock a persistent class table in the datastore.
 void lock(Object className, boolean wait)
          Lock a persistent object in the datastore.
 void lock(Persistable persistentObj)
          Lock a persistent object in the datastore.
 void lock(Persistable persistentObj, boolean wait)
          Lock a persistent object in the datastore.
protected static void makeNonPersistent(Persistable obj)
           
protected static void makePersistent(Persistable obj)
           
static long newId()
           
private static PersistableList newPersistableList(WTCollection objs, Timestamp createDate, Timestamp modifyDate)
           
 Persistable query(ObjectIdentifier anOid)
          Queries the datastore for a persistent object matching the given object id.
 Persistable query(ObjectIdentifier anOid, boolean lock)
          Queries the datastore for a persistent object matching the given object id.
 QueryResult query(PageableQuerySpec a_statementSpec, AccessControllerProcessor a_accessControllerProcessor, PagingSessionCache pagingSessionCache, ResultProcessor a_resultProcessor)
          Execute a query
 QueryResult query(PageableQuerySpec aStatementSpec, PagingSessionCache pagingSessionCache, AccessControllerProcessor anAccessControllerProcessor)
          Execute a query
 QueryResult query(StatementSpec aStatementSpec, AccessController anAccessController)
          Execute a query
 QueryResult query(StatementSpec aStatementSpec, AccessControllerProcessor anAccessControllerProcessor)
          Execute a query
 QueryResult query(StatementSpec a_statementSpec, AccessControllerProcessor a_accessControllerProcessor, ResultProcessor a_resultProcessor)
          Execute a query
private  void queryWithEnable(StatementSpec a_snapshotSpec, boolean a_advancedQueryEnabled, WTConnection a_connection, AccessControllerProcessor a_accessControllerProcessor, ResultProcessor a_resultProcessor)
           
 Persistable refresh(Persistable aPersistentObj, boolean aInPlace)
          Queries the datastore to refresh a given persistent object.
 Persistable refresh(Persistable aPersistentObj, boolean aInPlace, boolean aLock)
          Queries the datastore to refresh a given persistent object.
private  Persistable refresh(Persistable a_obj, ObjectIdentifier a_oid, boolean aInPlace, boolean aLock)
          Queries the datastore to refresh a given persistent object.
 void remove(Persistable aPersistentObj)
          Remove a persistent object from the datastore.
static void removeLocalOperationListener(POMOperationListener listener)
          Remove a listener for POM operations.
 void removeOperationListener(POMOperationListener listener)
          Remove a listener for POM operations.
 void removeTransactionListener(TransactionListener listener)
          Remove a listener to the current transaction
 void rollbackTransaction()
          Rollback the current transaction
 void rollbackTransaction(int aHandle)
          Rollback a transaction cancelling pending changes to the datastore.
 void setTransactionIsolation(int mode)
          Set transaction isolation
private  void sortFullPersistable(ObjectVectorIfc a_resultProcessor, ObjectVectorIfc a_oidClassNameVec, int a_offset, int a_range, int a_groupFromIndex)
           
 void update(Persistable aPersistentObj, boolean changeModifyDate)
          Update a persistent object in the datastore.
private  void update(PersistableList a_list, boolean a_changeModifyDate)
          Update a persistent object in the datastore.
 void update(Persistable aPersistentObj, String attrName, ObjectMappable objAttr)
          Update one of the attributes in a persistent object in the datastore.
 void update(WTCollection objs, boolean changeModifyDate)
          Update persistent objects in the datastore.
 long updateLob(Persistable anObj, LobLocator aLobLocator, InputStream aStream)
           
 long updateLob(Persistable anObj, LobLocator aLobLocator, InputStream aStream, boolean updateChangeStamp)
          Update a LOB in the datastore from an input stream of unknown length.
 void updateLob(Persistable anObj, LobLocator aLobLocator, InputStream aStream, long length)
           
 void updateLob(Persistable anObj, LobLocator aLobLocator, InputStream aStream, long length, boolean updateChangeStamp)
          Update a LOB in the datastore from an input stream.
private  void validateInsert(WTConnection aConnection)
           
private  void validateLock(WTConnection aConnection)
           
private  void validateRemove(WTConnection aConnection)
           
private  RoleDescriptor[] validateRoles(ClassInfo a_sourceClassInfo, LinkInfo a_linkInfo)
           
private  void validateUpdate(WTConnection aConnection)
           
private  boolean validLink(RoleDescriptor rds, LinkInfo linkInfo)
           
private  void verifyTransaction(WTConnection aConnection)
           
private  int waitForBackground(int a_fetchAttemp, WTConnection a_connection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME

DEBUG

public static final boolean DEBUG

LOG

private static final DebugWriter LOG

oidPool

private static OIDPool oidPool

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

TARGET_FROM_INDEX

private static final int[] TARGET_FROM_INDEX

LINK_FROM_INDEX

private static final int[] LINK_FROM_INDEX

ROLE_A

static final String ROLE_A
See Also:
Constant Field Values

ROLE_B

static final String ROLE_B
See Also:
Constant Field Values

ROLE_A_CONSTANT

private static final ConstantExpression ROLE_A_CONSTANT

ROLE_B_CONSTANT

private static final ConstantExpression ROLE_B_CONSTANT

TARGET_CLASSNAME

private static final ClassAttribute TARGET_CLASSNAME

TARGET_ID

private static final ClassAttribute TARGET_ID

LINK_ID

private static final ClassAttribute LINK_ID

NOOP_ACCESS_CONTROLLER

private static final AccessController NOOP_ACCESS_CONTROLLER

STANDARD_ACCESS_CONTROLLER

private static final AccessController STANDARD_ACCESS_CONTROLLER

sortName

private static final String sortName
See Also:
Constant Field Values

INVALID_PAGINGSESSION

private static final int INVALID_PAGINGSESSION

VALID_LINK_ROLE_MAP

private static final HashMap VALID_LINK_ROLE_MAP

OID_REUSE

public static final Object OID_REUSE

CREATE

static final PersistentObjectManager.NotifyCreateListener CREATE

UPDATE

static final PersistentObjectManager.NotifyUpdateListener UPDATE

DELETE

static final PersistentObjectManager.NotifyDeleteListener DELETE

LOCK

static final PersistentObjectManager.NotifyLockListener LOCK

REFRESH

static final PersistentObjectManager.NotifyRefreshListener REFRESH

operationListeners

private ArrayList operationListeners
Constructor Detail

PersistentObjectManager

public PersistentObjectManager()
                        throws POMInitException
PersistentObjectManager constructor

Throws:
POMInitException - Occurs if JDBC driver or native method library or properties file cannot be loaded
Method Detail

getPom

public static PersistentObjectManager getPom()
                                      throws POMInitException
Throws:
POMInitException

connect

public WTConnection connect()
                     throws PersistenceException
Connection to a datastore.

Returns:
connection - a datastore connection
Throws:
PersistenceException - Occurs if the persistent object manager cannot connect to a datastore.

disconnect

public void disconnect(WTConnection aConnection)
                throws DatastoreException
Disconnect from a datastore.

Throws:
DatastoreException - Occurs if the persistent object manager cannont disconnect from the datastore.

getUserConnection

static WTConnection getUserConnection()
                               throws DatastoreException
Throws:
DatastoreException

freeUserConnection

static void freeUserConnection()
                        throws DatastoreException
Throws:
DatastoreException

freeUserConnection

private static void freeUserConnection(WTConnection conn)
                                throws DatastoreException
Throws:
DatastoreException

getTransactionManager

public static TransactionManager getTransactionManager()
                                                throws PersistenceException
Returns TransactionManager instance associated with this MethodContext. This value may be null, if no Transaction has been created.

Throws:
PersistenceException

getTransactionManager

protected static TransactionManager getTransactionManager(WTConnection conn)
                                                   throws PersistenceException
Throws:
PersistenceException

commitTransaction

public void commitTransaction(int aHandle)
                       throws PersistenceException
Commit a transaction flushing changes to the datastore.

Specified by:
commitTransaction in interface POMIfc
Parameters:
aHandle - The transaction identifier provided by the startTransaction method.
Throws:
PersistenceException - Occurs if the persistent object manager cannot end the transaction.

rollbackTransaction

public void rollbackTransaction(int aHandle)
                         throws PersistenceException
Rollback a transaction cancelling pending changes to the datastore.

Specified by:
rollbackTransaction in interface POMIfc
Parameters:
aHandle - The transaction identifier provided by the startTransaction method.
Throws:
PersistenceException - Occurs if the persistent object manager cannot drop the transaction.

rollbackTransaction

public void rollbackTransaction()
                         throws PersistenceException
Description copied from interface: POMIfc
Rollback the current transaction

Specified by:
rollbackTransaction in interface POMIfc
Throws:
PersistenceException - Occurs if the persistent object manager cannot drop the transaction.

addTransactionListener

public void addTransactionListener(TransactionListener listener)
                            throws PersistenceException
Add a listener to the current transaction

Specified by:
addTransactionListener in interface POMIfc
Throws:
PersistenceException - Occurs if the persistent object manager cannot find an active transaction.

removeTransactionListener

public void removeTransactionListener(TransactionListener listener)
                               throws PersistenceException
Remove a listener to the current transaction

Specified by:
removeTransactionListener in interface POMIfc
Throws:
PersistenceException - Occurs if the persistent object manager cannot find an active transaction.

setTransactionIsolation

public void setTransactionIsolation(int mode)
                             throws PersistenceException
Set transaction isolation

Parameters:
mode - TRANSACTION_READ_UNCOMMITTED TRANSACTION_READ_COMMITTED TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE
Throws:
PersistenceException - if a database-access error occurs

isTransactionActive

public boolean isTransactionActive()
                            throws PersistenceException
isTransactionActive

Throws:
PersistenceException - if a database-access error occurs

isTransactionActive

public boolean isTransactionActive(WTConnection conn)
                            throws PersistenceException
isTransactionActive

Throws:
PersistenceException - if a database-access error occurs

insert

public void insert(Persistable aPersistentObj)
            throws PersistenceException
Insert a persistent object in a datastore.

Specified by:
insert in interface POMIfc
Parameters:
aPersistentObj - The object to be made persistent.
Throws:
UnsupportedPDSException - if no PDS defined
ObjectIsPersistentException - if object already persisent
DatastoreException - if database error
WTIntrospectionException - if introspection error
PersistenceException - Occurs if the persistent object manager cannot insert the persistent object.

insert

public void insert(Persistable aPersistentObj,
                   Timestamp createDate,
                   Timestamp modifyDate)
            throws PersistenceException
Insert a persistent object in a datastore.

Specified by:
insert in interface POMIfc
Parameters:
createDate - explicit create Timestamp to set (if null, current time is used)
modifyDate - explicit modify Timestamp to set (if null, current time is used)
aPersistentObj - The object to be made persistent.
Throws:
PersistenceException - Occurs if the persistent object manager cannot insert the persistent object.

insert

public void insert(WTCollection objs,
                   Timestamp createDate,
                   Timestamp modifyDate)
            throws WTException
Insert an array of persistent objects in a datastore.

Parameters:
objs - The objects to be made persistent. The type of each object in the array must be the same.
createDate - explicit create Timestamp to set (if null, current time is used)
modifyDate - explicit modify Timestamp to set (if null, current time is used)
Throws:
PersistenceException - Occurs if the persistent object manager cannot insert any of the persistent objects.
WTException

remove

public void remove(Persistable aPersistentObj)
            throws PersistenceException
Remove a persistent object from the datastore.

Specified by:
remove in interface POMIfc
Parameters:
aPersistentObj - The persistent object to be removed.
Throws:
UnsupportedPDSException - if no PDS defined
ObjectNotPersistentException - if object is not persisent
ObjectIsStaleException - if object was concurrently changed
DatastoreException - if database error
WTIntrospectionException - if introspection error
PersistenceException - Occurs if the persistent object manager cannot remove the persistent object.

execute

public int execute(AbstractBatchSpec a_batchSpec,
                   WTSet a_objects,
                   boolean a_fullObjects)
            throws WTException
Executes the specified statements in from the datastore.

Parameters:
a_batchSpec - Specifies the objects to remove
a_objects - set of object OIDs that are being affected. This may be null.
a_fullObjects - indicates if a_objects contains full Persistables
Returns:
number of objects affected
Throws:
WTException

update

public void update(Persistable aPersistentObj,
                   boolean changeModifyDate)
            throws PersistenceException
Update a persistent object in the datastore.

Specified by:
update in interface POMIfc
Parameters:
aPersistentObj - The persistent object to be modified.
changeModifyDate - boolean
Throws:
UnsupportedPDSException - if no PDS defined
ObjectNotPersistentException - if object is not persisent
ObjectIsStaleException - if object was concurrently changed
DatastoreException - if database error
WTIntrospectionException - if introspection error
PersistenceException - Occurs if the persistent object manager cannot update the persistent object.

update

public void update(WTCollection objs,
                   boolean changeModifyDate)
            throws WTException
Update persistent objects in the datastore.

Parameters:
changeModifyDate - boolean says whether to change business modify stamp or not
Throws:
WTException - occurs if the persistent object manager cannot update the persistent object.

update

public void update(Persistable aPersistentObj,
                   String attrName,
                   ObjectMappable objAttr)
            throws PersistenceException
Update one of the attributes in a persistent object in the datastore.

Specified by:
update in interface POMIfc
Parameters:
aPersistentObj - The persistent object to be modified.
attrName - Name of the attribute
objAttr - The attribute
Throws:
UnsupportedPDSException - if no PDS defined
ObjectNotPersistentException - if object is not persisent
ObjectIsStaleException - if object was concurrently changed
DatastoreException - if database error
WTIntrospectionException - if introspection error
PersistenceException - Occurs if the persistent object manager cannot update the persistent object.

lock

public void lock(Persistable persistentObj)
          throws PersistenceException
Lock a persistent object in the datastore.

Specified by:
lock in interface POMIfc
Parameters:
persistentObj - The persistent objects to be locked.
Throws:
PersistenceException - Occurs if the persistent object manager cannot lock the persistent object.

lock

public void lock(Persistable persistentObj,
                 boolean wait)
          throws PersistenceException
Lock a persistent object in the datastore.

Specified by:
lock in interface POMIfc
Parameters:
persistentObj - The persistent objects to be locked.
wait - boolean whether to wait for lock or not
Throws:
PersistenceException - Occurs if the persistent object manager cannot lock the persistent object.

lock

public void lock(Object className)
          throws PersistenceException
Lock a persistent class table in the datastore.

Parameters:
className - The persistent class name/Class to be locked.
Throws:
PersistenceException - Occurs if the persistent object manager cannot lock the persistent object.

lock

public void lock(Object className,
                 boolean wait)
          throws PersistenceException
Lock a persistent object in the datastore.

Parameters:
className - The persistent class name/Class to be locked.
wait - boolean whether to wait for lock or not
Throws:
PersistenceException - Occurs if the persistent object manager cannot lock the persistent object.

query

public QueryResult query(StatementSpec aStatementSpec,
                         AccessController anAccessController)
                  throws PersistenceException
Execute a query

Throws:
PersistenceException - Occurs if the persistent object manager cannot execute the query.

query

public QueryResult query(StatementSpec aStatementSpec,
                         AccessControllerProcessor anAccessControllerProcessor)
                  throws PersistenceException
Execute a query

Specified by:
query in interface POMIfc
Parameters:
aStatementSpec - - selection criteria
Throws:
PersistenceException - Occurs if the persistent object manager cannot execute the query.

query

public QueryResult query(PageableQuerySpec aStatementSpec,
                         PagingSessionCache pagingSessionCache,
                         AccessControllerProcessor anAccessControllerProcessor)
                  throws PersistenceException
Execute a query

Throws:
PersistenceException - Occurs if the persistent object manager cannot execute the query.

query

public QueryResult query(StatementSpec a_statementSpec,
                         AccessControllerProcessor a_accessControllerProcessor,
                         ResultProcessor a_resultProcessor)
                  throws PersistenceException
Execute a query

Throws:
PersistenceException - Occurs if the persistent object manager cannot execute the query.

query

public QueryResult query(PageableQuerySpec a_statementSpec,
                         AccessControllerProcessor a_accessControllerProcessor,
                         PagingSessionCache pagingSessionCache,
                         ResultProcessor a_resultProcessor)
                  throws PersistenceException
Execute a query

Throws:
PersistenceException - Occurs if the persistent object manager cannot execute the query.

getLob

public InputStream getLob(LobLocator aLobLocator)
                   throws PersistenceException
Get a LOB from the datastore as an input stream.

Specified by:
getLob in interface POMIfc
Parameters:
aLobLocator - the lob locator
Throws:
PersistenceException - Occurs if the persistent object manager cannot retrieve the persistent object.

updateLob

public void updateLob(Persistable anObj,
                      LobLocator aLobLocator,
                      InputStream aStream,
                      long length,
                      boolean updateChangeStamp)
               throws PersistenceException
Update a LOB in the datastore from an input stream.

Specified by:
updateLob in interface POMIfc
Parameters:
aLobLocator - the stream to connect
aStream - the input stream to store
length - the length of the input stream
updateChangeStamp - t/f
anObj - the object holding the LOB
Throws:
PersistenceException - Occurs if the persistent object manager cannot store the persistent object.

updateLob

public void updateLob(Persistable anObj,
                      LobLocator aLobLocator,
                      InputStream aStream,
                      long length)
               throws PersistenceException
Throws:
PersistenceException

updateLob

public long updateLob(Persistable anObj,
                      LobLocator aLobLocator,
                      InputStream aStream,
                      boolean updateChangeStamp)
               throws PersistenceException
Update a LOB in the datastore from an input stream of unknown length.

Specified by:
updateLob in interface POMIfc
Parameters:
aLobLocator - the stream to connect
aStream - the input stream to store
updateChangeStamp - t/f
anObj - the object holding the LOB
Returns:
length of the LOB
Throws:
PersistenceException - Occurs if the persistent object manager cannot store the persistent object.

updateLob

public long updateLob(Persistable anObj,
                      LobLocator aLobLocator,
                      InputStream aStream)
               throws PersistenceException
Throws:
PersistenceException

query

public Persistable query(ObjectIdentifier anOid)
                  throws PersistenceException
Queries the datastore for a persistent object matching the given object id. Returns null if the object is not found.

Returns:
The persistent object with the matching object id
Throws:
PersistenceException

query

public Persistable query(ObjectIdentifier anOid,
                         boolean lock)
                  throws PersistenceException
Queries the datastore for a persistent object matching the given object id. Returns null if the object is not found.

Returns:
The persistent object with the matching object id
Throws:
PersistenceException

refresh

public Persistable refresh(Persistable aPersistentObj,
                           boolean aInPlace)
                    throws PersistenceException
Queries the datastore to refresh a given persistent object. Returns null if the object is not found, otherwise returns the input object with all its persistent attributes refreshed. If specified, the current instance of the object and any structured attributes are refreshed in place.

Parameters:
aPersistentObj - persistent object
aInPlace - indicates if the object is refreshed in place
Returns:
The set of objects matching the query criteria
Throws:
PersistenceException - if an introspection error

refresh

public Persistable refresh(Persistable aPersistentObj,
                           boolean aInPlace,
                           boolean aLock)
                    throws PersistenceException
Queries the datastore to refresh a given persistent object. Returns null if the object is not found, otherwise returns the input object with all its persistent attributes refreshed. If specified, the current instance of the object and any structured attributes are refreshed in place.

Parameters:
aPersistentObj - persistent object
aInPlace - indicates if the object is refreshed in place
aLock - indicates if the object should be locked as part of the refresh
Returns:
The set of objects matching the query criteria
Throws:
PersistenceException - if an introspection error

expand

public QueryResult expand(Persistable a_source,
                          String a_otherSideRole,
                          Class a_linkClass,
                          boolean a_onlyOtherSide,
                          AccessControllerProcessor a_accessControllerProcessor)
                   throws WTException
Expand the given persistent object by retrieving the links from the datastore given the role that the object plays in the association and and the target association class.

Returns:
The set of links.
Throws:
PersistenceException - Occurs if the persistent object manager cannot expand object in the datastore.
WTException

expand

public QueryResult expand(Persistable a_source,
                          String a_otherSideRole,
                          Class a_linkClass,
                          boolean a_onlyOtherSide,
                          AccessControllerProcessor a_accessControllerProcessor,
                          boolean a_sorted)
                   throws WTException
Expand the given persistent object by retrieving the links from the datastore given the role that the object plays in the association and and the target association class with added argument for sorting.

Parameters:
a_sorted - - whether to sort in the order of Object_identifier.id
Returns:
The set of links.
Throws:
PersistenceException - Occurs if the persistent object manager cannot expand object in the datastore.
WTException

expand

public QueryResult expand(Persistable a_source,
                          String a_otherSideRole,
                          QuerySpec a_querySpec,
                          boolean a_onlyOtherSide,
                          AccessControllerProcessor a_accessControllerProcessor)
                   throws WTException
Expand the given persistent object by retrieving the links from the datastore given the role that the object plays in the association, the target association class and the selection criteria provided.

Returns:
The set of links.
Throws:
PersistenceException - Occurs if the persistent object manager cannot expand object in the datastore.
WTException

refresh

private Persistable refresh(Persistable a_obj,
                            ObjectIdentifier a_oid,
                            boolean aInPlace,
                            boolean aLock)
                     throws PersistenceException
Queries the datastore to refresh a given persistent object. Returns null if the object is not found, otherwise returns a Persistable object. If specified, the current instance of the object and any structured attributes are refreshed in place.

Parameters:
aInPlace - indicates if the object is refreshed in place
aLock - indicates if the object should be locked as part of the refresh
Returns:
Persistable object
Throws:
PersistenceException - if an introspection error

expandAllRoles

private QueryResult expandAllRoles(Persistable a_source,
                                   Class a_linkClass,
                                   QuerySpec a_querySpec,
                                   boolean a_onlyOtherSide,
                                   AccessControllerProcessor a_accessControllerProcessor,
                                   boolean a_sorted)
                            throws WTException
Throws:
WTException

getRoleSpec

private QuerySpec getRoleSpec(Persistable a_source,
                              QuerySpec a_querySpec,
                              RoleDescriptor a_role,
                              boolean a_onlyOtherSide)
                       throws WTException
Throws:
WTException

executeCall

public Object executeCall(String a_procedureName,
                          Object[] a_argumentValues,
                          int[] a_argumentTypes,
                          Integer a_outputType)
                   throws PersistenceException
This method executes a call to a database stored procedure. Input argument types and values are mapped as specified. The output value from the stored procedure is returned, if applicable.

Supported API: false

Parameters:
a_procedureName - Specifies the database stored procedure to execute.
a_argumentValues - Array of input argument values
a_argumentTypes - Array of input argument types (java.sql.Types)
a_outputType - Type of the stored procedures return value (java.sql.Types). If null, then the stored procedure is assumed to be a procedure and a null value is returned.
Returns:
Object
Throws:
PersistenceException
See Also:
Types

executeCall

public Object executeCall(String a_procedureName,
                          StatementParameter[] a_argumentValues,
                          StatementParameter a_outputType)
                   throws PersistenceException
This method executes a call to a database stored procedure. The output value from the stored procedure is returned, if applicable.

Supported API: false

Parameters:
a_procedureName - Specifies the database stored procedure to execute.
a_argumentValues - Array of input argument values
a_outputType - Type of the stored procedures return value (java.sql.Types). If null, then the stored procedure is assumed to be a procedure and a null value is returned.
Returns:
Object
Throws:
PersistenceException

validLink

private boolean validLink(RoleDescriptor rds,
                          LinkInfo linkInfo)
                   throws WTIntrospectionException
Throws:
WTIntrospectionException

validateRoles

private RoleDescriptor[] validateRoles(ClassInfo a_sourceClassInfo,
                                       LinkInfo a_linkInfo)
                                throws WTIntrospectionException
Throws:
WTIntrospectionException

addOperationListener

public void addOperationListener(POMOperationListener a_listener)
                          throws PersistenceException
Add a listener for local POM operations.

Supported API: true

Throws:
PersistenceException

removeOperationListener

public void removeOperationListener(POMOperationListener listener)
                             throws PersistenceException
Remove a listener for POM operations.

Supported API: true

Throws:
PersistenceException

addLocalOperationListener

public static void addLocalOperationListener(POMOperationListener listener)
                                      throws PersistenceException
Add a listener for POM operations.

Supported API: true

Throws:
PersistenceException

removeLocalOperationListener

public static void removeLocalOperationListener(POMOperationListener listener)
                                         throws PersistenceException
Remove a listener for POM operations.

Supported API: true

Throws:
PersistenceException

validateRemove

private void validateRemove(WTConnection aConnection)
                     throws PersistenceException
Throws:
PersistenceException

validateInsert

private void validateInsert(WTConnection aConnection)
                     throws PersistenceException
Throws:
PersistenceException

validateUpdate

private void validateUpdate(WTConnection aConnection)
                     throws PersistenceException
Throws:
PersistenceException

validateLock

private void validateLock(WTConnection aConnection)
                   throws PersistenceException
Throws:
PersistenceException

verifyTransaction

private void verifyTransaction(WTConnection aConnection)
                        throws PersistenceException
Throws:
PersistenceException

getNextSequence

public String getNextSequence(String sequenceName)
                       throws PersistenceException
Get the next Sequence number - sequence must already exist

Specified by:
getNextSequence in interface POMIfc
Returns:
aSequenceNumber - aSequenceName.nextval
Throws:
PersistenceException

newId

public static long newId()
                  throws PersistenceException
Throws:
PersistenceException

getOidPool

private static OIDPool getOidPool()

getPds

protected static PDSIfc getPds(Class aClass)
                        throws UnsupportedPDSException
Throws:
UnsupportedPDSException

getDatastore

protected static String getDatastore(Class aClass)

makeNonPersistent

protected static void makeNonPersistent(Persistable obj)

makePersistent

protected static void makePersistent(Persistable obj)

insert

private void insert(PersistableList a_list)
             throws WTException
Insert a persistent objects in a datastore.

Parameters:
a_list - List of Persistables to update.
Throws:
WTException - occurs if the persistent object manager cannot insert any of the the persistent objects.

update

private void update(PersistableList a_list,
                    boolean a_changeModifyDate)
             throws WTException
Update a persistent object in the datastore.

Parameters:
a_list - List of Persistables to update.
a_changeModifyDate - indicates if the modifyStamp should be updated.
Throws:
WTException - occurs if the persistent object manager cannot insert any of the the persistent objects.

queryWithEnable

private void queryWithEnable(StatementSpec a_snapshotSpec,
                             boolean a_advancedQueryEnabled,
                             WTConnection a_connection,
                             AccessControllerProcessor a_accessControllerProcessor,
                             ResultProcessor a_resultProcessor)
                      throws WTException
Throws:
WTException

computeGroupCount

private int[] computeGroupCount(int a_groupIndex,
                                Vector a_resultVector,
                                int a_range,
                                int a_offset)

sortFullPersistable

private void sortFullPersistable(ObjectVectorIfc a_resultProcessor,
                                 ObjectVectorIfc a_oidClassNameVec,
                                 int a_offset,
                                 int a_range,
                                 int a_groupFromIndex)

newPersistableList

private static PersistableList newPersistableList(WTCollection objs,
                                                  Timestamp createDate,
                                                  Timestamp modifyDate)
                                           throws WTException
Throws:
WTException

waitForBackground

private int waitForBackground(int a_fetchAttemp,
                              WTConnection a_connection)
                       throws WTException
Throws:
WTException

firePOMOperationListener

static void firePOMOperationListener(List a_listeners,
                                     Object a_obj,
                                     boolean a_attributeUpdate,
                                     PersistentObjectManager.FirePOMOperationListener a_fireListener)
                              throws PersistenceException
Throws:
PersistenceException

firePOMOperationListener

static void firePOMOperationListener(List a_listeners,
                                     Object a_obj,
                                     PersistentObjectManager.FirePOMOperationListener a_fireListener)
                              throws PersistenceException
Throws:
PersistenceException