Version: (using KDE Devel) Installed from: Compiled sources Acceptance of umbrello could be helped if we offered an import facility for Rose petal files. One way of achieving this would be to use a standalone converter, such as http://crazybeans.sourceforge.net/ which already has an XMI generator. The generator would need to be expanded to also convert the diagram information to the umbrello specific format (the <diagrams> in the <XMI.extension> tag.)
What's a rose petal file? Is it just an XMI-according-to-rational UML file?
"Petal" file is the Rose name for "model" file, see for example http://xmlmodeling.com/book/examples/AppendixC/Bibliography.mdl
Crazybeans seems to be very sensitive to the exact version of Rose MDL file used and crashes more often than not. A simpler way forward might be the Unisys XMI plugin for Rose, ftp://www6.software.ibm.com/software/developer/library/rational/2834/Rose/RoseXMLTools1.3.6.01.zip the downside being that it is a Win32 app. Anyway, I tried importing the XMI produced by this converter and the results are promising. The biggest problem remains the loss of the diagram info. For further details see #56184.
Maybe we can steal code from, or even work together with: http://bouml.free.fr The Rose model import of v2.0 works quite well but is still missing the diagrams.
SVN commit 503042 by okellogg: Rose import, take 1: Define an internal representation (the PetalNode) and parse MDL files into this representation. Up next: Walk the PetalNode tree for building Umbrello objects. CCBUG:81364 M +2 -0 Makefile.am A import_rose.cpp [License: GPL (v2+)] A import_rose.h [License: no copyright] A petalnode.cpp [License: GPL (v2+)] A petalnode.h [License: GPL (v2+)] M +5 -1 uml.cpp M +5 -1 umldoc.cpp --- branches/KDE/3.5/kdesdk/umbrello/umbrello/Makefile.am #503041:503042 @@ -51,6 +51,7 @@ kplayerslideraction.cpp \ hierarchicalcodeblock.cpp \ idlimport.cpp \ +import_rose.cpp \ import_utils.cpp \ infowidget.cpp \ javaimport.cpp \ @@ -72,6 +73,7 @@ ownedhierarchicalcodeblock.cpp \ package.cpp \ packagewidget.cpp \ +petalnode.cpp \ plugin.cpp \ pluginloader.cpp \ pythonimport.cpp \ --- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #503041:503042 @@ -682,7 +682,11 @@ } else { KURL url=KFileDialog::getOpenURL(":open-umbrello-file", - i18n("*.xmi *.xmi.tgz *.xmi.tar.bz2|All Supported Files (*.xmi, *.xmi.tgz, *.xmi.tar.bz2)\n*.xmi|Uncompressed XMI Files (*.xmi)\n*.xmi.tgz|Gzip Compressed XMI Files (*.xmi.tgz)\n*.xmi.tar.bz2|Bzip2 Compressed XMI Files (*.xmi.tar.bz2)"), this, i18n("Open File")); + i18n("*.xmi *.xmi.tgz *.xmi.tar.bz2 *.mdl|All Supported Files (*.xmi, *.xmi.tgz, *.xmi.tar.bz2, *.mdl)\n" + "*.xmi|Uncompressed XMI Files (*.xmi)\n" + "*.xmi.tgz|Gzip Compressed XMI Files (*.xmi.tgz)\n" + "*.xmi.tar.bz2|Bzip2 Compressed XMI Files (*.xmi.tar.bz2)\n" + "*.mdl|Rose model files"), this, i18n("Open File")); if(!url.isEmpty()) { if(m_doc->openDocument(url)) fileOpenRecent->addURL( url ); --- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #503041:503042 @@ -60,6 +60,7 @@ #include "stereotype.h" #include "classifierlistitem.h" #include "object_factory.h" +#include "import_rose.h" #include "model_utils.h" #include "widget_utils.h" #include "uml.h" @@ -496,7 +497,10 @@ newDocument(); return false; } - status = loadFromXMI( file, ENC_UNKNOWN ); + if (filetype.endsWith(".mdl")) + status = Import_Rose::loadFromMDL(file); + else + status = loadFromXMI( file, ENC_UNKNOWN ); } file.close();
SVN commit 503608 by okellogg: petalTree2Uml(): New. Start making Umbrello objects from the PetalNode tree. CCBUG:81364 M +1 -0 Makefile.am M +27 -30 import_rose.cpp M +14 -0 petalnode.cpp M +10 -1 petalnode.h A petaltree2uml.cpp [License: GPL (v2+)] A petaltree2uml.h [License: GPL (v2+)] --- branches/KDE/3.5/kdesdk/umbrello/umbrello/Makefile.am #503607:503608 @@ -74,6 +74,7 @@ package.cpp \ packagewidget.cpp \ petalnode.cpp \ +petaltree2uml.cpp \ plugin.cpp \ pluginloader.cpp \ pythonimport.cpp \ --- branches/KDE/3.5/kdesdk/umbrello/umbrello/import_rose.cpp #503607:503608 @@ -23,6 +23,7 @@ #include <kdebug.h> // app includes #include "petalnode.h" +#include "petaltree2uml.h" namespace Import_Rose { @@ -37,9 +38,17 @@ // counter indicating how many additional node closings // have been seen. -QString comment; // comment buffer - uint linum; // line number +QString g_methodName; +void methodName(QString m) { + g_methodName = m; +} +/** + * Auxiliary function for diagnostics: Return current location. + */ +QString loc() { + return "Import_Rose::" + g_methodName + " line " + linum + ": "; +} /** * Split a line into lexemes. @@ -96,18 +105,13 @@ return false; if (tokens.last() == ")") { // For a single closing parenthesis, we just return true. - // But if there are more closing parentheses, we need to set the - // seenClosure for each corresponding scope to true. + // But if there are more closing parentheses, we need to increment + // nClosures for each scope. tokens.pop_back(); while (tokens.count() && tokens.last() == ")") { nClosures++; tokens.pop_back(); } - /* - if (tokens.last() == ")") { - kdError() << "Import_Rose::checkClosing:" << linum - << " too many ')' in file " << endl; - } */ return true; } return false; @@ -161,32 +165,29 @@ QString collectVerbatimText(QTextStream& stream) { QString result; - const QRegExp closingParenth("^\\s*\\)"); QString line; + methodName("collectVerbatimText"); while ((line = stream.readLine()) != QString::null) { linum++; line = line.stripWhiteSpace(); if (line.isEmpty() || line.startsWith(")")) break; if (line[0] != '|') { - kdError() << "Import_Rose::collectVerbatimText " << linum - << ": expecting '|' at start of verbatim text" << endl; + kdError() << loc() << "expecting '|' at start of verbatim text" << endl; return QString::null; } else { result += line.mid(1) + "\n"; } } if (line == QString::null) { - kdError() << "Import_Rose::collectVerbatimText " << linum - << ": premature EOF" << endl; + kdError() << loc() << "premature EOF" << endl; return QString::null; } if (! line.isEmpty()) { for (uint i = 0; i < line.length(); i++) { const QChar& clParenth = line[i]; if (clParenth != ')') { - kdError() << "Import_Rose::collectVerbatimText " << linum - << ": expected ')', found: " << clParenth << endl; + kdError() << loc() << "expected ')', found: " << clParenth << endl; return QString::null; } nClosures++; @@ -216,6 +217,7 @@ * The line ending '\n' of each line is preserved. */ QString extractValue(QStringList& l, QTextStream& stream) { + methodName("extractValue"); if (l.count() == 0) return QString::null; if (l.first() == "(") @@ -232,8 +234,7 @@ } else { result = shift(l); if (l.first() != ")") { - kdError() << "Import_Rose::extractValue " << linum - << ": expecting closing parenthesis" << endl; + kdError() << loc() << "expecting closing parenthesis" << endl; return result; } l.pop_front(); @@ -253,10 +254,10 @@ * @return Pointer to the created PetalNode or NULL on error. */ PetalNode *readAttributes(QStringList initialArgs, QTextStream& stream) { + methodName("readAttributes"); if (initialArgs.count() == 0) { - kdError() << "Import_Rose::readAttributes " << linum - << ": firstLine is empty" << endl; - return false; + kdError() << loc() << "initialArgs is empty" << endl; + return NULL; } PetalNode::NodeType nt; QString type = shift(initialArgs); @@ -265,8 +266,7 @@ else if (type == "list") nt = PetalNode::nt_list; else { - kdError() << "Import_Rose::readAttributes " << linum - << ": unknown node type " << type << endl; + kdError() << loc() << "unknown node type " << type << endl; return NULL; } PetalNode *node = new PetalNode(nt); @@ -285,8 +285,7 @@ QString stringOrNodeOpener = shift(tokens); QString name; if (nt == PetalNode::nt_object && !stringOrNodeOpener.contains(QRegExp("^[A-Za-z]"))) { - kdError() << "Import_Rose::readAttributes " << linum - << ": unexpected line " << line << endl; + kdError() << loc() << "unexpected line " << line << endl; return NULL; } PetalNode::StringOrNode value; @@ -312,8 +311,8 @@ PetalNode::NameValue attr(QString::null, value); attrs.append(attr); if (tokens.count() && tokens.first() != ")") { - kdDebug() << "Import_Rose::readAttributes " << linum - << ": NYI - immediate list entry with more than one item" << endl; + kdDebug() << loc() + << "NYI - immediate list entry with more than one item" << endl; } if (checkClosing(tokens)) break; @@ -380,9 +379,7 @@ file.close(); if (root == NULL) return false; - // @todo traverse the PetalNode tree and create Umbrello model objects - // - return true; + return petalTree2Uml(root); } } --- branches/KDE/3.5/kdesdk/umbrello/umbrello/petalnode.cpp #503607:503608 @@ -27,6 +27,12 @@ return m_initialArgs; } +QString PetalNode::name() const { + if (m_initialArgs.count() == 0) + return QString::null; + return m_initialArgs.first(); +} + PetalNode::NameValueList PetalNode::attributes() const { return m_attributes; } @@ -45,3 +51,11 @@ m_attributes = vl; } +PetalNode::StringOrNode PetalNode::findAttribute(QString name) const { + for (uint i = 0; i < m_attributes.count(); i++) { + if (m_attributes[i].first == name) + return m_attributes[i].second; + } + return StringOrNode(); +} + --- branches/KDE/3.5/kdesdk/umbrello/umbrello/petalnode.h #503607:503608 @@ -49,7 +49,8 @@ QString string; PetalNode *node; StringOrNode() { node = 0; } - virtual ~StringOrNode() { /* if (node) delete node; */ } + virtual ~StringOrNode() { } + bool isEmpty() { return (string.isEmpty() && node == 0); } }; typedef QPair<QString, StringOrNode> NameValue; typedef QValueList<NameValue> NameValueList; @@ -62,11 +63,19 @@ // getters NodeType type() const; QStringList initialArgs() const; // name and other initial args + QString name() const; // convenience function: equal to initialArgs().first() NameValueList attributes() const; // setters //void setType(NodeType nt); see constructor void setInitialArgs(QStringList args); void setAttributes(NameValueList vl); + // utilities + /** + * Find an attribute by name. + * @return The value of the attribute. StringOrNode::isEmpty() returns true + * if the name could not be found. + */ + StringOrNode findAttribute(QString name) const; private: NodeType m_type; QStringList m_initialArgs;
SVN commit 511453 by okellogg: Import objects of the UseCase, Component, and Deployment View (management of the objects at the UMLDoc is TBD.) CCBUG:81364 M +125 -3 petaltree2uml.cpp --- branches/KDE/3.5/kdesdk/umbrello/umbrello/petaltree2uml.cpp #511452:511453 @@ -23,8 +23,13 @@ #include "operation.h" #include "association.h" #include "umlrole.h" +#include "usecase.h" +#include "component.h" +#include "node.h" #include "uml.h" #include "umldoc.h" +#include "umllistview.h" +#include "umllistviewitem.h" namespace Import_Rose { @@ -143,7 +148,7 @@ PetalNode *attributes = node->findAttribute(m_attributeTag).node; if (attributes == NULL) { #ifdef VERBOSE_DEBUGGING - kdDebug() << "umbrellify(" << name << "): no " << m_attributeTag << " found" + kdDebug() << "read(" << name << "): no " << m_attributeTag << " found" << endl; #endif return; @@ -153,7 +158,7 @@ PetalNode *attNode = attributeList[i].second.node; QStringList initialArgs = attNode->initialArgs(); if (attNode->name() != m_elementName) { - kdDebug() << "umbrellify(" << name << "): expecting " << m_elementName + kdDebug() << "read(" << name << "): expecting " << m_elementName << ", " << "found " << initialArgs[0] << endl; continue; } @@ -294,7 +299,7 @@ }; /** - * Create an Umbrello object from a PetalNode. + * Create an Umbrello object from a PetalNode of the Logical View. * * @return True for success. * Given a PetalNode for which the mapping to Umbrello is not yet @@ -441,6 +446,78 @@ return true; } +Uml::ListView_Type folderType(UMLListViewItem *parent) { + Uml::ListView_Type type = Uml::lvt_Unknown; + switch (parent->getType()) { + case Uml::lvt_Logical_View: + case Uml::lvt_Logical_Folder: + type = Uml::lvt_Logical_Folder; + break; + case Uml::lvt_UseCase_View: + case Uml::lvt_UseCase_Folder: + type = Uml::lvt_UseCase_Folder; + break; + case Uml::lvt_Component_View: + case Uml::lvt_Component_Folder: + type = Uml::lvt_Component_Folder; + break; + case Uml::lvt_Deployment_View: + case Uml::lvt_Deployment_Folder: + type = Uml::lvt_Deployment_Folder; + break; + default: + break; + } + return type; +} + +/** + * Create an Umbrello object from a PetalNode of the UseCase, Component, + * or Deployment View. + * + * @return True for success. + * Given a PetalNode for which the mapping to Umbrello is not yet + * implemented umbrellify() is a no-op but also returns true. + */ +bool umbrellify(PetalNode *node, UMLListViewItem *parent) { + if (node == NULL) { + kdError() << "umbrellify: node is NULL" << endl; + return false; + } + QStringList args = node->initialArgs(); + QString objType = args[0]; + QString name = clean(args[1]); + Uml::IDType id = quid(node); + + if (objType == "Class_Category") { + Uml::ListView_Type lvType = folderType(parent); + UMLListViewItem *item = new UMLListViewItem( parent, name, lvType, id ); + PetalNode *logical_models = node->findAttribute("logical_models").node; + if (logical_models == NULL) { + kdError() << "umbrellify: cannot find logical_models" << endl; + return false; + } + PetalNode::NameValueList atts = logical_models->attributes(); + for (uint i = 0; i < atts.count(); i++) { + umbrellify(atts[i].second.node, item); + } + } else if (objType == "UseCase") { + UMLUseCase *uc = new UMLUseCase(name, id); + UMLListViewItem *item = new UMLListViewItem(parent, name, Uml::lvt_UseCase, uc); + } else if (objType == "SubSystem") { + UMLComponent *comp = new UMLComponent(name, id); + UMLListViewItem *item = new UMLListViewItem(parent, name, Uml::lvt_Component, comp); + } else if (objType == "Processor" || objType == "Device") { + UMLNode *un = new UMLNode(name, id); + un->setStereotype(objType.lower()); + UMLListViewItem *item = new UMLListViewItem(parent, name, Uml::lvt_Node, un); + } else { + kdDebug() << "umbrellify: object type " << objType + << " is not yet implemented" << endl; + } + return true; +} + bool petalTree2Uml(PetalNode *root) { if (root == NULL) { kdError() << "petalTree2Uml: root is NULL" << endl; @@ -450,6 +527,7 @@ kdError() << "petalTree2Uml: expecting root name Design" << endl; return false; } + /********************************** import Logical View *************************************/ PetalNode *root_category = root->findAttribute("root_category").node; if (root_category == NULL) { kdError() << "petalTree2Uml: cannot find root_category" << endl; @@ -471,6 +549,50 @@ for (uint i = 0; i < atts.count(); i++) { umbrellify(atts[i].second.node); } + + /** Shorthand for UMLApp::app()->getListView() **/ + UMLListView *lv = UMLApp::app()->getListView(); + + /********************************** import Use Case View *************************************/ + PetalNode *root_usecase_package = root->findAttribute("root_usecase_package").node; + if (root_usecase_package) { + PetalNode *logical_models = root_usecase_package->findAttribute("logical_models").node; + if (logical_models == NULL) { + kdError() << "petalTree2Uml: cannot find logical_models of root_usecase_package" << endl; + return false; + } + PetalNode::NameValueList atts = logical_models->attributes(); + for (uint i = 0; i < atts.count(); i++) { + umbrellify(atts[i].second.node, lv->theUseCaseView()); + } + } + /********************************** import Component View ************************************/ + PetalNode *root_subsystem = root->findAttribute("root_subsystem").node; + if (root_subsystem) { + PetalNode *physical_models = root_subsystem->findAttribute("physical_models").node; + if (physical_models == NULL) { + kdError() << "petalTree2Uml: cannot find physical_models of root_subsystem" << endl; + return false; + } + PetalNode::NameValueList atts = physical_models->attributes(); + for (uint i = 0; i < atts.count(); i++) { + umbrellify(atts[i].second.node, lv->theComponentView()); + } + } + /********************************** import Deployment View ***********************************/ + PetalNode *process_structure = root->findAttribute("process_structure").node; + if (process_structure) { + PetalNode *ProcsNDevs = process_structure->findAttribute("ProcsNDevs").node; + if (ProcsNDevs == NULL) { + kdError() << "petalTree2Uml: cannot find ProcsNDevs of process_structure" << endl; + return false; + } + PetalNode::NameValueList atts = ProcsNDevs->attributes(); + for (uint i = 0; i < atts.count(); i++) { + umbrellify(atts[i].second.node, lv->theDeploymentView()); + } + } + /********************************** wrap up *************************************/ Import_Utils::assignUniqueIdOnCreation(true); umldoc->resolveTypes(); return true;
Support for loading separate .cat and .sub files is coming in a few days.
SVN commit 575645 by okellogg: New class UMLFolder gives folders a representation in the document. Change the document model to match the listview appearance: UMLDoc::m_objects is replaced by m_root, an array of modelviews with one element for each of the Logical, UseCase, Component, Deployment, and EntityRelationship models. This prepares for implementing the loading of Rose controlled units. Stuff known to need work: - Support for external folders is temporarily broken - On loading previous XMI files, the contents of user created folders appear okay in the listview but are not located inside the proper UMLFolder in the document - The Datatypes folder appears multiple times in the list view - Diagrams should appear in the XMI.extension of the respective UMLFolder CCBUG:87252 CCBUG:81364 M +2 -0 Makefile.am M +0 -4 artifact.h M +9 -5 association.cpp M +6 -5 classifier.cpp M +4 -6 clipboard/umldrag.cpp M +0 -1 codeimport/import_utils.cpp M +4 -6 dialogs/umloperationdialog.cpp M +4 -3 entity.cpp M +0 -5 enum.h A folder.cpp [License: GPL (v2+)] A folder.h [License: GPL (v2+)] M +9 -1 listpopupmenu.cpp M +7 -0 main.cpp M +2 -1 messagewidget.cpp M +149 -15 model_utils.cpp M +28 -4 model_utils.h M +47 -9 object_factory.cpp M +2 -6 object_factory.h M +6 -11 operation.cpp M +63 -32 package.cpp M +10 -11 package.h M +3 -1 uml.cpp M +230 -222 umldoc.cpp M +32 -20 umldoc.h M +676 -753 umllistview.cpp M +75 -107 umllistview.h M +67 -166 umllistviewitem.cpp M +3 -11 umllistviewitem.h M +63 -7 umlnamespace.h M +14 -46 umlobject.cpp M +1 -7 umlobject.h M +53 -54 umlview.cpp M +2 -1 umlwidget.cpp A uniqueid.cpp [License: no copyright] A uniqueid.h [License: GPL (v2+)] M +0 -3 usecase.h
SVN commit 579333 by okellogg: 1. Move ownership and basic management of UMLViews from UMLDoc to UMLFolder. This closes out the TODO mentioned in commit 575645, "Diagrams should appear in the XMI.extension of the respective UMLFolder". The only remaining TODO is "Support for external folders is temporarily broken". 2. Move convert_*() and typeIs*() utility functions from UMLListView to Model_Utils. CCBUG:81364 M +8 -7 clipboard/umlclipboard.cpp M +163 -6 folder.cpp M +56 -0 folder.h M +472 -1 model_utils.cpp M +79 -0 model_utils.h M +55 -82 umldoc.cpp M +1 -19 umldoc.h M +67 -521 umllistview.cpp M +0 -76 umllistview.h M +8 -8 umllistviewitem.cpp M +1 -1 umlobject.cpp M +5 -5 umlview.cpp
SVN commit 682168 by okellogg: handleControlledUnit(): New. To be fleshed out Real Soon Now. CCBUG:81364 M +33 -8 petaltree2uml.cpp --- trunk/KDE/kdesdk/umbrello/umbrello/petaltree2uml.cpp #682167:682168 @@ -304,6 +304,30 @@ }; /** + * Handle a controlled unit. + * + * @param node Pointer to the PetalNode which may contain a controlled unit + * @param name Name of the current node + * @param id QUID of the current node + * @param parentPkg Pointer to the current parent UMLPackage. + * @return True if the node actually contained a controlled unit. + */ +bool handleControlledUnit(PetalNode *node, QString name, Uml::IDType id, UMLPackage *parentPkg) { + if (node->findAttribute("is_unit").string != "TRUE") + return false; + bool is_loaded = (node->findAttribute("is_loaded").string != "FALSE"); + QString file_name = node->findAttribute("file_name").string; + if (file_name.isEmpty()) { + kError() << "handleControlledUnit(" << name + << "): attribute file_name not found (?)" << endl; + return true; + } + // To Be Continued. + + return true; +} + +/** * Create an Umbrello object from a PetalNode of the Logical View. * * @return True for success. @@ -324,15 +348,16 @@ UMLObject *o = Import_Utils::createUMLObject(Uml::ot_Package, name, parentPkg); o->setID(id); PetalNode *logical_models = node->findAttribute("logical_models").node; - if (logical_models == NULL) { - kError() << "umbrellify: cannot find logical_models" << endl; - return false; + if (logical_models) { + UMLPackage *localParent = static_cast<UMLPackage*>(o); + PetalNode::NameValueList atts = logical_models->attributes(); + for (int i = 0; i < atts.count(); i++) { + umbrellify(atts[i].second.node, localParent); + } + } else if (!handleControlledUnit(node, name, id, parentPkg)) { + kDebug() << "umbrellify: handling of " << objType << " " << name + << " is not yet implemented" << endl; } - UMLPackage *localParent = static_cast<UMLPackage*>(o); - PetalNode::NameValueList atts = logical_models->attributes(); - for (int i = 0; i < atts.count(); i++) { - umbrellify(atts[i].second.node, localParent); - } } else if (objType == "Class") { UMLObject *o = Import_Utils::createUMLObject(Uml::ot_Class, name, parentPkg);
Git commit a113a1be49ef43f0365d03c5a36b9c1776575f1e by Oliver Kellogg. Committed on 13/05/2014 at 20:26. Pushed by okellogg into branch 'master'. (In reply to comment #11) > handleControlledUnit(): New. To be fleshed out Real Soon Now. Real Soon Now has turned into 7 years... umbrello/petaltree2uml.{h,cpp} - Start fleshing out function handleControlledUnit - tested so far only using .cat file, not .sub file. - Remove duplicated function names in texts at uDebug() / uError() - At function petalTree2Uml add optional bool argument requireDesign defaulting to true. If requireDesign is false then: - Do not check for root->name() == "Design" - Do not attempt root->findAttribute("root_category"); instead, set root_category to root directly. - Do not call umldoc->setCurrentRoot(), the current root was already set by the loadFromMDL call on the .mdl file (with requireDesign = true.) - Do not call importView() for the UseCase, Component, or Deployment view. umbrello/import_rose.{h,cpp} - At function loadFromMDL add optional bool argument requireDesign defaulting to true. Pass requireDesign into call to petalTree2Uml. M +61 -40 umbrello/import_rose.cpp M +1 -1 umbrello/import_rose.h M +84 -37 umbrello/petaltree2uml.cpp M +1 -1 umbrello/petaltree2uml.h http://commits.kde.org/umbrello/a113a1be49ef43f0365d03c5a36b9c1776575f1e
Git commit 12615a59a115a4642f4f09168e50120b14b0f24e by Oliver Kellogg. Committed on 13/05/2014 at 23:13. Pushed by okellogg into branch 'master'. Continuation of support for Rose import of controlled units: umbrello/import_rose.{h,cpp} - At function loadFromMDL change argument "bool requireDesign" into "UMLPackage *parentPkg" defaulting to NULL. Pass parentPkg into call to petalTree2Uml. umbrello/petaltree2uml.{h,cpp} - In function handleControlledUnit pass parentPkg into call to loadFromMDL. - At function petalTree2Uml change argument "bool requireDesign" into "UMLPackage *parentPkg" defaulting to NULL. If parentPkg is non NULL then create an UMLObject::ot_Package with root->initialArgs()[1] as name and parentPkg as parent. Reassign parentPkg from the object created, and pass parentPkg into call to umbrellify. M +2 -2 umbrello/import_rose.cpp M +3 -1 umbrello/import_rose.h M +16 -7 umbrello/petaltree2uml.cpp M +2 -1 umbrello/petaltree2uml.h http://commits.kde.org/umbrello/12615a59a115a4642f4f09168e50120b14b0f24e
(In reply to comment #2) > "Petal" file is the Rose name for "model" file, > see for example > > http://xmlmodeling.com/book/examples/AppendixC/Bibliography.mdl the link is not valid anymore.
Created attachment 86694 [details] ATM.mdl from zip at http://www.rationalrose.com/models/atmexample.htm (In reply to comment #14) > [...] > > http://xmlmodeling.com/book/examples/AppendixC/Bibliography.mdl > the link is not valid anymore. ATM.mdl also shows duplications when loaded using current work/rational-rose-import branch. Compare with load on master: 1) Duplications do not happen on master 2) Classes go to their proper subpackages on master 3) Loading takes much less time on master (it feels like there might be some sort of unwarranted recursive loop in the load code of the branch)
(In reply to comment #15) > Created attachment 86694 [details] > ATM.mdl from zip at http://www.rationalrose.com/models/atmexample.htm > > (In reply to comment #14) > > [...] > > > http://xmlmodeling.com/book/examples/AppendixC/Bibliography.mdl > > the link is not valid anymore. > > ATM.mdl also shows duplications when loaded using current > work/rational-rose-import branch. Compare with load on master: > 1) Duplications do not happen on master > 2) Classes go to their proper subpackages on master > 3) Loading takes much less time on master (it feels like there might be some > sort of unwarranted recursive loop in the load code of the branch) I rebased the work/rational-rose-import branch against master and removed the "merge umbrellify..." for now
Created attachment 87324 [details] http://www.mec.ita.br/~glevson/arquivos/CE235/Take_Home_Test_Warm_Ups/2/PassiveClass.rtmdl As another test case, here is a Rose/RealTime model with a Processor in the Deployment. BTW, further example MDLs can be found at http://crazybeans.cvs.sourceforge.net/viewvc/crazybeans/CrazyBeans/examples/
(In reply to comment #17) > [...] > BTW, further example MDLs can be found at > http://crazybeans.cvs.sourceforge.net/viewvc/crazybeans/CrazyBeans/examples/ Actually, there's no lack of test cases: A Google search for "rose deployment physical_models procsndevs" yields a plethora of MDL files.
Git commit 9ba1d6c0088bb79d16e2fcd8ba6a52c3c2979273 by Oliver Kellogg. Committed on 22/06/2014 at 18:56. Pushed by okellogg into branch 'KDE/4.13'. umbrello/import_rose.{h,cpp} umbrello/petalnode.{h,cpp} umbrello/petaltree2uml.{h,cpp} - Make equal to master commit 8a1e776. M +124 -5 umbrello/import_rose.cpp M +6 -2 umbrello/import_rose.h M +69 -0 umbrello/petalnode.cpp M +6 -0 umbrello/petalnode.h M +463 -189 umbrello/petaltree2uml.cpp M +11 -1 umbrello/petaltree2uml.h http://commits.kde.org/umbrello/9ba1d6c0088bb79d16e2fcd8ba6a52c3c2979273
(In reply to comment #19) > Git commit 9ba1d6c0088bb79d16e2fcd8ba6a52c3c2979273 by Oliver Kellogg. > Committed on 22/06/2014 at 18:56. > Pushed by okellogg into branch 'KDE/4.13'. > [...] > - Make equal to master commit 8a1e776. Thanks to ground work initially done by Ralf Habacker on the work/rational-rose-import branch we have a rough translation of class, usecase, and component diagrams starting with version 2.13.3.
Created attachment 87335 [details] http://crazybeans.cvs.sourceforge.net/viewvc/crazybeans/CrazyBeans/examples/ComponentDiagram98.mdl (In reply to comment #17) > [...] > BTW, further example MDLs can be found at > http://crazybeans.cvs.sourceforge.net/viewvc/crazybeans/CrazyBeans/examples/ This test case contains multiple class diagrams and exposes a bug in the current import code: Only the last of the class diagrams actually show up.
Git commit 8449eba58239caad9db2d603197a624905915db2 by Oliver Kellogg. Committed on 24/06/2014 at 05:35. Pushed by okellogg into branch 'master'. (In reply to comment #21) > [...] > This test case contains multiple class diagrams and exposes a bug in the > current import code: > Only the last of the class diagrams actually show up. Here is the fix: umbrello/umllistview.cpp - In function slotDiagramCreated(), use return value from findUMLObject(scene->folder()) as the `parent' argument in call to UMLListViewItem constructor. - In function slotObjectCreated(), use return value from findUMLObject(object->umlPackage()) for `parentItem' instead of using determineParentItem(object). umbrello/widgets/widget_factory.cpp - In function createWidget() handle type UMLObject::ot_Folder alongside ot_Package. umbrello/import_rose.{h,cpp} - At function loadFromMDL() change return type to pointer-to-UMLPackage. On non NULL parentPkg return result from handleControlledUnit(); on NULL parentPkg return UMLDoc::m_root[Uml::ModelType::Logical]. umbrello/petaltree2uml.h - At function petalTree2Uml() change return type to pointer-to-UMLPackage. umbrello/petaltree2uml.{h,cpp} - At function handleControlledUnit() change return type to ptr-to-UMLPackage. Return object created for controlled unit. - New function diagramType() maps Rose diagram keyword to corresponding Uml::DiagramType::Enum. - In function umbrellify(), - At handling of Class_Category attribute logical_models and SubSystem attribute physical_models, for the non controlled-unit case add handling of attributes logical_presentations and physical_presentations. If unit_reference_list is non empty then create a UML object of type ot_Folder instead of ot_Package. - At handling of {Class,UseCase,Module_,Process_}Diagram employ function diagramType(). Use `parentPkg' cast to UMLFolder* as the rootFolder in call to umlDoc->createDiagram(). - At function petalTree2Uml(), - Choose attribute to find based on umlDoc->rootFolderType(Model_Utils::rootPackage(parentPkg)) : - For Uml::ModelType::Logical seek logical_models; - For Uml::ModelType::Component seek physical_models. - At definition of `atts' use the PetalNode::attributes() of the `models' found. - Return pointer to the UMLFolder which is created for the controlled unit. M +7 -5 umbrello/import_rose.cpp M +1 -1 umbrello/import_rose.h M +73 -39 umbrello/petaltree2uml.cpp M +1 -1 umbrello/petaltree2uml.h M +11 -2 umbrello/umllistview.cpp M +2 -1 umbrello/widgets/widget_factory.cpp http://commits.kde.org/umbrello/8449eba58239caad9db2d603197a624905915db2
(In reply to comment #21) > Created attachment 87335 [details] > http://crazybeans.cvs.sourceforge.net/viewvc/crazybeans/CrazyBeans/examples/ > ComponentDiagram98.mdl > > (In reply to comment #17) > > [...] > > BTW, further example MDLs can be found at > > http://crazybeans.cvs.sourceforge.net/viewvc/crazybeans/CrazyBeans/examples/ > http://crazybeans.cvs.sourceforge.net/viewvc/crazybeans/CrazyBeans/examples/JDK-12_01.mdl?revision=1.1&view=markup imports components wrongly into "Logical View" instead of "Component View"
(In reply to comment #23) > [...] > http://crazybeans.cvs.sourceforge.net/viewvc/crazybeans/CrazyBeans/examples/ > JDK-12_01.mdl?revision=1.1&view=markup imports components wrongly into > "Logical View" instead of "Component View" Thanks for noticing. This is fixed by commit e9b61b4 on master.
Git commit 97b727cb9824dc9e7216dca2c16a9f409fc7f95f by Ralf Habacker. Committed on 26/06/2014 at 15:00. Pushed by habacker into branch 'master'. Improve documentation fetch from petal nodes. - Add PetalNode::documention() to fetch documentation from petal files, which converts petal documentation format to umbrello. - Fetch documentation attribute from petal file for actor, class, use case, component, module and root view uml object types. M +17 -0 umbrello/petalnode.cpp M +1 -0 umbrello/petalnode.h M +6 -6 umbrello/petaltree2uml.cpp http://commits.kde.org/umbrello/97b727cb9824dc9e7216dca2c16a9f409fc7f95f
Created attachment 88433 [details] http://www.aixm.aero/gallery/content/public/AIXM51/AIXM-5-1-20100201-uml.zip While working on bug 338536 I notice that the class diagrams in this testcase are not loaded, and various related error messages are logged.
(In reply to Oliver Kellogg from comment #26) > > While working on bug 338536 I notice that the class diagrams in this > testcase are not loaded, and various related error messages are logged. Error messages pointing to problems in Umbrello not in the MDL file, of course.
Git commit f5c68f765948dc007367f986d9d56147dd751c63 by Oliver Kellogg. Committed on 26/08/2014 at 18:25. Pushed by okellogg into branch 'master'. Followup to commit c982099, "Reduce gratuitous filling of undo stack during import of Rose models" umbrello/petaltree2uml.cpp function umbrellify() - Use UMLObject::setStereotypeCmd() instead of UMLObject::setStereotype(). M +2 -2 umbrello/petaltree2uml.cpp http://commits.kde.org/umbrello/f5c68f765948dc007367f986d9d56147dd751c63
Git commit a060b1601eade02fe2a33b1d33913e7a23a875c9 by Oliver Kellogg. Committed on 29/08/2014 at 23:38. Pushed by okellogg into branch 'master'. Address http://bugs.kde.org/show_bug.cgi?id=81364#c26, > > While working on bug 338536 I notice that the class diagrams in this > testcase are not loaded, and various related error messages are logged. Umbrello has a concept of "folders" which are like packages but can additionally contain diagrams. Rational Rose does not make this distinction; only packages are used, and packages may contain diagrams. Umbrello did not support nesting folders inside packages, a case exposed by this model. Fixed as follows: umbrello/package.cpp function appendPackages() - Include objects of type ot_Folder in result list. umbrello/folder.cpp function findView(id) - Instead of iterating over m_objects, first recursively gather contained packages and folders using UMLPackage::appendPackages() and then iterate over the resulting list. CCMAIL: m.hounsell@acfr.usyd.edu.au M +3 -1 umbrello/folder.cpp M +3 -3 umbrello/package.cpp http://commits.kde.org/umbrello/a060b1601eade02fe2a33b1d33913e7a23a875c9
Not perfect (regarding diagrams) but good enough (regarding structural elements.) Issues should be reported using separate bug reports.
Git commit 1a9d32832d2217e57ed3db03eb4217105d1650d5 by Oliver Kellogg. Committed on 13/12/2020 at 07:52. Pushed by okellogg into branch 'master'. import_rose.cpp : Align active programming language with model content - Global `progLang' of type Uml::ProgrammingLanguage::Enum captures programming language specified by Rose model. - In function readAttributes loop of stream.readLine(), if nt is PetalNode::nt_string and stringOrNodeOpener is not "(" then test name for "language". If equal then derive progLang from value.string. - In function loadFromMDL, after parsing the model file, - if progLang hash not been established by the model and no code generator hash been allocated at UMLApp then allocate generator for C++ as default; - else if progLang is not the same as the active generator at UMLApp then call UMLApp::app()->setGenerator(progLang). M +29 -0 umbrello/import_rose.cpp https://invent.kde.org/sdk/umbrello/commit/1a9d32832d2217e57ed3db03eb4217105d1650d5
Git commit ea603204f76d0e857abfa46266cd703133ddf272 by Oliver Kellogg. Committed on 14/12/2020 at 19:48. Pushed by okellogg into branch 'master'. umbrello/petaltree2uml.cpp - Add importing of enum types from Rose : - New ClassifierListReader child class LiteralsReader furnishes boilerplate for converting from PetalNode to UMLEnumLiteral. - In function umbrellify, if parsed class has some form of enum stereotype (such as "enum", "Enumeration", "CORBAEnum" etc) then - call Object_Factory::createUMLObject for type UMLObject::ot_Enum; - run LiteralsReader::read on the returned UMLEnum. M +44 -1 umbrello/petaltree2uml.cpp https://invent.kde.org/sdk/umbrello/commit/ea603204f76d0e857abfa46266cd703133ddf272
Git commit 72fdab6a907bcf1f204b5116cbf3e22c4611434c by Oliver Kellogg. Committed on 19/12/2020 at 19:11. Pushed by okellogg into branch 'master'. umbrello/petaltree2uml.cpp - Add importing of dependencies from Rose : - New ClassifierListReader child class UsesReader furnishes boilerplate for converting from PetalNode to UMLAssociation with type Dependency. - In function umbrellify, - in handling of objType "Class" create UsesReader on `c' and call usesReader.read on `node'; - in handling of defined diagramType(objType), on handling InheritView and RealizeView also handle UsesView setting `t' to Uml::AssociationType::Dependency; - remove handling of UsesView from handling of AttachView. M +44 -6 umbrello/petaltree2uml.cpp https://invent.kde.org/sdk/umbrello/commit/72fdab6a907bcf1f204b5116cbf3e22c4611434c
Git commit 8c4efe08b41b4c34f429b4336e7c8053b6635f68 by Oliver Kellogg. Committed on 14/01/2022 at 06:45. Pushed by okellogg into branch 'master'. umbrello/import_rose.cpp followup to commit c7fdfef : - In function loadFromMDL, after loop over stream.readLine() do not set C++ as the code generator if progLang is `Reserved' and no code generator is set. Reason: progLang value Reserved indicates that the Rose "language" attribute was found to be "Analysis" which corresponds to the UML primitive types. M +2 -5 umbrello/import_rose.cpp https://invent.kde.org/sdk/umbrello/commit/8c4efe08b41b4c34f429b4336e7c8053b6635f68
Git commit 9bfc122d8d5cc3331ae063b51761ce952471a9eb by Oliver Kellogg. Committed on 26/03/2022 at 06:27. Pushed by okellogg into branch 'master'. umbrello/petaltree2uml.cpp : Start fleshing out conversion of statemachine statediagrams. M +213 -27 umbrello/petaltree2uml.cpp https://invent.kde.org/sdk/umbrello/commit/9bfc122d8d5cc3331ae063b51761ce952471a9eb
Git commit 7b68b769c66b511b5d50e1772f9aaf657b16f32e by Oliver Kellogg. Committed on 26/03/2022 at 22:22. Pushed by okellogg into branch 'master'. umbrello/petaltree2uml.cpp various fixes following commit 9bfc122 : - In function fetchLocation, - revert change to argument of location.split(); - do not adjust returned values by factor Rose2Qt when width or height are provided as 0. - In function fetchDouble, - replace argument defaultValue by bool applyRose2Qt defaulting to true; - add debug statements on cases where 0.0 is returned; - adjust returned value by factor Rose2Qt only if applyRose2Qt is true. - In function umbrellify case (dt != Uml::DiagramType::Undefined) for- loop, fix bug in handling of line_color and fill_color: The hexadecimal number provided to QColor constructor must be 6 hex digits wide. If less than 6 digits pad with leading zeros. M +31 -9 umbrello/petaltree2uml.cpp https://invent.kde.org/sdk/umbrello/commit/7b68b769c66b511b5d50e1772f9aaf657b16f32e
Git commit a1cb29f22904150e5489813c79f778857e84e794 by Oliver Kellogg. Committed on 27/03/2022 at 15:15. Pushed by okellogg into branch 'master'. umbrello/petaltree2uml.cpp function umbrellify completion of statemachine statediagrams conversion: - Local viewTagToWidget is a QMap<QString, UMLWidget*> mapping a view object's tag (number preceded by "@") to the Umbrello widget created. - In case (dt != Uml::DiagramType::Undefined) : - Local qreal maxY is initialized to 0.0 and is set to the largest Y (plus height) coordinate encountered during conversion of widgets. - Move declaration of locals `width` and `height` to inside for-loop. - Local UMLWidgetList swimlanes is an auxiliary list for adjusting the final height of swimlanes to contain all widgets. - Convert TransView to AssociationWidget with type State or Activity depending on the diagram type. - On converting Swimlane call swimlanes.append(w). - On converting StateView initialize `width` and `height` from w->width() and w->height(), respectively. - Convert DecisionView to ActivityWidget with ActivityType `Branch`. - Convert SynchronizationView to ForkJoinWidget with Qt::Orientation according to Rose attribute sync_is_horizontal. - Fill viewTagToWidget with attr->viewTag() as key and `w` (pointer to UMLWidget) as value. - After the conversion loop iterate over `swimlanes` for adjusting each swimlane's height to maxY. M +128 -14 umbrello/petaltree2uml.cpp https://invent.kde.org/sdk/umbrello/commit/a1cb29f22904150e5489813c79f778857e84e794
Created attachment 147774 [details] Topcased-mm_V24_V2toV3-last.mdl with syntax errors fixed The file Topcased-mm_V24_V2toV3-last.mdl originates from an old Eclipse M2M Model-to-Model project which is now defunct and whose files are no longer available online. The original file had a few parenthesis imbalances which are fixed in this attachment. The file contains several activity diagrams which were used for testing the activity diagram conversion to Umbrello.
Git commit d6f1ebc2fbc6ae34f999a6ea228097555a0ade68 by Oliver Kellogg. Committed on 30/03/2022 at 05:14. Pushed by okellogg into branch 'master'. umbrello/petaltree2uml.cpp improvements on converting diagram elements: - Move viewTagToWidget from function umbrellify to global level and reset it to empty on beginning parse of diagram. - In function handleAssocView : - Do not fail if attribute "roleview_list" is not found. Reason: InheritView, RealizeView, and UsesView do not have this attribute. - If "roleview_list" is not present then retrieve `supplier` and `client` using attr->findAttribute() for "supplier" and "client", respectively. - Move locals supW and cliW up to wider scope in order to attempt their retrieval from viewTagToWidget[supplier] and viewTagToWidget[client], respectively. Execute the code involving view->umlScene()->widgetOnDiagram() only if client and/or supplier is not a key in viewTagToWidget. - In function umbrellify case (dt != Uml::DiagramType::Undefined) : - Clear viewTagToWidget. - In for-loop over atts, on handling CategoryView/ClassView etc retrieve attribute "icon" from attr. If it is "Interface" then - set local pointer cw to dynamic_cast<ClassifierWidget*>(w); - if cw is non null then set visual property `DrawAsCircle` on cw. M +79 -53 umbrello/petaltree2uml.cpp https://invent.kde.org/sdk/umbrello/commit/d6f1ebc2fbc6ae34f999a6ea228097555a0ade68
Git commit 41a11789e272cf54c508f2053c1d58030ef1976b by Oliver Kellogg. Committed on 01/04/2022 at 19:49. Pushed by okellogg into branch 'master'. umbrello/petaltree2uml.cpp function ClassifierListReader::read : Generate xmi:id on datatype created for ClassAttribute type. M +12 -2 umbrello/petaltree2uml.cpp https://invent.kde.org/sdk/umbrello/commit/41a11789e272cf54c508f2053c1d58030ef1976b