public class OdiReference extends oracle.odi.domain.support.AbstractOdiEntity implements IWorkDevelopmentOdiEntity, IFlexFieldUser
OdiDataStore
and a primary OdiDataStore
.
The reference is a functional link between two datastores. It corresponds to a foreign key in a relational model. For example: The INVOICE datastore references the CUSTOMER datastore through the customer number.
From a persitence point of view the OdiReference belongs to the foreign datastore: getForeignDataStore()
.
Note: ReferenceColumn
s are added to the reference by constructing reference columns
and are removed by removeReferenceColumn(oracle.odi.domain.model.ReferenceColumn)
Modifier and Type | Class and Description |
---|---|
static class |
OdiReference.CascadingRule
Defines the possible delete and update rule.
|
static class |
OdiReference.ReferenceType
Defines the possible types of references.
|
Modifier and Type | Field and Description |
---|---|
static int |
NAME_MAX_LENGTH
Maximum length supported for the "name" property.
|
static int |
PRIMARY_DATASTORE_ALIAS_MAX_LENGTH
Maximum length supported for the "primaryDataStoreName" property.
|
Constructor and Description |
---|
OdiReference(OdiDataStore pForeignDataStore,
OdiDataStore pPrimaryDataStore,
java.lang.String pName)
Creates an
OdiReference for the given foreign and primary OdiDataStore s. |
Modifier and Type | Method and Description |
---|---|
Expression |
getComplexSqlExpression()
Returns the complex SQL expression of this
OdiReference instance, or null if none. |
OdiReference.CascadingRule |
getDeleteAction()
Returns the deletion rule of this
OdiReference instance. |
java.util.Collection |
getFlexFieldsValues()
Obtains flex fields values related to this
IFlexFieldUser . |
OdiDataStore |
getForeignDataStore()
Returns the foreign datastore of this
OdiReference instance (the datastore that contains the FK). |
java.io.Serializable |
getInternalId()
Provides a common getter for the persistence layer to obtain an identity,
irrespective of the actual type of identity used.
|
java.lang.String |
getName()
Returns the name of this
OdiReference instance. |
OdiDataStore |
getPrimaryDataStore()
Returns the primary datastore of this
OdiReference (the datastore that contains the PK). |
java.lang.String |
getPrimaryDataStoreAlias()
Returns the primary datastore alias for this
OdiReference instance. |
java.lang.String |
getPrimaryDataStoreCatalogName()
Get the primary data store catalog name for this
OdiReference instance. |
java.lang.String |
getPrimaryDataStoreName()
Get the primary data store name for this
OdiReference instance. |
java.lang.String |
getPrimaryDataStoreSchemaName()
Get the primary data store schema name for this
OdiReference instance. |
OdiDataStore |
getPrimaryDataStoreShortcut()
Returns the primary datastore shortcut of this
OdiReference |
java.util.Collection |
getReferenceColumns()
Returns an unmodifiable, sorted collection of reference columns of this
OdiReference instance. |
java.lang.Number |
getReferenceId()
Returns the internal identifier of this
OdiReference . |
OdiReference.ReferenceType |
getReferenceType()
Returns the reference type of this
OdiReference instance. |
IRepositoryEntity |
getSecurityContainer()
Define a generic way to retrieve container for entities.
|
OdiReference.CascadingRule |
getUpdateAction()
Returns the update rule of this
OdiReference instance. |
void |
initFlexFields(IOdiFlexFieldFinder pOdiFlexFieldFinder)
Initialize flex fields related to this
IFlexFieldUser . |
boolean |
isActive()
Returns whether this
OdiReference instance is active or not. |
boolean |
isFlowCheckEnabled()
Returns whether the flow check is enabled for this
OdiReference or not. |
boolean |
isStaticCheckEnabled()
Returns whether the static check is enabled for this
OdiReference or not. |
void |
moveReferenceColumn(ReferenceColumn pReferenceColumn,
int pNewPosition)
Change the position of the given
ReferenceColumn to a new position and arrange
position of other elements accordingly. |
void |
removeReferenceColumn(ReferenceColumn pReferenceColumn)
Actually remove the given
ReferenceColumn from the reference columns associated
to this OdiReference instance. |
void |
setActive(boolean pActive)
Defines whether this
OdiReference instance is active or not. |
void |
setComplexSqlExpression(Expression pExpression)
Sets the complex SQL expression of this
OdiReference instance. |
void |
setComplexSqlExpression(java.lang.String pExpressionString,
GlobalExpressionContext pGlobalContext,
com.sunopsis.language.SnpsLanguage pLanguage)
Convenient method to set the "complexSqlExpression" property of this reference from the given
expression string value.
|
void |
setDeleteAction(OdiReference.CascadingRule pDeleteAction)
Sets the
OdiReference.CascadingRule for this OdiReference instance. |
void |
setFlowCheckEnabled(boolean pFlowCheckEnabled)
Defines whether the flow check is enabled for this
OdiReference or not. |
void |
setName(java.lang.String pName)
Sets the name of this
OdiReference instance. |
void |
setPrimaryDataStore(OdiDataStore pPrimaryDataStore)
Sets the primary data store (i.e.
|
void |
setPrimaryDataStoreAlias(java.lang.String pPrimaryDatastoreAlias)
Sets the primary data store alias for this
OdiReference instance. |
void |
setReferenceType(OdiReference.ReferenceType pReferenceType)
Sets the
OdiReference.ReferenceType for this OdiReference instance. |
void |
setStaticCheckEnabled(boolean pStaticCheckEnabled)
Defines whether the static check is enabled for this
OdiReference or not. |
void |
setUpdateAction(OdiReference.CascadingRule pUpdateAction)
Sets the
OdiReference.CascadingRule for this OdiReference instance. |
equals, getFirstDate, getFirstUser, getInternalVersion, getLastDate, getLastUser, hashCode, isInstanceLevelSecurityNeeded, isNew, preCommit, toString
getGlobalId, getNumericId, hasCustomizedPersistenceMethodFor, invokeCustomizedPersistenceMethodFor
getFirstDate, getFirstUser, getLastDate, getLastUser, isInstanceLevelSecurityNeeded
getGlobalId
public static final int NAME_MAX_LENGTH
public static final int PRIMARY_DATASTORE_ALIAS_MAX_LENGTH
public OdiReference(OdiDataStore pForeignDataStore, OdiDataStore pPrimaryDataStore, java.lang.String pName)
OdiReference
for the given foreign and primary OdiDataStore
s.
This constructor also sets the name of the reference
pForeignDataStore
- the foreign data store (the one that contains the FK)pPrimaryDataStore
- the primary data store (the one that contains the PK)pName
- the name of the referenceDomainRuntimeException
- if the name is not valid (empty of length greater than 128)
or if one of the table is null
public void setComplexSqlExpression(Expression pExpression)
OdiReference
instance.
A complex SQL expression could only be set on OdiReference
that are
defined as complex reference (i.e. OdiReference.ReferenceType.COMPLEX_REFERENCE
).
pExpression
- the complex SQL expressionDomainRuntimeException
- if the type of reference is not OdiReference.ReferenceType.COMPLEX_REFERENCE
OdiReference.ReferenceType
,
getComplexSqlExpression()
public void setComplexSqlExpression(java.lang.String pExpressionString, GlobalExpressionContext pGlobalContext, com.sunopsis.language.SnpsLanguage pLanguage)
That implementation internally use a ExpressionStringParser
to create the expression.
The expression is created using the given GlobalExpressionContext
and OdiDataStoreExpressionContext
against "foreignDataStore" and "primaryDataStore" of this reference.
pExpressionString
- the full string representation of the expressionpGlobalContext
- the global expression contextpLanguage
- the language to be used during parsing of the stringgetComplexSqlExpression()
public Expression getComplexSqlExpression()
OdiReference
instance, or null if none.DomainRuntimeException
- if the type of reference is not OdiReference.ReferenceType.COMPLEX_REFERENCE
OdiReference.ReferenceType
,
setComplexSqlExpression(Expression)
public java.io.Serializable getInternalId()
IRepositoryEntity
Typically a subclass will delegate to a public
SomePrimitiveWrapper getId()
method. The necessity for the
getInternalId()
abstract method is solely because the
persistence layer needs a way of obtaining the identity irrespective of
the actual identity implementation choice.
Returning null
from this method will indicate the object has
never been saved. This will likely be relied on by some DAO
implementations.
getInternalId
in interface IRepositoryEntity
public java.lang.String getName()
OdiReference
instance.getName
in interface IFlexFieldUser
getName
in interface IOdiEntity
getName
in class oracle.odi.domain.support.AbstractOdiEntity
setName(String)
public void setName(java.lang.String pName)
OdiReference
instance.pName
- the reference nameDomainRuntimeException
- if the name is null, empty or longer than 128NAME_MAX_LENGTH
,
getName()
public OdiReference.ReferenceType getReferenceType()
OdiReference
instance.setReferenceType(ReferenceType)
public void setReferenceType(OdiReference.ReferenceType pReferenceType)
OdiReference.ReferenceType
for this OdiReference
instance.
Setting a reference type to OdiReference.ReferenceType.COMPLEX_REFERENCE
will
clear any reference columns.
By default, the reference type of an OdiReference
is OdiReference.ReferenceType.ODI_REFERENCE
.
pReferenceType
- the type of referenceDomainRuntimeException
- if the type is nullgetReferenceType()
public OdiReference.CascadingRule getDeleteAction()
OdiReference
instance.setDeleteAction(CascadingRule)
public void setDeleteAction(OdiReference.CascadingRule pDeleteAction)
OdiReference.CascadingRule
for this OdiReference
instance.pDeleteAction
- the deletion rulegetDeleteAction()
public OdiReference.CascadingRule getUpdateAction()
OdiReference
instance.#setUpdateAction(CascadingRule))
public void setUpdateAction(OdiReference.CascadingRule pUpdateAction)
OdiReference.CascadingRule
for this OdiReference
instance.pUpdateAction
- the update rulegetUpdateAction()
public IRepositoryEntity getSecurityContainer()
IRepositoryEntity
getSecurityContainer
in interface IRepositoryEntity
public OdiDataStore getForeignDataStore()
OdiReference
instance (the datastore that contains the FK).public OdiDataStore getPrimaryDataStore()
OdiReference
(the datastore that contains the PK).setPrimaryDataStore(OdiDataStore)
public OdiDataStore getPrimaryDataStoreShortcut()
OdiReference
setPrimaryDataStore(OdiDataStore)
public java.lang.Number getReferenceId()
OdiReference
.public void setPrimaryDataStore(OdiDataStore pPrimaryDataStore)
OdiReference
.
If any previous primary datastore was set, this method
clears any ReferenceColumn
s already defined for this reference.
If the given primary datastore is equals to the previous one, this method does nothing and simply return.
pPrimaryDataStore
- the primary data storeDomainRuntimeException
- if the given datastore is null
getPrimaryDataStore()
public java.lang.String getPrimaryDataStoreAlias()
OdiReference
instance.
Invoking this method will throw an IllegalStatException if the reference type
isn't OdiReference.ReferenceType.COMPLEX_REFERENCE
.
DomainRuntimeException
- if this reference's type isn't OdiReference.ReferenceType.COMPLEX_REFERENCE
setReferenceType(OdiReference.ReferenceType)
,
setPrimaryDataStoreAlias(String)
public void setPrimaryDataStoreAlias(java.lang.String pPrimaryDatastoreAlias)
OdiReference
instance.
In order to invoke that method, this OdiReference
must be defined
with a OdiReference.ReferenceType.COMPLEX_REFERENCE
as reference type. Otherwise this
method will throw an IllegalStateException
.
pPrimaryDatastoreAlias
- the alias name of the primary datastoreDomainRuntimeException
- if the name is null, empty or longer than 128DomainRuntimeException
- if this reference's type isn't OdiReference.ReferenceType.COMPLEX_REFERENCE
getPrimaryDataStoreAlias()
public boolean isActive()
OdiReference
instance is active or not.true
if this OdiReference
is active, false
otherwisesetActive(boolean)
public void setActive(boolean pActive)
OdiReference
instance is active or not.
By default, an OdiReference
is active.
pActive
- true
to make this OdiReference
active, false
otherwiseisActive()
public boolean isFlowCheckEnabled()
OdiReference
or not.true
if enabled, false
otherwisesetFlowCheckEnabled(boolean)
public void setFlowCheckEnabled(boolean pFlowCheckEnabled)
OdiReference
or not.
By default, flow check is enabled.
pFlowCheckEnabled
- true
to make flow check enabled, false
otherwiseisFlowCheckEnabled()
public boolean isStaticCheckEnabled()
OdiReference
or not.true
if enabled, false
otherwisesetFlowCheckEnabled(boolean)
public void setStaticCheckEnabled(boolean pStaticCheckEnabled)
OdiReference
or not.
By default, static check is enabled.
pStaticCheckEnabled
- true
to make static check enabled, false
otherwiseisFlowCheckEnabled()
public java.util.Collection getReferenceColumns()
OdiReference
instance.removeReferenceColumn(ReferenceColumn)
public void removeReferenceColumn(ReferenceColumn pReferenceColumn)
ReferenceColumn
from the reference columns associated
to this OdiReference
instance.
This will reorder position of each reference columns of this OdiReference
accordingly.
pReferenceColumn
- the reference column to removeDomainRuntimeException
- if the parameter is nullDomainRuntimeException
- if the parameter reference column is not associated with this instance of OdiReference
public void moveReferenceColumn(ReferenceColumn pReferenceColumn, int pNewPosition)
ReferenceColumn
to a new position and arrange
position of other elements accordingly.pReferenceColumn
- the reference column to movepNewPosition
- the new positionDomainRuntimeException
- if the given reference column is nullDomainRuntimeException
- if the given reference column doesn't belong to this referencepublic java.lang.String getPrimaryDataStoreName()
OdiReference
instance.public java.lang.String getPrimaryDataStoreCatalogName()
OdiReference
instance.public java.lang.String getPrimaryDataStoreSchemaName()
OdiReference
instance.public java.util.Collection getFlexFieldsValues()
IFlexFieldUser
IFlexFieldUser
.
In most implementations method IFlexFieldUser.initFlexFields(IOdiFlexFieldFinder)
should be
called before calling this method.getFlexFieldsValues
in interface IFlexFieldUser
public void initFlexFields(IOdiFlexFieldFinder pOdiFlexFieldFinder)
IFlexFieldUser
IFlexFieldUser
.initFlexFields
in interface IFlexFieldUser
pOdiFlexFieldFinder
- OdiFlexField
finder to be used to query flex fields