public class OdiKey extends oracle.odi.domain.support.AbstractOdiEntity implements IKey, IWorkDevelopmentOdiEntity, IFlexFieldUser, IKey
OdiDataStore
.
The type of key (i.e. Primary Key, Alternative Key or Index) can be controlled using the
type safe enum OdiKey.KeyType
and the method setKeyType(oracle.odi.domain.model.OdiKey.KeyType)
.
Modifier and Type | Class and Description |
---|---|
static class |
OdiKey.KeyType
Defines the type of an
OdiKey instance. |
Modifier and Type | Field and Description |
---|---|
static int |
NAME_MAX_LENGTH
Maximum length supported for the "name" property.
|
Constructor and Description |
---|
OdiKey(OdiDataStore pDataStore,
java.lang.String pName)
Construct a new OdiKey.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(OdiColumn pColumn)
Adds the given column to this
OdiKey instance. |
java.util.List |
getColumns()
Returns an unmodifiable list of the columns that are part of this key.
|
OdiDataStore |
getDataStore()
Returns the
OdiDataStore this OdiKey belongs to. |
java.util.Collection |
getFlexFieldsValues()
Obtains flex fields values related to this
IFlexFieldUser . |
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.Number |
getKeyId()
Returns the internal identifier of this
OdiKey instance. |
OdiKey.KeyType |
getKeyType()
Returns the
OdiKey.KeyType of this OdiKey instance. |
java.lang.String |
getName()
Returns the name of this
OdiKey instance. |
IRepositoryEntity |
getSecurityContainer()
Define a generic way to retrieve container for entities.
|
void |
initFlexFields(IOdiFlexFieldFinder pOdiFlexFieldFinder)
Initialize flex fields related to this
IFlexFieldUser . |
boolean |
isActive()
Returns whether this key is active (enabled) or not in the database.
|
boolean |
isAK()
If the key is alternate unique key
|
boolean |
isFlowCheckEnabled()
Returns whether the flow check is enabled for this key, or not.
|
boolean |
isInDatabase()
Returns whether this key is implemented in database or not.
|
boolean |
isIndex()
If the key is index
|
boolean |
isPK()
If the key is primary key
|
boolean |
isStaticCheckEnabled()
Returns whether the static check is enabled for this key, or not.
|
void |
moveColumn(OdiColumn pColumn,
int pNewPosition)
Sets a new Position for the given column of this key.
|
void |
removeColumn(OdiColumn pColumn)
Remove the the given column from this key.
|
void |
setActive(boolean pActive)
Defines whether this key is active (enabled) or inactive (disabled) in the database.
|
void |
setFlowCheckEnabled(boolean pFlowCheckEnabled)
Defines whether the flow check is enabled for this key, or not.
|
void |
setInDatabase(boolean pInDatabase)
Defines whether this key is implemented in database or not.
|
void |
setKeyType(OdiKey.KeyType pKeyType)
Sets the
OdiKey.KeyType for this OdiKey . |
void |
setStaticCheckEnabled(boolean pStaticCheckEnabled)
Defines whether the static check is enabled for this key, or not.
|
equals, getFirstDate, getFirstUser, getInternalVersion, getLastDate, getLastUser, hashCode, isInstanceLevelSecurityNeeded, isNew, toString
getGlobalId, getNumericId, hasCustomizedPersistenceMethodFor, invokeCustomizedPersistenceMethodFor
getFirstDate, getFirstUser, getLastDate, getLastUser, isInstanceLevelSecurityNeeded
getGlobalId
getGlobalId, getNumericId
public static final int NAME_MAX_LENGTH
public OdiKey(OdiDataStore pDataStore, java.lang.String pName)
This constructor sets the parent OdiDataStore
and the name of this OdiKey
instance.
pDataStore
- the datastore this key belongs to.pName
- the name of this keyDomainRuntimeException
- if the datastore is null or if the name is null, empty or longer than 128public 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.Number getKeyId()
OdiKey
instance.public java.lang.String getName()
OdiKey
instance.getName
in interface IModelObject
getName
in interface IKey
getName
in interface IOdiEntity
getName
in class oracle.odi.domain.support.AbstractOdiEntity
public boolean isActive()
true
if the key is active, false
otherwisesetActive(boolean)
public void setActive(boolean pActive)
By default, this property is set to true
.
pActive
- true
to make this key enabled, false
to make it disabledisActive()
public boolean isInDatabase()
true
if this key is defined as implemented database, false
otherwise.setInDatabase(boolean)
public void setInDatabase(boolean pInDatabase)
By default, this property is set to false
.
pInDatabase
- true
if this key is implemented in database, false
otherwiseisInDatabase()
public IRepositoryEntity getSecurityContainer()
IRepositoryEntity
getSecurityContainer
in interface IRepositoryEntity
public OdiDataStore getDataStore()
OdiDataStore
this OdiKey
belongs to.public OdiKey.KeyType getKeyType()
OdiKey.KeyType
of this OdiKey
instance.setKeyType(KeyType)
public void setKeyType(OdiKey.KeyType pKeyType) throws java.lang.IllegalArgumentException
OdiKey.KeyType
for this OdiKey
.
By default, the type of an OdiKey is set to OdiKey.KeyType.ALTERNATE_KEY
.
pKeyType
- the type of the keyDomainRuntimeException
- if the given parameter is null or
if trying to set to PRIMARY_KEY and datastore already has a PKjava.lang.IllegalArgumentException
getKeyType()
public boolean isFlowCheckEnabled()
isFlowCheckEnabled
in interface IKey
true
if enabled, false
otherwisesetFlowCheckEnabled(boolean)
public void setFlowCheckEnabled(boolean pFlowCheckEnabled)
By default, this property is set to true
.
pFlowCheckEnabled
- true
if enabled, false
otherwiseisFlowCheckEnabled()
public boolean isStaticCheckEnabled()
isStaticCheckEnabled
in interface IKey
true
if enabled, false
otherwisesetStaticCheckEnabled(boolean)
public void setStaticCheckEnabled(boolean pStaticCheckEnabled)
By default, this property is set to true
.
pStaticCheckEnabled
- true
if enabled, false
otherwiseisStaticCheckEnabled()
public java.util.List getColumns()
The returned list is ordered by columns' position in this key object.
getColumns
in interface IKey
addColumn(OdiColumn)
,
removeColumn(OdiColumn)
public void addColumn(OdiColumn pColumn)
OdiKey
instance.
This makes the given column participating in this key object at last position index.
pColumn
- the column to addDomainRuntimeException
- if pColumn is null or does not belong to the OdiDataStore
to which this key belongs.getColumns()
,
removeColumn(OdiColumn)
public void removeColumn(OdiColumn pColumn)
This makes the given column to do not participate to this key object anymore. Positions of each columns in this key will be rearranged accordingly.
pColumn
- the column to remove from this keyDomainRuntimeException
- if the column is null
or is not part of this keygetColumns()
,
addColumn(OdiColumn)
public java.util.Collection getFlexFieldsValues()
IFlexFieldUser
.
In most implementations method 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 fieldspublic void moveColumn(OdiColumn pColumn, int pNewPosition)
pColumn
- the column to change position topNewPosition
- the new positionDomainRuntimeException
- if the column is null or not present in the key or if the new position is not validgetColumns()
,
addColumn(OdiColumn)
,
removeColumn(OdiColumn)
public boolean isAK()
IKey
public boolean isPK()
IKey