M2DoC-->Objects not found (eAllContents)

Hello,
I’m using Capella 5.2 with M2DOC 3.2.1.
For a different project I used an other generating tool, but now I have to come to M2DOC for a local project.
For this project I created a new template and modified it, to get my informations from the model.

Lesson learnt from the las time, I checked the capella package at the template properties ;-).

Nevertheless when I validate the template, no error messages will be generated. Also when “generate document” is operated.

Unfortunatly there are now many error messages in the generated file. It seems that the eAllContens() method does not find any objects.

I reduced my template to isolate the error, but I have no idea what is missing.
So I start to create a loop to create a table with all my OC:
Template
{m:for ocp | self.eAllContents(oa::OperationalCapabilityPkg)}
{m:if cop.name=‘meinName’}
(tableHeader)
{m:for oc | ocp.eAllContents(oa::OperationalCapability)}
(tablerows)
{endfor}{endif}{endear}

Result
So far so good. Validation states no errors, generation states finished with no errors.
When opening the doc, this is the content:

{m:for ocp | self.eAllContents(oa::OperationalCapabilityPkg)}
eAllContents(org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EClass) with arguments [null, org.eclipse.emf.ecore.impl.EClassImpl@ad620fd (name: OperationalCapabilityPkg) (instanceClassName: null) (abstract: false, interface: false)] failed: null java.lang.NullPointerException at org.eclipse.acceleo.query.services.EObjectServices.eAllContents(EObjectServices.java:1085) at org.eclipse.acceleo.query.services.EObjectServices.eAllContents(EObjectServices.java:1061) at org.eclipse.acceleo.query.services.EObjectServices.eAllContents(EObjectServices.java:1032) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.eclipse.acceleo.query.runtime.impl.JavaMethodService.internalInvoke(JavaMethodService.java:162) at org.eclipse.acceleo.query.runtime.impl.AbstractService.invoke(AbstractService.java:135) at org.eclipse.acceleo.query.runtime.impl.EvaluationServices.callService(EvaluationServices.java:129) at org.eclipse.acceleo.query.runtime.impl.EvaluationServices.call(EvaluationServices.java:172) at org.eclipse.acceleo.query.runtime.impl.EvaluationServices.callOrApply(EvaluationServices.java:208) at org.eclipse.acceleo.query.parser.AstEvaluator.caseCall(AstEvaluator.java:189) at org.eclipse.acceleo.query.ast.util.AstSwitch.doSwitch(AstSwitch.java:119) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69) at org.eclipse.acceleo.query.parser.AstEvaluator.eval(AstEvaluator.java:109) at org.eclipse.acceleo.query.runtime.impl.QueryEvaluationEngine.eval(QueryEvaluationEngine.java:52) at org.obeonetwork.m2doc.generator.M2DocEvaluator.caseRepetition(M2DocEvaluator.java:1415) at org.obeonetwork.m2doc.generator.M2DocEvaluator.caseRepetition(M2DocEvaluator.java:1) at org.obeonetwork.m2doc.template.util.TemplateSwitch.doSwitch(TemplateSwitch.java:147) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69) at org.obeonetwork.m2doc.generator.M2DocEvaluator.doSwitch(M2DocEvaluator.java:1450) at org.obeonetwork.m2doc.generator.M2DocEvaluator.caseBlock(M2DocEvaluator.java:1675) at org.obeonetwork.m2doc.generator.M2DocEvaluator.caseBlock(M2DocEvaluator.java:1) at org.obeonetwork.m2doc.template.util.TemplateSwitch.doSwitch(TemplateSwitch.java:199) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69) at org.obeonetwork.m2doc.generator.M2DocEvaluator.doSwitch(M2DocEvaluator.java:1450) at org.obeonetwork.m2doc.generator.M2DocEvaluator.caseDocumentTemplate(M2DocEvaluator.java:314) at org.obeonetwork.m2doc.generator.M2DocEvaluator.caseDocumentTemplate(M2DocEvaluator.java:1) at org.obeonetwork.m2doc.template.util.TemplateSwitch.doSwitch(TemplateSwitch.java:279) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69) at org.obeonetwork.m2doc.generator.M2DocEvaluator.doSwitch(M2DocEvaluator.java:1450) at org.obeonetwork.m2doc.generator.M2DocEvaluator.generate(M2DocEvaluator.java:299) at org.obeonetwork.m2doc.util.M2DocUtils.generate(M2DocUtils.java:853) at org.obeonetwork.m2doc.genconf.GenconfUtils.generate(GenconfUtils.java:507) at org.obeonetwork.m2doc.genconf.GenconfUtils.generate(GenconfUtils.java:432) at org.obeonetwork.m2doc.genconf.editor.command.GenerateHandler$GenerateJob.runInWorkspace(GenerateHandler.java:87) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Additional infos
I already tried to add nsURI from a template I used in 2022 for a different project, but with the same result.

Does anyone have an idea what I have overseen or where is the error Imade?
Thanks in advance and best regards
Carsten

Ok, seems I identified the problem. I used mutated vowel (ä and ß) in the project name. I tried the same procedure I described above, with a different project. There everything is working. So I guess that M2DOC can’t find the *.aird file because I used mutated vowels?
New problem: How an I rename the whole project? Because If I to rename the *.aird, *.afm and *.capella files with F2, my project is unreadable :frowning:

Thanks in advance
Carsten

This issue is fixed in M2Doc 3.3.1.

We don’t provide a build of the M2Doc extension for Capella 5.x with M2Doc version 3.3.1 or above. If you need such build, you can contact Obeo’s commercial support.

Just did a test for renaming a project: While the Capella session being closed, I sequentially:

  • renamed the .afm file
  • renamed the .aird file
  • renamed the .capella file
  • renamed the project folder
    And it worked nicely.

Stephane

In the documentation there are some more hints about rename and copy of a Capella model…:

Capella Guide > User Manual > First steps with Capella > How to rename a Capella Project?

1 Like

I tried both sequences. As soon as I rename the *.capella file the project is invalid and the aird does not show any artefacts anymore

There are references from the .aird to the .capella. You probably need to replace the .capella file name in your .aird so it can reference the renamed model.

Manmy thanks, that was the problem…I renamed the references within the .aird and now it works :-). Also the M2DOC now operates as expected.

2 Likes