Skip to content

Instantly share code, notes, and snippets.

@xcriptus
Last active August 29, 2015 13:57
Show Gist options
  • Save xcriptus/9815128 to your computer and use it in GitHub Desktop.
Save xcriptus/9815128 to your computer and use it in GitHub Desktop.
Modelio Factory Create Model Transaction Jython Class 3.1
# This code creates two classes in the package MyPackage
# The library modelioscriptor is used
# The code assume that "MyPackage" is in the model
trans = theSession().createTransaction("Class creation")
try:
fact= theUMLFactory()
myp = instanceNamed(Package,"MyPackage")
c1 = fact.createClass()
c1.setOwner(myp)
c1.setName("Class1")
c2 = fact.createClass("Class2",myp)
trans.commit()
except:
trans.rollback()
raise
# Documentation:
# for transactions: http://forge.modelio.org/projects/modelio3-moduledevelopersmanuals-api/wiki/Transaction_api
# for the uml factory: http://modelio.org/documentation/javadoc-3.1/org/modelio/api/model/IUmlModel.html
# for the analyst factory: http://modelio.org/documentation/javadoc-3.1/org/modelio/api/model/IAnalystModel.html
# for more http://modelio.org/documentation/javadoc-3.1/org/modelio/metamodel/factory/IModelFactory.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment