Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Snippet: Work with Model Artifacts

< To: Tigerstripe_APIs

This snippet illustrates how to work with model artifacts.


Note: the EMF-Based API is still under construction and is not fully implemented

// Start by getting the Model Manager of the project
ITigerstripeModelProject project = ...
IModelManager mMgr = project.getModelManager();
// For now the default repository is hardcoded to be a PojoModelRepository,
// This should be configurable in the future.
IModelRepository repo = mMgr.getDefaultRepository();
// Use the EMF-generated factory to create a new artifact
IManagedEntityArtifact nMea = MetamodelFactory.eINSTANCE.createIManagedEntityArtifact();
// Name & Package are required before a Repository can store an Artifact
// The pojo is created in a transaction, true);
// To change an attribute on the Mea once it belongs to a repository,
// A transaction is needed:
final IManagedEntityArtifact fMea = nMea;
TransactionalEditingDomain editingDomain = repo.getEditingDomain();
editingDomain.getCommandStack().execute(new AbstractCommand() {
      public boolean canExecute() {
        return true;
      public void execute() {
      public void redo() {

Note that as this command is executed and commits, the POJO is renamed accordingly.


Note: the Old API is soon going to be deprecated

Back to the top