Commit 628a6cf7 authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

Followup to commit 3ded4560 for loading UML2/XMI2 files implements findings

from loading https://bugs.kde.org/attachment.cgi?id=85894 (bug 332612)

umbrello/enum.cpp function load() :
- Add decoding of UML2 tag "ownedLiteral".

umbrello/object_factory.cpp function makeObjectFromXMI() :
- Add decoding of UML2 tag "generalization".

umbrello/association.cpp function load() :
- Add decoding of UML2 generalization attribute "general".

CCBUG:56184
parent bbf4f903
......@@ -217,8 +217,22 @@ bool UMLAssociation::load(QDomElement & element)
m_AssocType == Uml::AssociationType::Realization ||
m_AssocType == Uml::AssociationType::Dependency ||
m_AssocType == Uml::AssociationType::Child2Category ||
m_AssocType == Uml::AssociationType::Category2Parent
) {
m_AssocType == Uml::AssociationType::Category2Parent) {
QString general = element.attribute("general", "");
if (!general.isEmpty()) {
UMLClassifier *owningClassifier = dynamic_cast<UMLClassifier*>(m_pUMLPackage);
if (owningClassifier == NULL){
uWarning() << "Cannot load UML2 generalization: m_pUMLPackage is expected "
<< "to be the owning classifier (=client)";
return false;
}
m_pRole[RoleType::A]->setObject(owningClassifier);
m_pRole[RoleType::B]->setSecondaryId(general); // defer resolution to resolveRef()
owningClassifier->addAssociationEnd(this);
m_pUMLPackage = m_pUMLPackage->umlPackage(); // reparent
m_pUMLPackage->addObject(this);
return true;
}
for (unsigned r = RoleType::A; r <= RoleType::B; ++r) {
const QString fetch = (m_AssocType == Uml::AssociationType::Generalization ?
r == RoleType::A ? "child" : "parent"
......
......@@ -261,6 +261,7 @@ bool UMLEnum::load(QDomElement& element)
QDomElement tempElement = node.toElement();
QString tag = tempElement.tagName();
if (UMLDoc::tagEq(tag, "EnumerationLiteral") ||
UMLDoc::tagEq(tag, "ownedLiteral") ||
UMLDoc::tagEq(tag, "EnumLiteral")) { // for backward compatibility
UMLEnumLiteral* pEnumLiteral = new UMLEnumLiteral(this);
if(!pEnumLiteral->loadFromXMI(tempElement)) {
......
......@@ -370,7 +370,8 @@ UMLObject* makeObjectFromXMI(const QString& xmiTag,
} else if (UMLDoc::tagEq(xmiTag, "Association") ||
UMLDoc::tagEq(xmiTag, "AssociationClass")) {
pObject = new UMLAssociation();
} else if (UMLDoc::tagEq(xmiTag, "Generalization")) {
} else if (UMLDoc::tagEq(xmiTag, "Generalization") ||
UMLDoc::tagEq(xmiTag, "generalization")) {
pObject = new UMLAssociation(Uml::AssociationType::Generalization);
} else if (UMLDoc::tagEq(xmiTag, "Realization") ||
UMLDoc::tagEq(xmiTag, "Abstraction")) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment