umbrello 2.32.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

foreignkeyconstraint.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2002-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef FOREIGNKEYCONSTRAINT_H
12 #define FOREIGNKEYCONSTRAINT_H
13
14 // appl includes
15 #include "basictypes.h"
16 #include "entityconstraint.h"
17
18 // qt includes
19 #include <QMap>
20
21 //forward declarations
22 class UMLEntityAttribute;
23 class UMLEntity;
24
32 class UMLForeignKeyConstraint : public UMLEntityConstraint
33 {
34 Q_OBJECT
35
36 public:
37
42 enum UpdateDeleteAction { uda_NoAction = 0,
43 uda_Restrict,
44 uda_Cascade,
45 uda_SetNull,
46 uda_SetDefault };
47
48 UMLForeignKeyConstraint(UMLObject *parent, const QString& name,
49 Uml::ID::Type id = Uml::ID::None);
50 explicit UMLForeignKeyConstraint(UMLObject *parent);
51
52 bool operator==(const UMLForeignKeyConstraint &rhs) const;
53
54 virtual ~UMLForeignKeyConstraint();
55
56 virtual void copyInto(UMLObject *lhs) const;
57
58 virtual UMLObject* clone() const;
59
60 QString toString(Uml::SignatureType::Enum sig = Uml::SignatureType::NoSig, bool withStereotype=false);
61
62 void setReferencedEntity(UMLEntity* ent);
63 UMLEntity* getReferencedEntity() const;
64
65 void saveToXMI1(QDomDocument & qDoc, QDomElement & qElement);
66
67 virtual bool showPropertiesDialog(QWidget* parent = 0);
68
69 bool addEntityAttributePair(UMLEntityAttribute* pAttr, UMLEntityAttribute* rAttr);
70
71 bool removeEntityAttributePair(UMLEntityAttribute* /*key*/ pAttr);
72
73 bool hasEntityAttributePair(UMLEntityAttribute* pAttr, UMLEntityAttribute* rAttr) const;
74
75 QMap<UMLEntityAttribute*, UMLEntityAttribute*> getEntityAttributePairs();
76
77 void setDeleteAction(UpdateDeleteAction uda);
78 UpdateDeleteAction getDeleteAction() const;
79
80 void setUpdateAction(UpdateDeleteAction uda);
81 UpdateDeleteAction getUpdateAction() const;
82
83 void clearMappings();
84
85 bool resolveRef();
86
87 signals:
88 void sigReferencedEntityChanged();
89
90 private slots:
91 void slotReferencedEntityChanged();
92
93 protected:
94 bool load1(QDomElement & element);
95
96 private:
97
98 Uml::ID::Type m_pReferencedEntityID;
99
105 QMap<UMLEntityAttribute*, Uml::ID::Type> m_pEntityAttributeIDMap;
106
107 void init();
108
109 UMLEntity* m_ReferencedEntity;
110
114 QMap<UMLEntityAttribute*, UMLEntityAttribute*> m_AttributeMap;
115
116 UpdateDeleteAction m_UpdateAction;
117 UpdateDeleteAction m_DeleteAction;
118 };
119
120 #endif
UMLForeignKeyConstraint::getUpdateAction
UpdateDeleteAction getUpdateAction() const
Definition: foreignkeyconstraint.cpp:425
UMLForeignKeyConstraint::m_DeleteAction
UpdateDeleteAction m_DeleteAction
What to do on Deletion of referenced attributes.
Definition: foreignkeyconstraint.h:117
UMLForeignKeyConstraint::UpdateDeleteAction
UpdateDeleteAction
Definition: foreignkeyconstraint.h:42
UMLObject::id
virtual Uml::ID::Type id() const
Definition: umlobject.cpp:425
UMLEntity
Non-graphical Information for an Entity.
Definition: entity.h:35
UMLForeignKeyConstraint::load1
bool load1(QDomElement &element)
Definition: foreignkeyconstraint.cpp:271
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
UMLEntityConstraint::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: entityconstraint.cpp:70
UMLForeignKeyConstraint::setUpdateAction
void setUpdateAction(UpdateDeleteAction uda)
Definition: foreignkeyconstraint.cpp:441
entity.h
UMLForeignKeyConstraint::m_ReferencedEntity
UMLEntity * m_ReferencedEntity
The UMLEntity that this foreign key references.
Definition: foreignkeyconstraint.h:109
UMLObject::ot_ForeignKeyConstraint
@ ot_ForeignKeyConstraint
Definition: umlobject.h:106
UMLForeignKeyConstraint::setReferencedEntity
void setReferencedEntity(UMLEntity *ent)
Definition: foreignkeyconstraint.cpp:336
foreignkeyconstraint.h
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:353
UMLForeignKeyConstraint
Sets up Foreign Key entity constraint information.
Definition: foreignkeyconstraint.h:33
object_factory.h
Uml::SignatureType::SigNoVis
@ SigNoVis
Definition: basictypes.h:165
Uml::ID::toString
QString toString(const ID::Type &id)
Definition: basictypes.cpp:1263
UMLForeignKeyConstraint::uda_SetDefault
@ uda_SetDefault
Definition: foreignkeyconstraint.h:46
UMLForeignKeyConstraint::operator==
bool operator==(const UMLForeignKeyConstraint &rhs) const
Definition: foreignkeyconstraint.cpp:69
UMLObject::umlParent
UMLObject * umlParent() const
Definition: umlobject.cpp:671
UMLForeignKeyConstraint::m_pEntityAttributeIDMap
QMap< UMLEntityAttribute *, Uml::ID::Type > m_pEntityAttributeIDMap
Definition: foreignkeyconstraint.h:105
UMLEntityConstraint
Sets up entity constraint information.
Definition: entityconstraint.h:27
UMLForeignKeyConstraint::toString
QString toString(Uml::SignatureType::Enum sig=Uml::SignatureType::NoSig, bool withStereotype=false)
Definition: foreignkeyconstraint.cpp:121
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
UMLForeignKeyConstraint::setDeleteAction
void setDeleteAction(UpdateDeleteAction uda)
Definition: foreignkeyconstraint.cpp:433
UMLForeignKeyConstraint::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: foreignkeyconstraint.cpp:91
UMLForeignKeyConstraint::m_pReferencedEntityID
Uml::ID::Type m_pReferencedEntityID
Used to resolve forward references to UMLEntity.
Definition: foreignkeyconstraint.h:98
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
UMLObject::asUMLEntityAttribute
UMLEntityAttribute * asUMLEntityAttribute()
Definition: umlobject.cpp:1314
UMLForeignKeyConstraint::getReferencedEntity
UMLEntity * getReferencedEntity() const
Definition: foreignkeyconstraint.cpp:350
entityconstraint.h
UMLObject::asUMLEntity
UMLEntity * asUMLEntity()
Definition: umlobject.cpp:1313
UMLObject::m_BaseType
ObjectType m_BaseType
objects type
Definition: umlobject.h:276
UMLForeignKeyConstraint::clearMappings
void clearMappings()
Definition: foreignkeyconstraint.cpp:367
Uml::ID::fromString
ID::Type fromString(const QString &id)
Definition: basictypes.cpp:1268
entityattribute.h
UMLClassifier::findChildObjectById
virtual UMLObject * findChildObjectById(Uml::ID::Type id, bool considerAncestors=false)
Definition: classifier.cpp:546
UMLForeignKeyConstraint::resolveRef
bool resolveRef()
Definition: foreignkeyconstraint.cpp:376
uWarning
#define uWarning()
Definition: debug_utils.h:124
UMLForeignKeyConstraintDialog
A dialog page to display foreignkey constraint properties.
Definition: umlforeignkeyconstraintdialog.h:43
UMLForeignKeyConstraint::m_UpdateAction
UpdateDeleteAction m_UpdateAction
What to do on Update of referenced attributes.
Definition: foreignkeyconstraint.h:116
UMLObject::save1
QDomElement save1(const QString &tag, QDomDocument &qDoc)
Definition: umlobject.cpp:845
UMLObject::asUMLForeignKeyConstraint
UMLForeignKeyConstraint * asUMLForeignKeyConstraint()
Definition: umlobject.cpp:1319
UMLForeignKeyConstraint::getEntityAttributePairs
QMap< UMLEntityAttribute *, UMLEntityAttribute * > getEntityAttributePairs()
Definition: foreignkeyconstraint.cpp:409
basictypes.h
int
int int y int
Definition: cxx11-lambda-functions-and-expressions.h:4
uDebug
#define uDebug()
Definition: debug_utils.h:122
Uml::SignatureType::Enum
Enum
Definition: basictypes.h:162
MyProject\connect
connect()
Definition: namespaces-multiple.php:5
UMLObject::doc
QString doc() const
Definition: umlobject.cpp:435
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:278
UMLDoc::name
QString name() const
Definition: umldoc.cpp:2007
UMLDoc
Definition: umldoc.h:75
UMLForeignKeyConstraint::slotReferencedEntityChanged
void slotReferencedEntityChanged()
Definition: foreignkeyconstraint.cpp:358
UMLForeignKeyConstraint::uda_SetNull
@ uda_SetNull
Definition: foreignkeyconstraint.h:45
UMLForeignKeyConstraint::hasEntityAttributePair
bool hasEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr) const
Definition: foreignkeyconstraint.cpp:257
UMLDoc::tagEq
static bool tagEq(const QString &tag, const QString &pattern)
Definition: umldoc.cpp:3582
uError
#define uError()
Definition: debug_utils.h:123
UMLForeignKeyConstraint::getDeleteAction
UpdateDeleteAction getDeleteAction() const
Definition: foreignkeyconstraint.cpp:417
uml.h
Uml::SignatureType::ShowSig
@ ShowSig
Definition: basictypes.h:164
MultiPageDialogBase::exec
int exec()
Definition: multipagedialogbase.cpp:223
UMLForeignKeyConstraint::m_AttributeMap
QMap< UMLEntityAttribute *, UMLEntityAttribute * > m_AttributeMap
Definition: foreignkeyconstraint.h:114
UMLForeignKeyConstraint::saveToXMI1
void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: foreignkeyconstraint.cpp:147
debug_utils.h
Uml::SignatureType::NoSig
@ NoSig
Definition: basictypes.h:163
umlobject.h
UMLForeignKeyConstraint::~UMLForeignKeyConstraint
virtual ~UMLForeignKeyConstraint()
Definition: foreignkeyconstraint.cpp:83
UMLForeignKeyConstraint::init
void init()
Definition: foreignkeyconstraint.cpp:50
UMLForeignKeyConstraint::UMLForeignKeyConstraint
UMLForeignKeyConstraint(UMLObject *parent, const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: foreignkeyconstraint.cpp:30
UMLForeignKeyConstraint::uda_Cascade
@ uda_Cascade
Definition: foreignkeyconstraint.h:44
UMLForeignKeyConstraint::uda_NoAction
@ uda_NoAction
Definition: foreignkeyconstraint.h:42
UMLForeignKeyConstraint::addEntityAttributePair
bool addEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr)
Definition: foreignkeyconstraint.cpp:185
UMLForeignKeyConstraint::clone
virtual UMLObject * clone() const
Definition: foreignkeyconstraint.cpp:108
UMLForeignKeyConstraint::sigReferencedEntityChanged
void sigReferencedEntityChanged()
Definition: moc_foreignkeyconstraint.cpp:139
UMLEntityAttribute
Sets up entityattribute information.
Definition: entityattribute.h:26
umlforeignkeyconstraintdialog.h
UMLForeignKeyConstraint::removeEntityAttributePair
bool removeEntityAttributePair(UMLEntityAttribute *pAttr)
Definition: foreignkeyconstraint.cpp:244
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1064
umldoc.h
UMLForeignKeyConstraint::uda_Restrict
@ uda_Restrict
Definition: foreignkeyconstraint.h:43
UMLForeignKeyConstraint::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent=0)
Definition: foreignkeyconstraint.cpp:173