Is there a way of including the pre- and postconditions of system capabilities into the generated word document? I didn’t found an example and I’ve tried myself to enhance the template, but without any success.
If you already have the Capability object you can use something like:
{m:capability.preCondition.name}
or
{m:capability.postCondition.name}
To get the capability in the first place if you are on a System object and want capabilitys from the SystemAnalysis you can use:
{m:system.ownedArchitectures->filter(ctx::SystemAnalysis)->at(1).ownedAbstractCapabilityPkg.oclAsType(ctx::CapabilityPkg).ownedCapabilities.postCondition.name}
Note there are other places where you can find Capabilities:
{m:system.ownedArchitectures->filter(la::LogicalArchitecture)->at(1).ownedAbstractCapabilityPkg.oclAsType(la::CapabilityRealizationPkg).ownedCapabilityRealizations}
Hi Yvan, thanks for your help. Unfortunately it doesn’t seem to work as aql query and in the m2doc template. Despite there are pre- and postconditions defined on a system capability the string generated is empty. See my screenshots below:
After looking at The Capella metamodels I found that the object referenced by a Capability.preCondition or .postCondition is a Constraint and it can be of different natures, so I looked in the definition of the odesign and found a service that can represent those objects in a human readable way. But the service seems to reference an editor and I’m not sure if it will work with M2Doc, anyway you can try by importing the service class in your template (using the template properties wizard):
The returned text will be the same as in the property view so you might need to change it a bit to fit your needs.
For the second point, the error happens because the Constraint.ownedSpecification can be diffent kinds of objects for instance an OpaqueExpression with a feature body or a ValueSpecification that don’t have a feaure body.
I’m still struggling to import the service class. The template properties wizard, doesn’t offer any service to choose. I’ve tried to follow the instructions on the refered reference documentation. However I hadn’t any success. Are there any prerequisites for using the CapellaServices?
This dialog is using the JDT and is only populated if a plugin project is opened in the workspace. This project should have dependencies to Capella plugins. To make things easier in the future, I’ll add those classes to the Capella token accessible in the template properties wizard: