4

There are some variables in templates.cfg that could be used, like ${SRC} , ${ROOT_PKG} , ${BEANNAME} , ...

I would like to know the list of variables that could be used, and also it if it possible to get the database information configured in databases.dbcfg . For example, I want to use the database name and schema in the path of the generated files.

I would like to execute a template like

JPA record (without links)  ; ${BEANNAME}.java      ; ${SRC}/${ROOT_PKG}/model/${database.name} ; XxxJpaRecord_java.vm ; *

but it creates a folder with the name "${database.name}" instead creating a folder with the name of the database.

gbelin
  • 365
  • 1
  • 4
  • 14

1 Answers1

1

Each Telosys project has a set of variables : "standard variables" and “specific project variables”. These variables are usable in every template of the current project (whatever the templates bundle).

All the project variables are defined in the "telosys.cfg" file. This file is a text file editable with any text editor (you can also use the "ecfg" command if you are using Telosys-CLI). In this file you can set the "standard variables" (like SRC, RES, etc) and your own "project variables" (specific variables with "ProjectVariable." prefix) all variables are usable in the templates and in the "templates.cfg" files). By convention the variables names are in capitals.

In your example you just have to define a new "project variable" in the "telosys.cfg" file, for example:

ProjectVariable.DATABASE_NAME=mydb 

and use it in your "templates.cfg" files

${SRC}/${ROOT_PKG}/model/${DATABASE_NAME}
lgu
  • 2,342
  • 21
  • 29
  • What about c# asp.net core solution with multiple projects: MVC razor pages, Application, Infrastructure, Common. What are these standard variables referring to? – Rad Oct 13 '21 at 10:10