Business Components

oracle.jbo.server
Class EntityDefImpl

java.lang.Object
  |
  +--oracle.jbo.common.BaseObject
        |
        +--oracle.jbo.server.NamedObjectImpl
              |
              +--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
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  java.util.Vector mAssocAccessors
          The Association accessors for the Entity object
protected  java.util.Vector mAssocs
          Association objects for the Entity object
protected  java.util.Vector mAttrAccessors
          The Attribute accessors for the Entity object
protected  boolean mIsObjectTable
          Is Object Table or not
protected  AttributeDefImpl mOIDAttribute
          If entity is a OIDObject
protected  AttributeDefImpl[] mPrimaryKeys
          List of attributes that make the primary key
protected  java.lang.String mSource
          To keep the name of the database source : The database entity for the Entity Object
protected  java.lang.String mSourceType
          To keep the database source type
 
Fields inherited from class oracle.jbo.server.DefObject
mCompUsageList, mCompUsages
 
Fields inherited from class oracle.jbo.server.NamedObjectImpl
mFullName, mName, mParent, mProperties
 
Fields inherited from class oracle.jbo.common.BaseObject
TRACE_EVERY_ALLOC, TRACE_NONE, TRACE_OCCASIONAL, TRACE_UNINITIALIZED
 
Constructor Summary
protected EntityDefImpl()
          Default Constructor, set the row class
 
Method Summary
protected  void addEntityAssociation(EntityAssociation assoc)
          Add an EntityAssociation to this Entity.
protected  void addPropertyChangeListener(int index, oracle.jbo.server.util.PropertyChangeListener listener)
          Utility method to Add a PropertyChangeListener to the listener list for an attribute at the given index.
protected  void addPropertyChangeListener(java.lang.String attributeName, oracle.jbo.server.util.PropertyChangeListener listener)
          Utility method to Add 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 validate that the primary-key for an entity is always unique.
protected  void addVetoableChangeListener(int index, oracle.jbo.server.util.VetoableChangeListener listener)
          Utility method to Add a VetoableChangeListener to the listener list for an attribute at the given index
protected  void addVetoableChangeListener(java.lang.String attributeName, oracle.jbo.server.util.VetoableChangeListener listener)
          Utility method to Add a VetoableChangeListener to the listener list for an attribute of the given Name
protected  void addVetoableChangeListener(oracle.jbo.server.util.VetoableChangeListener listener)
          Utility method to Add a VetoableChangeListener to the listener list.
protected  EntityImpl createBlankInstance(DBTransaction txn)
          Internal method invoked whenver an entity of this type is created within the framework.
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 name-value pairs, creates a Primary key object for this entity.
 EntityImpl findByPrimaryKey(DBTransaction txn, Key key)
          Finds an Entity Object given a Primary Key.
static EntityDefImpl findDefObject(java.lang.String defFullName)
          Finds the named Entity Object definition.
 java.lang.String getAliasName()
           
 oracle.jbo.server.java.util.Iterator getAllEntityInstances(DBTransaction tr)
          Creates an iterator for stepping through instances of this definition.
protected  oracle.jbo.server.AssociationDefImpl getAssociationDefImpl(int index)
          Get the AssociationDefImpl given an index.
protected  oracle.jbo.server.AssociationDefImpl getAssociationDefImpl(java.lang.String name)
          Get the AssociationDefImpl given the association name.
protected  oracle.jbo.server.AssociationDefImpl[] getAssociationDefImpls()
          Get the AssociationDefImpls.
 AttributeDefImpl getAttributeDefImpl(int index)
          Gets an attribute definition by column position.
 AttributeDefImpl getAttributeDefImpl(java.lang.String attrName)
          Gets the named attribute definition.
protected  AttributeDefImpl getAttributeDefImplByColumnName(java.lang.String colName)
          Gets the attribute definition by column name.
protected  AttributeDefImpl[] getAttributeDefImpls()
          Get the AttributeDefImpls.
 int getBindingStyle()
           
protected  AttributeDefImpl getChangeIndicatorColumn()
          Get the Change Indicator column for the Source.
protected  java.lang.Class getComponentClass()
          Get the class of the reference object.
protected  EntityAssociation[] getEntityAssociations()
          Get the EntityAssociation objects for this Entity.
static int getMaxAttrConst(java.lang.String entityName)
           
protected  AttributeDefImpl getOIDAttribute()
          returns the OID Attribute
protected  AttributeDefImpl[] getPrimaryKeys()
          Get the primary key attributes.
 java.lang.String getQuery()
          Gets this definition's SQL query statment.
protected  AttributeDefImpl[] getRetrievedOnInsertAttributes()
          Returns a list of retrieved on Insert Attributes, Primary keys are excluded
protected  AttributeDefImpl[] getRetrievedOnInsertPrimaryKeys()
           
protected  AttributeDefImpl[] getRetrievedOnUpdateAttributes()
          Return a list of retrievedOnUpdate attributes, Primary keys are excluded.
protected  AttributeDefImpl[] getRetrievedOnUpdatePrimaryKeys()
           
 java.lang.Class getRowClass()
          Gets the implementation class of this definition's row objects.
protected  java.lang.String getSource()
          Get the name of the Database source table.
protected  java.lang.String getSourceType()
          Get the name of the Database source type.
protected  boolean hasLOBAttrs()
           
protected  boolean isObjectTable()
          Is or is not an Object table
protected  boolean isOIDInPrimaryKey()
          Is the OID a primary key? Returns true if OID attribute has been marked as primary key
protected  boolean isRowIDPrimaryKey()
          Is the ROWID a primary key? Returns true if ROWID attribute has been marked as primary key
protected  boolean isUpdateChangedColumns()
          Function to consider changed columns for SQL UPDATE generation? 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.
protected  void loadCustomDef(oracle.jbo.server.xml.JboElementImpl xmlElement)
           
protected  void removePropertyChangeListener(int index, oracle.jbo.server.util.PropertyChangeListener listener)
          Utility method to Remove a PropertyChangeListener from the listener list of the given attribute (by index)
protected  void removePropertyChangeListener(java.lang.String attributeName, oracle.jbo.server.util.PropertyChangeListener listener)
          Utility method to Remove a PropertyChangeListener from the listener list of the given attribute (by index)
protected  void removeVetoableChangeListener(int index, oracle.jbo.server.util.VetoableChangeListener listener)
          Utility method to Remove a VetoableChangeListener from the listener list of the given attribute (by index)
protected  void removeVetoableChangeListener(java.lang.String attributeName, oracle.jbo.server.util.VetoableChangeListener listener)
          Utility method to Remove a VetoableChangeListener from the listener list of the given attribute (by index)
protected  void removeVetoableChangeListener(oracle.jbo.server.util.VetoableChangeListener listener)
          Remove a VetoableChangeListener from the listener list.
 void setBindingStyle(int bindingStyle)
           
protected  void setRowClass(java.lang.Class rowClass)
          Set the class to represent instances of this Entity.
protected  void setSource(java.lang.String source)
          Set the name of the Database source table.
protected  void setSourceType(java.lang.String sourceType)
          Set the name of the Database source type.
 
Methods inherited from class oracle.jbo.server.DefObject
getPackageDef, getPackageName, isObjectResolved
 
Methods inherited from class oracle.jbo.server.NamedObjectImpl
getFullName, getName, getParent, getProperties, getPropertiesAsStrings, getProperty, setFullName, setProperty
 
Methods inherited from class oracle.jbo.common.BaseObject
dumpState, setTraceLevel, setTraceWriter
 
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 java.util.Vector mAttrAccessors
The Attribute accessors for the Entity object

mAssocAccessors

protected java.util.Vector mAssocAccessors
The Association accessors for the Entity object

mAssocs

protected java.util.Vector mAssocs
Association objects for the Entity object

mPrimaryKeys

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

mOIDAttribute

protected AttributeDefImpl mOIDAttribute
If entity is a OIDObject

mSource

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

mSourceType

protected java.lang.String mSourceType
To keep the database source type

mIsObjectTable

protected boolean mIsObjectTable
Is Object Table or not
Constructor Detail

EntityDefImpl

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

findDefObject

public static EntityDefImpl findDefObject(java.lang.String defFullName)
Finds the named Entity Object definition.
Parameters:
defFullName - the fully qualified name of the definition.
Returns:
the definition.

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 def object's metadata is loaded

getEntityAssociations

protected EntityAssociation[] getEntityAssociations()
Get the EntityAssociation objects for this Entity.

addEntityAssociation

protected void addEntityAssociation(EntityAssociation assoc)
Add an EntityAssociation to this Entity.
Parameters:
assoc - The entity assocition to be added.

getAttributeDefImpl

public AttributeDefImpl getAttributeDefImpl(java.lang.String attrName)
Gets the named attribute definition.
Parameters:
attrName - the named attribute.
Returns:
an attribute definition.

getAttributeDefImpl

public AttributeDefImpl getAttributeDefImpl(int index)
Gets an attribute definition by column position.
Parameters:
index - the position of an attribute, where the leftmost has index 0.
Returns:
an attribute definition.

getAttributeDefImplByColumnName

protected AttributeDefImpl getAttributeDefImplByColumnName(java.lang.String colName)
Gets the attribute definition by column name.
Parameters:
colName - the name of the column in the database.
Returns:
an attribute definition.

getAttributeDefImpls

protected AttributeDefImpl[] getAttributeDefImpls()
Get the AttributeDefImpls.
Returns:
an array of the attribute descriptors.

getAssociationDefImpl

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

getAssociationDefImpl

protected oracle.jbo.server.AssociationDefImpl getAssociationDefImpl(int index)
Get the AssociationDefImpl given an index.
Parameters:
index - of the assciation attribute
Returns:
The association accessors for this object.

getAssociationDefImpls

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

getSource

protected java.lang.String getSource()
Get the name of the Database source table.
Returns:
The name of database entity this business object represent.

setSource

protected void setSource(java.lang.String source)
Set the name of the Database source table.
Parameters:
name - The name of database entity of the business object.

isObjectTable

protected boolean isObjectTable()
Is or is not an Object table

getSourceType

protected java.lang.String getSourceType()
Get the name of the Database source type.
Returns:
The type of database source.

setSourceType

protected void setSourceType(java.lang.String sourceType)
Set 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)
Creates an iterator for stepping through instances of this definition.
Parameters:
tr - the transaction containing the Entity Objects.
Returns:
the iterator.

getRowClass

public java.lang.Class getRowClass()
Gets the implementation class of this definition's row objects.
Overrides:
getRowClass in class oracle.jbo.server.RowDef
Returns:
a class name.

findByPrimaryKey

public EntityImpl findByPrimaryKey(DBTransaction txn,
                                   Key key)
Finds an Entity Object given a Primary Key.
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 name-value pairs, creates a Primary key object for this entity. On error returns null.
Returns:
the key with ordered attribute list values as per this definition.

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.
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.

createBlankInstance

protected EntityImpl createBlankInstance(DBTransaction txn)
Internal method invoked whenver an entity of this type is created within the framework.
Parameters:
Database - Transaction Object
Returns:
EntityImpl Instance of the Entity

setRowClass

protected void setRowClass(java.lang.Class rowClass)
Set the class to represent instances of this Entity.
Parameters:
rowClass - The row data class

getComponentClass

protected java.lang.Class getComponentClass()
Get the class of the reference object.
Returns:
the Class of the reference object.

getPrimaryKeys

protected AttributeDefImpl[] getPrimaryKeys()
Get the primary key attributes.
Returns:
an array of primary key attribute descriptors.

getOIDAttribute

protected AttributeDefImpl getOIDAttribute()
returns the OID Attribute

getRetrievedOnInsertAttributes

protected AttributeDefImpl[] getRetrievedOnInsertAttributes()
Returns a list of retrieved on Insert Attributes, Primary keys are excluded
Returns:
a list of retrievedOnInsert attributes.

getRetrievedOnUpdateAttributes

protected AttributeDefImpl[] getRetrievedOnUpdateAttributes()
Return a list of retrievedOnUpdate attributes, Primary keys are excluded.
Returns:
a list of retrievedOnUpdate attributes.

getRetrievedOnInsertPrimaryKeys

protected AttributeDefImpl[] getRetrievedOnInsertPrimaryKeys()
Returns:
A list of retrievedOnInsert primary key attributes.

getRetrievedOnUpdatePrimaryKeys

protected AttributeDefImpl[] getRetrievedOnUpdatePrimaryKeys()
Returns:
A list of retrievedOnUpdate primary key attributes.

getChangeIndicatorColumn

protected AttributeDefImpl getChangeIndicatorColumn()
Get the Change Indicator column for the Source. 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()
Function to consider changed columns for SQL UPDATE generation? 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 we return true then only the Updated columns should be considered, otherwise we'll consider all of the columns that are present.
Returns:
true if only changed cols are used in SQL generation.

getQuery

public java.lang.String getQuery()
Gets this definition's SQL query statment.
Returns:
the SQL query statment.

addPropertyChangeListener

protected void addPropertyChangeListener(int index,
                                         oracle.jbo.server.util.PropertyChangeListener listener)
Utility method to Add 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

addPropertyChangeListener

protected void addPropertyChangeListener(java.lang.String attributeName,
                                         oracle.jbo.server.util.PropertyChangeListener listener)
Utility method to Add a PropertyChangeListener 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 PropertyChangeListener to be added

removePropertyChangeListener

protected void removePropertyChangeListener(int index,
                                            oracle.jbo.server.util.PropertyChangeListener listener)
Utility method to Remove 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

removePropertyChangeListener

protected final void removePropertyChangeListener(java.lang.String attributeName,
                                                  oracle.jbo.server.util.PropertyChangeListener listener)
Utility method to Remove 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

addVetoableChangeListener

protected void addVetoableChangeListener(oracle.jbo.server.util.VetoableChangeListener listener)
Utility method to Add a VetoableChangeListener to the listener list.

This method modifies the static/singleton metadata

Parameters:
listener - The VetoableChangeListener to be added

addVetoableChangeListener

protected void addVetoableChangeListener(int index,
                                         oracle.jbo.server.util.VetoableChangeListener listener)
Utility method to Add a VetoableChangeListener 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 VetoableChangeListener to be added

addVetoableChangeListener

protected void addVetoableChangeListener(java.lang.String attributeName,
                                         oracle.jbo.server.util.VetoableChangeListener listener)
Utility method to Add 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

removeVetoableChangeListener

protected void removeVetoableChangeListener(oracle.jbo.server.util.VetoableChangeListener listener)
Remove a VetoableChangeListener from the listener list.

This method modifies the static/singleton metadata

Parameters:
listener - The VetoableChangeListener to be removed

removeVetoableChangeListener

protected void removeVetoableChangeListener(int index,
                                            oracle.jbo.server.util.VetoableChangeListener listener)
Utility method to Remove 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

removeVetoableChangeListener

protected final void removeVetoableChangeListener(java.lang.String attributeName,
                                                  oracle.jbo.server.util.VetoableChangeListener listener)
Utility method to Remove 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

getAliasName

public java.lang.String getAliasName()
Overrides:
getAliasName in class oracle.jbo.server.RowDef

getBindingStyle

public int getBindingStyle()

setBindingStyle

public void setBindingStyle(int bindingStyle)

isRowIDPrimaryKey

protected boolean isRowIDPrimaryKey()
Is the ROWID a primary key? Returns true if ROWID attribute has been marked as primary key
Returns:
True if ROWID is used as primary key

isOIDInPrimaryKey

protected boolean isOIDInPrimaryKey()
Is the OID a primary key? Returns true if OID attribute has been marked as primary key
Returns:
True if OID is used as primary key

addUniquePKValidation

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

Whenever any of the primary key attribute value changes, this validation rule is invoked to validate that the new key does not belong to any other entity of this type. If found, 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.

Throws:
TooManyObjectsException - if a duplicate entity is found.

loadCustomDef

protected void loadCustomDef(oracle.jbo.server.xml.JboElementImpl xmlElement)
                      throws PersistenceException

hasLOBAttrs

protected boolean hasLOBAttrs()

getMaxAttrConst

public static int getMaxAttrConst(java.lang.String entityName)

Business Components