Business Components

oracle.jbo.server
Class EntityDefImpl

java.lang.Object
  |
  +--oracle.jbo.common.NamedObjectImpl
        |
        +--oracle.jbo.mom.DefinitionObject
              |
              +--oracle.jbo.server.DefObject
                    |
                    +--oracle.jbo.server.RowDef
                          |
                          +--oracle.jbo.server.EntityDefImpl

public class EntityDefImpl
extends oracle.jbo.server.RowDef

Defines metadata for Entity Object classes.

Since:
JDeveloper 3.0

Field Summary
TypeField
static java.lang.String DBOBJ_TYPE_OBJTAB
           
static java.lang.String DBOBJ_TYPE_OBJTYP
           
static java.lang.String DBOBJ_TYPE_TABLE
           
static java.lang.String DBOBJ_TYPE_VIEW
           
protected  com.sun.java.util.collections.ArrayList mAssocAccessors
          The Association accessors for the Entity Object.
protected  com.sun.java.util.collections.ArrayList mAssocs
          Association objects for this Entity Object.
protected  com.sun.java.util.collections.ArrayList mAttrAccessors
          The Attribute accessors for the Entity Object.
protected  int mBatchThreshold
           
protected  java.lang.Class mComponentClass
           
protected  AttributeDefImpl[] mFKeys
          List of attributes that comprise the foreign key.
protected  boolean mIsObjectTable
          Determines if the current table is an Object Table.
protected  AttributeDefImpl mOIDAttribute
          If entity is a OIDObject
protected  AttributeDefImpl[] mPrimaryKeys
          List of attributes that comprise the primary key.
protected  java.lang.String mSource
          Stores the name of the database source: the database entity for the Entity Object.
protected  java.lang.String mSourceType
          Stores the database source type.
 
Fields inherited from class oracle.jbo.mom.DefinitionObject
mBaseDefObject, mExtendedDefObjects, mObjectResolved
 
Fields inherited from class oracle.jbo.common.NamedObjectImpl
mFullName, mObjName, mParent, mProperties
 
Constructor Summary
TypeConstructor
protected EntityDefImpl()
          Default Constructor, sets the row class.
 
Method Summary
TypeMethod
protected  void addEntityAssociation(EntityAssociation assoc)
          Internal: Applications should not use this method.
protected  void addPropertyChangeListener(int index, PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list for an attribute at the given index.
protected  void addPropertyChangeListener(java.lang.String attributeName, PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list for an attribute of the given Name.
protected  void addUniquePKValidation()
          Adds validators to each primary key attribute of this Entity to ensure that the primary key for an Entity is always unique.
protected  void addVetoableChangeListener(int index, VetoableChangeListener listener)
          Adds a VetoableChangeListener to the listener list for an attribute at the given index.
protected  void addVetoableChangeListener(java.lang.String attributeName, VetoableChangeListener listener)
          Adds a VetoableChangeListener to the listener list for an attribute of the given name.
protected  void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a VetoableChangeListener to the listener list.
protected  EntityImpl createBlankInstance(DBTransaction txn)
          Internal: Applications should not use this method.
protected  void createDef()
          This method should be used to perform custom-metadata initialization in a subclass of EntityDefImpl.
protected  EntityImpl createInstance(DBTransaction txn, AttributeList al)
          Instantiate an instance of the Entity.
 Key createKey(AttributeList al)
          Given a set of attribute values (name-value pairs), creates a Primary key object for this Entity.
protected  boolean discrValuesQualify(java.lang.Object[] values)
           
 EntityImpl findByPrimaryKey(DBTransaction txn, Key key)
          Finds an Entity Object given a Primary Key.
protected  oracle.jbo.server.RowDef findDefForDiscrValues(java.lang.Object[] values, boolean recurse)
           
static EntityDefImpl findDefObject(java.lang.String defFullName)
          Finds the named Entity Object definition.
protected  void finishedLoading()
           
 java.lang.String getAliasName()
          Returns the database alias that was declared for this definition object at Design-Time.
 oracle.jbo.server.java.util.Iterator getAllEntityInstances(DBTransaction tr)
          Deprecated. since 5.0 use getAllEntityInstancesIterator.
 com.sun.java.util.collections.Iterator getAllEntityInstancesIterator(DBTransaction tr)
          Creates an iterator for stepping through instances of Entities of this definition object type.
protected  oracle.jbo.server.AssociationDefImpl getAssociationDefImpl(int index)
          Returns the AssociationDefImpl (association accessors) given an index.
protected  oracle.jbo.server.AssociationDefImpl getAssociationDefImpl(java.lang.String name)
          Returns the AssociationDefImpl (association accessors) given the association name.
protected  oracle.jbo.server.AssociationDefImpl[] getAssociationDefImpls()
          Returns the AssociationDefImpls.
 AttributeDefImpl getAttributeDefImpl(int index)
          Given the attribute's column position (index) in the database, returns the attribute definition object.
 AttributeDefImpl getAttributeDefImpl(java.lang.String attrName)
          Given an attribute name, returns the attribute definition object.
protected  AttributeDefImpl getAttributeDefImplByColumnName(java.lang.String colName)
          Given an attribute's column name, returns the attribute definition object.
protected  AttributeDefImpl[] getAttributeDefImpls()
          Returns the AttributeDefImpls objects for this Entity Object.
 oracle.jbo.mom.DefinitionObject getBaseDefObject()
           
 int getBindingStyle()
          Returns the Oracle or JDBC binding style defined for this Entity definition.
protected  AttributeDefImpl getChangeIndicatorColumn()
          Returns the AttributeDef for the Change Indicator column for the datasource.
 java.lang.Class getCollClass()
          Gets the implementation class of this Entity's collection.
protected  java.lang.Class getComponentClass()
          Internal: Applications should not use this method.
protected  AttributeDefImpl[] getDiscrColumns()
          Returns the AttributeDef's of the discriminator columns.
protected  EntityAssociation[] getEntityAssociations()
          Internal: Applications should not use this method.
protected  AttributeDefImpl[] getForeignKeyAttrs()
          Returns the list of AttributeDefs that make the foreign key for the composition cases.
static int getMaxAttrConst(java.lang.String entityName)
          Returns the index of the last attribute for this entity at runtime.
protected  AttributeDefImpl getOIDAttribute()
          Internal: Applications should not use this method.
 oracle.jbo.server.PackageDefImpl getPackageDef()
           
 java.lang.String getPackageName()
           
protected  AttributeDefImpl[] getPrimaryKeys()
          Returns the AttributeDef's that define the primary key.
 java.lang.String getQuery()
          Returns the query that will return all columns for this Entity.
 int getRefAttrIndex()
           
protected  AttributeDefImpl[] getRetrievedOnInsertAttributes()
          Returns the list of attributes for which the Refresh on Insert flag is enabled at Design Time.
protected  AttributeDefImpl[] getRetrievedOnInsertPrimaryKeys()
          Returns the list of primary keys for which the Refresh on Insert flag is enabled at Design Time.
protected  AttributeDefImpl[] getRetrievedOnUpdateAttributes()
          Returns the list of attributes for which the Refresh on Update flag is enabled at Design Time.
protected  AttributeDefImpl[] getRetrievedOnUpdatePrimaryKeys()
          Returns the list of primary key attributes for which the Refresh on Update flag is enabled at Design Time.
 java.lang.Class getRowClass()
          Gets the implementation class of this Entity's rows.
protected  java.lang.String getSource()
          Returns the name of the Database source table.
protected  java.lang.String getSourceType()
          Internal: Applications should not use this method.
protected  boolean hasLOBAttrs()
          Determines whether the EntityDef contains attributes that are LOBs.
protected  boolean isObjectTable()
          Determines whether this is an Object table.
protected  boolean isOIDInPrimaryKey()
          Determines whether the OID (object identifier) attribute is a primary key.
 boolean isRefPKBased()
          Indicates whether this Entity's REF is primary key based or not.
protected  boolean isRowIDPrimaryKey()
          Determines whether this Entity Object has a ROWID attribute that is used as a primary key.
protected  boolean isUpdateChangedColumns()
          Determines whether the SQL generation of UPDATE statements should include all of the columns or just the changed columns.
protected  void loadCustomDef(oracle.jbo.mom.xml.DefElementImpl xmlElement)
          Internal: Applications should not use this method.
protected  void loadProperties(oracle.jbo.mom.xml.DefElementImpl xmlElement)
           
protected  void removePropertyChangeListener(int index, PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list of the given attribute (by index).
protected  void removePropertyChangeListener(java.lang.String attributeName, PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list of the given attribute (by index).
protected  void removeVetoableChangeListener(int index, VetoableChangeListener listener)
          Removes a VetoableChangeListener from the listener list of the given attribute (by index).
protected  void removeVetoableChangeListener(java.lang.String attributeName, VetoableChangeListener listener)
          Removes a VetoableChangeListener from the listener list of the given attribute (by index).
protected  void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes a VetoableChangeListener from the listener list.
protected  void resolveReferences()
          Since this gets called from lazyload, load all attribute accessors upfront.
protected  void setBaseDefObject(oracle.jbo.mom.DefinitionObject baseDefObject)
           
 void setBindingStyle(int bindingStyle)
          Sets the Oracle or JDBC binding style defined for this Entity definition.
protected  void setCollClass(java.lang.Class collClass)
          Internal: Applications should not use this method.
protected  void setDiscrColumns(AttributeDefImpl[] discrCols)
          Sets the AttributeDef's of the discriminator columns.
protected  void setName(java.lang.String name)
          Name this object.
protected  void setParent(NamedObjectImpl parent)
          Sets this object's parent.
 void setRefPKBased(boolean val)
          Internal: Applications should not use this method.
protected  void setRowClass(java.lang.Class rowClass)
          Internal: Applications should not use this method.
protected  void setSource(java.lang.String source)
          Internal: Applications should not use this method.
protected  void setSourceType(java.lang.String sourceType)
          Internal: Applications should not use this method.
 
Methods inherited from class oracle.jbo.mom.DefinitionObject
addExtendedDefObject, getContainerDef, getContainerName, getExtendedDefObjects, isBaseDefFor, isDynamicDefinitionObject, isObjectResolved, setObjectResolved
 
Methods inherited from class oracle.jbo.common.NamedObjectImpl
getFullName, getName, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, refreshProperty, setFullName, setPropertiesMap, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBOBJ_TYPE_TABLE

public static final java.lang.String DBOBJ_TYPE_TABLE

DBOBJ_TYPE_VIEW

public static final java.lang.String DBOBJ_TYPE_VIEW

DBOBJ_TYPE_OBJTYP

public static final java.lang.String DBOBJ_TYPE_OBJTYP

DBOBJ_TYPE_OBJTAB

public static final java.lang.String DBOBJ_TYPE_OBJTAB

mAttrAccessors

protected com.sun.java.util.collections.ArrayList mAttrAccessors
The Attribute accessors for the Entity Object.

mAssocAccessors

protected com.sun.java.util.collections.ArrayList mAssocAccessors
The Association accessors for the Entity Object.

mAssocs

protected com.sun.java.util.collections.ArrayList mAssocs
Association objects for this Entity Object.

mFKeys

protected AttributeDefImpl[] mFKeys
List of attributes that comprise the foreign key.

mPrimaryKeys

protected AttributeDefImpl[] mPrimaryKeys
List of attributes that comprise the primary key.

mOIDAttribute

protected AttributeDefImpl mOIDAttribute
If entity is a OIDObject

mSource

protected java.lang.String mSource
Stores the name of the database source: the database entity for the Entity Object.

mSourceType

protected java.lang.String mSourceType
Stores the database source type.

mIsObjectTable

protected boolean mIsObjectTable
Determines if the current table is an Object Table. Default is false.

mBatchThreshold

protected int mBatchThreshold

mComponentClass

protected java.lang.Class mComponentClass
Constructor Detail

EntityDefImpl

protected EntityDefImpl()
Default Constructor, sets the row class.
Method Detail

findDefObject

public static EntityDefImpl findDefObject(java.lang.String defFullName)
Finds the named Entity Object definition.

This method takes the fully qualified name (package_name.Entity_name) of an Entity definition and returns the corresponding Entity definition object. This method can be used to return only the Entity Object defintion object, instead of the more global methods in the MetaObjectManager class.

The following example returns the EntityDef object associated with the Categories Entity in package1.

 mDefinitionObject =
     (EntityDefImpl)EntityDefImpl.findDefObject("package1.Categories");
 
Parameters:
defFullName - the fully qualified name of the definition.
Returns:
the Entity definition object corresponding to the specified name.
See Also:
MetaObjectManager

createDef

protected void createDef()
This method should be used to perform custom-metadata initialization in a subclass of EntityDefImpl. The method is called as a notification that this definition object's metadata is loaded.

Override this method to satisfy your application's specific custom properties for the Entity definition. For example, you would override this method if your application builds custom properties programatically based on user preferences.

Subclasses of EntityDefImpl should invoke addUniquePKValidation() in this method to add primary key validators. For example:

 protected void createDef()
   {
     addUniquePKValidation();
    }

 
By default, the framework does not invoke the unique key check.
See Also:
addUniquePKValidation()

getEntityAssociations

protected EntityAssociation[] getEntityAssociations()
Internal: Applications should not use this method.

Returns an array of Entity Association objects for this Entity.


addEntityAssociation

protected void addEntityAssociation(EntityAssociation assoc)
Internal: Applications should not use this method.

Adds an Entity Association to this Entity.

Parameters:
assoc - the entity assocition to be added.

getAttributeDefImpl

public AttributeDefImpl getAttributeDefImpl(java.lang.String attrName)
Given an attribute name, returns the attribute definition object.

This method takes the string name of an Entity Object attribute and returns the corresponding attribute definition object. For example, use this method to get the attribute definition object to store custom properties.

Parameters:
attrName - the specified Entity attribute.
Returns:
an Entity attribute definition object.

getAttributeDefImpl

public AttributeDefImpl getAttributeDefImpl(int index)
Given the attribute's column position (index) in the database, returns the attribute definition object.

This method takes the Entity attribute's database column position (index) and returns the corresponding attribute definition object. For example, use this method to get the attribute definition object to store custom properties.

Parameters:
index - the attribute's database column position, where the leftmost column has index 0.
Returns:
an Entity attribute definition object; null if the given index is invalid.

getAttributeDefImplByColumnName

protected AttributeDefImpl getAttributeDefImplByColumnName(java.lang.String colName)
Given an attribute's column name, returns the attribute definition object.

This method takes the Entity attribute's database colunm name and returns the corresponding attribute definition object. For example, use this method to get the attribute definition object to store custom properties.

Parameters:
colName - the name of the attribute's column in the database.
Returns:
an Entity attribute definition object.

getAttributeDefImpls

protected AttributeDefImpl[] getAttributeDefImpls()
Returns the AttributeDefImpls objects for this Entity Object. This method is typically used when customizing properties.
Overrides:
getAttributeDefImpls in class oracle.jbo.server.RowDef
Returns:
an array of the attribute descriptors.

getAssociationDefImpl

protected oracle.jbo.server.AssociationDefImpl getAssociationDefImpl(java.lang.String name)
Returns the AssociationDefImpl (association accessors) given the association name.
Parameters:
name - the name of the association.
Returns:
the association accessors for this object.

getAssociationDefImpl

protected oracle.jbo.server.AssociationDefImpl getAssociationDefImpl(int index)
Returns the AssociationDefImpl (association accessors) given an index. If an invalid index number is given, this method returns null.
Parameters:
index - of the association attribute.
Returns:
the association accessors for this object; null if an invalid index number is given.

getAssociationDefImpls

protected oracle.jbo.server.AssociationDefImpl[] getAssociationDefImpls()
Returns the AssociationDefImpls.
Returns:
the association accessors for this object.

getSource

protected java.lang.String getSource()
Returns the name of the Database source table.

This method could be overridden if, for example, your application implements table generator code at runtime.

Returns:
the name of database table that this business object represents.

setSource

protected void setSource(java.lang.String source)
Internal: Applications should not use this method.

Sets the name of the Database source table.

Parameters:
source - the name of database table corresponding to this business object.

isObjectTable

protected boolean isObjectTable()
Determines whether this is an Object table.

This method returns true if this table is:

Returns:
true if this is an object table; false otherwise.

getSourceType

protected java.lang.String getSourceType()
Internal: Applications should not use this method.

Returns the name of the database source type.

Returns:
the type of database source.

setSourceType

protected void setSourceType(java.lang.String sourceType)
Internal: Applications should not use this method.

Sets the name of the Database source type.

Parameters:
name - the type of database source.

getAllEntityInstances

public oracle.jbo.server.java.util.Iterator getAllEntityInstances(DBTransaction tr)
Deprecated. since 5.0 use getAllEntityInstancesIterator.

Creates an iterator for stepping through instances of Entities of this definition object type. This method could typically be used in a cache clean-up routine.
Parameters:
tr - the transaction containing the Entity Objects.
Returns:
the iterator.

getAllEntityInstancesIterator

public com.sun.java.util.collections.Iterator getAllEntityInstancesIterator(DBTransaction tr)
Creates an iterator for stepping through instances of Entities of this definition object type. This method could typically be used in a cache clean-up routine.
Parameters:
tr - the transaction containing the Entity Objects.
Returns:
the iterator.

getRowClass

public java.lang.Class getRowClass()
Gets the implementation class of this Entity's rows. For example, if this method is called on the Dept Entity Object, it will return DeptImpl.
Overrides:
getRowClass in class oracle.jbo.server.RowDef
Returns:
the row implementation class.

getCollClass

public java.lang.Class getCollClass()
Gets the implementation class of this Entity's collection.
Returns:
the collection implementation class.

findByPrimaryKey

public EntityImpl findByPrimaryKey(DBTransaction txn,
                                   Key key)
Finds an Entity Object given a Primary Key.

Given the name of the databse transaction and the table's primary key, this method returns the associated Entity Object. If the Entity has not already been brought into the cache by any of the View Objects, this method will cause the Entity to be fetched from the database.

This method returns null if the Entity Object is not found.

Parameters:
txn - the transaction containing the Entity Object.
key - the Primary Key.
Returns:
the Entity Object matching Key, or null if not found.

createKey

public Key createKey(AttributeList al)
Given a set of attribute values (name-value pairs), creates a Primary key object for this Entity. This method could be used to create the input for the findByPrimaryKey method. If the key cannot be created, this method returns null.
Returns:
the key with ordered attribute list values according to this definition; null if the key cannot be created.

createInstance

protected EntityImpl createInstance(DBTransaction txn,
                                    AttributeList al)
Instantiate an instance of the Entity. The default values of the entity attributes are filled in in this method.

Override this method to create instances of composite Entities.

Parameters:
txn - the DBTransaction instance for the Entity.
al - List of attribute name/value pairs to be passed to Entity.create()
Returns:
a new instance of the Entity.
See Also:
EntityImpl.create(AttributeList)

createBlankInstance

protected EntityImpl createBlankInstance(DBTransaction txn)
Internal: Applications should not use this method.

Internal method invoked whenever an Entity of this type is created within the framework.

Parameters:
txn - the Database Transaction Object.
Returns:
EntityImpl an instance of the Entity Object.

setRowClass

protected void setRowClass(java.lang.Class rowClass)
Internal: Applications should not use this method.

Sets the implementation class for this Entity's rows.

Parameters:
rowClass - the row implementation class.

setCollClass

protected void setCollClass(java.lang.Class collClass)
Internal: Applications should not use this method.

Sets the implementation class for this Entity's collection.

Parameters:
collClass - the collection implementation class.

getComponentClass

protected java.lang.Class getComponentClass()
Internal: Applications should not use this method.

Returns the class of the reference object.

Returns:
the class of the reference object.

getForeignKeyAttrs

protected AttributeDefImpl[] getForeignKeyAttrs()
Returns the list of AttributeDefs that make the foreign key for the composition cases. For example, in the case of Dept/Emp, this method returns the Deptno AttributeDef on the Emp EntityDef.
Returns:
an array of primary key attribute descriptors.

getPrimaryKeys

protected AttributeDefImpl[] getPrimaryKeys()
Returns the AttributeDef's that define the primary key.
Returns:
an array attribute definitions for the primary key.

getOIDAttribute

protected AttributeDefImpl getOIDAttribute()
Internal: Applications should not use this method.

Returns the object identifier attribute (OID). This method is used to return attributes that are Oracle Objects.

Returns:
the object identifier attribute (OID) for this Entity.

getRetrievedOnInsertAttributes

protected AttributeDefImpl[] getRetrievedOnInsertAttributes()
Returns the list of attributes for which the Refresh on Insert flag is enabled at Design Time. Primary keys are excluded from the list even if they are marked Refresh on Insert. This method should not be overridden.
Returns:
a list of attributes whose values are refreshed on insert.

getRetrievedOnUpdateAttributes

protected AttributeDefImpl[] getRetrievedOnUpdateAttributes()
Returns the list of attributes for which the Refresh on Update flag is enabled at Design Time. Primary keys are excluded from the list even if they are marked Refresh on Update. This method should not be overridden.
Returns:
a list of attributes whose values are refreshed on update.

getRetrievedOnInsertPrimaryKeys

protected AttributeDefImpl[] getRetrievedOnInsertPrimaryKeys()
Returns the list of primary keys for which the Refresh on Insert flag is enabled at Design Time. This method should not be overridden.
Returns:
a list of primary key attributes whose values are refreshed on insert.

getRetrievedOnUpdatePrimaryKeys

protected AttributeDefImpl[] getRetrievedOnUpdatePrimaryKeys()
Returns the list of primary key attributes for which the Refresh on Update flag is enabled at Design Time. This method should not be overridden.
Returns:
a list of primary key attributes whose values are refreshed on update.

getChangeIndicatorColumn

protected AttributeDefImpl getChangeIndicatorColumn()
Returns the AttributeDef for the Change Indicator column for the datasource. It returns null if the the column does not exist.

The Change Indicator column is used, in some applications, to indicate changes in the underlying row in the datastore. It usually takes the form of a Timestamp or a Counter and, is compared at change time, against the value in the cache, to check for consistency.

Returns:
the Change Indicator column or null if none exists.

isUpdateChangedColumns

protected boolean isUpdateChangedColumns()
Determines whether the SQL generation of UPDATE statements should include all of the columns or just the changed columns.

The return value of this flag indicates whether the SQL Generation of UPDATE statements should include all of the columns or just the changed columns. If this method returns true then only the updated columns will be included, otherwise the method will include all of the columns that are present.

Returns:
true if only changed columns are used in SQL generation; false if all columns are used.

getQuery

public java.lang.String getQuery()
Returns the query that will return all columns for this Entity. Override this method to provide your own query, perhaps specifying another datasource or a different collection of columns.
Returns:
the SQL query statement.

addPropertyChangeListener

protected void addPropertyChangeListener(int index,
                                         PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for an attribute at the given index.

This method modifies the static/singleton metadata.

Parameters:
index - the index of the attribute to which the listener is to be added.
listener - the PropertyChangeListener to be added.
See Also:
PropertyChangeListener

addPropertyChangeListener

protected void addPropertyChangeListener(java.lang.String attributeName,
                                         PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for an attribute of the given Name.

This method modifies the static/singleton metadata.

Parameters:
attributeName - the name of the attribute to which the listener is to be added.
listener - the PropertyChangeListener to be added.
See Also:
PropertyChangeListener

removePropertyChangeListener

protected void removePropertyChangeListener(int index,
                                            PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list of the given attribute (by index).

This method modifies the static/singleton metadata.

Parameters:
listener - the PropertyChangeListener to be removed.
See Also:
PropertyChangeListener

removePropertyChangeListener

protected final void removePropertyChangeListener(java.lang.String attributeName,
                                                  PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list of the given attribute (by index).

This method modifies the static/singleton metadata.

Parameters:
attributeName - the attribute to which the listener is to be added.
listener - the PropertyChangeListener to be removed.
See Also:
PropertyChangeListener

addVetoableChangeListener

protected void addVetoableChangeListener(VetoableChangeListener listener)
Adds a VetoableChangeListener to the listener list.

This method modifies the static/singleton metadata.

Parameters:
listener - the VetoableChangeListener to be added.
See Also:
VetoableChangeListener

addVetoableChangeListener

protected void addVetoableChangeListener(int index,
                                         VetoableChangeListener listener)
Adds a VetoableChangeListener to the listener list for an attribute at the given index. Use this method to add a validator to an attribute.

This method modifies the static/singleton metadata.

Parameters:
index - the index of the attribute to which the listener is to be added.
listener - the VetoableChangeListener to be added.
See Also:
VetoableChangeListener

addVetoableChangeListener

protected void addVetoableChangeListener(java.lang.String attributeName,
                                         VetoableChangeListener listener)
Adds a VetoableChangeListener to the listener list for an attribute of the given name.

This method modifies the static/singleton metadata.

Parameters:
attributeName - the attribute to which the listener is to be added.
listener - the VetoableChangeListener to be added.
See Also:
VetoableChangeListener

removeVetoableChangeListener

protected void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a VetoableChangeListener from the listener list.

This method modifies the static/singleton metadata.

Parameters:
listener - the VetoableChangeListener to be removed.
See Also:
VetoableChangeListener

removeVetoableChangeListener

protected void removeVetoableChangeListener(int index,
                                            VetoableChangeListener listener)
Removes a VetoableChangeListener from the listener list of the given attribute (by index).

This method modifies the static/singleton metadata.

Parameters:
index - the index of the attribute from which the listener is to be removed.
listener - the VetoableChangeListener to be removed.
See Also:
VetoableChangeListener

removeVetoableChangeListener

protected final void removeVetoableChangeListener(java.lang.String attributeName,
                                                  VetoableChangeListener listener)
Removes a VetoableChangeListener from the listener list of the given attribute (by index).

This method modifies the static/singleton metadata.

Parameters:
attributeName - the attribute to which the listener is to be added.
listener - the VetoableChangeListener to be removed.
See Also:
VetoableChangeListener

finishedLoading

protected void finishedLoading()
Overrides:
finishedLoading in class oracle.jbo.server.DefObject

resolveReferences

protected void resolveReferences()
Since this gets called from lazyload, load all attribute accessors upfront.
Overrides:
resolveReferences in class oracle.jbo.server.DefObject

isRefPKBased

public boolean isRefPKBased()
Indicates whether this Entity's REF is primary key based or not. This method is meaningful only for an Entity whose base table is an Oracle object table. For such an Entity, a question arises whether the object reference ("REF") for the table is primary key based or not. This method returns true if it is.
Returns:
a flag indicating whether the underlying object table's REF is primary key based or not.

setRefPKBased

public void setRefPKBased(boolean val)
Internal: Applications should not use this method.

Sets a flag that indicates whether this Entity's REF is primary key based or not. This method is meaningful only for an Entity whose base table is an Oracle object table. For such an Entity, a question arises whether the object reference ("REF") for the table is primary key based or not. This method sets this flag.

Parameters:
val - should be true if the underlying object table's REF is primary key based. Otherwise, false.

getRefAttrIndex

public int getRefAttrIndex()

isRowIDPrimaryKey

protected boolean isRowIDPrimaryKey()
Determines whether this Entity Object has a ROWID attribute that is used as a primary key. Returns true if the ROWID attribute has been marked as a primary key.
Returns:
true if the ROWID attribute is used as primary key; false otherwise.

isOIDInPrimaryKey

protected boolean isOIDInPrimaryKey()
Determines whether the OID (object identifier) attribute is a primary key. Use this method for tables that contain Oracle Objects. It returns true if an OID attribute has been marked as a primary key.
Returns:
true if OID is used as primary key; false otherwise.

addUniquePKValidation

protected void addUniquePKValidation()
Adds validators to each primary key attribute of this Entity to ensure that the primary key for an Entity is always unique.

Whenever any of the primary key attribute values change, this validation rule is invoked to validate, both in the cache and the database, that the new key does not belong to any other Entity of this type. If the key is found in one of the Entities, a TooManyObjectsException is thrown.

Subclasses should invoke this method in their createDef() method to add these validators. By default, the framework does not invoke the unique key check. For example, you can add a validator to look for duplicate keys. To do this, follow these instructions:

  1. In entity wizard, during Design Time, click the Entity Definition Class's "Generate Java File" checkbox.
  2. In the Entity DefImpl's .java source file (xxxDefImpl.java), override protected void createDef() and make a call to addUniquePKValidation(). For example:

     protected void createDef()
       {
         addUniquePKValidation();
        }
     
    This enables validation to check if the modified primary key value exists in either the database or the cache.

An alternative way to apply this validator in designtime is to edit the entity in designtime and apply UniqueKeyValidator to the entity in the Rules Tab.

Throws:
TooManyObjectsException - if a duplicate key is found.
See Also:
createDef(), TooManyObjectsException

loadCustomDef

protected void loadCustomDef(oracle.jbo.mom.xml.DefElementImpl xmlElement)
                      throws PersistenceException
Internal: Applications should not use this method.

Loads a custom Entity definition from the associated XML file. For example, add custom attributes or additional metadata to an Entity's XML file. Then use this method to load the new definition of the Entity definition.

Typically, a call to createDef() follows this method.

Parameters:
xmlElement - the root XML node for the Entity.
Throws:
PersistenceException - if an error occurred while loading the XML files at runtime.
See Also:
createDef()

hasLOBAttrs

protected boolean hasLOBAttrs()
Determines whether the EntityDef contains attributes that are LOBs.

This method is used by doDML to determine if the EntityDef contains LOB attributes. If it does, doDML calls doDMLWithLOBs to process the DML request. For example:

  protected void doDML(int operation, TransactionEvent e)
 {
   if (!getEntityDef().hasLOBAttrs())
   {
      getSQLBuilder().doEntityDML(this,operation,e);
   }
   else
   {
      doDMLWithLOBs(operation, e);
   }
 }
 
Developers who implement doDML() to handle the two-phase insert and update process, should override hasLOBAttrs() in the EntityDefImpl subclass and return false. This will cause doDML() to work properly with the current release.
Returns:
true if the Entity contains LOB attributes; false otherwise.
See Also:
doDML, doDMLWithLOBs

getMaxAttrConst

public static int getMaxAttrConst(java.lang.String entityName)
Returns the index of the last attribute for this entity at runtime.

The framework's Extends feature lets developers add information, such as additional attributes and validation, to an existing Entity. The additional attributes are "appended" to the original Entity's list of attributes. The framework adds this method to the generated extended Entity's *Impl file and uses it at runtime to determine the index of the last attribute belonging to the original Entity. All of the attributes with index greater than this number belong to the extended Entity.

The following code snippet represents part of the class definition of the *Impl file generated by the framework for the extended Entity Object newEmp:

 public class newEmpImpl extends package27.EmpImpl {
    protected static final int MAXATTRCONST =
                         EntityDefImpl.getMaxAttrConst("package27.Emp");
  ...
 
The getMaxAttrConst method returns the index of the last attribute from the EntityDefImpl belonging to the original Entity Emp in package27. The result is stored in the constant MAXATTRCONST. This constant is used in calculations later in the file.
Parameters:
entityName - the name of the Entity for which the index of the last attribute is retrieved.

getDiscrColumns

protected AttributeDefImpl[] getDiscrColumns()
Returns the AttributeDef's of the discriminator columns.
Returns:
an array attribute definitions of the discriminator columns.

setDiscrColumns

protected void setDiscrColumns(AttributeDefImpl[] discrCols)
Sets the AttributeDef's of the discriminator columns.
Parameters:
discrCols - an array attribute definitions of the discriminator columns.

discrValuesQualify

protected boolean discrValuesQualify(java.lang.Object[] values)

findDefForDiscrValues

protected oracle.jbo.server.RowDef findDefForDiscrValues(java.lang.Object[] values,
                                                         boolean recurse)

getBindingStyle

public int getBindingStyle()
Returns the Oracle or JDBC binding style defined for this Entity definition. The integer values and their meaning are determined by the SQLBuilder interface.
Returns:
an integer representing the Oracle or JDBC binding style. The returns values can be:
  • -1 - unknown
  • 0 - JDBC
  • 1 - Oracle
See Also:
SQLBuilder

setBindingStyle

public void setBindingStyle(int bindingStyle)
Sets the Oracle or JDBC binding style defined for this Entity definition. The integer values and their meaning are determined by the SQLBuilder interface.
Parameters:
bindingStyle - an integer representing the Oracle or JDBC binding style for this Entity definition. The possible values can be:
  • -1 unknown
  • 0 JDBC
  • 1 Oracle
See Also:
SQLBuilder

getAliasName

public java.lang.String getAliasName()
Returns the database alias that was declared for this definition object at Design-Time.
Returns:
the alias for this definition object as a String.

getPackageDef

public oracle.jbo.server.PackageDefImpl getPackageDef()

getPackageName

public java.lang.String getPackageName()

setName

protected void setName(java.lang.String name)
Name this object.
Overrides:
setName in class oracle.jbo.mom.DefinitionObject
Parameters:
name - the name to be given to this object.

getBaseDefObject

public oracle.jbo.mom.DefinitionObject getBaseDefObject()
Overrides:
getBaseDefObject in class oracle.jbo.mom.DefinitionObject

setBaseDefObject

protected void setBaseDefObject(oracle.jbo.mom.DefinitionObject baseDefObject)
Overrides:
setBaseDefObject in class oracle.jbo.mom.DefinitionObject

setParent

protected void setParent(NamedObjectImpl parent)
Sets this object's parent.
Overrides:
setParent in class oracle.jbo.mom.DefinitionObject
Parameters:
parent - the named object that is to be the parent of this object.

loadProperties

protected void loadProperties(oracle.jbo.mom.xml.DefElementImpl xmlElement)
Overrides:
loadProperties in class oracle.jbo.mom.DefinitionObject
Following copied from class: oracle.jbo.mom.DefinitionObject
Parameters:
xmlDoc - The XML doc to load from.
name - The name of the Property.

Business Components