DSD-DBS/capella-rm-bridge

Fix order of Requirements and Folders in the Capella model

Closed this issue · 0 comments

Problem Definition

Currently the RM Bridge identifies capellambse.reqif.Folders iff there are non-empty children in the snapshot item. (Once upon a time there was a special case where a folder_hint boolean variable was set to True if an attribute combination type="Folder" was met. This was removed.) For the following live-doc Preamble and General Assumptions are just headings without any children work items. Therefore they won't have children in the snapshot and the RM Bridge identifies them as capellambse.reqif.Requirements.
image

This causes a false order in the Capella model:
image

As you can see the Introduction folder is written into the xml file after General Assumptions even if the order was still correct in the ChangeSet but they are divided into requirements and folders.

With my understanding of how capellambse registers requirements and folders on a capellambse.reqif.CapellaModule and how declarative modelling (decl) works, there's currently no way to control the creation order when using decl. Letting decl create folders first and then requirements could fix the problem, but I don't think that this specific behavior should be implemented in capellambse.

Solution proposal

With my understanding the order of model object creation with different class types (xsi-types) using decl can't be controlled in capellambse. Not with the current DirectProxyAccessor infrastructure. But that is a different problem that was revealed by this one. This problem is caused by a miss-identification of the workitem as a requirement. That caused the division of it into another bucket (requirements) and the order is only kept inside each bucket (folders, requirements). So I think that if these headings would've been identified as folders, the order would've been kept.

Folder identification by configured type (folder_hint revival)

I see a feature where the user specifies a special capellambse.reqif.RequirementType (as type) in the config and marks all work items with this special type as to-be-identified as folders. With this, a folder_hint boolean can be set in the TrackerChange.yield_requirements_create_actions (and probably also TrackerChange.yield_requirements_mod_actions) in capella_rm_bridge.changeset.change.py such that these special work items will be rendered as folders w/o any children.

RM content revision number:
r2551