Page 1 of 1

Properly Creating a Connector in Java OpenAPI

PostPosted: Wed Aug 02, 2017 4:59 pm
by david.baum@aero.org
Hello,

In Cameo Systems Modeler, I am trying to create a connector programmatically from within a plugin using the Java OpenAPI. I have two Part Properties that I need to connect, each with their own specific ports. I am having trouble finding the proper code to perform this operation.

Currently what I am attempting is the following:
Code: Select all
Connector connector = project.getElementsFactory().createConnectorInstance();
List<ConnectorEnd> ends = connector.getEnd();

ends.get(0).setPartWithPort(part1);
ends.get(0).setRole(part1.get_connectorEndOfPartWithPort().get(0).getRole());
StereotypesHelper.addStereotypeByString(ends.get(0), "NestedConnectorEnd");

ends.get(1).setPartWithPort(part2);
ends.get(1).setRole(part2.get_connectorEndOfPartWithPort().get(0).getRole());
StereotypesHelper.addStereotypeByString(ends.get(1), "NestedConnectorEnd");


Once this connector is added to the model, however, it does not appear like connectors created using Cameo. Any help would be appreciated.

Re: Properly Creating a Connector in Java OpenAPI

PostPosted: Thu Aug 03, 2017 11:44 pm
by Rolandas
Hello,

Maybe you could attach a screenshot, what is your connector like created in Cameo and what you get.
From code i see, you created a simple connector and added "NestedConnectorEnd" stereotypes, but did not set any "propertyPath" for it. So maybe you mean that is not same, as from Cameo it creates with the paths?
If it is so, you will need to set the "NestedConnectorEnd" tag value yourself, as right now there is no OpenAPI to automatically calculate it.

Regards,
No Magic Support Team

Re: Properly Creating a Connector in Java OpenAPI

PostPosted: Fri Aug 04, 2017 9:27 am
by david.baum@aero.org
Thanks for the response! Setting the propertyPath for the NestedConnectorEnd stereotype seems to have solved my problem.