Services for float operations in M2Doc

Hi,
I am writing a template which gathers property values computed by a Python4Capella scripts. I need to evaluate an expression which involves M2Doc queries. From the error I got, my understanding is that there are not M2Doc services for float or better Double type arithmetic operations.

Should I implement them myself?

Thanks

Hi,

Yes some arithmetic services are missing from the version of AQL M2Doc is using. Some services have been added to AQL 8.x (see this issue). You can have a look at this patch to see which one have been added and also implement your own.

Hi Yvan,
just a confirmation. Should I start from the code in the jar file org.eclipse.acceleo.query.source_7.0.0.202311201319.jar within Capella Studio 7.0 distribution? On Githut I found a commit from you with the transition from AQL 6.0.9 to 7.0.0 made on Feb 20, 2020.
I am worried about plugin dependencies.

Thanks
Pier Giorgio

Hi Pier,

You can implement the class with your services (Java method) in a plugin and deploy it in your environment and then import this class in your template. You can use the template property wizard and its service tab.

Services can be used to extends the features of AQL/M2Doc and also override the behavior of existing services if needed. And operators call services.

Yvan Lussaud.

Hi Yvan,
at the end I solved without implementing any custom service. The solution is a bit tricky, but it works.
I converted the floatProperty to a String with the method toString() and then to a Double with the method toReal() provided by the AQL String services.

Thank you for the support

1 Like