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

entity.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) 2003-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef ENTITY_H
12 #define ENTITY_H
13
14 #include "classifier.h"
15
16 // forward declarations
17 class UMLEntityAttribute;
18 class UMLEntityConstraint;
19 class UMLUniqueConstraint;
20 class UMLForeignKeyConstraint;
21 class UMLCheckConstraint;
22 class UMLEntityAttributeList;
23
34 class UMLEntity : public UMLClassifier
35 {
36 Q_OBJECT
37 public:
38 explicit UMLEntity(const QString& name = QString(), Uml::ID::Type id = Uml::ID::None);
39 virtual ~UMLEntity();
40
41 bool operator==(const UMLEntity& rhs) const;
42
43 virtual void copyInto(UMLObject *lhs) const;
44
45 virtual UMLObject* clone() const;
46
47 virtual UMLAttribute* createAttribute(const QString &name = QString(),
48 UMLObject *type = 0, Uml::Visibility::Enum vis = Uml::Visibility::Private,
49 const QString &init = QString());
50
51 UMLUniqueConstraint* createUniqueConstraint(const QString &name = QString());
52 UMLForeignKeyConstraint* createForeignKeyConstraint(const QString &name = QString());
53 UMLCheckConstraint* createCheckConstraint(const QString &name = QString());
54
55 UMLObject* addEntityAttribute(const QString &name, Uml::ID::Type id = Uml::ID::None);
56 bool addEntityAttribute(UMLEntityAttribute* att, IDChangeLog* log = 0);
57 bool addEntityAttribute(UMLEntityAttribute* att, int position);
58
59 int removeEntityAttribute(UMLClassifierListItem* att);
60
61 void signalEntityAttributeRemoved(UMLClassifierListItem *eattr);
62
63 int entityAttributes() ;
64
65 bool setAsPrimaryKey(UMLUniqueConstraint* uconstr);
66 void unsetPrimaryKey();
67 bool hasPrimaryKey() const;
68 bool isPrimaryKey(UMLUniqueConstraint* uConstr) const;
69
70 bool addConstraint(UMLEntityConstraint* constr);
71 bool removeConstraint(UMLEntityConstraint* constr);
72
73 virtual bool resolveRef();
74
75 virtual void saveToXMI1(QDomDocument& qDoc, QDomElement& qElement);
76
77 UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const;
78
79 UMLEntityAttributeList getEntityAttributes() const;
80
81 virtual UMLClassifierListItem* makeChildObject(const QString& xmiTag);
82
83 private slots:
84 void slotEntityAttributeRemoved(UMLClassifierListItem*);
85
86 signals:
87 void entityAttributeAdded(UMLClassifierListItem*);
88 void entityAttributeRemoved(UMLClassifierListItem*);
89 void entityConstraintAdded(UMLClassifierListItem*);
90 void entityConstraintRemoved(UMLClassifierListItem*);
91
92 protected:
93 bool load1(QDomElement& element);
94
95 private:
96
103 UMLUniqueConstraint* m_PrimaryKey;
104
105 };
106
107 #endif // ENTITY_H
108
UMLObject::id
virtual Uml::ID::Type id() const
Definition: umlobject.cpp:425
UMLEntity
Non-graphical Information for an Entity.
Definition: entity.h:35
UMLObject::ObjectType
ObjectType
Definition: umlobject.h:80
UMLObject::ot_EntityConstraint
@ ot_EntityConstraint
Definition: umlobject.h:104
UMLEntity::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: entity.cpp:70
checkconstraint.h
umluniqueconstraintdialog.h
UMLEntity::saveToXMI1
virtual void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: entity.cpp:437
UMLObject::ot_CheckConstraint
@ ot_CheckConstraint
Definition: umlobject.h:107
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
UMLEntity::hasPrimaryKey
bool hasPrimaryKey() const
Definition: entity.cpp:561
UMLObject::asUMLClassifierListItem
UMLClassifierListItem * asUMLClassifierListItem()
Definition: umlobject.cpp:1310
UMLCanvasObject::uniqChildName
virtual QString uniqChildName(const UMLObject::ObjectType type, const QString &prefix=QString())
Definition: umlcanvasobject.cpp:180
UMLEntity::~UMLEntity
virtual ~UMLEntity()
Definition: entity.cpp:53
entity.h
UMLEntity::createAttribute
virtual UMLAttribute * createAttribute(const QString &name=QString(), UMLObject *type=0, Uml::Visibility::Enum vis=Uml::Visibility::Private, const QString &init=QString())
Definition: entity.cpp:100
UMLClassifier::getFilteredList
virtual UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: classifier.cpp:998
UMLObject::ot_ForeignKeyConstraint
@ ot_ForeignKeyConstraint
Definition: umlobject.h:106
UMLEntity::removeConstraint
bool removeConstraint(UMLEntityConstraint *constr)
Definition: entity.cpp:599
UMLEntity::operator==
bool operator==(const UMLEntity &rhs) const
Definition: entity.cpp:61
UMLObject::resolveRef
virtual bool resolveRef()
Definition: umlobject.cpp:739
UMLObject::ot_Entity
@ ot_Entity
Definition: umlobject.h:101
foreignkeyconstraint.h
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:353
UMLForeignKeyConstraint
Sets up Foreign Key entity constraint information.
Definition: foreignkeyconstraint.h:33
UMLEntity::signalEntityAttributeRemoved
void signalEntityAttributeRemoved(UMLClassifierListItem *eattr)
Definition: entity.cpp:401
umlentityconstraintlist.h
UMLEntity::addConstraint
bool addConstraint(UMLEntityConstraint *constr)
Definition: entity.cpp:576
UMLEntity::entityAttributeAdded
void entityAttributeAdded(UMLClassifierListItem *)
Definition: moc_entity.cpp:212
Uml::ID::toString
QString toString(const ID::Type &id)
Definition: basictypes.cpp:1263
UMLObject::emitModified
void emitModified()
Definition: umlobject.cpp:385
UMLEntity::makeChildObject
virtual UMLClassifierListItem * makeChildObject(const QString &xmiTag)
Definition: entity.cpp:712
UMLUniqueConstraint::removeEntityAttribute
bool removeEntityAttribute(UMLEntityAttribute *attr)
Definition: uniqueconstraint.cpp:278
umlentityattributedialog.h
UMLObject::umlParent
UMLObject * umlParent() const
Definition: umlobject.cpp:671
UMLEntityConstraint
Sets up entity constraint information.
Definition: entityconstraint.h:27
UMLEntity::getEntityAttributes
UMLEntityAttributeList getEntityAttributes() const
Definition: entity.cpp:692
UMLClassifier::resolveRef
virtual bool resolveRef()
Definition: classifier.cpp:691
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
UMLEntity::m_PrimaryKey
UMLUniqueConstraint * m_PrimaryKey
Definition: entity.h:103
UMLEntityAttributeDialog
Definition: umlentityattributedialog.h:32
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
UMLObject::asUMLEntityAttribute
UMLEntityAttribute * asUMLEntityAttribute()
Definition: umlobject.cpp:1314
UMLEntity::entityAttributeRemoved
void entityAttributeRemoved(UMLClassifierListItem *)
Definition: moc_entity.cpp:219
UMLObject::baseType
ObjectType baseType() const
Definition: umlobject.cpp:397
UMLEntity::removeEntityAttribute
int removeEntityAttribute(UMLClassifierListItem *att)
Definition: entity.cpp:373
UMLDoc::signalUMLObjectCreated
void signalUMLObjectCreated(UMLObject *o)
Definition: umldoc.cpp:1985
UMLObject::asUMLEntity
UMLEntity * asUMLEntity()
Definition: umlobject.cpp:1313
UMLObject::m_BaseType
ObjectType m_BaseType
objects type
Definition: umlobject.h:276
UMLEntity::load1
bool load1(QDomElement &element)
Definition: entity.cpp:458
UMLClassifier::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: classifier.cpp:642
IDChangeLog::removeChangeByNewID
void removeChangeByNewID(Uml::ID::Type OldID)
Definition: idchangelog.cpp:124
IDChangeLog
Definition: idchangelog.h:27
UMLCanvasObject::operator==
bool operator==(const UMLCanvasObject &rhs) const
Definition: umlcanvasobject.cpp:274
entityattribute.h
uniqueid.h
umlentityattributelist.h
UMLClassifier::findChildObjectById
virtual UMLObject * findChildObjectById(Uml::ID::Type id, bool considerAncestors=false)
Definition: classifier.cpp:546
UMLUniqueConstraint::hasEntityAttribute
bool hasEntityAttribute(UMLEntityAttribute *attr)
Definition: uniqueconstraint.cpp:226
UMLUniqueConstraintDialog
A dialog page to display unique constraint properties.
Definition: umluniqueconstraintdialog.h:36
uWarning
#define uWarning()
Definition: debug_utils.h:124
UMLForeignKeyConstraintDialog
A dialog page to display foreignkey constraint properties.
Definition: umlforeignkeyconstraintdialog.h:43
UMLEntity::createForeignKeyConstraint
UMLForeignKeyConstraint * createForeignKeyConstraint(const QString &name=QString())
Definition: entity.cpp:205
UMLObject::saveToXMI1
virtual void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: umlobject.cpp:834
UMLObject::save1
QDomElement save1(const QString &tag, QDomDocument &qDoc)
Definition: umlobject.cpp:845
i18n
#define i18n
Definition: main.cpp:39
UMLEntity::setAsPrimaryKey
bool setAsPrimaryKey(UMLUniqueConstraint *uconstr)
Definition: entity.cpp:512
UMLEntity::clone
virtual UMLObject * clone() const
Definition: entity.cpp:84
UMLObject::ot_EntityAttribute
@ ot_EntityAttribute
Definition: umlobject.h:102
UMLEntity::slotEntityAttributeRemoved
void slotEntityAttributeRemoved(UMLClassifierListItem *)
Definition: entity.cpp:623
uDebug
#define uDebug()
Definition: debug_utils.h:122
UMLObject::modified
void modified()
Definition: moc_umlobject.cpp:217
UMLEntity::createUniqueConstraint
UMLUniqueConstraint * createUniqueConstraint(const QString &name=QString())
Definition: entity.cpp:151
UMLEntity::getFilteredList
UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: entity.cpp:645
UMLObject::ot_UniqueConstraint
@ ot_UniqueConstraint
Definition: umlobject.h:105
MyProject\connect
connect()
Definition: namespaces-multiple.php:5
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:278
UMLDoc
Definition: umldoc.h:75
UMLAttribute
Sets up attribute information.
Definition: attribute.h:28
UMLCanvasObject::subordinates
UMLObjectList & subordinates() const
Definition: umlcanvasobject.h:80
UMLEntityAttributeList
Definition: umlentityattributelist.h:26
UMLEntity::resolveRef
virtual bool resolveRef()
Definition: entity.cpp:410
UMLEntity::UMLEntity
UMLEntity(const QString &name=QString(), Uml::ID::Type id=Uml::ID::None)
Definition: entity.cpp:41
UMLCanvasObject::findChildObject
virtual UMLObject * findChildObject(const QString &n, UMLObject::ObjectType t=UMLObject::ot_UMLObject)
Definition: umlcanvasobject.cpp:238
UniqueID::gen
Uml::ID::Type gen()
Definition: uniqueid.cpp:26
UMLDoc::tagEq
static bool tagEq(const QString &tag, const QString &pattern)
Definition: umldoc.cpp:3582
Uml::Visibility::Enum
Enum
Definition: basictypes.h:59
UMLClassifierListItemList
Definition: umlclassifierlistitemlist.h:27
UMLEntity::entityAttributes
int entityAttributes()
Definition: entity.cpp:392
classifier.h
UMLObject::asUMLUniqueConstraint
UMLUniqueConstraint * asUMLUniqueConstraint()
Definition: umlobject.cpp:1330
uniqueconstraint.h
UMLObject::loadFromXMI1
virtual bool loadFromXMI1(QDomElement &element)
Definition: umlobject.cpp:955
uml.h
UMLCheckConstraint
Sets up Check Constraint information for UMLEntities.
Definition: checkconstraint.h:26
UMLCheckConstraintDialog
A dialog page to display check constraint properties.
Definition: umlcheckconstraintdialog.h:31
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
debug_utils.h
UMLEntity::entityConstraintRemoved
void entityConstraintRemoved(UMLClassifierListItem *)
Definition: moc_entity.cpp:233
UMLEntity::addEntityAttribute
UMLObject * addEntityAttribute(const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: entity.cpp:305
UMLEntity::isPrimaryKey
bool isPrimaryKey(UMLUniqueConstraint *uConstr) const
Definition: entity.cpp:679
idchangelog.h
UMLEntity::createCheckConstraint
UMLCheckConstraint * createCheckConstraint(const QString &name=QString())
Definition: entity.cpp:254
UMLObject::init
void init()
Definition: umlobject.cpp:126
Uml::Visibility::Private
@ Private
Definition: basictypes.h:61
UMLEntityAttribute
Sets up entityattribute information.
Definition: entityattribute.h:26
umlcheckconstraintdialog.h
umlforeignkeyconstraintdialog.h
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1064
umldoc.h
UMLEntity::entityConstraintAdded
void entityConstraintAdded(UMLClassifierListItem *)
Definition: moc_entity.cpp:226
UMLUniqueConstraint
Sets up Unique entity constraint information.
Definition: uniqueconstraint.h:29
UMLEntity::unsetPrimaryKey
void unsetPrimaryKey()
Definition: entity.cpp:552