umbrello: umbrello/uml1model/entity.h Source File

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
IDChangeLog
Definition: idchangelog.h:27
UMLAttribute
Sets up attribute information.
Definition: attribute.h:28
UMLCheckConstraint
Sets up Check Constraint information for UMLEntities.
Definition: checkconstraint.h:26
UMLClassifierListItemList
Definition: umlclassifierlistitemlist.h:27
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
UMLEntityAttributeList
Definition: umlentityattributelist.h:26
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
UMLEntity::~UMLEntity
virtual ~UMLEntity()
Definition: entity.cpp:53
UMLEntity::operator==
bool operator==(const UMLEntity &rhs) const
Definition: entity.cpp:61
UMLEntity::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: entity.cpp:70
UMLEntity::saveToXMI1
virtual void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: entity.cpp:437
UMLEntity::createForeignKeyConstraint
UMLForeignKeyConstraint * createForeignKeyConstraint(const QString &name=QString())
Definition: entity.cpp:205
UMLEntity::addEntityAttribute
UMLObject * addEntityAttribute(const QString &name, Uml::ID::Type id=Uml::ID::None)
Definition: entity.cpp:305
UMLEntity::load1
bool load1(QDomElement &element)
Definition: entity.cpp:458
UMLEntity::slotEntityAttributeRemoved
void slotEntityAttributeRemoved(UMLClassifierListItem *)
Definition: entity.cpp:623
UMLEntity::entityAttributeRemoved
void entityAttributeRemoved(UMLClassifierListItem *)
UMLEntity::UMLEntity
UMLEntity(const QString &name=QString(), Uml::ID::Type id=Uml::ID::None)
Definition: entity.cpp:41
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
UMLEntity::clone
virtual UMLObject * clone() const
Definition: entity.cpp:84
UMLEntity::entityAttributeAdded
void entityAttributeAdded(UMLClassifierListItem *)
UMLEntity::entityAttributes
int entityAttributes()
Definition: entity.cpp:392
UMLEntity::unsetPrimaryKey
void unsetPrimaryKey()
Definition: entity.cpp:552
UMLEntity::isPrimaryKey
bool isPrimaryKey(UMLUniqueConstraint *uConstr) const
Definition: entity.cpp:679
UMLEntity::removeEntityAttribute
int removeEntityAttribute(UMLClassifierListItem *att)
Definition: entity.cpp:373
UMLEntity::addConstraint
bool addConstraint(UMLEntityConstraint *constr)
Definition: entity.cpp:576
UMLEntity::createUniqueConstraint
UMLUniqueConstraint * createUniqueConstraint(const QString &name=QString())
Definition: entity.cpp:151
UMLEntity::getEntityAttributes
UMLEntityAttributeList getEntityAttributes() const
Definition: entity.cpp:692
UMLEntity::entityConstraintAdded
void entityConstraintAdded(UMLClassifierListItem *)
UMLEntity::makeChildObject
virtual UMLClassifierListItem * makeChildObject(const QString &xmiTag)
Definition: entity.cpp:712
UMLEntity::entityConstraintRemoved
void entityConstraintRemoved(UMLClassifierListItem *)
UMLEntity::createCheckConstraint
UMLCheckConstraint * createCheckConstraint(const QString &name=QString())
Definition: entity.cpp:254
UMLEntity::resolveRef
virtual bool resolveRef()
Definition: entity.cpp:410
UMLEntity::getFilteredList
UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: entity.cpp:645
UMLEntity::setAsPrimaryKey
bool setAsPrimaryKey(UMLUniqueConstraint *uconstr)
Definition: entity.cpp:512
UMLEntity::m_PrimaryKey
UMLUniqueConstraint * m_PrimaryKey
Definition: entity.h:103
UMLEntity::signalEntityAttributeRemoved
void signalEntityAttributeRemoved(UMLClassifierListItem *eattr)
Definition: entity.cpp:401
UMLEntity::removeConstraint
bool removeConstraint(UMLEntityConstraint *constr)
Definition: entity.cpp:599
UMLEntity::hasPrimaryKey
bool hasPrimaryKey() const
Definition: entity.cpp:561
UMLForeignKeyConstraint
Sets up Foreign Key entity constraint information.
Definition: foreignkeyconstraint.h:33
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
UMLObject::ObjectType
ObjectType
Definition: umlobject.h:80
UMLObject::init
void init()
Definition: umlobject.cpp:126
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
UMLUniqueConstraint
Sets up Unique entity constraint information.
Definition: uniqueconstraint.h:29
classifier.h
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:353
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
Uml::Visibility::Enum
Enum
Definition: basictypes.h:59
Uml::Visibility::Private
@ Private
Definition: basictypes.h:61