Synchronization of InputPins from a Parameter

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Synchronization of InputPins from a Parameter

Postby j.flender@wzl.rwth-aachen.de » Wed Nov 21, 2018 5:01 am

Dear Support-Team,
i have created a method to create and synchronize stereotyped InputPins on a Actions using Parameters. Though i am having a problem with the synchronization of InputPins with the ParameterElement. This is what i do - all of this is done within one SessionManager-Session:

1) At first i create a Input Pin Instance, adding type and stereotype (Works fine)
Code: Select all
inputPinInstance = getElementsFactory().createInputPinInstance());
StereotypesHelper.addStereotype(inputPinInstance, myStereotype);
      
inputPinInstance.setOwner(action);
inputPinInstance.createPresentation(action.getPresentation().getInstance());
inputPinInstance.setType(targetStatus);


2) Based on the Input Pin, i then create a parameter. (Works so far)
Code: Select all
parameterInstance = getElementsFactory().createParameterInstance());
parameterInstance.setDirection(portWrapper.getDirection());
parameterInstance.getInstance().setType(status.getInstance());
StereotypesHelper.addStereotype(parameterInstance, myStereotype); //Note - myStereotype is the same as before


3) I add the parameterInstance to the corresponding FunctionBehavior-Element of the Action

Code: Select all
inputPinInstance.setSynchronizationElement(parameterInstance); //Necessary, as otherwise an additional port on the source action would be created
functionBehaviorInstance.getOwnedParameter().add(parameterInstance);


At first, this result seems to be fine. "functionBehaviorInstance" now owns the correct Parameter and all actions that are specified from it automatically now own an InputPin. The Type and the Name are also synchronized towards the InputPin - except the Stereotype. (see Picture)

How can i force that the Stereotype is also synchronized analogue to the Name and Type?
Unbenannt.PNG


This picture shows the Specification of the generated InputPin - as you can see, Type is correct while Stereotype is empty
Unbenannt_1.PNG
You do not have the required permissions to view the files attached to this post.
j.flender@wzl.rwth-aachen.de
Forum Newbie
Forum Newbie
 
Posts: 11
Posts Rating:0
Joined: Fri Jul 01, 2016 8:10 am

Re: Synchronization of InputPins from a Parameter

Postby j.flender@wzl.rwth-aachen.de » Tue Dec 04, 2018 4:00 am

Ok - maybe i was a bit to unspecific. I added additional information to the post.
Is there a solution/workaround to force the synchronization of that stereotype?
j.flender@wzl.rwth-aachen.de
Forum Newbie
Forum Newbie
 
Posts: 11
Posts Rating:0
Joined: Fri Jul 01, 2016 8:10 am


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests