umbrello: umbrello/uml1model/foreignkeyconstraint.h Source File

umbrello 2.32.1 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 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4 */
5
6 #ifndef FOREIGNKEYCONSTRAINT_H
7 #define FOREIGNKEYCONSTRAINT_H
8
9 // appl includes
10 #include "basictypes.h"
11 #include "entityconstraint.h"
12
13 // qt includes
14 #include <QMap>
15
16 //forward declarations
17 class UMLEntityAttribute;
18 class UMLEntity;
19
27 class UMLForeignKeyConstraint : public UMLEntityConstraint
28 {
29 Q_OBJECT
30
31 public:
32
37 enum UpdateDeleteAction { uda_NoAction = 0,
38 uda_Restrict,
39 uda_Cascade,
40 uda_SetNull,
41 uda_SetDefault };
42
43 UMLForeignKeyConstraint(UMLObject *parent, const QString& name,
44 Uml::ID::Type id = Uml::ID::None);
45 explicit UMLForeignKeyConstraint(UMLObject *parent);
46
47 bool operator==(const UMLForeignKeyConstraint &rhs) const;
48
49 virtual ~UMLForeignKeyConstraint();
50
51 virtual void copyInto(UMLObject *lhs) const;
52
53 virtual UMLObject* clone() const;
54
55 QString toString(Uml::SignatureType::Enum sig = Uml::SignatureType::NoSig, bool withStereotype=false);
56
57 void setReferencedEntity(UMLEntity* ent);
58 UMLEntity* getReferencedEntity() const;
59
60 void saveToXMI1(QXmlStreamWriter& writer);
61
62 virtual bool showPropertiesDialog(QWidget* parent = 0);
63
64 bool addEntityAttributePair(UMLEntityAttribute* pAttr, UMLEntityAttribute* rAttr);
65
66 bool removeEntityAttributePair(UMLEntityAttribute* /*key*/ pAttr);
67
68 bool hasEntityAttributePair(UMLEntityAttribute* pAttr, UMLEntityAttribute* rAttr) const;
69
70 QMap<UMLEntityAttribute*, UMLEntityAttribute*> getEntityAttributePairs();
71
72 void setDeleteAction(UpdateDeleteAction uda);
73 UpdateDeleteAction getDeleteAction() const;
74
75 void setUpdateAction(UpdateDeleteAction uda);
76 UpdateDeleteAction getUpdateAction() const;
77
78 void clearMappings();
79
80 bool resolveRef();
81
82 signals:
83 void sigReferencedEntityChanged();
84
85 private slots:
86 void slotReferencedEntityChanged();
87
88 protected:
89 bool load1(QDomElement & element);
90
91 private:
92
93 Uml::ID::Type m_pReferencedEntityID;
94
100 QMap<UMLEntityAttribute*, Uml::ID::Type> m_pEntityAttributeIDMap;
101
102 void init();
103
104 UMLEntity* m_ReferencedEntity;
105
109 QMap<UMLEntityAttribute*, UMLEntityAttribute*> m_AttributeMap;
110
111 UpdateDeleteAction m_UpdateAction;
112 UpdateDeleteAction m_DeleteAction;
113 };
114
115 #endif
basictypes.h
UMLEntityAttribute
Sets up entityattribute information.
Definition: entityattribute.h:21
UMLEntityConstraint
Sets up entity constraint information.
Definition: entityconstraint.h:22
UMLEntity
Non-graphical Information for an Entity.
Definition: entity.h:30
UMLForeignKeyConstraint
Sets up Foreign Key entity constraint information.
Definition: foreignkeyconstraint.h:28
UMLForeignKeyConstraint::init
void init()
Definition: foreignkeyconstraint.cpp:45
UMLForeignKeyConstraint::setDeleteAction
void setDeleteAction(UpdateDeleteAction uda)
Definition: foreignkeyconstraint.cpp:428
UMLForeignKeyConstraint::clearMappings
void clearMappings()
Definition: foreignkeyconstraint.cpp:362
UMLForeignKeyConstraint::getReferencedEntity
UMLEntity * getReferencedEntity() const
Definition: foreignkeyconstraint.cpp:345
UMLForeignKeyConstraint::getEntityAttributePairs
QMap< UMLEntityAttribute *, UMLEntityAttribute * > getEntityAttributePairs()
Definition: foreignkeyconstraint.cpp:404
UMLForeignKeyConstraint::sigReferencedEntityChanged
void sigReferencedEntityChanged()
UMLForeignKeyConstraint::m_AttributeMap
QMap< UMLEntityAttribute *, UMLEntityAttribute * > m_AttributeMap
Definition: foreignkeyconstraint.h:109
UMLForeignKeyConstraint::~UMLForeignKeyConstraint
virtual ~UMLForeignKeyConstraint()
Definition: foreignkeyconstraint.cpp:78
UMLForeignKeyConstraint::setReferencedEntity
void setReferencedEntity(UMLEntity *ent)
Definition: foreignkeyconstraint.cpp:331
UMLForeignKeyConstraint::m_pReferencedEntityID
Uml::ID::Type m_pReferencedEntityID
Used to resolve forward references to UMLEntity.
Definition: foreignkeyconstraint.h:93
UMLForeignKeyConstraint::slotReferencedEntityChanged
void slotReferencedEntityChanged()
Definition: foreignkeyconstraint.cpp:353
UMLForeignKeyConstraint::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: foreignkeyconstraint.cpp:86
UMLForeignKeyConstraint::toString
QString toString(Uml::SignatureType::Enum sig=Uml::SignatureType::NoSig, bool withStereotype=false)
Definition: foreignkeyconstraint.cpp:116
UMLForeignKeyConstraint::getUpdateAction
UpdateDeleteAction getUpdateAction() const
Definition: foreignkeyconstraint.cpp:420
UMLForeignKeyConstraint::UMLForeignKeyConstraint
UMLForeignKeyConstraint(UMLObject *parent, const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: foreignkeyconstraint.cpp:25
UMLForeignKeyConstraint::hasEntityAttributePair
bool hasEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr) const
Definition: foreignkeyconstraint.cpp:252
UMLForeignKeyConstraint::addEntityAttributePair
bool addEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr)
Definition: foreignkeyconstraint.cpp:180
UMLForeignKeyConstraint::clone
virtual UMLObject * clone() const
Definition: foreignkeyconstraint.cpp:103
UMLForeignKeyConstraint::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent=0)
Definition: foreignkeyconstraint.cpp:168
UMLForeignKeyConstraint::load1
bool load1(QDomElement &element)
Definition: foreignkeyconstraint.cpp:266
UMLForeignKeyConstraint::m_UpdateAction
UpdateDeleteAction m_UpdateAction
What to do on Update of referenced attributes.
Definition: foreignkeyconstraint.h:111
UMLForeignKeyConstraint::resolveRef
bool resolveRef()
Definition: foreignkeyconstraint.cpp:371
UMLForeignKeyConstraint::UpdateDeleteAction
UpdateDeleteAction
Definition: foreignkeyconstraint.h:37
UMLForeignKeyConstraint::uda_NoAction
@ uda_NoAction
Definition: foreignkeyconstraint.h:37
UMLForeignKeyConstraint::uda_Cascade
@ uda_Cascade
Definition: foreignkeyconstraint.h:39
UMLForeignKeyConstraint::uda_Restrict
@ uda_Restrict
Definition: foreignkeyconstraint.h:38
UMLForeignKeyConstraint::uda_SetDefault
@ uda_SetDefault
Definition: foreignkeyconstraint.h:41
UMLForeignKeyConstraint::uda_SetNull
@ uda_SetNull
Definition: foreignkeyconstraint.h:40
UMLForeignKeyConstraint::getDeleteAction
UpdateDeleteAction getDeleteAction() const
Definition: foreignkeyconstraint.cpp:412
UMLForeignKeyConstraint::m_ReferencedEntity
UMLEntity * m_ReferencedEntity
The UMLEntity that this foreign key references.
Definition: foreignkeyconstraint.h:104
UMLForeignKeyConstraint::operator==
bool operator==(const UMLForeignKeyConstraint &rhs) const
Definition: foreignkeyconstraint.cpp:64
UMLForeignKeyConstraint::saveToXMI1
void saveToXMI1(QXmlStreamWriter &writer)
Definition: foreignkeyconstraint.cpp:142
UMLForeignKeyConstraint::m_pEntityAttributeIDMap
QMap< UMLEntityAttribute *, Uml::ID::Type > m_pEntityAttributeIDMap
Definition: foreignkeyconstraint.h:100
UMLForeignKeyConstraint::m_DeleteAction
UpdateDeleteAction m_DeleteAction
What to do on Deletion of referenced attributes.
Definition: foreignkeyconstraint.h:112
UMLForeignKeyConstraint::setUpdateAction
void setUpdateAction(UpdateDeleteAction uda)
Definition: foreignkeyconstraint.cpp:436
UMLForeignKeyConstraint::removeEntityAttributePair
bool removeEntityAttributePair(UMLEntityAttribute *pAttr)
Definition: foreignkeyconstraint.cpp:239
UMLObject
The base class for UML objects.
Definition: umlobject.h:70
UMLObject::name
QString name() const
Definition: umlobject.cpp:206
entityconstraint.h
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:373
Uml::ID::Type
std::string Type
Definition: basictypes.h:371
Uml::SignatureType::Enum
Enum
Definition: basictypes.h:160
Uml::SignatureType::NoSig
@ NoSig
Definition: basictypes.h:161