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 * 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(QXmlStreamWriter& writer);
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
basictypes.h
UMLEntityAttribute
Sets up entityattribute information.
Definition: entityattribute.h:26
UMLEntityConstraint
Sets up entity constraint information.
Definition: entityconstraint.h:27
UMLEntity
Non-graphical Information for an Entity.
Definition: entity.h:35
UMLForeignKeyConstraint
Sets up Foreign Key entity constraint information.
Definition: foreignkeyconstraint.h:33
UMLForeignKeyConstraint::init
void init()
Definition: foreignkeyconstraint.cpp:50
UMLForeignKeyConstraint::setDeleteAction
void setDeleteAction(UpdateDeleteAction uda)
Definition: foreignkeyconstraint.cpp:433
UMLForeignKeyConstraint::clearMappings
void clearMappings()
Definition: foreignkeyconstraint.cpp:367
UMLForeignKeyConstraint::getReferencedEntity
UMLEntity * getReferencedEntity() const
Definition: foreignkeyconstraint.cpp:350
UMLForeignKeyConstraint::getEntityAttributePairs
QMap< UMLEntityAttribute *, UMLEntityAttribute * > getEntityAttributePairs()
Definition: foreignkeyconstraint.cpp:409
UMLForeignKeyConstraint::sigReferencedEntityChanged
void sigReferencedEntityChanged()
UMLForeignKeyConstraint::m_AttributeMap
QMap< UMLEntityAttribute *, UMLEntityAttribute * > m_AttributeMap
Definition: foreignkeyconstraint.h:114
UMLForeignKeyConstraint::~UMLForeignKeyConstraint
virtual ~UMLForeignKeyConstraint()
Definition: foreignkeyconstraint.cpp:83
UMLForeignKeyConstraint::setReferencedEntity
void setReferencedEntity(UMLEntity *ent)
Definition: foreignkeyconstraint.cpp:336
UMLForeignKeyConstraint::m_pReferencedEntityID
Uml::ID::Type m_pReferencedEntityID
Used to resolve forward references to UMLEntity.
Definition: foreignkeyconstraint.h:98
UMLForeignKeyConstraint::slotReferencedEntityChanged
void slotReferencedEntityChanged()
Definition: foreignkeyconstraint.cpp:358
UMLForeignKeyConstraint::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: foreignkeyconstraint.cpp:91
UMLForeignKeyConstraint::toString
QString toString(Uml::SignatureType::Enum sig=Uml::SignatureType::NoSig, bool withStereotype=false)
Definition: foreignkeyconstraint.cpp:121
UMLForeignKeyConstraint::getUpdateAction
UpdateDeleteAction getUpdateAction() const
Definition: foreignkeyconstraint.cpp:425
UMLForeignKeyConstraint::UMLForeignKeyConstraint
UMLForeignKeyConstraint(UMLObject *parent, const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: foreignkeyconstraint.cpp:30
UMLForeignKeyConstraint::hasEntityAttributePair
bool hasEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr) const
Definition: foreignkeyconstraint.cpp:257
UMLForeignKeyConstraint::addEntityAttributePair
bool addEntityAttributePair(UMLEntityAttribute *pAttr, UMLEntityAttribute *rAttr)
Definition: foreignkeyconstraint.cpp:185
UMLForeignKeyConstraint::clone
virtual UMLObject * clone() const
Definition: foreignkeyconstraint.cpp:108
UMLForeignKeyConstraint::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent=0)
Definition: foreignkeyconstraint.cpp:173
UMLForeignKeyConstraint::load1
bool load1(QDomElement &element)
Definition: foreignkeyconstraint.cpp:271
UMLForeignKeyConstraint::m_UpdateAction
UpdateDeleteAction m_UpdateAction
What to do on Update of referenced attributes.
Definition: foreignkeyconstraint.h:116
UMLForeignKeyConstraint::resolveRef
bool resolveRef()
Definition: foreignkeyconstraint.cpp:376
UMLForeignKeyConstraint::UpdateDeleteAction
UpdateDeleteAction
Definition: foreignkeyconstraint.h:42
UMLForeignKeyConstraint::uda_NoAction
@ uda_NoAction
Definition: foreignkeyconstraint.h:42
UMLForeignKeyConstraint::uda_Cascade
@ uda_Cascade
Definition: foreignkeyconstraint.h:44
UMLForeignKeyConstraint::uda_Restrict
@ uda_Restrict
Definition: foreignkeyconstraint.h:43
UMLForeignKeyConstraint::uda_SetDefault
@ uda_SetDefault
Definition: foreignkeyconstraint.h:46
UMLForeignKeyConstraint::uda_SetNull
@ uda_SetNull
Definition: foreignkeyconstraint.h:45
UMLForeignKeyConstraint::getDeleteAction
UpdateDeleteAction getDeleteAction() const
Definition: foreignkeyconstraint.cpp:417
UMLForeignKeyConstraint::m_ReferencedEntity
UMLEntity * m_ReferencedEntity
The UMLEntity that this foreign key references.
Definition: foreignkeyconstraint.h:109
UMLForeignKeyConstraint::operator==
bool operator==(const UMLForeignKeyConstraint &rhs) const
Definition: foreignkeyconstraint.cpp:69
UMLForeignKeyConstraint::saveToXMI1
void saveToXMI1(QXmlStreamWriter &writer)
Definition: foreignkeyconstraint.cpp:147
UMLForeignKeyConstraint::m_pEntityAttributeIDMap
QMap< UMLEntityAttribute *, Uml::ID::Type > m_pEntityAttributeIDMap
Definition: foreignkeyconstraint.h:105
UMLForeignKeyConstraint::m_DeleteAction
UpdateDeleteAction m_DeleteAction
What to do on Deletion of referenced attributes.
Definition: foreignkeyconstraint.h:117
UMLForeignKeyConstraint::setUpdateAction
void setUpdateAction(UpdateDeleteAction uda)
Definition: foreignkeyconstraint.cpp:441
UMLForeignKeyConstraint::removeEntityAttributePair
bool removeEntityAttributePair(UMLEntityAttribute *pAttr)
Definition: foreignkeyconstraint.cpp:244
UMLObject
The base class for UML objects.
Definition: umlobject.h:75
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
entityconstraint.h
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:387
Uml::ID::Type
std::string Type
Definition: basictypes.h:385
Uml::SignatureType::Enum
Enum
Definition: basictypes.h:174
Uml::SignatureType::NoSig
@ NoSig
Definition: basictypes.h:175