te::da::ForeignKey Class Reference

It models a foreign key constraint for a DataSetType. More...

#include <ForeignKey.h>

Inheritance diagram for te::da::ForeignKey:
te::da::Constraint

Public Member Functions

void add (te::dt::Property *p)
 It adds a property to the foreign key constraint. More...
 
void addRefProperty (te::dt::Property *p)
 It adds a reference property (on the referenced DataSetType) of this foreign key constraint. More...
 
Constraintclone ()
 It returns a clone of the object. More...
 
 ForeignKey (unsigned int id=0)
 Constructor. More...
 
 ForeignKey (const std::string &name, unsigned int id=0)
 Constructor. More...
 
 ForeignKey (const ForeignKey &rhs)
 Copy constructor not allowed. More...
 
virtual DataSetTypegetDataSetType () const
 It returns the DataSetType associated to the constraint. More...
 
virtual unsigned int getId () const
 It returns the constraint identifier. More...
 
virtual const std::string & getName () const
 It returns the constraint name. More...
 
FKActionType getOnDeleteAction () const
 It returns the action performed when a referenced element value in the referenced DataSetType is being deleted. More...
 
FKActionType getOnUpdateAction () const
 It returns the action performed when a referenced element value in the referenced DataSetType is being updated to a new value. More...
 
const std::vector< te::dt::Property * > & getProperties () const
 It returns the properties that take part of the foreign key constraint. More...
 
DataSetTypegetReferencedDataSetType () const
 It returns the referenced DataSetType of this foreign key constraint. More...
 
const std::vector< te::dt::Property * > & getReferencedProperties () const
 It returns the referenced properties (on the referenced DataSetType) of this foreign key constraint. More...
 
ConstraintType getType () const
 It returns the constraint type: FOREIGNKEY. More...
 
bool has (te::dt::Property *p)
 It verifies if Property takes part of the foreign key. More...
 
bool isReferenced (te::dt::Property *p)
 It verifies if Property is referenced by the foreign key. More...
 
ForeignKeyoperator= (const ForeignKey &rhs)
 Assignment operator. More...
 
void replace (te::dt::Property *p, te::dt::Property *pp)
 It changes a reference to property p to pp. More...
 
virtual void setDataSetType (DataSetType *dt)
 It sets the DataSetType associated to the constraint. More...
 
virtual void setId (unsigned int id)
 It sets the constraint identifier. More...
 
virtual void setName (const std::string &name)
 It sets the constraint name. More...
 
void setOnDeleteAction (FKActionType a)
 It sets the action to be performed when a referenced element value in the referenced DataSetType is being deleted. More...
 
void setOnUpdateAction (FKActionType a)
 It sets the action to be performed when a referenced element value in the referenced DataSetType is being updated to a new value. More...
 
void setProperties (const std::vector< te::dt::Property * > &properties)
 It sets the properties that take part of the foreign key constraint. More...
 
void setReferencedDataSetType (DataSetType *refDt)
 It sets the referenced DataSetType of this foreign key constraint. More...
 
void setReferencedProperties (const std::vector< te::dt::Property * > &properties)
 It sets the referenced properties (on the referenced DataSetType) of this foreign key constraint. More...
 
 ~ForeignKey ()
 Destructor. More...
 

Private Attributes

FKActionType m_onDelete
 The action to be performed when a referenced element value in the referenced DataSetType is being deleted. More...
 
FKActionType m_onUpdate
 The action to be performed when a referenced element value in the referenced DataSetType is being updated to a new value. More...
 
std::vector< te::dt::Property * > m_properties
 The properties that are part of the foreign key constraint. More...
 
DataSetTypem_refDt
 The referenced DataSetType of this foreign key constraint. More...
 
std::vector< te::dt::Property * > m_refProperties
 The referenced properties (on the referenced DataSetType) of this foreign key constraint. More...
 

Detailed Description

It models a foreign key constraint for a DataSetType.

See also
DataSetType, PrimaryKey, UniqueKey, CheckConstraint

Definition at line 50 of file ForeignKey.h.

Constructor & Destructor Documentation

te::da::ForeignKey::ForeignKey ( unsigned int  id = 0)

Constructor.

The default fk will have the actions OnDelete and OnUpdate set as NO_ACTION.

Parameters
idThe fk identifier.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!
te::da::ForeignKey::ForeignKey ( const std::string &  name,
unsigned int  id = 0 
)

Constructor.

Parameters
nameThe foreign key constraint name.
idThe fk identifier.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!
te::da::ForeignKey::ForeignKey ( const ForeignKey rhs)

Copy constructor not allowed.

The new object will not have an associated DataSetType.

Parameters
rhsRight-hand-side instance.
te::da::ForeignKey::~ForeignKey ( )
inline

Destructor.

Definition at line 85 of file ForeignKey.h.

Member Function Documentation

void te::da::ForeignKey::add ( te::dt::Property p)
inline

It adds a property to the foreign key constraint.

Parameters
pThe property to be added to the foreign key constraint.
Precondition
All properties added must belong to the same DataSetType.

Definition at line 112 of file ForeignKey.h.

void te::da::ForeignKey::addRefProperty ( te::dt::Property p)
inline

It adds a reference property (on the referenced DataSetType) of this foreign key constraint.

Parameters
pThe referenced property (on the referenced DataSetType) of this foreign key constraint.
Precondition
All properties being added must reference the same DataSetType.

Definition at line 137 of file ForeignKey.h.

Constraint* te::da::ForeignKey::clone ( )
virtual

It returns a clone of the object.

The new object will not have an associated DataSetType.

Returns
A clone of the object.

Implements te::da::Constraint.

virtual DataSetType* te::da::Constraint::getDataSetType ( ) const
inlinevirtualinherited

It returns the DataSetType associated to the constraint.

Returns
The DataSetType associated to the constraint.

Definition at line 133 of file Constraint.h.

virtual unsigned int te::da::Constraint::getId ( ) const
inlinevirtualinherited

It returns the constraint identifier.

Returns
A number that identifies the constraint.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 103 of file Constraint.h.

virtual const std::string& te::da::Constraint::getName ( ) const
inlinevirtualinherited

It returns the constraint name.

Returns
The constraint name.

Definition at line 119 of file Constraint.h.

FKActionType te::da::ForeignKey::getOnDeleteAction ( ) const
inline

It returns the action performed when a referenced element value in the referenced DataSetType is being deleted.

Returns
The action performed when a referenced element value in the referenced DataSetType is being deleted.

Definition at line 167 of file ForeignKey.h.

FKActionType te::da::ForeignKey::getOnUpdateAction ( ) const
inline

It returns the action performed when a referenced element value in the referenced DataSetType is being updated to a new value.

Returns
The action performed when a referenced element value in the referenced DataSetType is being updated to a new value.

Definition at line 181 of file ForeignKey.h.

const std::vector<te::dt::Property*>& te::da::ForeignKey::getProperties ( ) const
inline

It returns the properties that take part of the foreign key constraint.

Returns
The properties that take part of the foreign key constraint.

Definition at line 103 of file ForeignKey.h.

DataSetType* te::da::ForeignKey::getReferencedDataSetType ( ) const
inline

It returns the referenced DataSetType of this foreign key constraint.

Returns
The referenced DataSetType of this foreign key constraint.

Definition at line 153 of file ForeignKey.h.

const std::vector<te::dt::Property*>& te::da::ForeignKey::getReferencedProperties ( ) const
inline

It returns the referenced properties (on the referenced DataSetType) of this foreign key constraint.

Returns
The referenced properties (on the referenced DataSetType) of this foreign key constraint.

Definition at line 128 of file ForeignKey.h.

ConstraintType te::da::ForeignKey::getType ( ) const
inlinevirtual

It returns the constraint type: FOREIGNKEY.

Returns
The constraint type FOREIGNKEY.

Implements te::da::Constraint.

Definition at line 225 of file ForeignKey.h.

References te::da::FOREIGN_KEY.

bool te::da::ForeignKey::has ( te::dt::Property p)

It verifies if Property takes part of the foreign key.

Parameters
pThe Property to be verified.
Returns
True if Property takes part of the foreign key, false otherwise.
bool te::da::ForeignKey::isReferenced ( te::dt::Property p)

It verifies if Property is referenced by the foreign key.

Parameters
pThe Property to be verified.
Returns
True if Property is referenced by the foreign key, false otherwise.
ForeignKey& te::da::ForeignKey::operator= ( const ForeignKey rhs)

Assignment operator.

The new object will not have an assigned DataSetType.

Parameters
rhsRight-hand-side instance.
Returns
A reference to this.
void te::da::ForeignKey::replace ( te::dt::Property p,
te::dt::Property pp 
)

It changes a reference to property p to pp.

Parameters
pA property that takes part of the foreign key or is referenced by it.
ppThe property that will take p place.
Note
This method will replace property checking both property list (referenced and the properties in the fk).
If the property p is not in the fk attribute list this method does nothing.
virtual void te::da::Constraint::setDataSetType ( DataSetType dt)
inlinevirtualinherited

It sets the DataSetType associated to the constraint.

Parameters
dtThe DataSetType associated to this constraint.
Warning
Take care when calling this method. If the constraint belongs to a DataSetType, remember to detach it from the DataSetType before calling this method.

Definition at line 143 of file Constraint.h.

virtual void te::da::Constraint::setId ( unsigned int  id)
inlinevirtualinherited

It sets the constraint identifier.

Parameters
idA number that identifies the constraint.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 112 of file Constraint.h.

virtual void te::da::Constraint::setName ( const std::string &  name)
inlinevirtualinherited

It sets the constraint name.

Parameters
nameThe constraint name.

Definition at line 126 of file Constraint.h.

void te::da::ForeignKey::setOnDeleteAction ( FKActionType  a)
inline

It sets the action to be performed when a referenced element value in the referenced DataSetType is being deleted.

Parameters
aThe action to be performed when a referenced element value in the referenced DataSetType is being deleted.

Definition at line 174 of file ForeignKey.h.

void te::da::ForeignKey::setOnUpdateAction ( FKActionType  a)
inline

It sets the action to be performed when a referenced element value in the referenced DataSetType is being updated to a new value.

Parameters
aThe action to be performed when a referenced element value in the referenced DataSetType is being updated to a new value.

Definition at line 188 of file ForeignKey.h.

void te::da::ForeignKey::setProperties ( const std::vector< te::dt::Property * > &  properties)
inline

It sets the properties that take part of the foreign key constraint.

Parameters
propertiesThe properties that take part of the foreign key constraint.
Precondition
All properties added must belong to the same DataSetType.

Definition at line 121 of file ForeignKey.h.

void te::da::ForeignKey::setReferencedDataSetType ( DataSetType refDt)
inline

It sets the referenced DataSetType of this foreign key constraint.

Parameters
refDtThe referenced DataSetType of this foreign key constraint.

Definition at line 160 of file ForeignKey.h.

void te::da::ForeignKey::setReferencedProperties ( const std::vector< te::dt::Property * > &  properties)
inline

It sets the referenced properties (on the referenced DataSetType) of this foreign key constraint.

Parameters
propertiesThe referenced properties (on the referenced DataSetType) of this foreign key constraint.
Precondition
All properties must reference the same DataSetType.

Definition at line 146 of file ForeignKey.h.

Member Data Documentation

FKActionType te::da::ForeignKey::m_onDelete
private

The action to be performed when a referenced element value in the referenced DataSetType is being deleted.

Definition at line 238 of file ForeignKey.h.

FKActionType te::da::ForeignKey::m_onUpdate
private

The action to be performed when a referenced element value in the referenced DataSetType is being updated to a new value.

Definition at line 239 of file ForeignKey.h.

std::vector<te::dt::Property*> te::da::ForeignKey::m_properties
private

The properties that are part of the foreign key constraint.

Definition at line 241 of file ForeignKey.h.

DataSetType* te::da::ForeignKey::m_refDt
private

The referenced DataSetType of this foreign key constraint.

Definition at line 240 of file ForeignKey.h.

std::vector<te::dt::Property*> te::da::ForeignKey::m_refProperties
private

The referenced properties (on the referenced DataSetType) of this foreign key constraint.

Definition at line 242 of file ForeignKey.h.


The documentation for this class was generated from the following file: