Oracle® Data Integrator Java API Reference
11g Release 1 (11.1.1.3.0)

E17060-01

oracle.odi.domain.model
Class OdiReference

java.lang.Object
  extended by oracle.odi.domain.support.BusinessObject
      extended by oracle.odi.domain.support.AbstractRepositoryEntity
          extended by oracle.odi.domain.support.AbstractOdiEntity
              extended by oracle.odi.domain.model.OdiReference
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, IOdiEntity, IRepositoryEntity, IWorkDevelopmentOdiEntity

public class OdiReference
extends oracle.odi.domain.support.AbstractOdiEntity
implements IWorkDevelopmentOdiEntity

An OdiReference is a reference between a foreign 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: ReferenceColumns are added to the reference by constructing reference columns and are removed by removeReferenceColumn(oracle.odi.domain.model.ReferenceColumn)

Since:
11.1.1.3.0
See Also:
Serialized Form

Nested Class Summary
static class OdiReference.ReferenceType
          Defines the possible types of references.
 
Field Summary
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.
 
Fields inherited from class oracle.odi.domain.support.AbstractOdiEntity
STARTING_INTERNAL_VERSION
 
Constructor Summary
OdiReference(OdiDataStore pForeignDataStore, OdiDataStore pPrimaryDataStore, java.lang.String pName)
          Creates an OdiReference for the given foreign and primary OdiDataStores.
 
Method Summary
 Expression getComplexSqlExpression()
          Returns the complex SQL expression of this OdiReference instance, or null if none.
 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.
 java.util.Collection<ReferenceColumn> 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.
 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 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.
 
Methods inherited from class oracle.odi.domain.support.AbstractOdiEntity
equals, getFirstDate, getFirstUser, getInternalVersion, getLastDate, getLastUser, hashCode, isInstanceLevelSecurityNeeded, isNew, toString
 
Methods inherited from class oracle.odi.domain.support.BusinessObject
clone
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.odi.domain.IOdiEntity
getFirstDate, getFirstUser, getLastDate, getLastUser, isInstanceLevelSecurityNeeded
 

Field Detail

NAME_MAX_LENGTH

public static final int NAME_MAX_LENGTH
Maximum length supported for the "name" property.

See Also:
OdiReference(OdiDataStore, OdiDataStore, String), Constant Field Values

PRIMARY_DATASTORE_ALIAS_MAX_LENGTH

public static final int PRIMARY_DATASTORE_ALIAS_MAX_LENGTH
Maximum length supported for the "primaryDataStoreName" property.

See Also:
setPrimaryDataStoreAlias(String), Constant Field Values
Constructor Detail

OdiReference

public OdiReference(OdiDataStore pForeignDataStore,
                    OdiDataStore pPrimaryDataStore,
                    java.lang.String pName)
Creates an OdiReference for the given foreign and primary OdiDataStores.

This constructor also sets the name of the reference

Parameters:
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 reference
Throws:
java.lang.IllegalArgumentException - if the name is not valid (empty of length greater than 128) or if one of the table is null
Method Detail

getComplexSqlExpression

public Expression getComplexSqlExpression()
Returns the complex SQL expression of this OdiReference instance, or null if none.

Returns:
Epression object as the complex sql expression
Throws:
java.lang.IllegalStateException - if the type of reference is not OdiReference.ReferenceType.COMPLEX_REFERENCE
See Also:
OdiReference.ReferenceType, setComplexSqlExpression(Expression)

getForeignDataStore

public OdiDataStore getForeignDataStore()
Returns the foreign datastore of this OdiReference instance (the datastore that contains the FK).

Returns:
an OdiDataStore object representing the foreign data store value

getInternalId

public java.io.Serializable getInternalId()
Description copied from interface: IRepositoryEntity
Provides a common getter for the persistence layer to obtain an identity, irrespective of the actual type of identity used.

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.

Specified by:
getInternalId in interface IRepositoryEntity
Returns:
the persistence identity of this instance

getName

public java.lang.String getName()
Returns the name of this OdiReference instance.

Specified by:
getName in interface IOdiEntity
Overrides:
getName in class oracle.odi.domain.support.AbstractOdiEntity
Returns:
the name
See Also:
setName(String)

getPrimaryDataStore

public OdiDataStore getPrimaryDataStore()
Returns the primary datastore of this OdiReference (the datastore that contains the PK).

Returns:
an OdiDataStore object representing the primary data store value
See Also:
setPrimaryDataStore(OdiDataStore)

getPrimaryDataStoreAlias

public java.lang.String getPrimaryDataStoreAlias()
Returns the primary datastore alias for this OdiReference instance.

Invoking this method will throw an IllegalStatException if the reference type isn't OdiReference.ReferenceType.COMPLEX_REFERENCE.

Returns:
a String representing the primary data store alias value
Throws:
java.lang.IllegalStateException - if this reference's type isn't OdiReference.ReferenceType.COMPLEX_REFERENCE
See Also:
setReferenceType(OdiReference.ReferenceType), setPrimaryDataStoreAlias(String)

getPrimaryDataStoreCatalogName

public java.lang.String getPrimaryDataStoreCatalogName()
Get the primary data store catalog name for this OdiReference instance.

Returns:
PK catalog name

getPrimaryDataStoreName

public java.lang.String getPrimaryDataStoreName()
Get the primary data store name for this OdiReference instance.

Returns:
PK data store name

getPrimaryDataStoreSchemaName

public java.lang.String getPrimaryDataStoreSchemaName()
Get the primary data store schema name for this OdiReference instance.

Returns:
PK schema name

getReferenceColumns

public java.util.Collection<ReferenceColumn> getReferenceColumns()
Returns an unmodifiable, sorted collection of reference columns of this OdiReference instance.

Returns:
a Collection object representing the reference columns value
See Also:
removeReferenceColumn(ReferenceColumn)

getReferenceId

public java.lang.Number getReferenceId()
Returns the internal identifier of this OdiReference.

Returns:
a Number object representing the reference id value

getReferenceType

public OdiReference.ReferenceType getReferenceType()
Returns the reference type of this OdiReference instance.

Returns:
ReferenceType object.
See Also:
setReferenceType(ReferenceType)

getSecurityContainer

public IRepositoryEntity getSecurityContainer()
Description copied from interface: IRepositoryEntity
Define a generic way to retrieve container for entities.

Specified by:
getSecurityContainer in interface IRepositoryEntity
Returns:
container entity

isActive

public boolean isActive()
Returns whether this OdiReference instance is active or not.

Returns:
true if this OdiReference is active, false otherwise
See Also:
setActive(boolean)

isFlowCheckEnabled

public boolean isFlowCheckEnabled()
Returns whether the flow check is enabled for this OdiReference or not.

Returns:
true if enabled, false otherwise
See Also:
setFlowCheckEnabled(boolean)

isStaticCheckEnabled

public boolean isStaticCheckEnabled()
Returns whether the static check is enabled for this OdiReference or not.

Returns:
true if enabled, false otherwise
See Also:
setFlowCheckEnabled(boolean)

moveReferenceColumn

public void moveReferenceColumn(ReferenceColumn pReferenceColumn,
                                int pNewPosition)
Change the position of the given ReferenceColumn to a new position and arrange position of other elements accordingly.

Parameters:
pReferenceColumn - the reference column to move
pNewPosition - the new position
Throws:
java.lang.IllegalArgumentException - if the given reference column is null
java.lang.IllegalArgumentException - if the given reference column doesn't belong to this reference

removeReferenceColumn

public void removeReferenceColumn(ReferenceColumn pReferenceColumn)
Actually remove the given ReferenceColumn from the reference columns associated to this OdiReference instance.

This will reorder position of each reference columns of this OdiReference accordingly.

Parameters:
pReferenceColumn - the reference column to remove
Throws:
java.lang.IllegalArgumentException - if the parameter is null
java.lang.IllegalArgumentException - if the parameter reference column is not associated with this instance of OdiReference

setActive

public void setActive(boolean pActive)
Defines whether this OdiReference instance is active or not.

By default, an OdiReference is active.

Parameters:
pActive - true to make this OdiReference active, false otherwise
See Also:
isActive()

setComplexSqlExpression

public void setComplexSqlExpression(Expression pExpression)
Sets the complex SQL expression of this OdiReference instance.

A complex SQL expression could only be set on OdiReference that are defined as complex reference (i.e. OdiReference.ReferenceType.COMPLEX_REFERENCE).

Parameters:
pExpression - the complex SQL expression
Throws:
java.lang.IllegalStateException - if the type of reference is not OdiReference.ReferenceType.COMPLEX_REFERENCE
See Also:
OdiReference.ReferenceType, getComplexSqlExpression()

setComplexSqlExpression

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

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.

Parameters:
pExpressionString - the full string representation of the expression
pGlobalContext - the global expression context
pLanguage - the language to be used during parsing of the string
See Also:
getComplexSqlExpression()

setFlowCheckEnabled

public void setFlowCheckEnabled(boolean pFlowCheckEnabled)
Defines whether the flow check is enabled for this OdiReference or not.

By default, flow check is enabled.

Parameters:
pFlowCheckEnabled - true to make flow check enabled, false otherwise
See Also:
isFlowCheckEnabled()

setName

public void setName(java.lang.String pName)
Sets the name of this OdiReference instance.

Parameters:
pName - the reference name
Throws:
java.lang.IllegalArgumentException - if the name is null, empty or longer than 128
See Also:
NAME_MAX_LENGTH, getName()

setPrimaryDataStore

public void setPrimaryDataStore(OdiDataStore pPrimaryDataStore)
Sets the primary data store (i.e. the data store that contains the PK) of this OdiReference.

If any previous primary datastore was set, this method clears any ReferenceColumns already defined for this reference.

If the given primary datastore is equals to the previous one, this method does nothing and simply return.

Parameters:
pPrimaryDataStore - the primary data store
Throws:
java.lang.IllegalArgumentException - if the given datastore is null
See Also:
getPrimaryDataStore()

setPrimaryDataStoreAlias

public void setPrimaryDataStoreAlias(java.lang.String pPrimaryDatastoreAlias)
Sets the primary data store alias for this 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.

Parameters:
pPrimaryDatastoreAlias - the alias name of the primary datastore
Throws:
java.lang.IllegalArgumentException - if the name is null, empty or longer than 128
java.lang.IllegalStateException - if this reference's type isn't OdiReference.ReferenceType.COMPLEX_REFERENCE
See Also:
getPrimaryDataStoreAlias()

setReferenceType

public void setReferenceType(OdiReference.ReferenceType pReferenceType)
Sets the 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.

Parameters:
pReferenceType - the type of reference
Throws:
java.lang.IllegalArgumentException - if the type is null
See Also:
getReferenceType()

setStaticCheckEnabled

public void setStaticCheckEnabled(boolean pStaticCheckEnabled)
Defines whether the static check is enabled for this OdiReference or not.

By default, static check is enabled.

Parameters:
pStaticCheckEnabled - true to make static check enabled, false otherwise
See Also:
isFlowCheckEnabled()

Oracle® Data Integrator Java API Reference
11g Release 1 (11.1.1.3.0)

E17060-01

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