In the viewpoint.spec.vptext file, it is possible to automatically create a Viewpoint Service file.
In this file, one can define Rules ( = which " executes code which conforms to a language type according to
https://wiki.polarsys.org/images/2/26/Kitalpha-B02-AF_and_Vi ewpoint_DSLs.pdf ) and Services ( = which "orchestrates the execution of a Rules list. )
What does “Orchestrate” means in that context ? And is that way to create custom rules appropriate with Capella Studio ( Comparing for example to the automatic implementation of Java services when defining conditions in the viewpoint.diagram file ) ?
“Orchestrate” means that a call to the service will call the rules in the order defined in the service.
I’m not sure to understand what you mean by appropriate. The two services you are referring to are different.
- services.vptext services are the way to create treatments (the “run” method) on elements satisfying the condition (the “canRun” method) implemented in the generated code.
- diagram.vptext conditions are implemented as a Java method returning a boolean value.
First of all, thank you for your answer.
The fact is that I don’t understand where and how those services will interact with the rest of the code ( I think that the fact that I never seen the code of others VP than the BasicVP does’nt help… ).
For exemple if a have a simple calculation to make in order to set the value of an attribute of a customized class, can I do that in a rule ? and how will I call the the service orchestrating this rule ?
When you create a service in the services.vptext file, this service is contributed to the Viewpoint view: when your viewpoint is referenced and active on your model, you have a new view named after your viewpoint that can be found in the views list (window > show view) or that can be opened by double click on the viewpoint name in the Viewpoint manager view.
In the viewpoint-specific view, the services tab displays your services.
Services can be triggered from here (or from a graphical model element, right click, viewpoint services.
It seems indeed to be the right way to achieve the need you describe in your example.
Thank you Arnaud, this is a lot clearer now !