te::da::UniqueKey Class Reference

It describes a unique key (uk) constraint. More...

#include <UniqueKey.h>

Inheritance diagram for te::da::UniqueKey:
te::da::Constraint

Public Member Functions

void add (te::dt::Property *p)
 It adds the property to the list of properties that participates in the unique key. More...
 
Constraintclone ()
 It returns a clone of the object. More...
 
IndexgetAssociatedIndex () const
 It returns the associated index if one exists. 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...
 
const std::vector< te::dt::Property * > & getProperties () const
 It returns the properties that form the unique key. More...
 
ConstraintType getType () const
 It returns the constraint type: UNIQUEKEY. More...
 
bool has (const te::dt::Property *p) const
 It verifies if Property is associated to the unique key. More...
 
UniqueKeyoperator= (const UniqueKey &rhs)
 Assignment operator. More...
 
void replace (te::dt::Property *p, te::dt::Property *pp)
 
void setAssociatedIndex (Index *idx)
 It sets the associated index. 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 setProperties (const std::vector< te::dt::Property * > &properties)
 It sets the properties that form the unique key. More...
 
 UniqueKey (DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 UniqueKey (const std::string &name, DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 UniqueKey (const UniqueKey &rhs)
 Copy constructor. More...
 
 ~UniqueKey ()
 Destructor. More...
 

Private Attributes

Indexm_index
 A pointer to an associated index. More...
 
std::vector< te::dt::Property * > m_properties
 The properties that are part of the unique key constraint. More...
 

Detailed Description

It describes a unique key (uk) constraint.

See also
DataSetType, Index, PrimaryKey, ForeignKey, DataSetTypeCheckRestriction

Definition at line 53 of file UniqueKey.h.

Constructor & Destructor Documentation

te::da::UniqueKey::UniqueKey ( DataSetType dt = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
dtThe DataSetType associated to this uk.
idThe uk identifier.
Postcondition
If dt is provided, the uk will belong to the given DataSetType.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 31 of file dataaccess/dataset/UniqueKey.cpp.

References te::da::DataSetType::add().

Referenced by clone().

te::da::UniqueKey::UniqueKey ( const std::string &  name,
DataSetType dt = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
nameThe unique key (uk) constraint name.
dtThe DataSetType associated to this uk.
idThe uk identifier.
Postcondition
If dt is provided, the uk will belong to the given DataSetType.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 39 of file dataaccess/dataset/UniqueKey.cpp.

References te::da::DataSetType::add().

te::da::UniqueKey::UniqueKey ( const UniqueKey rhs)

Copy constructor.

The new object will not have an associated DataSetType.

Parameters
rhsRight-hand-side instance.

Definition at line 47 of file dataaccess/dataset/UniqueKey.cpp.

te::da::UniqueKey::~UniqueKey ( )
inline

Destructor.

Definition at line 92 of file UniqueKey.h.

Member Function Documentation

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

It adds the property to the list of properties that participates in the unique key.

Parameters
pThe Property that will take part of the unique key.

Definition at line 124 of file UniqueKey.h.

Referenced by AddUniqueKey(), te::da::DataSetType::DataSetType(), te::qt::widgets::UniqueKeyConstraintWidget::getConstraint(), te::ado::Transactor::getUniqueKeys(), TsManagerDataSource::initialize(), and TsDataSetType::tcCreateDataSetTypeAndChecks().

te::da::Constraint * te::da::UniqueKey::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.

Definition at line 91 of file dataaccess/dataset/UniqueKey.cpp.

References UniqueKey().

Referenced by UniqueKey_Clone().

Index* te::da::UniqueKey::getAssociatedIndex ( ) const
inline

It returns the associated index if one exists.

Returns
An associated index if one exists.

Definition at line 131 of file UniqueKey.h.

Referenced by te::da::DataSetType::DataSetType(), and TsDataSetType::tcCreateDataSetTypeAndChecks().

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.

Referenced by te::da::DataSourceCatalog::dropDependentFKs(), te::da::DataSetType::remove(), and TsDataSetType::tcCreateDataSetTypeAndChecks().

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.

Referenced by Constraint_GetId().

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.

Referenced by te::pgis::Transactor::addCheckConstraint(), te::qt::widgets::ConstraintsIndexesListWidget::addConstraint(), te::pgis::Transactor::addForeignKey(), te::pgis::Transactor::addPrimaryKey(), te::sqlite::DataSourceTransactor::addUniqueKey(), te::pgis::Transactor::addUniqueKey(), te::qt::widgets::DataSetTableView::changeColumnData(), Constraint_GetName(), te::pgis::Transactor::createDataSet(), te::qt::widgets::ForeignKeyItem::data(), te::qt::widgets::PrimaryKeyItem::data(), te::qt::widgets::CheckConstraintItem::data(), te::qt::widgets::UniqueKeyItem::data(), te::da::DataSetType::DataSetType(), te::da::DataSetTypeConverter::DataSetTypeConverter(), DSInfo::getCheckConstraintInfo(), te::pgis::Transactor::getConstraints(), DSInfo::getForeignKeyInfo(), te::sqlite::DataSourceCatalogLoader::getIndex(), te::pgis::Transactor::getIndexes(), te::pgis::Transactor::getPrimaryKey(), DSInfo::getPrimaryKeyInfo(), te::pgis::Transactor::getUniqueKey(), DSInfo::getUniqueKeyInfo(), te::qt::widgets::ConstraintsIndexesListWidget::onEditToolButtonClicked(), te::stmem::Transactor::primaryKeyExists(), PrintCatalog(), te::qt::widgets::ConstraintsIndexesListWidget::removePrimaryKey(), te::qt::widgets::ConstraintsIndexesListWidget::removeUniqueKey(), te::qt::widgets::PrimaryKeyConstraintWidget::setConstraint(), te::qt::widgets::UniqueKeyConstraintWidget::setConstraint(), te::qt::widgets::LayerPropertiesInfo::setLayerVecProperties(), and TsDataSetType::tcCreateDataSetTypeAndChecks().

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

It returns the constraint type: UNIQUEKEY.

Returns
The constraint type UNIQUEKEY.

Implements te::da::Constraint.

Definition at line 164 of file UniqueKey.h.

References te::da::UNIQUE_KEY.

bool te::da::UniqueKey::has ( const te::dt::Property p) const

It verifies if Property is associated to the unique key.

Parameters
pThe Property to be verified.
Returns
True if Property is associated to the unique key, false otherwise.

Definition at line 68 of file dataaccess/dataset/UniqueKey.cpp.

References m_properties.

Referenced by TsDataSetType::tcCreateDataSetTypeAndChecks().

te::da::UniqueKey & te::da::UniqueKey::operator= ( const UniqueKey rhs)

Assignment operator.

The new object will not have an assigned DataSetType.

Parameters
rhsRight-hand-side instance.
Returns
A reference to this.

Definition at line 54 of file dataaccess/dataset/UniqueKey.cpp.

References m_index, m_properties, and te::da::Constraint::operator=().

void te::da::UniqueKey::replace ( te::dt::Property p,
te::dt::Property pp 
)

Definition at line 79 of file dataaccess/dataset/UniqueKey.cpp.

References m_properties.

void te::da::UniqueKey::setAssociatedIndex ( Index idx)
inline
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.

References dt.

Referenced by te::da::DataSetType::add(), te::da::DataSetType::DataSetType(), and te::da::DataSetType::setPrimaryKey().

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.

Referenced by Constraint_SetId(), te::pgis::Transactor::getCheckConstraint(), and te::pgis::Transactor::getConstraints().

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

It sets the properties that form the unique key.

Parameters
propertiesThe properties that form the unique key.

Definition at line 117 of file UniqueKey.h.

Referenced by te::ado::Convert2Terralib().

Member Data Documentation

Index* te::da::UniqueKey::m_index
private

A pointer to an associated index.

Definition at line 177 of file UniqueKey.h.

Referenced by operator=().

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

The properties that are part of the unique key constraint.

Definition at line 178 of file UniqueKey.h.

Referenced by has(), operator=(), and replace().


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