DSD-DBS / py-capellambse

A Python 3 headless implementation of the Capella modeling tool.
https://dsd-dbs.github.io/py-capellambse/
Apache License 2.0
53 stars 11 forks source link

Feature Request: Support for Component Exchange Categories #462

Closed podolsir closed 1 month ago

podolsir commented 1 month ago

In SA, LA and PA layers, the Component Exchanges can be assigned one or more Component Exchange Categories. Currently, the access to the categories has no API equivalent in the capellambse package.

Wuestengecko commented 1 month ago

Hi! Could you please try out #463, whether it works properly and has everything you need?

podolsir commented 1 month ago

Tried it out, looks great, thank you! I've tested my use case (logical architecture) for now, I think the rest works analogously.

There is just one remaining wrinkle. In Capella it is possible to add the component/function exchange categories directly to the root of an architecture layer. In this case, it is not possible with the current implementation to access it through the hierarchy (only via an exchange if one is assigned). The parent of the category is reported the la object in this case.

In other words, this is not possible despite being supported by Capella: cat_list = model.la.exchange_categories

as opposed to this which already works perfectly: cat_list = model.la.component_package.exchange_categories

Wuestengecko commented 1 month ago

Ah, I missed that when looking through the metamodel (it's so deeply buried in this hierarchy of abstract classes...). Good catch!

I've just updated #463 to also add a component_exchange_categories attribute on the layer objects - that's the name used in the original metamodel, and it avoids confusion with the ExchangeCategory used for functional exchanges. Could you please quickly retest this?

podolsir commented 1 month ago

Thanks! Tested it, now it works. Still have a small comment about the API naming, I commented the relevant line directly in the PR.