Skip to content
Commit b57c7616 authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

Enhancement: Write UML2 XMI format when UML2 mode is selected.

Directory umbrello/uml1model is renamed to umbrello/umlmodel to reflect
how the enhancement is implemented (same source file for UML1 and UML2
mode).

Changes:

umbrello/CMakeLists.txt
umbrello/codeimport/CMakeLists.txt
unittests/CMakeLists.txt
- Adjust include_directories et al. to renamed directory `umlmodel'.

umbrello/clipboard/umldragdata.cpp
umbrello/cmds/cmdremovediagram.cpp
umbrello/cmds/widget/cmdcreatewidget.cpp
umbrello/cmds/widget/cmdremovewidget.cpp
umbrello/codegenerators/classifiercodedocument.{h,cpp}
umbrello/codegenerators/codeaccessormethod.{h,cpp}
umbrello/codegenerators/codeblock.{h,cpp}
umbrello/codegenerators/codeblockwithcomments.{h,cpp}
umbrello/codegenerators/codeclassfield.{h,cpp}
umbrello/codegenerators/codeclassfielddeclarationblock.{h,cpp}
umbrello/codegenerators/codecomment.{h,cpp}
umbrello/codegenerators/codedocument.{h,cpp}
umbrello/codegenerators/codegenerator.{h,cpp}
umbrello/codegenerators/codegenobjectwithtextblocks.{h,cpp}
umbrello/codegenerators/codeoperation.{h,cpp}
umbrello/codegenerators/cpp/cppcodecomment.{h,cpp}
umbrello/codegenerators/cpp/cppcodedocumentation.{h,cpp}
umbrello/codegenerators/cpp/cppcodegenerator.{h,cpp}
umbrello/codegenerators/cpp/cppheaderclassdeclarationblock.{h,cpp}
umbrello/codegenerators/cpp/cppheadercodedocument.{h,cpp}
umbrello/codegenerators/d/dclassdeclarationblock.{h,cpp}
umbrello/codegenerators/d/dcodecomment.{h,cpp}
umbrello/codegenerators/d/dcodedocumentation.{h,cpp}
umbrello/codegenerators/hierarchicalcodeblock.{h,cpp}
umbrello/codegenerators/java/javaantcodedocument.{h,cpp}
umbrello/codegenerators/java/javaclassdeclarationblock.{h,cpp}
umbrello/codegenerators/java/javacodedocumentation.{h,cpp}
umbrello/codegenerators/ownedhierarchicalcodeblock.h
umbrello/codegenerators/ruby/rubyclassdeclarationblock.{h,cpp}
umbrello/codegenerators/ruby/rubycodedocumentation.{h,cpp}
umbrello/codegenerators/textblock.h
umbrello/codegenerators/xml/xmlelementcodeblock.{h,cpp}
umbrello/docgenerators/docbookgeneratorjob.cpp
umbrello/optionstate.{h,cpp}
umbrello/umldoc.{h,cpp}
umbrello/umllistview.{h,cpp}
umbrello/umllistviewitem.{h,cpp}
umbrello/umlmodel/umlobject.{h,cpp}
umbrello/umlmodel/actor.{h,cpp}
umbrello/umlmodel/artifact.{h,cpp}
umbrello/umlmodel/association.{h,cpp}
umbrello/umlmodel/attribute.{h,cpp}
umbrello/umlmodel/category.{h,cpp}
umbrello/umlmodel/checkconstraint.{h,cpp}
umbrello/umlmodel/classifier.{h,cpp}
umbrello/umlmodel/component.{h,cpp}
umbrello/umlmodel/datatype.{h,cpp}
umbrello/umlmodel/entity.{h,cpp}
umbrello/umlmodel/entityattribute.{h,cpp}
umbrello/umlmodel/enum.{h,cpp}
umbrello/umlmodel/enumliteral.{h,cpp}
umbrello/umlmodel/folder.{h,cpp}
umbrello/umlmodel/foreignkeyconstraint.{h,cpp}
umbrello/umlmodel/instance.{h,cpp}
umbrello/umlmodel/instanceattribute.{h,cpp}
umbrello/umlmodel/node.{h,cpp}
umbrello/umlmodel/operation.{h,cpp}
umbrello/umlmodel/package.{h,cpp}
umbrello/umlmodel/port.{h,cpp}
umbrello/umlmodel/stereotype.{h,cpp}
umbrello/umlmodel/template.{h,cpp}
umbrello/umlmodel/umlcanvasobject.h
umbrello/umlmodel/umlrole.{h,cpp}
umbrello/umlmodel/uniqueconstraint.{h,cpp}
umbrello/umlwidgets/activitywidget.{h,cpp}
umbrello/umlwidgets/actorwidget.{h,cpp}
umbrello/umlwidgets/artifactwidget.{h,cpp}
umbrello/umlwidgets/associationline.{h,cpp}
umbrello/umlwidgets/associationwidget.{h,cpp}
umbrello/umlwidgets/associationwidgetrole.{h,cpp}
umbrello/umlwidgets/boxwidget.{h,cpp}
umbrello/umlwidgets/categorywidget.{h,cpp}
umbrello/umlwidgets/classifierwidget.{h,cpp}
umbrello/umlwidgets/combinedfragmentwidget.{h,cpp}
umbrello/umlwidgets/componentwidget.{h,cpp}
umbrello/umlwidgets/datatypewidget.{h,cpp}
umbrello/umlwidgets/diagramproxywidget.{h,cpp}
umbrello/umlwidgets/entitywidget.{h,cpp}
umbrello/umlwidgets/enumwidget.{h,cpp}
umbrello/umlwidgets/floatingdashlinewidget.{h,cpp}
umbrello/umlwidgets/floatingtextwidget.{h,cpp}
umbrello/umlwidgets/forkjoinwidget.{h,cpp}
umbrello/umlwidgets/linkwidget.{h,cpp}
umbrello/umlwidgets/messagewidget.{h,cpp}
umbrello/umlwidgets/nodewidget.{h,cpp}
umbrello/umlwidgets/notewidget.{h,cpp}
umbrello/umlwidgets/objectnodewidget.{h,cpp}
umbrello/umlwidgets/objectwidget.{h,cpp}
umbrello/umlwidgets/packagewidget.{h,cpp}
umbrello/umlwidgets/pinportbase.{h,cpp}
umbrello/umlwidgets/preconditionwidget.{h,cpp}
umbrello/umlwidgets/regionwidget.{h,cpp}
umbrello/umlwidgets/signalwidget.{h,cpp}
umbrello/umlwidgets/statewidget.{h,cpp}
umbrello/umlwidgets/umlwidget.{h,cpp}
umbrello/umlwidgets/usecasewidget.{h,cpp}
umbrello/umlwidgets/widgetbase.{h,cpp}
umbrello/umlmodel/uniqueconstraint.{h,cpp}
umbrello/umlmodel/usecase.{h,cpp}
umbrello/umlscene.{h,cpp}
unittests/testbase.h
unittests/testoptionstate.cpp
- Rename saveToXMI1/loadFromXMI1 function definitions and invocations to
  saveToXMI/loadFromXMI.

umbrello/model_utils.cpp
- In function getXmiId recognize "xmi:id" before attempting "xmi.id".

umbrello/object_factory.cpp
- In function makeObjectFromXMI return new UMLAssociation for xmiTag
  "interfaceRealization".

umbrello/umldoc.cpp
- Additionally rename function loadUMLObjectsFromXMI1 to
  loadUMLObjectsFromXMI.
- In function saveToXMI write UML2 XMI format when in UML2 mode:
  - Write start element "xmi:XMI" instead of "XMI".
  - Write attribute "xmi:version" instead of "xmi.version".
  - Additionally write attributes "xmlns:xmi" and "xmlns:xsi".
  - Do not write start element "XMI.header" but do write some of the
    elements contained therein.
  - Write start element xmi:Documentation instead of XMI.documentation.
  - Write start element "uml:Model" instead of "UML:Model".
  - Write attribute "xmi:id" instead of "xmi.id".
  - Do not write attributes "isSpecification", "isAbstract", "isRoot",
    "isLeaf".
  - Write start element "xmi:Extension" instead of "XMI.extensions".
- In function encoding(QIODevice&), if element.tagName() is
  "xmi:Documentation" then return ENC_UNICODE.
- In function loadFromXMI handle outerTag "xmi:Extension" alongside
  "XMI.extensions".

umbrello/umlmodel/umlobject.{h,cpp}
- At function save1:
  - Switch order of arguments (`writer' comes first, then `type').
  - No longer expect argument `type' to carry an XMI namespace
    (the XMI namespace is added locally when in UML1 mode).
  - Add optional argument `tag' defaulting to QString().

umbrello/umlmodel/association.cpp
umbrello/umlmodel/component.cpp
umbrello/umlmodel/enumliteral.cpp
umbrello/umlmodel/entity.cpp
umbrello/umlmodel/entityattribute.cpp
umbrello/umlmodel/foreignkeyconstraint.cpp
umbrello/umlmodel/instance.cpp
umbrello/umlmodel/node.cpp
umbrello/umlmodel/operation.cpp
umbrello/umlmodel/package.cpp
umbrello/umlmodel/port.cpp
umbrello/umlmodel/stereotype.cpp
umbrello/umlmodel/template.cpp
umbrello/umlmodel/umlrole.cpp
umbrello/umlmodel/uniqueconstraint.cpp
umbrello/umlmodel/uniqueconstraint.cpp
umbrello/umlmodel/usecase.cpp
unittests/testumlobject.cpp
- In function saveToXMI1 call to UMLObject::save1(),
  - adjust arguments to changed order;
  - omit hard coded namespace prefix "UML:" on `type' argument;
  - provide value for new argument `tag' as required by UML2.

umbrello/umlmodel/association.cpp
- In function saveToXMI:
  - In case m_AssocType Uml::AssociationType::Realization, if
    Settings::optionState().generalState.uml2 is true then write tag
    "interfaceRealization" in lieu of "UML:Abstraction".
  - When producing the XMI for "Association" in UML2 mode do not write
    the start element "UML:Association.connection" but do write its
    content.  The content may still change for UML2 compliance.

umbrello/umlmodel/attribute.cpp
- In function saveToXMI, if Settings::optionState().generalState.uml2 is
  true then call UMLObject::save1() with type "Property" and tag
  "ownedAttribute".

umbrello/umlmodel/classifier.cpp
- In function saveToXMI1:
  - Omit XML namespace prefix "UML:" from `tag'.
  - On saving templates in UML2 mode, do not produce the
    "UML:ModelElement.templateParameter" envelope element but do produce
    its content.
  - On saving generalizations in UML2 mode, do not produce the
    "UML:GeneralizableElement.generalization" envelope element but do
    produce its content (adjusted to UML2 format).
  - On saving attributes (attList) and operations (opList) in UML2 mode,
    do not produce the"UML:Classifier.feature" envelope element but do
    produce its content.
  - On saving contained objects in UML2 mode, do not produce the
    "UML:Namespace.ownedElement" envelope element but do produce its
    content.
- In function makeChildObject handle xmiTag ClassifierTemplateParameter
  alongside "TemplateParameter".

umbrello/umlmodel/component.cpp
- In function saveToXMI1, if Settings::optionState().generalState.uml2
  is true then do not produce the "UML:Namespace.ownedElement" envelope
  element but do produce its content.
- In function load1 loop over nodes of `element', if the tag in `type'
  is "ownedAttribute" then set `type' to the value of tempElement's
  "xmi:type" XML attribute.

umbrello/umlmodel/entity.cpp
- In function load1 loop over nodes of `element', if the tag in `type'
  is "ownedAttribute" then set `type' to the value of tempElement's
  "xmi:type" XML attribute.

umbrello/umlmodel/enum.cpp
- In function saveToXMI1, if Settings::optionState().generalState.uml2
  is true then do not produce the "UML:Enumeration.literal" envelope
  element but do produce its content.

umbrello/umlmodel/folder.{h,cpp}
- Additionally rename function saveContents1 to saveContents.
- In function saveContents, if Settings::optionState().generalState.uml2
  is true then
  - do not produce the "UML:Namespace.ownedElement" envelope element but
    do produce its content;
  - on handling m_diagrams, produce start element "xmi:Extension" in
    lieu of "XMI.extension".
- In function save1:
  - Omit XML namespace prefix "UML:" from elementName, it will be added
    by UMLObject::save1.
  - Adjust call to UMLObject::save1() to changed order of arguments and
    provide special value "<use_type_as_tag>" as tag argument.
- In function saveToXMI1, on creating the extension stub in the main
  file, in UML2 mode produce start element "xmi:Extension" in lieu of
  "XMI.extension".
- In function load1:
  - Handle type "xmi:Extension" alongside "XMI.extension".
  - Remove check for invalid namespaces.  Reason: The "namespace" XML
    argument is non standard and is not produced in UML2 mode.

umbrello/umlmodel/instanceattribute.cpp
- In function saveToXMI, if Settings::optionState().generalState.uml2 is
  true then write attribute "xmi:id" in lieu of "xmi.id".

umbrello/umlmodel/operation.cpp
- In function saveToXMI1:
  - Do not produce the "UML:BehavioralFeature.parameter" envelope
    element but do produce its content.
  - Use the XML attribute name "direction" for indicating the
    parameter's "in out" or "out" calling convention.
  - Produce the tag "ownedParameter" and produce the "xmi:type"
    attribute set to "uml:Parameter".
  - Use the XML attribute name "xmi:id" for writing m_returnId.
- In function load1 handle tag "ownedParameter" alongside "Parameter".

umbrello/umlmodel/package.cpp
- In function saveToXMI, if Settings::optionState().generalState.uml2
  is true then do not produce the "UML:Namespace.ownedElement" envelope
  element but do produce its content.

umbrello/umlmodel/stereotype.cpp
- In function saveToXMI, if Settings::optionState().generalState.uml2
  is true then
  - do not produce the "UML:Stereotype.feature" envelope element but do
    produce its content;
  - produce the attribute definitions using XML tag "ownedAttribute".

umbrello/umlmodel/umlrole.cpp
- In function load1 use function Model_Utils::getXmiId to abstract away
  the difference in XMI ID attribute (UML1 "xmi.id" vs. UML2 "xmi:id").

umbrello/umlmodel/uniqueconstraint.cpp
- In function load1 loop over node, if tag is "ownedAttribute" then set
  tag to the value of the "xmi:type" attribute of tempElement.

umbrello/version.h
- Rename XMI_FILE_VERSION to XMI1_FILE_VERSION.
- Add XMI2_FILE_VERSION with value "2.0.0".
  XMI2_FILE_VERSION indicates the exporterVersion when UML2 support is
  enabled, i.e. when Settings::optionState().generalState.uml2 is true.
  The idea is that the UML1 XMI format will use versions below "2.0.0".

CCBUG: 115269
parent dba3b12e
Pipeline #114538 passed with stage
in 18 minutes and 34 seconds
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