Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3)
B16005-01


oracle.jbo.server
Class EntityCache

java.lang.Object
  extended byoracle.jbo.server.EntityCache

All Implemented Interfaces:
StructureDef
Direct Known Subclasses:
EntityCacheOverRowSet, EntityFacadeCollImpl

public class EntityCache
extends java.lang.Object
implements StructureDef

The EntityCache caches queried rows for a particular EntityImpl.

Version:
SDK

Constructor Summary
EntityCache()
          Constructor.

 

Method Summary
protected  EntityImpl add(EntityImpl srow)
          Add an Entity to the cache.
 AttributeDef addDynamicAttribute(java.lang.String attrName)
           
 void addEntityListener(EntityListener listener)
          Add an EntityListener.
protected  void addRowByDeletedPK(Key pkey, EntityImpl srow)
           
protected  void clearCache()
           
protected  void closeStatements()
           
protected  java.sql.PreparedStatement createPreparedStatement(java.lang.String sqlString, boolean lock, int noRowsPrefetch)
           
protected  void deliverEntityEvent(EntityEvent event)
           
 AttributeDef findAttributeDef(java.lang.String name)
          Gets an attribute definition, given its name.
 EntityImpl get(Key key)
          Get an EntityImpl from the cache.
 int getAttributeCount()
          Returns the number of defined attributes.
 AttributeDef getAttributeDef(int index)
          Gets an attribute definition, given its index.
 AttributeDef[] getAttributeDefs()
          Gets the defined attributes.
 int getAttributeIndexOf(java.lang.String name)
          Finds the index (0-based) of the named attribute.
protected  java.sql.Timestamp getCurrentDbTime()
          Get the current database time for DATE History Column.
 DBTransactionImpl getDBTransactionImpl()
           
 java.lang.String getDefFullName()
          Returns the fully qualified name of the structure's base definition.
 java.lang.String getDefName()
          Returns the structure's base definition name (short form).
 EntityDefImpl getEntityDef()
           
 java.lang.String getFullName()
          Returns the structure's fully qualified name.
 java.lang.String getName()
          Returns the structure's name (short form).
protected  java.sql.PreparedStatement getPreparedSelectStatement(boolean lock)
           
 boolean hasRows()
           
protected  void init(DBTransactionImpl trans, EntityDefImpl entityDef)
           
 boolean isAssociationAccessorRetained()
           
protected  boolean isBatchable(int operation)
           
protected  com.sun.java.util.collections.Iterator iterator()
          Return an Iterator for the EntityCache.
 AttributeDef lookupAttributeDef(java.lang.String name)
          Gets an attribute definition, given its name.
 void pin(EntityImpl srow)
           
 void removeEntityListener(EntityListener listener)
          Remove an EntityListener.
protected  EntityImpl removeRow(EntityImpl srow)
          Remove a EntityImpl from the cache.
protected  EntityImpl removeRowByDeletedPK(EntityImpl srow)
           
protected  EntityImpl removeRowByOldPK(EntityImpl srow)
           
protected  void replace(EntityImpl srow, Key okey)
          Remove a row in cache and add it in using the new key values.
 void setAssociationAccessorRetained(boolean b)
           
 boolean unpin(EntityImpl srow)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

EntityCache

public EntityCache()
Constructor.

Method Detail

getName

public java.lang.String getName()
Description copied from interface: StructureDef
Returns the structure's name (short form).
Specified by:
getName in interface StructureDef
Returns:
name of the structure.

getFullName

public java.lang.String getFullName()
Description copied from interface: StructureDef
Returns the structure's fully qualified name.
Specified by:
getFullName in interface StructureDef
Returns:
fully qualified name of the structure.

getDefName

public java.lang.String getDefName()
Description copied from interface: StructureDef
Returns the structure's base definition name (short form). Note that, in some cases, a StructureDef may have an instance name and definition name. For example, for a View Object, getName() returns the VO's instance name and getDefName() returns the View definition's name.
Specified by:
getDefName in interface StructureDef
Returns:
name of the structure's base definition.

getDefFullName

public java.lang.String getDefFullName()
Description copied from interface: StructureDef
Returns the fully qualified name of the structure's base definition. Note that, in some cases, a StructureDef may have an instance name and definition name. For example, for a View Object, getFullName() returns the VO's full instance name and getDefFullName() returns the View definition's full name.
Specified by:
getDefFullName in interface StructureDef
Returns:
fully qualified name of the structure's base definition.

init

protected void init(DBTransactionImpl trans,
                    EntityDefImpl entityDef)

getDBTransactionImpl

public DBTransactionImpl getDBTransactionImpl()

getEntityDef

public EntityDefImpl getEntityDef()

pin

public void pin(EntityImpl srow)

unpin

public boolean unpin(EntityImpl srow)

add

protected EntityImpl add(EntityImpl srow)
Add an Entity to the cache. TODO: This really should check for conflicts between the EntityDefImpl of the row and the cache.
Parameters:
srow - the row to be added.

get

public EntityImpl get(Key key)
Get an EntityImpl from the cache. If the entity is not found then we return a null value.
Parameters:
key - the Primary key of the EntityImpl.
Returns:
the EntityImpl with the Key or null if not found.

hasRows

public boolean hasRows()

addRowByDeletedPK

protected void addRowByDeletedPK(Key pkey,
                                 EntityImpl srow)

removeRowByDeletedPK

protected EntityImpl removeRowByDeletedPK(EntityImpl srow)

removeRowByOldPK

protected EntityImpl removeRowByOldPK(EntityImpl srow)

removeRow

protected EntityImpl removeRow(EntityImpl srow)
Remove a EntityImpl from the cache.
Parameters:
srow - the row to be removed.

clearCache

protected void clearCache()

iterator

protected com.sun.java.util.collections.Iterator iterator()
Return an Iterator for the EntityCache. The naming of this method is consistent with the JDK 1.2 Collection classes. The behaviour of the Iterator isn't defined if the underlying values in the cache change as it is executing.
Returns:
an Interator over the cache values.

addEntityListener

public void addEntityListener(EntityListener listener)
Add an EntityListener.
Parameters:
listener - The object to be registered as listener.

removeEntityListener

public void removeEntityListener(EntityListener listener)
Remove an EntityListener.
Parameters:
listener - The object to be removed from the list of listeners.

deliverEntityEvent

protected void deliverEntityEvent(EntityEvent event)

replace

protected void replace(EntityImpl srow,
                       Key okey)
Remove a row in cache and add it in using the new key values. This is used when the key values changed by the user or from RETURNING clause on INSERT or UPDATE.
Parameters:
srow - the row to be replaced.
okey - the original key.

getPreparedSelectStatement

protected java.sql.PreparedStatement getPreparedSelectStatement(boolean lock)

createPreparedStatement

protected java.sql.PreparedStatement createPreparedStatement(java.lang.String sqlString,
                                                             boolean lock,
                                                             int noRowsPrefetch)

isBatchable

protected boolean isBatchable(int operation)

closeStatements

protected void closeStatements()

getCurrentDbTime

protected java.sql.Timestamp getCurrentDbTime()
Get the current database time for DATE History Column. Subclasses can override this method to perform customizations.
Returns:
current database time.

isAssociationAccessorRetained

public boolean isAssociationAccessorRetained()

setAssociationAccessorRetained

public void setAssociationAccessorRetained(boolean b)

getAttributeDefs

public AttributeDef[] getAttributeDefs()
Description copied from interface: StructureDef
Gets the defined attributes.
Specified by:
getAttributeDefs in interface StructureDef
Returns:
an array of attribute definitions.

getAttributeCount

public int getAttributeCount()
Description copied from interface: StructureDef
Returns the number of defined attributes.
Specified by:
getAttributeCount in interface StructureDef
Returns:
the number of attributes.

lookupAttributeDef

public AttributeDef lookupAttributeDef(java.lang.String name)
Description copied from interface: StructureDef
Gets an attribute definition, given its name.
Specified by:
lookupAttributeDef in interface StructureDef
Parameters:
name - the name of an AttributeDef.
Returns:
an attribute definition if found, null otherwise

findAttributeDef

public AttributeDef findAttributeDef(java.lang.String name)
Description copied from interface: StructureDef
Gets an attribute definition, given its name.
Specified by:
findAttributeDef in interface StructureDef
Parameters:
name - the name of an AttributeDef.
Returns:
an attribute definition

getAttributeDef

public AttributeDef getAttributeDef(int index)
Description copied from interface: StructureDef
Gets an attribute definition, given its index.
Specified by:
getAttributeDef in interface StructureDef
Parameters:
index - the index of an AttributeDef, where the leftmost attribute has index zero.
Returns:
an attribute definition.

getAttributeIndexOf

public int getAttributeIndexOf(java.lang.String name)
Description copied from interface: StructureDef
Finds the index (0-based) of the named attribute.
Specified by:
getAttributeIndexOf in interface StructureDef
Parameters:
name - the attribute's name.
Returns:
an integer in the range 0 to getAttributeCount() - 1. If the named attribute is not found, it returns -1.

addDynamicAttribute

public AttributeDef addDynamicAttribute(java.lang.String attrName)

Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3)
B16005-01


Copyright © 1997, 2005, Oracle. All rights reserved.