Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Mr.Scott on December 12, 2015, 09:35:02 am
-
Hi, I am generating a document with a sequence diagram and I am trying to understand how to write a query to get the description off of the operation on the component object. Does anyone know how to link the operation on the sequence line to the component's operation?
Here are the steps I am taking:
On Sequence Diagram add components as an 'instance'
On sequence lines, select an operation defined on the component.
The query below returns the description on the sequence line on the diagram.
SELECT c.SeqNo, c.Name as FUNCTION_NAME, c.Notes as DESCRIPTION, c.SourceConstraint AS IMPACT
FROM t_connector AS c
WHERE (c.Connector_Type = 'Sequence')
AND (c.DiagramID = #INSERT DIAGRAM ID#)
ORDER BY c.SeqNo
From the object model and the queries I have tried it's not clear how to map the operation on the sequence back to the component's operation. Do you know what tables I need to look at to do a join on?
-
Here's the code I use in the Message wrapper (https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/master/EAAddinFramework/EAWrappers/Message.cs) to get a hold of the Operation
public UML.Classes.Kernel.Operation calledOperation
{
get
{
UML.Classes.Kernel.Operation returnedOperation = null;
foreach (global::EA.ConnectorTag tag in this.wrappedConnector.TaggedValues)
{
if (tag.Name == "operation_guid")
{
returnedOperation = this.model.getOperationByGUID(tag.Value);
}
}
return returnedOperation;
}
set
{
throw new NotImplementedException();
}
}
The message contains a tagged value that holds the operations GUID
Geert
-
Your approach makes sense and looks good. A friend suggested I look at the 't_connectortag' table and I was able to do it on a SQL join using the join below. I may try swapping to the operation approach.
...
FROM t_connector AS c
LEFT JOIN t_connectortag ct on (ct.elementID = c.Connector_ID)
LEFT JOIN t_operation o on (o.ea_guid = ct.value)
...