Reporting Usage in Diagrams

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

Reporting Usage in Diagrams

Postby eugene.nicholson@noaa.gov » Fri Dec 04, 2015 1:08 pm

I would like to create a report that lists Operational Exchanges and, for each OE, identifies the diagram(s) in which they are realized. I am able to list the OEs, but I don't know how to report the "Diagram" column identified in the table presented in specification's "Usage In" attribute group.

Can anyone suggest an approach?

I'm using MD 18.1, the UPDM plugin and the "DoDAF 2.0 Architect" perspective.
eugene.nicholson@noaa.gov
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:1
Joined: Mon Sep 14, 2015 8:42 am

Re: Reporting Usage in Diagrams

Postby paudzi » Mon Dec 07, 2015 2:12 am

Hello,

Operational Exchange can be realized in the model, but not in diagram. Diagram just represents relations which Operational Exchange realizes. The code which collects diagrams:

Code: Select all
Collection<Element> realizations = new HashSet<>();
realizations.addAll(operationalExchange.getRealization());
realizations.addAll(operationalExchange.getRealizingActivityEdge());
realizations.addAll(operationalExchange.getRealizingConnector());
realizations.addAll(operationalExchange.getRealizingMessage());
      
//Check if OperationalExchange is realized
if(!realizations.isEmpty())
{
   Collection<Diagram> diagramsInWhichOEIsRealized = new ArrayList<>();
   //Get all diagramsInWhichOEIsRealized
   for (DiagramPresentationElement diagram : project.getDiagrams())
   {
      Collection<Element> elements = diagram.getUsedModelElements(true);
      for (Element realization : realizations)
      {
         //Check if diagram represents one of the OperationalExchange realization
         if (elements.contains(realization))
         {
            diagramsInWhichOEIsRealized.add(diagram.getDiagram());
            break;
         }
      }
   }
}

With best regards,
No Magic Customer Support.
paudzi
Customer Support
Customer Support
 
Posts: 70
Posts Rating:4
Joined: Thu Oct 20, 2011 5:50 am

Re: Reporting Usage in Diagrams

Postby eugene.nicholson@noaa.gov » Tue Dec 08, 2015 8:13 am

Thank you for your response. I appreciate very much your taking the time to help me. However I'm new to MagicDraw and am using the report wizard and VTL to create a report in Excel. While I understand the logic of the code you provided, I am uncertain how to apply it. Perhaps you could provide a bit of context as to how the code can be applied?
eugene.nicholson@noaa.gov
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:1
Joined: Mon Sep 14, 2015 8:42 am

Re: Reporting Usage in Diagrams

Postby praktikant-e-mobility-sys-haus-entw-4.scw@zf.com » Wed Nov 14, 2018 4:51 am

Hello :-)

I have the same question.
Is there a solution by now?

greeting Christian
praktikant-e-mobility-sys-haus-entw-4.scw@zf.com
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:0
Joined: Wed Nov 14, 2018 4:25 am

Re: Reporting Usage in Diagrams

Postby lgunning@mitre.org » Tue Apr 16, 2019 7:11 pm

I too would like to know how to include the Colum of the relationship of "usage in diagrams"
This is reported in the AV-2 spreadsheet.
However, since this value is in the specification; it seems that it would not be too difficult to include this relationship value in a table.
what is the relationship? source to target?
lgunning@mitre.org
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Thu Mar 03, 2016 9:48 am

Re: Reporting Usage in Diagrams

Postby sarawut_w » Tue Apr 16, 2019 10:00 pm

Hello everybody,

We are sorry for lately response.
I too would like to know how to include the Colum of the relationship of "usage in diagrams"

We are sorry to say, we do not have the velocity function for getting *Usage in diagrams* elements.
But you can use this below VTL code instead:
Code: Select all
#foreach($element in $elements)
   Name = $element.name
   Type = $element.elementType
   #set($ar = $array.createArray())
   #foreach($diagramView in $project.getPresentationDiagrams())
      #if ($diagramView.isElementInDiagram($element))
         #set($diagram = $diagramView.getDiagram())
         #if (!$report.isEmpty($diagram))
            #set($void = $ar.add($diagram))
            Used in: $diagram.name
         #end
      #end
   #end
#end

Note: Replace your collection of element on the $elements variable, such as $OperationalExchange, $UseCase, $Association, etc.

This is reported in the AV-2 spreadsheet.

You would rather to customize the template by yourself.

what is the relationship? source to target?

You could get relationship for each element by this VTL code:
Code: Select all
#foreach($element in $elements)
Element name = $element.name
#foreach($rel in $report.getRelationship($element))
Relationship name = $rel.name
Source name = $rel.source.get(0).name
Target name = $rel.target.get(0).name
#end
#end

Note: Replace your collection of element on the $elements variable, such as $Class, $UseCase, $Association, etc.

Best regards,
Sarawut W.
Support Engineer
sarawut_w
No Magic
No Magic
 
Posts: 336
Posts Rating:23
Joined: Thu Jun 23, 2011 12:47 am


Return to Report Engine

Who is online

Users browsing this forum: Google [Bot] and 0 guests