Properly Creating a Connector in Java OpenAPI

Discussions about systems engineering product SysML functionalities

Moderator: Moderators

Properly Creating a Connector in Java OpenAPI

Postby david.baum@aero.org » Wed Aug 02, 2017 4:59 pm

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.
david.baum@aero.org
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:0
Joined: Fri Jul 28, 2017 4:05 pm

Re: Properly Creating a Connector in Java OpenAPI

Postby Rolandas » Thu Aug 03, 2017 11:44 pm

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
Rolandas
Customer Support
Customer Support
 
Posts: 226
Posts Rating:16
Joined: Mon Jul 30, 2012 3:59 am

Re: Properly Creating a Connector in Java OpenAPI

Postby david.baum@aero.org » Fri Aug 04, 2017 9:27 am

Thanks for the response! Setting the propertyPath for the NestedConnectorEnd stereotype seems to have solved my problem.
david.baum@aero.org
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:0
Joined: Fri Jul 28, 2017 4:05 pm


Return to SysML

Who is online

Users browsing this forum: No registered users and 0 guests

cron