Book a Demo

Author Topic: Reporting: Include Activity Diagram into a UseCase  (Read 9211 times)

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Reporting: Include Activity Diagram into a UseCase
« on: August 14, 2015, 10:49:00 pm »
Hello,

I need your advice how to approach such a problem:
How to include an activity diagram that is stored under a Use Case in the generated document?

Generally I use (I think) standard approach. I create use case element. Define scenario using structured scenario functionality of use case, then I generate Activity Diagram which is put automatically under the Activity which is under Use Case element in Project Browser.

Now when I'm generating documentation I can't include the activity diagram. I try to adapt standard Use Case Details template but I really don't know if I can do it simple way (by selecting appropriate sections from the left menu in editor) or I have to use advanced functionalities (like fragments / queries etc.)

Here is a structure

So, the point 1.1 displays Primary Use Cases diagram which is ok.
Then, point 1.2 is iterated over by each element in the Primary Use Cases package - in result each use case has it's own subchapter (again this is ok).

Now I want to display in each of those use case subchapters an activity diagram (if available). So in this case for Display Account Balance use case I want to have in generated document Display Account Balance_ActivityGraphWithAction activity diagram just under {Element.Notes} element. How to achieve that?

Additional question: in the picture you can see in the sections tree highlighted Diagram element. Why I can shift it up/down (using hand icons) but not above
Package->Element->Event element?

Thanks in advance for any advice. :D

I'm using EA12.
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Reporting: Include Activity Diagram into a Use
« Reply #1 on: August 14, 2015, 11:23:05 pm »
I only managed to get it working using a virtual document with a model document specifically for the Activity diagram.
This model document uses a query I wrote called getElementByGUID and I add the guid of the Activity_Graph element as search term.

If you come to the EA User group event in Brussels on the 18th September I would be happy to show you how I did it.

Geert

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Reporting: Include Activity Diagram into a Use
« Reply #2 on: August 15, 2015, 12:11:31 am »
Hi Geert,

Your getElementByGUID function is publicly available somewhere?

In a matter of fact I plan to attend the Brussels event, however I still not 100% sure as I don't speak French and I'm afraid that half of the presentations will be in that language. I see that agenda is still not published.
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Reporting: Include Activity Diagram into a Use
« Reply #3 on: August 17, 2015, 05:24:57 am »
I'll post the query here tomorrow.

The Brussels event will be completely in English, so you shouldn't worry about that.

I've finished the agenda this weekend, so it should be published somewhere this week.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Reporting: Include Activity Diagram into a Use
« Reply #4 on: August 17, 2015, 01:15:11 pm »
The search query ElementByGUID goes as follows:
Code: [Select]
select c.ea_guid AS CLASSGUID,c.object_type AS CLASSTYPE,c.name AS Name, c.stereotype AS Stereotype ,package.name AS PackageName ,package_p1.name AS PackageLevel1,package_p2.name AS PackageLevel2,package_p3.name AS PackageLevel3
from ((((t_object c
inner join t_package  package on c.package_id = package.package_id)
left join t_package  package_p1 on package_p1.package_id = package.parent_id)
left join t_package  package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package  package_p3 on package_p3.package_id = package_p2.parent_id)
where
c.ea_guid like '<Search Term>'

Geert

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Reporting: Include Activity Diagram into a Use
« Reply #5 on: August 17, 2015, 05:35:16 pm »
Quote
I'll post the query here tomorrow.

The Brussels event will be completely in English, so you shouldn't worry about that.

I've finished the agenda this weekend, so it should be published somewhere this week.
Thank you for the query.

As it goes about EAUG event I'm very pleased with that info. I will definitely attend :-)
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Reporting: Include Activity Diagram into a Use
« Reply #6 on: August 18, 2015, 05:42:51 pm »
Hi Geert,

I wrote a custom SQL query that finds inside of UseCase element an Activity and inside of it an Activity Diagram that I want to include in the generated document.

This SQL query is used in my "fragment" template Document options -> Custom query and is access via custom section of the template like that:



This fragment template is included in a "Use Case Details"  template like that:


So to SQL query can return ID or any other data of the diagram, but I don't know how to make EA to display diagram in a generated document and not only text information.
(In first screen you can see that I use variable {DiagramImg} but this is just my custom name, and EA does not display it as diagram)


Do you know if that's even possible?
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Reporting: Include Activity Diagram into a Use
« Reply #7 on: August 18, 2015, 06:01:42 pm »
No, you can only show diagrams in "regular" template fragments by selecting the diagram in the package or element section.

You can however use the SQL query to make a search, and use that search in the tagged values of your model document.

Geert

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Reporting: Include Activity Diagram into a Use
« Reply #8 on: August 18, 2015, 07:04:12 pm »
Lack of functionality allowing you to insert diagram found by SQL is a gap. Would be great to have this possibility added dear Sparx :-)

However, I managed to include this Activity Diagram using a simple fragment included into the template. By simple fragment I mean that I don't use SQL at all and I don't use model document.

Any way thanks Geert for inspiration :-)
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
« Last Edit: August 19, 2015, 08:43:25 am by simonm »

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Reporting: Include Activity Diagram into a Use
« Reply #10 on: August 19, 2015, 06:58:53 pm »
Quote
Look at the report scripting.

http://www.sparxsystems.com/enterprise_architect_user_guide/12.0/automation_and_scripting/document_generator_interface.html

Hi Simon,
I don't follow, this sequence diagram does not explain much to me.

You're saying it's possible to write a script the can include any diagram (found by SQL or any other means) in a generated document?

Could you elaborate a little bit more?
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Reporting: Include Activity Diagram into a Use
« Reply #11 on: August 20, 2015, 08:18:43 am »
Yes, it is possible. Did you read the child topic at all?

The pseudo code would go something like:

Code: [Select]
doc = repository.GetDocumentGenerator();
doc.NewDocument("Model Report");
diagrams = GetDiagramsFromSQL(sql); // Not a function in the API, write it yourself
for each diagramid in diagrams
{
  doc.DocumentDiagram(diagramid, 1, "Class Diagram");
}
diagrams = GetDiagramsFromSQL(sql2); // Not a function in the API, write it yourself
for each diagramid in diagrams
{
  doc.DocumentDiagram(diagramid, 1, "Activity Diagram");
}
doc.SaveDocument();