umbrello: umbrello/umlmodel/foreignkeyconstraint.h Source File

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

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

foreignkeyconstraint.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2002-2021 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
17class UMLEntityAttribute;
18class UMLEntity;
19
27 class UMLForeignKeyConstraint : public UMLEntityConstraint
28{
29 Q_OBJECT
30
31public:
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,
56 bool withStereotype=false) const;
57
58 void setReferencedEntity(UMLEntity* ent);
59 UMLEntity* getReferencedEntity() const;
60
61 void saveToXMI(QXmlStreamWriter& writer);
62
63 virtual bool showPropertiesDialog(QWidget* parent = 0);
64
65 bool addEntityAttributePair(UMLEntityAttribute* pAttr, UMLEntityAttribute* rAttr);
66
67 bool removeEntityAttributePair(UMLEntityAttribute* /*key*/ pAttr);
68
69 bool hasEntityAttributePair(UMLEntityAttribute* pAttr, UMLEntityAttribute* rAttr) const;
70
71 QMap<UMLEntityAttribute*, UMLEntityAttribute*> getEntityAttributePairs();
72
73 void setDeleteAction(UpdateDeleteAction uda);
74 UpdateDeleteAction getDeleteAction() const;
75
76 void setUpdateAction(UpdateDeleteAction uda);
77 UpdateDeleteAction getUpdateAction() const;
78
79 void clearMappings();
80
81 bool resolveRef();
82
83signals:
84 void sigReferencedEntityChanged();
85
86private slots:
87 void slotReferencedEntityChanged();
88
89protected:
90 bool load1(QDomElement & element);
91
92private:
93
94 Uml::ID::Type m_pReferencedEntityID;
95
101 QMap<UMLEntityAttribute*, Uml::ID::Type> m_pEntityAttributeIDMap;
102
103 void init();
104
105 UMLEntity* m_ReferencedEntity;
106
110 QMap<UMLEntityAttribute*, UMLEntityAttribute*> m_AttributeMap;
111
112 UpdateDeleteAction m_UpdateAction;
113 UpdateDeleteAction m_DeleteAction;
114};
115
116#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:47
UMLForeignKeyConstraint::setDeleteAction
void setDeleteAction(UpdateDeleteAction uda)
Definition: foreignkeyconstraint.cpp:432
UMLForeignKeyConstraint::clearMappings
void clearMappings()
Definition: foreignkeyconstraint.cpp:366
UMLForeignKeyConstraint::getReferencedEntity
UMLEntity * getReferencedEntity() const
Definition: foreignkeyconstraint.cpp:349
UMLForeignKeyConstraint::getEntityAttributePairs
QMap< UMLEntityAttribute *, UMLEntityAttribute * > getEntityAttributePairs()
Definition: foreignkeyconstraint.cpp:408
UMLForeignKeyConstraint::sigReferencedEntityChanged
void sigReferencedEntityChanged()
UMLForeignKeyConstraint::m_AttributeMap
QMap< UMLEntityAttribute *, UMLEntityAttribute * > m_AttributeMap
Definition: foreignkeyconstraint.h:110
UMLForeignKeyConstraint::~UMLForeignKeyConstraint
virtual ~UMLForeignKeyConstraint()
Definition: foreignkeyconstraint.cpp:80
UMLForeignKeyConstraint::setReferencedEntity
void setReferencedEntity(UMLEntity *ent)
Definition: foreignkeyconstraint.cpp:335
UMLForeignKeyConstraint::m_pReferencedEntityID
Uml::ID::Type m_pReferencedEntityID
Used to resolve forward references to UMLEntity.
Definition: foreignkeyconstraint.h:94
UMLForeignKeyConstraint::slotReferencedEntityChanged
void slotReferencedEntityChanged()
Definition: foreignkeyconstraint.cpp:357
UMLForeignKeyConstraint::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: foreignkeyconstraint.cpp:88
UMLForeignKeyConstraint::toString
QString toString(Uml::SignatureType::Enum sig=Uml::SignatureType::NoSig, bool withStereotype=false) const
Definition: foreignkeyconstraint.cpp:118
UMLForeignKeyConstraint::getUpdateAction
UpdateDeleteAction getUpdateAction() const
Definition: foreignkeyconstraint.cpp:424
UMLForeignKeyConstraint::saveToXMI
void saveToXMI(QXmlStreamWriter &writer)
Definition: foreignkeyconstraint.cpp:143
UMLForeignKeyConstraint::hasEntityAttributePair
bool hasEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr) const
Definition: foreignkeyconstraint.cpp:254
UMLForeignKeyConstraint::addEntityAttributePair
bool addEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr)
Definition: foreignkeyconstraint.cpp:181
UMLForeignKeyConstraint::clone
virtual UMLObject * clone() const
Definition: foreignkeyconstraint.cpp:105
UMLForeignKeyConstraint::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent=0)
Definition: foreignkeyconstraint.cpp:169
UMLForeignKeyConstraint::load1
bool load1(QDomElement &element)
Definition: foreignkeyconstraint.cpp:268
UMLForeignKeyConstraint::m_UpdateAction
UpdateDeleteAction m_UpdateAction
What to do on Update of referenced attributes.
Definition: foreignkeyconstraint.h:112
UMLForeignKeyConstraint::resolveRef
bool resolveRef()
Definition: foreignkeyconstraint.cpp:375
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:416
UMLForeignKeyConstraint::m_ReferencedEntity
UMLEntity * m_ReferencedEntity
The UMLEntity that this foreign key references.
Definition: foreignkeyconstraint.h:105
UMLForeignKeyConstraint::operator==
bool operator==(const UMLForeignKeyConstraint &rhs) const
Definition: foreignkeyconstraint.cpp:66
UMLForeignKeyConstraint::m_pEntityAttributeIDMap
QMap< UMLEntityAttribute *, Uml::ID::Type > m_pEntityAttributeIDMap
Definition: foreignkeyconstraint.h:101
UMLForeignKeyConstraint::m_DeleteAction
UpdateDeleteAction m_DeleteAction
What to do on Deletion of referenced attributes.
Definition: foreignkeyconstraint.h:113
UMLForeignKeyConstraint::setUpdateAction
void setUpdateAction(UpdateDeleteAction uda)
Definition: foreignkeyconstraint.cpp:440
UMLForeignKeyConstraint::removeEntityAttributePair
bool removeEntityAttributePair(UMLEntityAttribute *pAttr)
Definition: foreignkeyconstraint.cpp:241
UMLObject
The base class for UML objects.
Definition: umlobject.h:70
UMLObject::name
QString name() const
Definition: umlobject.cpp:207
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