Hi all,
I’m writing automation scripts with Python4Capella (Capella 7.0.1 + Python4Capella 1.1.3, Simplified API). I’ve noticed that for most high-level elements I can stay entirely in Python, but some relationships still seem to require a direct Java/EMF call.
Example script
python
CopierModifier
# create an Operational Actor
ac1 = OperationalActor()
ac1.set_name("Dummy Act")
pc_pkg_actor.get_owned_entities().add(ac1)
# create an Operational Capability
new_cap = OperationalCapability()
new_cap.set_name("Dummy Cap")
new_cap.set_description("dummy description")
oa_pkg.get_owned_operational_capabilities().add(new_cap)
# simple, high-level link works:
new_cap.get_involved_entities().add(ac1)
# --- trouble starts here ------------------------------------
# how to create the EntityOperationalCapabilityInvolvement?
involvement = org.polarsys.capella.core.data.oa.OaFactory \
.eINSTANCE.createEntityOperationalCapabilityInvolvement()
involvement.setInvolved(ac1.get_java_object())
new_cap.get_java_object() \
.getOwnedEntityOperationalCapabilityInvolvements() \
.add(involvement)
- Creating the actor and capability works fine with pure Python.
- Adding the actor to
new_cap.get_involved_entities()
also works. - But the EMF containment list
getOwnedEntityOperationalCapabilityInvolvements()
has no Python wrapper, so I had to drop down to Java.
What I’m struggling with
- Which setters are wrapped, which aren’t?
I use the metamodel browser for the Python side, but I can’t find a similar overview for the Java services. - How do you discover the correct factory / feature path?
Manually scanning plugin jars is painful. - Is there a best-practice way to keep scripts future-proof (so they don’t break if internal Java helpers move)?
- For this specific case: is there a Python-only helper to create
EntityOperationalCapabilityInvolvement
, or is a Java call inevitable?
Any pointers to documentation, code examples, or a recommended discovery workflow would be much appreciated.
Thanks in advance for your help!