Sparx Systems Forum

Discussion => General Board => Topic started by: wmather on December 31, 2017, 06:34:17 pm

Title: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on December 31, 2017, 06:34:17 pm
Hi,

Forgive my ignorance as am new to EA and am having some issues with the specification manager.  While I can create the hierarchy of requirements, the issue I am facing is trying to get embedded diagrams in the published output, or to add custom image(s) to the output.

I have tried to follow the EA User Guide but have failed to get either a state machine diagram or a copy-and-pasted object into the notes to be exported during the publish.

While usually not a fan of the dummies books, it seems Sparx Systems EA for Dummies is just what I need to understand this software as I am finding this are just not clicking with me yet. I usually don't consider myself unintelligent, but this is the first time I have had a piece of software where I don't just click into understanding how to drive it.

If anyone can give me pointers, or even a short list on what to do to get the expected output, I would be extremely grateful.

TLDR;

I want to achieve something like as follows. NOTE: It would be great if instead of linking to a diagram in the model, if I could also paste a custom image and have this in the output.

Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: Nizam on December 31, 2017, 07:43:30 pm
There are a number of ways to achieve this,  you can consider
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on January 01, 2018, 09:03:33 am
Hi Nizam,

Thanks for the fast response.

Set the statemachine diagram as the composite diagram under the chosen requirement (Right Click -> New Child Diagram -> Select Composite Diagram)

I have no new child diagram in 13.5 but have Add=>Select Composite Diagram=>Choose the diagram. This did not generate the diagram in any output from either the  "Specification Manager List" or "Requirements Report - Details" templates.

Will try to understand the template fragment method.
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: qwerty on January 01, 2018, 09:13:44 am
You need the context menu in the diagram. This is EAUI (EA's Unique Interface).

q.
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on January 01, 2018, 10:33:31 am
Hi qwerty,

Afraid that does not work either. I get the "glasses" symbol (i guess means linked?) but still no output on generation.

<strike>I would love to attach my sample ea file but I cannot attach documents in this forum.</strike>

Pastebin of exported XMI incase I am doing something wrong in my project setup: https://pastebin.com/swpQbQmy

Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: qwerty on January 01, 2018, 11:05:18 am
Once the glasses (or the chain or the infinity) appears, it means that the element is composite. You can dbl-click it and reveal the composite diagram inside (or if you chosen another diagram then this one). Use Shuft-Alt-G to find it back in the project browser.

q.
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on January 01, 2018, 11:30:02 am
Hi q,

Yes that all works, but the diagram does not come out in the documentation generation. I attached the XMI into pastebin incase I have not setup my package correctly and it needs a proper "EA Way of doing things" to work :)

On another note, want to purchase your books but not sure if EA for the BA is for EA newbies like myself....
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: qwerty on January 01, 2018, 12:12:33 pm
Well, it depends. What kind of rookie are you? ;-)

If all goes wrong you get a full refund at LeanPub.

And I have to be honest: I'm not familiar with the EA document generator at all since I have my own way of generating documents from EA.

q.
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on January 01, 2018, 02:44:33 pm
how do you do that! would love to know how to generate my own docs. i suspect scripting and some automation will be the key here
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: Nizam on January 01, 2018, 05:13:59 pm
Use the script below
Code: [Select]
!INC Local Scripts.EAConstants-JScript
 var ACTIVITY_TEMPLATE = "DiagramReports";
 
function main(ObjectID)
{
var docGenerator as EA.DocumentGenerator;
    docGenerator = Repository.CreateDocumentGenerator();
    if ( docGenerator.NewDocument("") )
    { 
var sEle  as EA.Element;
sEle = Repository.GetElementByID(ObjectID);
if(sEle.IsComposite)
{
var cDiag  as EA.Diagram;
cDiag = sEle.CompositeDiagram;
if(cDiag!=null)
{
docGenerator.DocumentDiagram(cDiag.DiagramID,0,ACTIVITY_TEMPLATE);
}
}

}

var rtf = docGenerator.GetDocumentAsRTF();
return rtf;

}

Call it in a fragment using 'Document Script',
Code: [Select]
main(#OBJECTID#);

Create another template to render your diagram, call it 'DiagramReports' (as referred in the script), enable Package-> Diagram section and insert Diagram.DiagramImg

Call the template fragment in the 'element' section of your main template.

HTH
Nizam


Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: qwerty on January 01, 2018, 08:58:42 pm
Yes, scripting is the key. Unfortunately most people not only think that "Word" is a text layout and processing program. Moreover they only know this single one. I create LaTeX documents which are sort of code. So it's a scripted LaTeX code generator. And the result is aesthetic based on mathematical principals.

q.
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on January 01, 2018, 11:26:15 pm
thanks qwerty

an old unix head here so l was thinking LaTeX as well then can output to various mediums. as a developer for over 20 years i dont mind cutting code and piping commands together. would love to see how you do that end-to-end so that i can get these leanpub book bundles and really understand how to "gain the upper hand" with EA so too speak :)

Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: qwerty on January 02, 2018, 02:37:31 am
I have a short write-up for the LaTeX stuff here: http://liquit.biz/brain/enterprise.html (http://liquit.biz/brain/enterprise.html) (last entry).

q.
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on January 02, 2018, 09:03:38 am
Hi qwerty,

Thanks for that resource would have loved to seen your perl script to see the complete end-to-end result. I used to be a data warehouse consultant so am comfortable trying to reverse engineer relationships.

Anyway, because you have done it, i believe I can do it :) I think I will consider the documentation generator as being flawed in some areas and strive to write my own.

Ok, leanpub it is and down the rabbit hole I go [hopefully the back-end data structures are easier to understand than the EAUI :)]
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: qwerty on January 02, 2018, 10:04:24 am
That Perl stuff is usually write-once-read-never. I still can read it, but probably not so many others (it's 3.5kloc base +3kloc libs).

If you run into trouble feel free to contact me.

q.
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on January 02, 2018, 03:46:21 pm
@qwerty - I bought your books and have "upsized" the access db to SQL Server to poke around the tables. Once I get the general structure of the DB I will be able to extract what I need. Your scripting book should hopefully answer some API questions around how to actually get EA to "export" the diagram to a non-vector based file format like jpg/png/tiff or whatever.

With all that completed, then doing the automation should be fairly simple. On another note, I will never use perl again! While at one time I could read sendmail.cf files without a manual, those days are long gone, so a nice structured easy to read language like C# or Java will suffice in my automation needs :)
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: Geert Bellekens on January 02, 2018, 05:30:03 pm
Although I've written a few document generators in my time, with the current state of affairs of the standard document generator, I cannot with good conscience recommend rolling your own anymore.
With virtual documents, SQL and scripting fragments, you can do almost anything you need using the standard RTF generator.
I agree, it not as much fun as writing your own, and it may not be in a fancy academic format as Latex, but most clients I work with don't care too much about my fun-level, or Latex. They just need Word documents with the contents they need from the model, and preferably in such a way that they can make (small) adjustments to the templates themselves.

I wrote a small article about the way I do document generation these days: https://bellekens.com/2015/11/12/tutorial-generate-complex-documents-from-enterprise-architect-with-a-two-step-semi-automated-approach/ (https://bellekens.com/2015/11/12/tutorial-generate-complex-documents-from-enterprise-architect-with-a-two-step-semi-automated-approach/)

If you still want to go for writing your own generator, you can take a look at my open source C# repositories on Github:

https://github.com/GeertBellekens/UML-Tooling-Framework (https://github.com/GeertBellekens/UML-Tooling-Framework)
https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework (https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework)
https://github.com/GeertBellekens/Enterprise-Architect-Toolpack (https://github.com/GeertBellekens/Enterprise-Architect-Toolpack)

Geert
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: qwerty on January 02, 2018, 09:04:45 pm
I also have to admit that my own generator has a lot of fun-added-value :-) I started with that in times when EA doc generator was a real PITA and it just lost me then. Maybe today I'd stick with it or take eaDocX instead. Anyhow, digging into automation is something you need in your daily work with EA. Eventually even when using their newer doc generator versions.

q.
Title: Re: Specification Manager - Child Diagrams And Embedded Images
Post by: wmather on January 03, 2018, 04:12:21 pm
Thanks @qwerty! I did not need to read all your books to get a handle on the DB. But it gave me enough tips to figure out the API calls.

I have used a hybrid repository that queries the MDB directly to create a treeview of packages and diagrams. I can then select a diagram and export that to a JPG thus minimizing the slow EA API COM calls.

This simple POC has most of what I need to think about how to automate my documentation generation. I am now very glad I chose EA as I can use the tool to create all the UML I require, in a hierarchy that I want, and my own custom tool-chain to generate the documentation that I want in a format that I choose.