Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.jbo.server
Class EntityDefImpl

java.lang.Object
  extended by oracle.jbo.server.NamedObjectImpl
      extended by oracle.jbo.mom.PersistableDefObject
          extended by oracle.jbo.server.DefObject
              extended by oracle.jbo.server.MetaObject
                  extended by oracle.jbo.server.RowDef
                      extended by oracle.jbo.server.EntityDefImpl
All Implemented Interfaces:
Formattable, ResourceBundleOwner, ValidationManager, StructureDef, VariableManagerOwner, VariableManagerOwnerBase
Direct Known Subclasses:
EntityDefOverRowSet

public class EntityDefImpl
extends RowDef
implements ValidationManager

Represents Entity metadata, i.e. structure of an Entity Object


Field Summary
static java.lang.Class CLASS_INSTANCE
           
static byte EFFECTIVE_DATE_TYPE_DATED
          Effective Dated entites could be of type dated or effective dated.
static byte EFFECTIVE_DATE_TYPE_EFFECTIVE_DATED
          Effective Dated entites could be of type dated or effective dated.
static byte EFFECTIVE_DATE_TYPE_NONE
          Constant for specifying non effective dated entitites.
protected  ArrayList mAssocAccessors
           
protected  ArrayList mAssocs
           
protected  int mBatchThreshold
           
protected  AttributeDefImpl[] mFKeys
           
protected  AttributeDefImpl mOIDAttribute
           
 
Fields inherited from class oracle.jbo.server.RowDef
mAttrAccessors
 
Fields inherited from class oracle.jbo.server.MetaObject
mComponentClass
 
Fields inherited from class oracle.jbo.server.DefObject
DEF_MDS_CLIENT_KEY, DEF_SCOPE_PERS, DEF_SCOPE_SESSION, DEF_SCOPE_SHARED, mBaseDefObject, mExtendedDefObjects, mObjectResolved, PERSDEF_MDS_CLIENT_KEY
 
Fields inherited from class oracle.jbo.server.NamedObjectImpl
mObjName, mParent, mProperties, mUserData, RES_ID_SUFFIX
 
Constructor Summary
EntityDefImpl()
           
 
Method Summary
protected  void addEntityAssociation(EntityAssociation assoc)
          Internal: Applications should not use this method.
protected  void addUniqueKeyValidation(JboUniqueKeyValidator val)
           
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.
 void addValidator(JboValidatorInterface listener)
          Adds a JboValidatorInterface to the listener list.
protected  void addVetoableChangeListener(int index, VetoableChangeListener listener)
          This method will be deprecated in a future release.
protected  void addVetoableChangeListener(java.lang.String attributeName, VetoableChangeListener listener)
          This method will be deprecated in a future release.
protected  void addVetoableChangeListener(VetoableChangeListener listener)
          This method will be deprecated in a future release.
protected  EntityImpl createBlankInstance(DBTransaction txn)
           
 EntityImpl createBlankInstance2(DBTransaction txn)
          Internal: Applications should not use this method.
static EntityDefImpl createEntityDef(int defScope, java.lang.String defClassName, java.lang.String dbObjName, java.lang.String viewObjectBase)
           
 EntityImpl findByAltKey(DBTransaction txn, java.lang.String keyName, Key key, boolean inclSubclasses, boolean searchDatabase)
           
 EntityImpl findByPKExtended(DBTransaction txn, Key key, boolean inclSubclasses)
           
 EntityImpl findByPrimaryKey(DBTransaction txn, Key key)
          Finds an Entity Object given a Primary Key.
static EntityDefImpl findDefObject(java.lang.String defFullName)
          Find the named EntityDefImpl object in the global catalog of metadata
 EntityImpl findInCacheByAltKeyExtended(DBTransaction txn, java.lang.String keyName, Key key, boolean inclSubclasses)
           
static EntityDefImpl findOrLoadDefObject(java.lang.String defFullName)
           
 java.lang.String formatForOutput(OutputFormatter formatter)
           
 Iterator getAllEntityInstancesIterator(DBTransaction tr)
          Creates an iterator for stepping through instances of Entities of this definition object type.
 int getAltKeyIndex(java.lang.String name)
           
 AssociationDefImpl getAssociationDefImpl(int index)
          Returns the AssociationDefImpl (association accessors) given an index.
 AssociationDefImpl getAssociationDefImpl(java.lang.String name)
          Returns the AssociationDefImpl (association accessors) given the association name.
 AssociationDefImpl[] getAssociationDefImpls()
          Returns the AssociationDefImpls.
protected  AttributeDefImpl getAttributeDefImplByColumnName(java.lang.String colName)
          Given an attribute's column name, returns the attribute definition object.
protected  int[] getAutoIncrementIndices()
          Determine the indices of AUTO-INCREMENT columns, denoted by a Java type of "oracle.jbo.domain.DBSequence"
 java.lang.Class getBaseComponentClass()
           
 AttributeDefImpl getChangeIndicatorColumn()
          Returns the AttributeDef for the Change Indicator column for the datasource.
 java.lang.String getClientProxyClassName()
           
 java.lang.Class getCollClass()
          Gets the implementation class of this Entity's collection.
 java.lang.String getColumnNameForQuery(int index)
           
 java.lang.Class getComponentClass()
           
 java.lang.String getComponentInterfaceName()
           
 Iterator getCreateEvents()
          Returns the list of events to fire when a row is created in the entity.
 AttributeDefImpl getDataSecurityAttribute()
           
 Iterator getDeleteEvents()
          Returns the list of events to fire when a row is deleted in the entity.
protected  java.lang.String getEffectiveClientProxyClassName()
           
protected  java.lang.String getEffectiveComponentInterfaceName()
           
protected  java.lang.String getEffectiveDateTransientAttrName()
          The name of the transient attribute that is used to lookup the effective date of a row while doing DML operations.
 byte getEffectiveDateType()
          Returns the Effective Date type of the Entity definition.
 AttributeDefImpl getEffectiveEndDateAttr()
           
 AttributeDefImpl getEffectiveStartDateAttr()
           
 EventDef getEventDef(java.lang.String name)
          Gets the request event definition.
 Iterator getEventParentAttrs()
          Gets the list of attributes on the parent entity that are used in the payload of events on this entity.
 Iterator getEventTransAttrs()
           
 ArrayList getExtendedDefObjects(boolean bSkipBusLogicUnits)
           
protected  AttributeDefImpl[] getForeignKeyAttrs()
          Returns the list of AttributeDefs that make the foreign key for the composition cases.
protected  AttributeDefImpl getOIDAttribute()
          Internal: Applications should not use this method.
 PayloadDef getPayloadDef(java.lang.String name)
          Returns the specified payload definition.
protected  AttributeDefImpl[] getPrimaryKeys()
          Returns the AttributeDef's that define the primary key
 AttributeDef[] getRawAttributeDefs()
           
 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.
 java.lang.String getSelectClause(SQLBuilder sqlBuilder, boolean forViewObject)
           
 java.lang.String getSource()
          Returns the name of the database source table
 java.lang.String getSourceType()
          Returns the name of the database source type.
 AttributeDefImpl[] getUniqueKeys()
          Returns the list of attributes that were marked as Unique-key constituents in designtime The order of attribute definitions is the order in which the unique-key attributes appear in the set of attributes for this entity.
 Iterator getUpdateEvents()
          Returns the list of events to fire when a row is updated in the entity.
 List getValidators()
          Get the list of JboValidatorInterface objects registered with this entity
protected static java.lang.String getValidatorSubtype(org.kxml2.io.KXmlParser parser)
           
 boolean hasDataSecurity()
           
protected  boolean hasLOBAttrs()
          Determines whether the EntityDef contains attributes that are LOBs.
 boolean isAssociationAccessorRetained()
           
 boolean isEffectiveDated()
          Checks if this Entity definition is Effective Dated.
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.
 boolean isSingleUseKeyStatement()
           
 boolean isUpdatable()
          Internal: Applications should not use this method.
 boolean isUpdateChangedColumns()
          Determines whether the SQL generation of UPDATE statements should include all of the columns or just the changed columns.
 boolean isUseGlueCode()
           
protected  void loadAttribute(org.kxml2.io.KXmlParser parser)
          Load the attributes from the XMLInput Stream
protected static void loadFromXML(org.kxml2.io.KXmlParser parser, oracle.jbo.server.RemotableCompDef defObj)
           
static EntityDefImpl loadFromXml(org.kxml2.io.KXmlParser parser, java.lang.String fullName)
           
protected  void loadValidator(org.kxml2.io.KXmlParser parser, AttributeDefImpl pAttr, boolean isAttr)
          Load a validator specified in the metadata
protected  ViewAccessorDef loadViewAccessor(org.kxml2.io.KXmlParser parser)
           
 void loadXMLContents(org.kxml2.io.KXmlParser parser, java.lang.String fullName)
           
 JboValidatorInterface lookupValidator(java.lang.String name)
           
protected  void removeValidator(JboValidatorInterface listener)
          Removes a VetoableChangeListener from the listener list.
protected  void removeVetoableChangeListener(int index, VetoableChangeListener listener)
          This method will be deprecated in a future release.
protected  void removeVetoableChangeListener(java.lang.String attributeName, VetoableChangeListener listener)
          This method will be deprecated in a future release.
protected  void removeVetoableChangeListener(VetoableChangeListener listener)
          This method will be deprecated in a future release.
protected  void resolveUniqueKeyValidators()
           
 void setAssociationAccessorRetained(boolean b)
           
 void setBatchThreshold(int threshold)
           
 void setBusLogicGroupName(java.lang.String name)
           
 void setBusLogicUnitName(java.lang.String name)
           
protected  void setChangeIndicatorColumn(AttributeDefImpl column)
          Set the AttributeDef for the Change Indicator column.
 void setClientProxyClassName(java.lang.String name)
           
 void setCollClass(java.lang.Class collClass)
          Internal: Applications should not use this method.
 void setComponentClass(java.lang.Class refClass)
           
 void setComponentInterfaceName(java.lang.String interfaceName)
           
 void setEffectiveDateType(byte effDtType)
          Sets the Effective Date Type for this Entity definition.
 void setEJBAppProviderURL(java.lang.String url)
           
 void setEJBHomeJNDIName(java.lang.String nam)
           
 void setRefPKBased(boolean val)
          Internal: Applications should not use this method.
 void setRowClass(java.lang.Class rowClass)
          Internal: Applications should not use this method.
 void setSingleUseKeyStatement(boolean singleUse)
           
 void setUpdatable(boolean flag)
          Internal: Applications should not use this method.
 void setUpdateChangedColumns(boolean updateChangedColumns)
          Sets the flag for status to update on Changed Columns
 void setUseGlueCode(boolean b)
           
protected  void verifyExtendedDefObjects()
           
 
Methods inherited from class oracle.jbo.server.RowDef
addAltKey, addListBindingDef, addViewAccessorDef, appendBindingNameForAttr, appendBindingSpec, bindListBindings, createDef, discrValuesQualify, findAltKeyDef, findAttributeDef, findDefForDiscrValues, findListBindingDef, findViewAccessorDef, getAliasName, getAltKeyAttrDefs, getAltKeyAttrDefs, getAltKeyCount, getAltKeyDef, getAltKeyNames, getAttributeCount, getAttributeDef, getAttributeDefImpl, getAttributeDefImpl, getAttributeDefImpls, getAttributeDefs, getAttributeIndexOf, getBindingStyle, getDefFullName, getDefName, getDiscrColumns, getEffectiveDateTransientAttr, getListBindingDefs, getViewAccessorDefs, loadListBindings, lookupAltKeyDef, lookupAttributeDef, lookupListBindingDef, lookupViewAccessorDef, setAliasName, setBindingStyle, setDiscrColumns, setThrowOnListBindingMismatch, throwOnListBindingMismatch
 
Methods inherited from class oracle.jbo.server.MetaObject
getMessageBundleClass, getMsgBundleDef, setMessageBundleClass
 
Methods inherited from class oracle.jbo.server.DefObject
addExtendedDefObject, ensureVariableManager, getBaseDefObject, getDefScope, getExtendedDefObjects, getResourceBundleDef, getResourcePrefix, getVariableManager, getVarMgrParents, hasExtendedDefObjects, hasVariables, isBaseDefFor, isObjectResolved, loadProperties, loadProperties, loadResourceBundleDef, loadUserData, resolvePropertyRaw, setBaseDefObject, setBaseDefObject, setDefForComponent, setDefScope, setObjectResolved, setResourceBundleDef, unsetDefForComponent
 
Methods inherited from class oracle.jbo.mom.PersistableDefObject
getDefManager
 
Methods inherited from class oracle.jbo.server.NamedObjectImpl
formatChildCollectionForOutput, formatChildCollectionForOutput, formatChildCollectionForOutput, formatForOutput, getAllProperties, getFullName, getName, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, getProperty, getResourcesFromBundle, getUserData, parseAttrArrayElements, refreshProperty, requiresNamePrefixedResId, setFullName, setName, setParent, setPropertiesMap, setProperty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.jbo.rules.ValidationManager
getFullName, getName, getResourceBundleDef
 
Methods inherited from interface oracle.jbo.StructureDef
getFullName, getName
 
Methods inherited from interface oracle.jbo.common.ResourceBundleOwner
getResourceBundleDef, getResourcePrefix
 
Methods inherited from interface oracle.jbo.VariableManagerOwner
getName
 

Field Detail

CLASS_INSTANCE

public static final java.lang.Class CLASS_INSTANCE

EFFECTIVE_DATE_TYPE_DATED

public static final byte EFFECTIVE_DATE_TYPE_DATED
Effective Dated entites could be of type dated or effective dated. The dated entities have a start and end effective date attributes but do not perform row split operations on attribute change. The validation is limited to simple overlap checks. Effective dated entities have elaborate row split operations and validations when an attribute value changes. In effect, the history of all the modifications is maintained.

See Also:
Constant Field Values

EFFECTIVE_DATE_TYPE_EFFECTIVE_DATED

public static final byte EFFECTIVE_DATE_TYPE_EFFECTIVE_DATED
Effective Dated entites could be of type dated or effective dated. Effective dated entities keep an audit trail of all the changes made to the values of a row. During DML, an attribute change will trigger a row update, end dating a previous row and creating a new row with the effective date as the start date.

See Also:
Constant Field Values

EFFECTIVE_DATE_TYPE_NONE

public static final byte EFFECTIVE_DATE_TYPE_NONE
Constant for specifying non effective dated entitites.

See Also:
Constant Field Values

mAssocs

protected ArrayList mAssocs

mAssocAccessors

protected ArrayList mAssocAccessors

mBatchThreshold

protected int mBatchThreshold

mOIDAttribute

protected AttributeDefImpl mOIDAttribute

mFKeys

protected AttributeDefImpl[] mFKeys
Constructor Detail

EntityDefImpl

public EntityDefImpl()
Method Detail

getChangeIndicatorColumn

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

setChangeIndicatorColumn

protected void setChangeIndicatorColumn(AttributeDefImpl column)
Set the AttributeDef for the Change Indicator column.

Parameters:
column -

getSource

public java.lang.String getSource()
Returns the name of the database source table

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

getSourceType

public java.lang.String getSourceType()
Returns the name of the database source type.

Returns:
the type of database source, e.g. 'table'

getPrimaryKeys

protected AttributeDefImpl[] getPrimaryKeys()
Returns the AttributeDef's that define the primary key

Specified by:
getPrimaryKeys in class RowDef
Returns:
an array of AttributeDef's for the primary key

findOrLoadDefObject

public static final EntityDefImpl findOrLoadDefObject(java.lang.String defFullName)

findDefObject

public static final EntityDefImpl findDefObject(java.lang.String defFullName)
Find the named EntityDefImpl object in the global catalog of metadata

Parameters:
defFullName -
Returns:

setBusLogicGroupName

public void setBusLogicGroupName(java.lang.String name)

setBusLogicUnitName

public void setBusLogicUnitName(java.lang.String name)

setCollClass

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

getCollClass

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

Returns:
the collection implementation class.

setRowClass

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

createEntityDef

public static EntityDefImpl createEntityDef(int defScope,
                                            java.lang.String defClassName,
                                            java.lang.String dbObjName,
                                            java.lang.String viewObjectBase)

loadFromXml

public static final EntityDefImpl loadFromXml(org.kxml2.io.KXmlParser parser,
                                              java.lang.String fullName)

getValidatorSubtype

protected static java.lang.String getValidatorSubtype(org.kxml2.io.KXmlParser parser)

loadValidator

protected void loadValidator(org.kxml2.io.KXmlParser parser,
                             AttributeDefImpl pAttr,
                             boolean isAttr)
Load a validator specified in the metadata

Parameters:
parser -

getAutoIncrementIndices

protected int[] getAutoIncrementIndices()
Determine the indices of AUTO-INCREMENT columns, denoted by a Java type of "oracle.jbo.domain.DBSequence"

Parameters:
entityDef -
Returns:
index of AUTO INCREMENT PRIMARY KEY column, or -1 if none exists

formatForOutput

public java.lang.String formatForOutput(OutputFormatter formatter)
Specified by:
formatForOutput in interface Formattable
Overrides:
formatForOutput in class RowDef

getSelectClause

public java.lang.String getSelectClause(SQLBuilder sqlBuilder,
                                        boolean forViewObject)

hasDataSecurity

public boolean hasDataSecurity()

getDataSecurityAttribute

public AttributeDefImpl getDataSecurityAttribute()

getColumnNameForQuery

public java.lang.String getColumnNameForQuery(int index)
Specified by:
getColumnNameForQuery in interface StructureDef
Overrides:
getColumnNameForQuery in class RowDef

isEffectiveDated

public boolean isEffectiveDated()
Checks if this Entity definition is Effective Dated.

Overrides:
isEffectiveDated in class RowDef
Returns:
true if the Entity definition has both effective start date and effective end date attributes, false otherwise.

getEffectiveStartDateAttr

public AttributeDefImpl getEffectiveStartDateAttr()
Returns:
The attribute that represents the effective start date

getEffectiveEndDateAttr

public AttributeDefImpl getEffectiveEndDateAttr()
Returns:
The attribute that represents the effective end date

getEffectiveDateType

public byte getEffectiveDateType()
Returns the Effective Date type of the Entity definition.

Returns:
EntityDefImpl.EFFECTIVE_DATE_TYPE_EFFECTIVE_DATED , EntityDefImpl.EFFECTIVE_DATE_TYPE_DATED or EntityDefImpl.EFFECTIVE_DATE_TYPE_NONE

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.

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.

Specified by:
getRowClass in class RowDef
Returns:
the row implementation class.

isAssociationAccessorRetained

public boolean isAssociationAccessorRetained()

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.

getBaseComponentClass

public java.lang.Class getBaseComponentClass()
Overrides:
getBaseComponentClass in class RowDef

getRawAttributeDefs

public AttributeDef[] getRawAttributeDefs()

setEJBHomeJNDIName

public void setEJBHomeJNDIName(java.lang.String nam)

setEJBAppProviderURL

public void setEJBAppProviderURL(java.lang.String url)

setBatchThreshold

public void setBatchThreshold(int threshold)

setUpdatable

public void setUpdatable(boolean flag)
Internal: Applications should not use this method.

Set false if this entity has to be readOnly (e.g., when this entity is mapping a snapshot table.) Default is true.

Parameters:
flag -

setUpdateChangedColumns

public void setUpdateChangedColumns(boolean updateChangedColumns)
Sets the flag for status to update on Changed Columns


setUseGlueCode

public void setUseGlueCode(boolean b)

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.

setAssociationAccessorRetained

public void setAssociationAccessorRetained(boolean b)

setEffectiveDateType

public void setEffectiveDateType(byte effDtType)
Sets the Effective Date Type for this Entity definition. Valid types are EntityDefImpl.EFFECTIVE_DATE_TYPE_EFFECTIVE_DATED , EntityDefImpl.EFFECTIVE_DATE_TYPE_DATED or EntityDefImpl.EFFECTIVE_DATE_TYPE_NONE . If the effective dated type is changed from EntityDefImpl.EFFECTIVE_DATE_TYPE_NONE then the framework assumes that there are start and end effective date attributes specified for this entity.

Parameters:
effDtType - EntityDefImpl.EFFECTIVE_DATE_TYPE_EFFECTIVE_DATED , EntityDefImpl.EFFECTIVE_DATE_TYPE_DATED or EntityDefImpl.EFFECTIVE_DATE_TYPE_NONE

loadAttribute

protected void loadAttribute(org.kxml2.io.KXmlParser parser)
Load the attributes from the XMLInput Stream

Parameters:
elem - : BC4J Entity

isUpdatable

public boolean isUpdatable()
Internal: Applications should not use this method.

Returns false if this entity has to be readOnly (e.g., when this entity is mapping a snapshot table.) Default is true.


verifyExtendedDefObjects

protected void verifyExtendedDefObjects()

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:
RowDef.createDef(), TooManyObjectsException

resolveUniqueKeyValidators

protected void resolveUniqueKeyValidators()

addUniqueKeyValidation

protected void addUniqueKeyValidation(JboUniqueKeyValidator val)

getEffectiveDateTransientAttrName

protected java.lang.String getEffectiveDateTransientAttrName()
The name of the transient attribute that is used to lookup the effective date of a row while doing DML operations.

Returns:
The name of the attribute

getAssociationDefImpls

public AssociationDefImpl[] getAssociationDefImpls()
Returns the AssociationDefImpls.

Returns:
the association accessors for this object.

getAssociationDefImpl

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

getAssociationDefImpl

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

findByPKExtended

public EntityImpl findByPKExtended(DBTransaction txn,
                                   Key key,
                                   boolean inclSubclasses)

createBlankInstance2

public EntityImpl createBlankInstance2(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.

getExtendedDefObjects

public ArrayList getExtendedDefObjects(boolean bSkipBusLogicUnits)

createBlankInstance

protected EntityImpl createBlankInstance(DBTransaction txn)

isSingleUseKeyStatement

public boolean isSingleUseKeyStatement()

setSingleUseKeyStatement

public void setSingleUseKeyStatement(boolean singleUse)

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.

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.

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.

getEventParentAttrs

public Iterator getEventParentAttrs()
Gets the list of attributes on the parent entity that are used in the payload of events on this entity.

Returns:
the list of attributes on the parent entity that are used in the payload of events in this entity.

getEventTransAttrs

public Iterator getEventTransAttrs()

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.

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.

getRefAttrIndex

public int getRefAttrIndex()

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.

findByAltKey

public EntityImpl findByAltKey(DBTransaction txn,
                               java.lang.String keyName,
                               Key key,
                               boolean inclSubclasses,
                               boolean searchDatabase)

getAllEntityInstancesIterator

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

findInCacheByAltKeyExtended

public EntityImpl findInCacheByAltKeyExtended(DBTransaction txn,
                                              java.lang.String keyName,
                                              Key key,
                                              boolean inclSubclasses)

getAltKeyIndex

public int getAltKeyIndex(java.lang.String name)

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

getValidators

public List getValidators()
Get the list of JboValidatorInterface objects registered with this entity

Specified by:
getValidators in interface ValidationManager
Returns:
ArrayList List of Validators

lookupValidator

public JboValidatorInterface lookupValidator(java.lang.String name)

addValidator

public void addValidator(JboValidatorInterface listener)
Adds a JboValidatorInterface to the listener list.

This method modifies the static/singleton metadata.

Specified by:
addValidator in interface ValidationManager
Parameters:
listener - the JboValidatorInterface to be added.
See Also:
JboValidatorInterface

removeValidator

protected void removeValidator(JboValidatorInterface 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

addVetoableChangeListener

protected void addVetoableChangeListener(VetoableChangeListener listener)
This method will be deprecated in a future release. Use add/removeValidator instead.

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)
This method will be deprecated in a future release. Use AttributeDefImpl.add/removeValidator instead.

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)
This method will be deprecated in a future release. Use AttributeDefImpl.add/removeValidator instead.

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)
This method will be deprecated in a future release. Use add/removeValidator instead.

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)
This method will be deprecated in a future release. Use AttributeDefImpl.add/removeValidator instead.

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)
This method will be deprecated in a future release. Use AttributeDefImpl.add/removeValidator instead.

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

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.

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.

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.

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.

getUniqueKeys

public AttributeDefImpl[] getUniqueKeys()
Returns the list of attributes that were marked as Unique-key constituents in designtime The order of attribute definitions is the order in which the unique-key attributes appear in the set of attributes for this entity. Only "Persistent" attributes can be marked as Unique Key attributes.


isUpdateChangedColumns

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

getCreateEvents

public Iterator getCreateEvents()
Returns the list of events to fire when a row is created in the entity.

Returns:
the list of events to fire when a row is created in the entity.

getUpdateEvents

public Iterator getUpdateEvents()
Returns the list of events to fire when a row is updated in the entity.

Returns:
the list of events to fire when a row is updated in the entity.

getDeleteEvents

public Iterator getDeleteEvents()
Returns the list of events to fire when a row is deleted in the entity.

Returns:
the list of events to fire when a row is deleted in the entity.

loadViewAccessor

protected ViewAccessorDef loadViewAccessor(org.kxml2.io.KXmlParser parser)
Overrides:
loadViewAccessor in class RowDef

getPayloadDef

public PayloadDef getPayloadDef(java.lang.String name)
Returns the specified payload definition. A payload definition is a list of attributes to be used as the payload when raising an event to fabric. A payload definition can be specified as the payload for multiple event mappings in the same entity definition.

Parameters:
name - - the name of the requested payload definition
Returns:
the requested payload definition.

getEventDef

public EventDef getEventDef(java.lang.String name)
Gets the request event definition. An event definitions represents an event in Fabric that we will raise at the appropriate event point, as specified by the event mappings for the entity.

Parameters:
name - - name of the event definition
Returns:
the requested event definition

isUseGlueCode

public boolean isUseGlueCode()

getComponentClass

public java.lang.Class getComponentClass()

setComponentClass

public void setComponentClass(java.lang.Class refClass)
Overrides:
setComponentClass in class MetaObject

setComponentInterfaceName

public void setComponentInterfaceName(java.lang.String interfaceName)

getComponentInterfaceName

public java.lang.String getComponentInterfaceName()

getClientProxyClassName

public java.lang.String getClientProxyClassName()

setClientProxyClassName

public void setClientProxyClassName(java.lang.String name)

getEffectiveClientProxyClassName

protected java.lang.String getEffectiveClientProxyClassName()

getEffectiveComponentInterfaceName

protected java.lang.String getEffectiveComponentInterfaceName()

loadFromXML

protected static void loadFromXML(org.kxml2.io.KXmlParser parser,
                                  oracle.jbo.server.RemotableCompDef defObj)

loadXMLContents

public void loadXMLContents(org.kxml2.io.KXmlParser parser,
                            java.lang.String fullName)
Overrides:
loadXMLContents in class PersistableDefObject

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.