umbrello 26.07.70-c53146a 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

umlentity.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2003-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef ENTITY_H
7#define ENTITY_H
8
9#include "umlclassifier.h"
10
11// forward declarations
12 class UMLEntityAttribute;
13 class UMLEntityConstraint;
14 class UMLUniqueConstraint;
15 class UMLForeignKeyConstraint;
16 class UMLCheckConstraint;
17 class UMLEntityAttributeList;
18
29 class UMLEntity : public UMLClassifier
30{
31 Q_OBJECT
32 public:
33 explicit UMLEntity(const QString& name = QString(), Uml::ID::Type id = Uml::ID::None);
34 virtual ~UMLEntity();
35
36 bool operator==(const UMLEntity& rhs) const;
37
38 virtual void copyInto(UMLObject *lhs) const;
39
40 virtual UMLObject* clone() const;
41
42 virtual UMLAttribute* createAttribute(const QString &name = QString(),
43 UMLObject *type = nullptr, Uml::Visibility::Enum vis = Uml::Visibility::Private,
44 const QString &init = QString());
45
46 UMLUniqueConstraint* createUniqueConstraint(const QString &name = QString());
47 UMLForeignKeyConstraint* createForeignKeyConstraint(const QString &name = QString());
48 UMLCheckConstraint* createCheckConstraint(const QString &name = QString());
49
50 UMLObject* addEntityAttribute(const QString &name, Uml::ID::Type id = Uml::ID::None);
51 bool addEntityAttribute(UMLEntityAttribute *att, IDChangeLog *log = nullptr);
52 bool addEntityAttribute(UMLEntityAttribute* att, int position);
53
54 int removeEntityAttribute(UMLClassifierListItem* att);
55
56 void signalEntityAttributeRemoved(UMLClassifierListItem *eattr);
57
58 int entityAttributes() const;
59
60 bool setAsPrimaryKey(UMLUniqueConstraint* uconstr);
61 void unsetPrimaryKey();
62 bool hasPrimaryKey() const;
63 bool isPrimaryKey(const UMLUniqueConstraint* uConstr) const;
64
65 bool addConstraint(UMLEntityConstraint* constr);
66 bool removeConstraint(UMLEntityConstraint* constr);
67
68 virtual bool resolveRef();
69
70 virtual void saveToXMI(QXmlStreamWriter& writer);
71
72 UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const;
73
74 UMLEntityAttributeList getEntityAttributes() const;
75
76 virtual UMLClassifierListItem* makeChildObject(const QString& xmiTag);
77
78 private Q_SLOTS:
79 void slotEntityAttributeRemoved(UMLClassifierListItem*);
80
81Q_SIGNALS:
82 void entityAttributeAdded(UMLClassifierListItem*);
83 void entityAttributeRemoved(UMLClassifierListItem*);
84 void entityConstraintAdded(UMLClassifierListItem*);
85 void entityConstraintRemoved(UMLClassifierListItem*);
86
87 protected:
88 bool load1(QDomElement& element);
89
90 private:
91
98 UMLUniqueConstraint* m_PrimaryKey;
99
100};
101
102#endif // ENTITY_H
103
IDChangeLog
Definition: idchangelog.h:22
UMLAttribute
Sets up attribute information.
Definition: umlattribute.h:23
UMLCheckConstraint
Sets up Check Constraint information for UMLEntities.
Definition: umlcheckconstraint.h:21
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: umlclassifier.h:35
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: umlclassifierlistitem.h:25
UMLClassifierListItemList
Definition: umlclassifierlistitemlist.h:22
UMLEntityAttribute
Sets up entityattribute information.
Definition: umlentityattribute.h:21
UMLEntityAttributeList
Definition: umlentityattributelist.h:20
UMLEntityConstraint
Sets up entity constraint information.
Definition: umlentityconstraint.h:22
UMLEntity
Non-graphical Information for an Entity.
Definition: umlentity.h:30
UMLEntity::~UMLEntity
virtual ~UMLEntity()
Definition: umlentity.cpp:50
UMLEntity::operator==
bool operator==(const UMLEntity &rhs) const
Definition: umlentity.cpp:58
UMLEntity::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: umlentity.cpp:67
UMLEntity::createAttribute
virtual UMLAttribute * createAttribute(const QString &name=QString(), UMLObject *type=nullptr, Uml::Visibility::Enum vis=Uml::Visibility::Private, const QString &init=QString())
Definition: umlentity.cpp:97
UMLEntity::createForeignKeyConstraint
UMLForeignKeyConstraint * createForeignKeyConstraint(const QString &name=QString())
Definition: umlentity.cpp:202
UMLEntity::addEntityAttribute
UMLObject * addEntityAttribute(const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: umlentity.cpp:302
UMLEntity::load1
bool load1(QDomElement &element)
Definition: umlentity.cpp:457
UMLEntity::slotEntityAttributeRemoved
void slotEntityAttributeRemoved(UMLClassifierListItem *)
Definition: umlentity.cpp:625
UMLEntity::entityAttributeRemoved
void entityAttributeRemoved(UMLClassifierListItem *)
UMLEntity::entityAttributes
int entityAttributes() const
Definition: umlentity.cpp:389
UMLEntity::clone
virtual UMLObject * clone() const
Definition: umlentity.cpp:81
UMLEntity::entityAttributeAdded
void entityAttributeAdded(UMLClassifierListItem *)
UMLEntity::unsetPrimaryKey
void unsetPrimaryKey()
Definition: umlentity.cpp:554
UMLEntity::removeEntityAttribute
int removeEntityAttribute(UMLClassifierListItem *att)
Definition: umlentity.cpp:370
UMLEntity::addConstraint
bool addConstraint(UMLEntityConstraint *constr)
Definition: umlentity.cpp:578
UMLEntity::createUniqueConstraint
UMLUniqueConstraint * createUniqueConstraint(const QString &name=QString())
Definition: umlentity.cpp:148
UMLEntity::getEntityAttributes
UMLEntityAttributeList getEntityAttributes() const
Definition: umlentity.cpp:693
UMLEntity::entityConstraintAdded
void entityConstraintAdded(UMLClassifierListItem *)
UMLEntity::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition: umlentity.cpp:435
UMLEntity::isPrimaryKey
bool isPrimaryKey(const UMLUniqueConstraint *uConstr) const
Definition: umlentity.cpp:680
UMLEntity::makeChildObject
virtual UMLClassifierListItem * makeChildObject(const QString &xmiTag)
Definition: umlentity.cpp:713
UMLEntity::entityConstraintRemoved
void entityConstraintRemoved(UMLClassifierListItem *)
UMLEntity::createCheckConstraint
UMLCheckConstraint * createCheckConstraint(const QString &name=QString())
Definition: umlentity.cpp:251
UMLEntity::resolveRef
virtual bool resolveRef()
Definition: umlentity.cpp:407
UMLEntity::getFilteredList
UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: umlentity.cpp:647
UMLEntity::setAsPrimaryKey
bool setAsPrimaryKey(UMLUniqueConstraint *uconstr)
Definition: umlentity.cpp:514
UMLEntity::m_PrimaryKey
UMLUniqueConstraint * m_PrimaryKey
Definition: umlentity.h:98
UMLEntity::signalEntityAttributeRemoved
void signalEntityAttributeRemoved(UMLClassifierListItem *eattr)
Definition: umlentity.cpp:398
UMLEntity::removeConstraint
bool removeConstraint(UMLEntityConstraint *constr)
Definition: umlentity.cpp:601
UMLEntity::hasPrimaryKey
bool hasPrimaryKey() const
Definition: umlentity.cpp:563
UMLForeignKeyConstraint
Sets up Foreign Key entity constraint information.
Definition: umlforeignkeyconstraint.h:28
UMLObject
The base class for UML objects.
Definition: umlobject.h:70
UMLObject::ObjectType
ObjectType
Definition: umlobject.h:76
UMLObject::init
void init()
Definition: umlobject.cpp:122
UMLObject::name
QString name() const
Definition: umlobject.cpp:207
UMLUniqueConstraint
Sets up Unique entity constraint information.
Definition: umluniqueconstraint.h:24
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::Visibility::Enum
Enum
Definition: basictypes.h:45
Uml::Visibility::Private
@ Private
Definition: basictypes.h:47
umlclassifier.h