ExchangeItemAllocation: Missing getTransmissionProtocol() / getAcquisitionProtocol() Methods

Hi,

I am encountering an issue when trying to manipulate elements of type ExchangeItemAllocation in my code. When executing it, Py4J throws the following exceptions:

py4j.protocol.Py4JError: An error occurred while calling o1171.getTransmissionProtocol. Trace:
py4j.Py4JException: Method getTransmissionProtocol() does not exist

and

py4j.protocol.Py4JError: An error occurred while calling o1171.getAcquisitionProtocol. Trace:
py4j.Py4JException: Method getAcquisitionProtocol() does not exist

Is there a known workaround or a recommended way to access these properties?

Here is the relevant part of the code causing the issue:

def get_interfaces(root_parent, behavior_component):
    if behavior_component.get_implemented_interfaces():
        implemented_interfaces = behavior_component.get_implemented_interfaces()  # Interface[*]
        for interface in implemented_interfaces:
            exchange_item_allocation_list = interface.get_owned_exchange_item_allocations()  # ExchangeItemAllocation[*]
            for exchangeItemAllocation in exchange_item_allocation_list:
                xml_exhangeItem_tree = etree.SubElement(root_parent, "Published")
                
                transmissionProtocol = exchangeItemAllocation.get_transmission_protocol()  # String
                print(transmissionProtocol)
                acquisitionProtocol = exchangeItemAllocation.get_acquisition_protocol()  # String
                print(acquisitionProtocol)
                
                exchangeItem = exchangeItemAllocation.get_allocated_item()  # ExchangeItem
                xml_exhangeItem_tree.set('Name', exchangeItem.get_name())
                xml_exhangeItem_tree.set('ExchangeMechanism', exchangeItem.get_exchange_mechanism())
                get_all_exchange_item_elem(xml_exhangeItem_tree, exchangeItem)

Thanks in advance for your help!

Hi,

The simplified Python API is not calling the right Java API, it should call:

  • getSendProtocol()
  • getReceiveProtocol()
    and
  • setSendProtocol()
  • setReceiveProtocol()

You can change the capella.py file on your side to fix this issue. I opened the following issue to make the change in Python for Capella:

1 Like

Thanks for your reply. The solution works perfectly !!

1 Like