labs4capella / python4capella

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

Fix the CapellaLibrary API #217

Open ylussaud opened 4 months ago

ylussaud commented 4 months ago

in Capella API:

def get_libraries(system_engineering):
    """Gets the list of libraries for the given system engineering"""
    res = []

    if system_engineering is not None:
        lib_cls = getattr(sys.modules["__main__"], "CapellaLibrary")
        for value in getLibraries(system_engineering.get_java_object()):
            lib = lib_cls(value)
            res.append(lib)

But the class CapellaLibrary should then extends SystemEngineering. Because the Java SystemEngineering is loaded in the main project Sirius Session. Then we need to add a method get_capella_model() to load the libraries Sirius session. After that we will have two instances of the library in memory with different Objects (Python and Java). That will probably be confusing.

The method get_capella_model() should compute the .aird file from the resource URI replacing the .capella with .aird.