Use "Application" model writer in Rhapsody Code Generation

When you deploy a transformation ruleset (as below) and run it with the Code Generator (menu command: Code > Re generate), you have probably noticed that the model was not updated.

public ruleset UpdateModel(inout source : rhapsody) {

  public rule myRule() {
    var app : rhapsody.Application = source.getInstances("Application").first();

    // Always get active project only !
    var proj : rhapsody.Project = app.activeProject;
       
    var newPkg : rhapsody.Package = source.create("Package");
   
    newPkg.name = "Hello";
       
    proj.packages.add(newPkg);
}

In fact, the Code Generator has been designed to use a On-Demand reader as input argument and nothing as output, since code source modules are generated.

Two possible solutions are exposed here:


Prev Section: Either use On-Demand or Application model reader in Rhapsody Code Generation
Next Section: Customize filenames associated to Rhapsody objects