{"id":1255,"date":"2014-11-10T08:58:01","date_gmt":"2014-11-10T07:58:01","guid":{"rendered":"http:\/\/www.capri-soft.de\/blog\/?p=1255"},"modified":"2014-11-10T08:58:01","modified_gmt":"2014-11-10T07:58:01","slug":"ibm-doors-dxl-import-from-sparx-systems-enterprise-architect","status":"publish","type":"post","link":"https:\/\/www.capri-soft.de\/blog\/?p=1255","title":{"rendered":"IBM Doors DXL: Import from Sparx Systems Enterprise Architect"},"content":{"rendered":"<h1>Problem<\/h1>\n<p>To refresh all UML Diagrams within an Formal Doors Module, a script is needed that imports all actual versions of a UML Diagram.<\/p>\n<h1>Approach<\/h1>\n<p>* Copy the GUID of the Diagram \/ Note<br \/>\n** right-click the project menu on the right side.<br \/>\n** Select &#8222;Copy Reference -> Copy Node GUID to clipboard&#8220;<br \/>\n* If not done before, create an Module attribute (here ATTRIBUT_WITH_GUID)<br \/>\n* Paste the GUID to the place in your doors module, where the diagram should be created<\/p>\n<h1>Solution<\/h1>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\/\/ Recommended as module plugin\r\n\/**\r\n * Run through all objects of the current module \r\n * and watch for the attribute ATTRIBUT_WITH_GUID.\r\n * If it is not empty, fetch the diagram\/note\r\n * from this attribute an load it into the \r\n * Object Text of Sparx Systems Enterprise Architect\r\n *\/\r\n\r\nObject o\r\nFilter currentFilter, f\r\nModule m\r\nDB updateWin\r\n\r\nstring guid\r\nstring projectPath = &quot;DP_ENTARCHITECT --- DBType=1;&quot; \/\/-\r\n&quot;Connect=Provider=SQLOLEDB.1;Integrated Security=SSPI;&quot; \/\/-\r\n&quot;Persist Security Info=False;Initial Catalog=DBNAME;&quot; \/\/-\r\n&quot;Data Source=EA_DB_SERVER&quot;\r\n\r\nOleAutoObj eaProject, eaRepository, diaObj, actObj\r\nOleAutoArgs autoArgs = create\r\nstring diagramName, elementNotes\r\n\r\nvoid establishInterface()\r\n{\r\n eaProject = oleGetAutoObject(&quot;EA.Project&quot;)\r\n if(null(eaProject))\r\n { \r\n   eaProject = oleCreateAutoObject(&quot;EA.Project&quot;)\r\n }\r\n\r\n if(null(eaProject))\r\n {\r\n   ack &quot;Creating OLE-Object &#039;EA.Project&#039; not possible.&quot;\r\n   progressStop\r\n   halt\r\n }\r\n\r\n eaRepository = oleGetAutoObject(&quot;EA.Project&quot;)\r\n\r\n if(null(eaRepository))\r\n {\r\n   eaRepository = oleCreateAutoObject(&quot;EA.Repository&quot;)\r\n }\r\n\r\n if(null(eaRepository))\r\n {\r\n   ack &quot;Creating OLE-Object &#039;EA.Repository&#039; not possible.&quot;\r\n  progressStop\r\n  halt\r\n }\r\n\r\n put(autoArgs,projectPath)\r\n oleMethod(eaRepository,&quot;OpenFile&quot;,autoArgs)\r\n clear(autoArgs)\r\n}\r\n\r\nvoid closeInterface()\r\n{\r\n  oleMethod(eaRepository,&quot;CloseFile&quot;,autoArgs)\r\n  oleMethod(eaRepository,&quot;Exit&quot;,autoArgs)\r\n\t\r\n  delete(autoArgs)\r\n}\r\n\r\nvoid updateObjects()\r\n{\r\n int progessbarStep = 0\r\n bool diagramCopied\r\n string fileName\r\n\r\n for o in m do\r\n {\r\n  guid = o.&quot;BB_ImageFileName&quot;\r\n  diagramCopied = false\r\n\t\r\n  if(guid != &quot;&quot; &amp;&amp; guid&#x5B;0:0] == &quot;{&quot;)\r\n  {\r\n   progressMessage(&quot;Updating &quot; identifier(o))\r\n   put(autoArgs, guid)\r\n\t\t\r\n   \/**************************************************\r\n    * Gets a pointer to a diagram using an absolute \r\n    * reference number (local ID). This is usually \r\n    * found using the DiagramID property of an \r\n    * element, and stored for later use to open a diagram \r\n    * without using the \r\n    * collection GetAt() function.\r\n    **************************************************\/\r\n    oleMethod(eaRepository, &quot;GetDiagramByGuid&quot;, autoArgs, diaObj)\r\n\t\t\r\n    \/*************************************************\r\n     * An Element is the main modeling unit. \r\n     * It corresponds to (for example) a Class, \r\n     * Use Case, Node or Component. \r\n     * You create new elements by adding to the \r\n     * Package Elements collection. \r\n     * Once you have created an element, you can add it\r\n     * to the DiagramObject \r\n     * Class of a diagram to include it in the diagram.\r\n     ****************************************************\/\r\n     oleMethod(eaRepository, &quot;GetElementByGuid&quot;, autoArgs, actObj)\r\n     clear(autoArgs)\r\n\t\t\r\n     \/\/ Wenn das Diagramm mit der GUID nicht gefunden wurde\r\n     if(null(diaObj))\r\n     {\r\n      \/\/ ... und auch kein Element mit der GUID gefunden wurde\r\n      if(null(actObj))\r\n      {\r\n         ack &quot;GUID &quot; guid &quot; of object &quot; identifier(o) &quot;&quot; \/\/-\r\n            &quot; not found in EA as diagram or element.&quot;\r\n      }\r\n      else\r\n      {\r\n        \/\/ Es wurde kein Diagramm, aber ein Element \r\n        \/\/ mit der GUID gefunden\r\n        oleGet(actObj, &quot;Notes&quot;, elementNotes)\r\n        if(null(elementNotes))\r\n        {\r\n          ack &quot;Getting Notes of GUID &quot; guid &quot; failed.&quot;\r\n        }\r\n        else\r\n        {\r\n\t o.&quot;Object Text&quot; = elementNotes\r\n\t progressStep(++progessbarStep)\r\n        }\r\n      }\r\n    }\r\n    else \/\/ Es wurde ein Diagramm mit der GUID gefunden\r\n    {\t\t\t\t\t\r\n      \/***************************************************\r\n       *  EA.Project.PutDiagramImageOnClipboard: \r\n       *  ======================================\r\n       *  Copies an image of the specified diagram to the \r\n       *  clipboard.\r\n       *\t\r\n       *  Parameters:\r\n       *\t\u2022\tDiagramGUID: String - the GUID \r\n       *        (in XML format) \r\n       *        of the diagram \r\n       *        to copy\r\n       *\t\u2022\tType: Long - the file type\r\n       *\t\t\u2022\tIf Type = 0 then it is a metafile\r\n       *\t\t\u2022\tIf Type = 1 then it is a Device \r\n       *            Independent Bitmap\r\n       *\r\n       *****************************************************\/\r\n       put(autoArgs, guid)\r\n       put(autoArgs, 0)\t\t\t\t\r\n       oleMethod(eaProject, &quot;PutDiagramImageOnClipboard&quot;, autoArgs, \r\n\t             diagramCopied)\r\n       clear(autoArgs)\r\n\t\t\r\n       if(diagramCopied)\r\n       {\r\n         while(oleDelete(o));\r\n         if(olePaste(o))\t\t\t\t\t\r\n         {\r\n\t       oleSetMaxWidth(o.&quot;Object Text&quot;, 400)\r\n\t        progressStep(++progessbarStep)\r\n         }\r\n         else\r\n         {\r\n\t       ack &quot;Pasting from clipboard of GUID &quot; guid &quot; failed.&quot;\r\n         }\r\n       }\r\n       else\r\n       {\r\n         ack &quot;Copying to clipboard of GUID &quot; guid &quot; failed.&quot;\r\n       }\r\n     }\r\n\t diaObj = null\r\n     actObj = null\r\n   }\r\n  }\r\n}\r\n\r\nvoid main(DB updateWin)\r\n{\r\n  int accepted, rejected\r\n\r\n  currentFilter = current\t\r\n  f = contains(attribute(&quot;ATTRIBUT_WITH_GUID&quot;),&quot;{&quot;, false)\r\n  set(m, f, accepted, rejected)\r\n  unApplyFiltering(m)\r\n  progressStart(updateWin, &quot;Executing update&quot;, &quot;Processing...&quot;, accepted)\r\n  establishInterface()\r\n  updateObjects()\r\n  if(!null(currentFilter)) set(m, currentFilter, accepted, rejected)\r\n  closeInterface()\r\n  progressStop\r\n  refresh(m)\r\n  hide(updateWin)\r\n  destroy(updateWin)\r\n  updateWin = null\r\n}\r\n\r\nm = current\r\nif(null(m))\r\n{\r\n  ack &quot;Update can only be started within a module.&quot;\r\n}\r\nelse\r\n{\r\n if(isEdit(m))\r\n {\r\n   updateWin = create(&quot;Update EA &quot;, styleCentered|styleFloating)\r\n   label(updateWin, &quot;Do you wish to update?&quot;)\r\n   ok(updateWin, main)\r\n   show updateWin\r\n }\r\n else\r\n {\r\n  ack &quot;Module must be opend in &#039;Exclusive Edit&#039;.&quot;\r\n }\r\n}\r\n<\/pre>\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=https%3A%2F%2Fwww.capri-soft.de%2Fblog%2F%3Fp%3D1255&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px;margin-top:5px;\"><\/iframe>","protected":false},"excerpt":{"rendered":"<p>Problem To refresh all UML Diagrams within an Formal Doors Module, a script is needed that imports all actual versions of a UML Diagram. Approach * Copy the GUID of the Diagram \/ Note ** right-click the project menu on the right side. ** Select &#8222;Copy Reference -> Copy Node GUID to clipboard&#8220; * If &hellip; <a href=\"https:\/\/www.capri-soft.de\/blog\/?p=1255\" class=\"more-link\"><span class=\"screen-reader-text\">IBM Doors DXL: Import from Sparx Systems Enterprise Architect<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[22,29,28],"tags":[],"class_list":["post-1255","post","type-post","status-publish","format-standard","hentry","category-dxl","category-modellierung","category-sparx-systems-enterprise-architect"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4yGeN-kf","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1255"}],"version-history":[{"count":1,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1255\/revisions"}],"predecessor-version":[{"id":1256,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1255\/revisions\/1256"}],"wp:attachment":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}