Business Components

oracle.jbo.server
Class EntityAssociation

java.lang.Object
  |
  +--oracle.jbo.common.BaseObject
        |
        +--oracle.jbo.server.NamedObjectImpl
              |
              +--oracle.jbo.server.DefObject
                    |
                    +--oracle.jbo.server.EntityAssociation

public class EntityAssociation
extends oracle.jbo.server.DefObject
implements oracle.jbo.server.Association

Describes the relationship between two Entity Objects. An association selects attributes from source and destination Entity Objects. Typically, these attributes represent key fields in a database table, but an association can be defined using any Entity Object attributes. Although an association identifies a source and destination end, the association can be navigated in either direction. Associations have package scope.

The EntityAssociation class determines the content of the AssociationDefImpl attributes on the Entity definitions. The AssociationDefImpl attributes are the attributes at the source Entity and the destination Entity. There are two AssociationDefImpls for each EntityAssociation. For example, in the case of an association between Dept and Emp, Dept will have one AssociationDefImpl attribute for Emp; Emp will have one AssociationDefImpl attribute for Dept. The EntityAssociation links the two AssociationDefImpls.

An instance of the EntityAssociation class maps to the XML file for the association. At runtime, when the XML for the EntityAssociation is read, the framework creates the two AssociationDefImpls and determines whether they are source or destination attributes.

Since:
JDevloper 3.0

Field Summary
protected  AttributeDefImpl[] mBindVars
          The list of AttributeDefImpls as bind variables on one end.
protected  AttributeDefImpl[] mOtherBindVars
          The list of bind variable AttributeDefImpls on one end.
 
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
 
Method Summary
static EntityAssociation findEntityAssociation(java.lang.String entityAssocName)
          Finds the named entity association from the statically maintained list of metaobjects.
 oracle.jbo.server.AssociationDefImpl getAccessorByEndName(java.lang.String endName)
          Returns the accessor of one of the associated Entity Objects.
 oracle.jbo.server.AssociationEnd getAssociationEnd(java.lang.String endName)
          Gets an end of the association.
 AttributeDefImpl[] getAttributeDefImpls()
          Gets the attributes of the source of the association.
 AttributeDefImpl[] getAttributeDefImplsByEndName(java.lang.String endName)
          Returns the attribute definitions of one end of the association.
 AttributeDefImpl[] getBindVariables()
          Returns the bind variables for one end of the association.
 java.lang.Class getComponentClass()
          Returns the class name of this Entity association's reference.
 oracle.jbo.server.DefObject[] getDefs()
          Returns the definitions of both ends of the association.
 EntityDefImpl getEntityDef()
          Gets the definition of the source of the association.
 AttributeDefImpl[] getOtherAttributeDefImpls()
          Returns the attributes of the destination of the association.
 AttributeDefImpl[] getOtherBindVariables()
          Returns the bind variables for the other end of the association.
 EntityDefImpl getOtherEntityDef()
          Returns the definition of the destination of the association.
 void link(oracle.jbo.server.AssociationDefImpl srcAccr, oracle.jbo.server.AssociationDefImpl dstAccr)
          Establishes a link between two Entity Objects.
 void setBindVariables(AttributeDefImpl[] vars)
          Sets the bind variables for one end of the association.
 void setOtherBindVariables(AttributeDefImpl[] vars)
          Sets the bind variables for the other end of the association.
 
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, refreshProperty, 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

mBindVars

protected AttributeDefImpl[] mBindVars
The list of AttributeDefImpls as bind variables on one end.

mOtherBindVars

protected AttributeDefImpl[] mOtherBindVars
The list of bind variable AttributeDefImpls on one end.
Method Detail

findEntityAssociation

public static EntityAssociation findEntityAssociation(java.lang.String entityAssocName)
Finds the named entity association from the statically maintained list of metaobjects.
Parameters:
entityAssocName - the fully qualified name of the entity association.
Returns:
an entity association.

getComponentClass

public java.lang.Class getComponentClass()
Returns the class name of this Entity association's reference.
Returns:
an EntityAssociationReference class name.

link

public void link(oracle.jbo.server.AssociationDefImpl srcAccr,
                 oracle.jbo.server.AssociationDefImpl dstAccr)
Establishes a link between two Entity Objects.
Parameters:
srcAccr - the source Entity Object's association accessor.
dstAccr - the destination Entity Object's association accessor.

getEntityDef

public EntityDefImpl getEntityDef()
Gets the definition of the source of the association.
Returns:
the source Entity Object's definition.

getOtherEntityDef

public EntityDefImpl getOtherEntityDef()
Returns the definition of the destination of the association.
Returns:
the destination Entity Object's definition.

getAccessorByEndName

public oracle.jbo.server.AssociationDefImpl getAccessorByEndName(java.lang.String endName)
Returns the accessor of one of the associated Entity Objects.
Parameters:
endname - the name of one of the association's Entity Objects.
Returns:
the accessor.

getAttributeDefImpls

public AttributeDefImpl[] getAttributeDefImpls()
Gets the attributes of the source of the association.
Specified by:
getAttributeDefImpls in interface oracle.jbo.server.Association
Returns:
the source Entity Object's attributes.

getOtherAttributeDefImpls

public AttributeDefImpl[] getOtherAttributeDefImpls()
Returns the attributes of the destination of the association.
Specified by:
getOtherAttributeDefImpls in interface oracle.jbo.server.Association
Returns:
the destination Entity Object's attributes.

getAttributeDefImplsByEndName

public AttributeDefImpl[] getAttributeDefImplsByEndName(java.lang.String endName)
Returns the attribute definitions of one end of the association.
Specified by:
getAttributeDefImplsByEndName in interface oracle.jbo.server.Association
Parameters:
endName - the name of one of the association's Entity Objects.
Returns:
an array of attribute definitions.

getDefs

public oracle.jbo.server.DefObject[] getDefs()
Returns the definitions of both ends of the association.
Specified by:
getDefs in interface oracle.jbo.server.Association
Returns:
A two-element array, with the source definition at index 0, and the destination definition at index 1.

setBindVariables

public void setBindVariables(AttributeDefImpl[] vars)
Sets the bind variables for one end of the association.
Parameters:
vars - an array of bind variables.
See Also:
setOtherBindVariables(oracle.jbo.server.AttributeDefImpl[])

getBindVariables

public AttributeDefImpl[] getBindVariables()
Returns the bind variables for one end of the association.
Returns:
an array of bind variables.
See Also:
getOtherBindVariables()

setOtherBindVariables

public void setOtherBindVariables(AttributeDefImpl[] vars)
Sets the bind variables for the other end of the association.
Parameters:
vars - an array of bind variables.
See Also:
setBindVariables(oracle.jbo.server.AttributeDefImpl[])

getOtherBindVariables

public AttributeDefImpl[] getOtherBindVariables()
Returns the bind variables for the other end of the association.
Returns:
an array of bind variables.
See Also:
getBindVariables()

getAssociationEnd

public oracle.jbo.server.AssociationEnd getAssociationEnd(java.lang.String endName)
Gets an end of the association.
Parameters:
endName - the name of one of the association's Entity Objects.
Returns:
the named end of the association.

Business Components