labs4capella / python4capella

Python for Capella
Eclipse Public License 2.0
52 stars 10 forks source link

Capella-ExchangeMechanism extraction #133

Closed thierry112 closed 2 years ago

thierry112 commented 2 years ago

This issue known in M2Doc (mentioned in help forum) about extracting echangeMechanism of exchange Items exists as well in python4capella. The get function can't find the attribute. The reason for extracting is preventing mix between flows and others, as they are permanent and not instantanous.

ylussaud commented 2 years ago

The M2Doc thread can be found here.

ylussaud commented 2 years ago

The problem is related to the enumeration. In the Python API we should return a String. You can try to replace the method with:

        value =  self.get_java_object().getExchangeMechanism()
        if value is None:
            return value
        else:
            return value.getName()

and the set_exchange_mechanism:

         self.get_java_object().setExchangeMechanism(get_enum_literal("http://www.polarsys.org/capella/core/information/" + capella_version(), "ExchangeMechanism", value))