umbrello 26.03.70-1a62d36 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

umlforeignkeyconstraint.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 "umlentityconstraint.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,
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 = nullptr);
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
83Q_SIGNALS:
84 void sigReferencedEntityChanged();
85
86 private Q_SLOTS:
87 void slotReferencedEntityChanged();
88
89 protected:
90 bool load1(QDomElement & element);
91
92 private:
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: umlentityattribute.h:21
UMLEntityConstraint
Sets up entity constraint information.
Definition: umlentityconstraint.h:22
UMLEntity
Non-graphical Information for an Entity.
Definition: umlentity.h:30
UMLForeignKeyConstraint
Sets up Foreign Key entity constraint information.
Definition: umlforeignkeyconstraint.h:28
UMLForeignKeyConstraint::init
void init()
Definition: umlforeignkeyconstraint.cpp:47
UMLForeignKeyConstraint::setDeleteAction
void setDeleteAction(UpdateDeleteAction uda)
Definition: umlforeignkeyconstraint.cpp:432
UMLForeignKeyConstraint::clearMappings
void clearMappings()
Definition: umlforeignkeyconstraint.cpp:366
UMLForeignKeyConstraint::getReferencedEntity
UMLEntity * getReferencedEntity() const
Definition: umlforeignkeyconstraint.cpp:349
UMLForeignKeyConstraint::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent=nullptr)
Definition: umlforeignkeyconstraint.cpp:169
UMLForeignKeyConstraint::getEntityAttributePairs
QMap< UMLEntityAttribute *, UMLEntityAttribute * > getEntityAttributePairs()
Definition: umlforeignkeyconstraint.cpp:408
UMLForeignKeyConstraint::sigReferencedEntityChanged
void sigReferencedEntityChanged()
UMLForeignKeyConstraint::m_AttributeMap
QMap< UMLEntityAttribute *, UMLEntityAttribute * > m_AttributeMap
Definition: umlforeignkeyconstraint.h:110
UMLForeignKeyConstraint::~UMLForeignKeyConstraint
virtual ~UMLForeignKeyConstraint()
Definition: umlforeignkeyconstraint.cpp:80
UMLForeignKeyConstraint::setReferencedEntity
void setReferencedEntity(UMLEntity *ent)
Definition: umlforeignkeyconstraint.cpp:335
UMLForeignKeyConstraint::m_pReferencedEntityID
Uml::ID::Type m_pReferencedEntityID
Used to resolve forward references to UMLEntity.
Definition: umlforeignkeyconstraint.h:94
UMLForeignKeyConstraint::slotReferencedEntityChanged
void slotReferencedEntityChanged()
Definition: umlforeignkeyconstraint.cpp:357
UMLForeignKeyConstraint::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: umlforeignkeyconstraint.cpp:88
UMLForeignKeyConstraint::toString
QString toString(Uml::SignatureType::Enum sig=Uml::SignatureType::NoSig, bool withStereotype=false) const
Definition: umlforeignkeyconstraint.cpp:118
UMLForeignKeyConstraint::getUpdateAction
UpdateDeleteAction getUpdateAction() const
Definition: umlforeignkeyconstraint.cpp:424
UMLForeignKeyConstraint::saveToXMI
void saveToXMI(QXmlStreamWriter &writer)
Definition: umlforeignkeyconstraint.cpp:143
UMLForeignKeyConstraint::hasEntityAttributePair
bool hasEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr) const
Definition: umlforeignkeyconstraint.cpp:254
UMLForeignKeyConstraint::addEntityAttributePair
bool addEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr)
Definition: umlforeignkeyconstraint.cpp:181
UMLForeignKeyConstraint::clone
virtual UMLObject * clone() const
Definition: umlforeignkeyconstraint.cpp:105
UMLForeignKeyConstraint::load1
bool load1(QDomElement &element)
Definition: umlforeignkeyconstraint.cpp:268
UMLForeignKeyConstraint::m_UpdateAction
UpdateDeleteAction m_UpdateAction
What to do on Update of referenced attributes.
Definition: umlforeignkeyconstraint.h:112
UMLForeignKeyConstraint::resolveRef
bool resolveRef()
Definition: umlforeignkeyconstraint.cpp:375
UMLForeignKeyConstraint::UpdateDeleteAction
UpdateDeleteAction
Definition: umlforeignkeyconstraint.h:37
UMLForeignKeyConstraint::uda_NoAction
@ uda_NoAction
Definition: umlforeignkeyconstraint.h:37
UMLForeignKeyConstraint::uda_Cascade
@ uda_Cascade
Definition: umlforeignkeyconstraint.h:39
UMLForeignKeyConstraint::uda_Restrict
@ uda_Restrict
Definition: umlforeignkeyconstraint.h:38
UMLForeignKeyConstraint::uda_SetDefault
@ uda_SetDefault
Definition: umlforeignkeyconstraint.h:41
UMLForeignKeyConstraint::uda_SetNull
@ uda_SetNull
Definition: umlforeignkeyconstraint.h:40
UMLForeignKeyConstraint::getDeleteAction
UpdateDeleteAction getDeleteAction() const
Definition: umlforeignkeyconstraint.cpp:416
UMLForeignKeyConstraint::m_ReferencedEntity
UMLEntity * m_ReferencedEntity
The UMLEntity that this foreign key references.
Definition: umlforeignkeyconstraint.h:105
UMLForeignKeyConstraint::operator==
bool operator==(const UMLForeignKeyConstraint &rhs) const
Definition: umlforeignkeyconstraint.cpp:66
UMLForeignKeyConstraint::m_pEntityAttributeIDMap
QMap< UMLEntityAttribute *, Uml::ID::Type > m_pEntityAttributeIDMap
Definition: umlforeignkeyconstraint.h:101
UMLForeignKeyConstraint::m_DeleteAction
UpdateDeleteAction m_DeleteAction
What to do on Deletion of referenced attributes.
Definition: umlforeignkeyconstraint.h:113
UMLForeignKeyConstraint::setUpdateAction
void setUpdateAction(UpdateDeleteAction uda)
Definition: umlforeignkeyconstraint.cpp:440
UMLForeignKeyConstraint::removeEntityAttributePair
bool removeEntityAttributePair(UMLEntityAttribute *pAttr)
Definition: umlforeignkeyconstraint.cpp:241
UMLObject
The base class for UML objects.
Definition: umlobject.h:70
UMLObject::name
QString name() const
Definition: umlobject.cpp:207
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
umlentityconstraint.h