saveValueToInstance

Moderator: Moderators

saveValueToInstance

Postby tpen3219 » Tue May 14, 2013 9:55 pm

I encountered this error when I tried to use saveValueToInstance.

2013-05-14 20:27:57,242 INFO : [execute] Opaque behavior saveValueToInstance... 2013-05-14 20:27:57,242 INFO : Opaque behavior evaluation. Context is : Call Behavior Action action 2013-05-14 20:27:57,259 ERROR: Cannot evaluate Function Behavior saveValueToInstance: sun.org.mozilla.javascript.internal.EvaluatorException: Can't find method com.nomagic.magicdraw.simulation.utils.SimHelper.saveValueToInstance(fUML.Semantics.Classes.Kernel.Object_,fUML.Semantics.Classes.Kernel.Object_). (<Unknown source>#1) in <Unknown source> at line number 1 expression body: com.nomagic.magicdraw.simulation.utils.SimHelper.saveValueToInstance(object, instance)
You do not have the required permissions to view the files attached to this post.
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Re: saveValueToInstance

Postby pakornpong_p » Wed May 15, 2013 2:19 am

Dear Mr. Pender,

We do not open the "saveValueToInstance" as an OpenAPI.
So, we do not advise to use it.
However, to do so, you need to modify your model as you can't use the ForkNode to magically set an arbitrary InstanceSpecification as the input parameter of the method.

runPortalParametric_original.jpg


Instead, please create an empty InstanceSpecification of the Portal classifier first.
Next, create a ValueSpecificationAction, and then set its value to be an ElementValue which references to the InstanceSpecification you would like to set as the input parameter.
Ensure that the "result" output pin's type is InstanceSpecification.
Finally, move the "Instance" ControlFlow from the ForkNode to the "result" output pin.

runPortalParametric_mod.png


Note that, as the "saveValueToInstance" is not an OpenAPI, the return result is not guaranteed to be correct in this kind of usage.
You do not have the required permissions to view the files attached to this post.
pakornpong_p
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:-3
Joined: Wed Oct 19, 2011 11:04 pm

Re: saveValueToInstance

Postby tpen3219 » Wed May 15, 2013 9:10 am

Thank you very much.

The correction you offered is consistent with the sample project. That was entirely my mistake.

If it is not recommended to use the saveValueToInstance then we should remove it from the sample project CylinderPipe.
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Re: saveValueToInstance

Postby pakornpong_p » Mon May 20, 2013 10:22 pm

Dear Mr. Pender,

The "saveValueToInstance" API is in the sample as an advance feature that we would like to demonstrate and to formally have it in the future version of Cameo Simulation Toolkit. However, as it is not an OpenAPI, it has not been explicitly, formally tested as an API.

Best Regards,
Pakornpong P.
pakornpong_p
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:-3
Joined: Wed Oct 19, 2011 11:04 pm

Re: saveValueToInstance

Postby tpen3219 » Mon May 20, 2013 11:50 pm

Users rely on these samples to learn about new features.
Does it makes sense to have a sample element that is 1. something we want in the future and 2. something that has not been tested?
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Re: saveValueToInstance

Postby pakornpong_p » Wed May 22, 2013 1:02 am

Dear Mr. Pender,

We have decided to make the "com.nomagic.magicdraw.simulation.fuml.fUMLHelper.saveValueToInstance(object, instance)" method as an OpenAPI. It will be tested and available with the CST 17.0.4 release.

Best Regards,
Pakornpong P.
pakornpong_p
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:-3
Joined: Wed Oct 19, 2011 11:04 pm


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 1 guest