Search code examples
persisttelosys

Saving a modified DslModelEntity or DslModelAttribute with api in telosys-cli-4.1.1-001


I found out howto modify an existing entity with the api class DslModelEntity. I want to add an attribute to an entity, or an entity to a model, ...

I can do that by using the DslModel... add methods provided in the respective classes of the api. But how do I persist the modifications I did? I find no save... methods anywhere. Can you help me?


Solution

  • If you want to save an instance of DslModel you can use "ModelWriter".
    Example:

    String modelDirectory = "xxx";    
    ModelWriter modelWriter = new ModelWriter();
    modelWriter.writeModel(model, modelDirectory);
    

    For a concrete example, see the source code of the “DbToModelManager” class: https://github.com/telosys-tools-bricks/telosys-tools-dsl-parser/blob/master/src/main/java/org/telosys/tools/dsl/model/dbmodel/DbToModelManager.java