Browse a directory in Velocity Template Language with TelosysIncluding all the jars in a directory within the Java classpathWhat is the lexically correct statement in Velocity Template LanguageGetting the Current Working Directory in JavaCreate and iterate through an array in Velocity Template LanguageReplace a Substring of a String in Velocity Template LanguageVelocity Template Language dynamic variableTelosys : How can i get database table records in template?Apache Velocity Template LanguageVelocity Template Language: subtract two variablesGet file directory in Apache Velocity Template Language
Would getting a natural 20 with a penalty still count as a critical hit?
Ending a line of dialogue with "?!": Allowed or obnoxious?
Adjective or adverb before another adjective
What should we do with manuals from the 80s?
Quick destruction of a helium filled airship?
What's the point of writing that I know will never be used or read?
How to prevent criminal gangs from making/buying guns?
Number of matrices with bounded products of rows and columns
Output the list of musical notes
Alignement of different align environment
Combinatorial Argument for Exponential and Logarithmic Function Being Inverse
What's a good pattern to calculate a variable only when it is used the first time?
Regression when x and y each have uncertainties
What is the purpose/function of this power inductor in parallel?
Is the Microsoft recommendation to use C# properties applicable to game development?
Heyawacky: Ace of Cups
Have there ever been other TV shows or Films that told a similiar story to the new 90210 show?
Gofer work in exchange for LoR
My new Acer Aspire 7 doesn't have a Legacy Boot option, what can I do to get it?
A reccomended structured approach to self studying music theory for songwriting
Tikz: The position of a label change step-wise and not in a continuous way
Expressing a chain of boolean ORs using ILP
What are some tips and tricks for finding the cheapest flight when luggage and other fees are not revealed until far into the booking process?
How to train a replacement without them knowing?
Browse a directory in Velocity Template Language with Telosys
Including all the jars in a directory within the Java classpathWhat is the lexically correct statement in Velocity Template LanguageGetting the Current Working Directory in JavaCreate and iterate through an array in Velocity Template LanguageReplace a Substring of a String in Velocity Template LanguageVelocity Template Language dynamic variableTelosys : How can i get database table records in template?Apache Velocity Template LanguageVelocity Template Language: subtract two variablesGet file directory in Apache Velocity Template Language
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to write templates in VTL to generate java classes with telosys. My starting point is a directory (src/main/resources/templates/es) that contains json files (mapping1.json, mapping2.json, ...). The number and names of json files are unknown and may vary. I have to generate several java classes per json files.
I have already write a template for each java classe that i have to generate. But these templates work with a static embedded json object.
This an example:
#set($json =
"template":"acces_formation",
"mappings":
"data":
"properties":
"MATRICULE":
"type":"string",
"index":"not_analyzed"
,
"NOM":
"type":"string",
"index":"not_analyzed"
,
"DATE_NAIS":
"type":"date",
"format":"dd/MM/yyyy"
,
"SEXE":
"type":"string",
"index":"not_analyzed"
,
"GRADE":
"type":"string",
"index":"not_analyzed"
)
#macro(javaName $s)$s.substring(0,1).toUpperCase()$s.substring(1)#end
#macro(setter $s)set#javaName($s)#end
#macro(getter $s)get#javaName($s)#end
###############################start macro toCamelCase
#macro(toCamelCase $s)
#set($datas = $s.split("_"))
#set($name = "")
#foreach($data in $datas)
#set($data = $data.substring(0,1).toUpperCase()+$data.substring(1))
#set($name = $name+$data)
#end
$name##
#end
###############################End macro toCamelCase
###############################Start macro tab
#macro(tab $nbreTotal)
#if($nbreTotal >= 1)
#foreach($nbre in [1..$nbreTotal])
##
#end
#end
#end
###############################End macro tab
###############################Start macro javaType
#macro(javaType $f, $nbreTab)
#if($f.equals("string"))
#tab($nbreTab)String##
#elseif($f.equals("boolean"))
#tab($nbreTab)Boolean##
#elseif($f.equals("long"))
#tab($nbreTab)Long##
#elseif($f.equals("float"))
#tab($nbreTab)Float##
#elseif($f.equals("double"))
#tab($nbreTab)Double##
#elseif($f.equals("int"))
#tab($nbreTab)Integer##
#elseif($f.equals("integer"))
#tab($nbreTab)Integer##
#elseif($f.equals("date"))
#tab($nbreTab)String##
#elseif($f.equals("array"))
#tab($nbreTab)java.util.List<#javaType($f)>##
#else
#tab($nbreTab)$f##
#end
#end
###############################End macro javaType
#############################################
#set($templateName = $json.template)
#set($entity = "#toCamelCase($json.template)")
#set($entityDto = $entity+"Dto")
#set($param = "_param")
/*
Java dto for elasticSearch template $templateName
Created on $today.date ( Time $today.time )
Generator tool : $generator.name ( version $generator.version )
*/
package $target.javaPackageFromFolder($SRC);
import java.util.Date;
import $ROOT_PKG.helper.contract.SearchParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
DTO for elasticSearch template "$templateName"
@author Lazare yao
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder(alphabetic = true)
@getter
@Setter
@NoArgsConstructor
@tostring
public class $entityDto implements Cloneable
#set($properties = $json.mappings.data.properties)
private String#tab(3)_id;
#foreach($key in $properties.keySet())
#set($field = $key.toLowerCase())
#tab(1)private #javaType($properties.get($key).type,0)#tab(3)$field ;
#end
private SearchParam<String>#tab(3)_id$param;
#foreach($key in $properties.keySet())
#set($field = $key.toLowerCase())
#tab(1)private SearchParam<#javaType($properties.get($key).type,0)>#tab(3)$field$param;
#end
private String orderDirection;
private String orderField;
What i need now is to:
1- browse my json directory, get each json file and apply the templates on that json to create the java classes for that json file.
2- properly configure the file templates.cfg to create java class file with the java class name. Concerning this point, i heve tried to modify the variable $BEANNAME, $BEANNAME_UC, $BEANNAME_LC (given by default by telosys) since the template. But it did not work: They still empty and No file is generated. This is the content of the file templates.cfg :
#---------------------------------------------------------
# Templates configuration file
# Values separated by ";"
# . value 1 : the label
# . value 2 : the file to be generated ( var allowed : $BEANNAME, $BEANNAME_UC, $BEANNAME_LC )
# . value 3 : the project folder where to generate ( var allowed : $BEANNAME, $BEANNAME_UC, $BEANNAME_LC )
# . value 4 : the template to use
# . value 5 : number of execution : "1" for "ONCE" for all entities, default is multiple executions ( executed for each entity )
#---------------------------------------------------------
# Since v 2.0 the project's variables can be used in file and folder name
#---------------------------------------------------------
Dto ; $BEANNAMEDto.java ; $SRC/$ROOT_PKG/helper/dto ; dto.vm
CustomDto ; _$BEANNAMEDto.java ; $SRC/$ROOT_PKG/helper/dto/customize ; _dto.vm
Enum ; $BEANNAMEEnum.java ; $SRC/$ROOT_PKG/helper/enums ; enum.vm
Repository ; $BEANNAMERepository.java ; $SRC/$ROOT_PKG/dao/repository/es ; repository.vm ;
Custom Repository ; _$BEANNAMERepository.java ; $SRC/$ROOT_PKG/dao/repository/es/customize ; _repository.vm ;
Business ; $BEANNAMEBusiness.java ; $SRC/$ROOT_PKG/business/ ; business.vm
Controller ; $BEANNAMEController.java ; $SRC/$ROOT_PKG/rest/api ; controller.vm
Thank you for helping me please !
java json vtl telosys
add a comment |
I am trying to write templates in VTL to generate java classes with telosys. My starting point is a directory (src/main/resources/templates/es) that contains json files (mapping1.json, mapping2.json, ...). The number and names of json files are unknown and may vary. I have to generate several java classes per json files.
I have already write a template for each java classe that i have to generate. But these templates work with a static embedded json object.
This an example:
#set($json =
"template":"acces_formation",
"mappings":
"data":
"properties":
"MATRICULE":
"type":"string",
"index":"not_analyzed"
,
"NOM":
"type":"string",
"index":"not_analyzed"
,
"DATE_NAIS":
"type":"date",
"format":"dd/MM/yyyy"
,
"SEXE":
"type":"string",
"index":"not_analyzed"
,
"GRADE":
"type":"string",
"index":"not_analyzed"
)
#macro(javaName $s)$s.substring(0,1).toUpperCase()$s.substring(1)#end
#macro(setter $s)set#javaName($s)#end
#macro(getter $s)get#javaName($s)#end
###############################start macro toCamelCase
#macro(toCamelCase $s)
#set($datas = $s.split("_"))
#set($name = "")
#foreach($data in $datas)
#set($data = $data.substring(0,1).toUpperCase()+$data.substring(1))
#set($name = $name+$data)
#end
$name##
#end
###############################End macro toCamelCase
###############################Start macro tab
#macro(tab $nbreTotal)
#if($nbreTotal >= 1)
#foreach($nbre in [1..$nbreTotal])
##
#end
#end
#end
###############################End macro tab
###############################Start macro javaType
#macro(javaType $f, $nbreTab)
#if($f.equals("string"))
#tab($nbreTab)String##
#elseif($f.equals("boolean"))
#tab($nbreTab)Boolean##
#elseif($f.equals("long"))
#tab($nbreTab)Long##
#elseif($f.equals("float"))
#tab($nbreTab)Float##
#elseif($f.equals("double"))
#tab($nbreTab)Double##
#elseif($f.equals("int"))
#tab($nbreTab)Integer##
#elseif($f.equals("integer"))
#tab($nbreTab)Integer##
#elseif($f.equals("date"))
#tab($nbreTab)String##
#elseif($f.equals("array"))
#tab($nbreTab)java.util.List<#javaType($f)>##
#else
#tab($nbreTab)$f##
#end
#end
###############################End macro javaType
#############################################
#set($templateName = $json.template)
#set($entity = "#toCamelCase($json.template)")
#set($entityDto = $entity+"Dto")
#set($param = "_param")
/*
Java dto for elasticSearch template $templateName
Created on $today.date ( Time $today.time )
Generator tool : $generator.name ( version $generator.version )
*/
package $target.javaPackageFromFolder($SRC);
import java.util.Date;
import $ROOT_PKG.helper.contract.SearchParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
DTO for elasticSearch template "$templateName"
@author Lazare yao
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder(alphabetic = true)
@getter
@Setter
@NoArgsConstructor
@tostring
public class $entityDto implements Cloneable
#set($properties = $json.mappings.data.properties)
private String#tab(3)_id;
#foreach($key in $properties.keySet())
#set($field = $key.toLowerCase())
#tab(1)private #javaType($properties.get($key).type,0)#tab(3)$field ;
#end
private SearchParam<String>#tab(3)_id$param;
#foreach($key in $properties.keySet())
#set($field = $key.toLowerCase())
#tab(1)private SearchParam<#javaType($properties.get($key).type,0)>#tab(3)$field$param;
#end
private String orderDirection;
private String orderField;
What i need now is to:
1- browse my json directory, get each json file and apply the templates on that json to create the java classes for that json file.
2- properly configure the file templates.cfg to create java class file with the java class name. Concerning this point, i heve tried to modify the variable $BEANNAME, $BEANNAME_UC, $BEANNAME_LC (given by default by telosys) since the template. But it did not work: They still empty and No file is generated. This is the content of the file templates.cfg :
#---------------------------------------------------------
# Templates configuration file
# Values separated by ";"
# . value 1 : the label
# . value 2 : the file to be generated ( var allowed : $BEANNAME, $BEANNAME_UC, $BEANNAME_LC )
# . value 3 : the project folder where to generate ( var allowed : $BEANNAME, $BEANNAME_UC, $BEANNAME_LC )
# . value 4 : the template to use
# . value 5 : number of execution : "1" for "ONCE" for all entities, default is multiple executions ( executed for each entity )
#---------------------------------------------------------
# Since v 2.0 the project's variables can be used in file and folder name
#---------------------------------------------------------
Dto ; $BEANNAMEDto.java ; $SRC/$ROOT_PKG/helper/dto ; dto.vm
CustomDto ; _$BEANNAMEDto.java ; $SRC/$ROOT_PKG/helper/dto/customize ; _dto.vm
Enum ; $BEANNAMEEnum.java ; $SRC/$ROOT_PKG/helper/enums ; enum.vm
Repository ; $BEANNAMERepository.java ; $SRC/$ROOT_PKG/dao/repository/es ; repository.vm ;
Custom Repository ; _$BEANNAMERepository.java ; $SRC/$ROOT_PKG/dao/repository/es/customize ; _repository.vm ;
Business ; $BEANNAMEBusiness.java ; $SRC/$ROOT_PKG/business/ ; business.vm
Controller ; $BEANNAMEController.java ; $SRC/$ROOT_PKG/rest/api ; controller.vm
Thank you for helping me please !
java json vtl telosys
add a comment |
I am trying to write templates in VTL to generate java classes with telosys. My starting point is a directory (src/main/resources/templates/es) that contains json files (mapping1.json, mapping2.json, ...). The number and names of json files are unknown and may vary. I have to generate several java classes per json files.
I have already write a template for each java classe that i have to generate. But these templates work with a static embedded json object.
This an example:
#set($json =
"template":"acces_formation",
"mappings":
"data":
"properties":
"MATRICULE":
"type":"string",
"index":"not_analyzed"
,
"NOM":
"type":"string",
"index":"not_analyzed"
,
"DATE_NAIS":
"type":"date",
"format":"dd/MM/yyyy"
,
"SEXE":
"type":"string",
"index":"not_analyzed"
,
"GRADE":
"type":"string",
"index":"not_analyzed"
)
#macro(javaName $s)$s.substring(0,1).toUpperCase()$s.substring(1)#end
#macro(setter $s)set#javaName($s)#end
#macro(getter $s)get#javaName($s)#end
###############################start macro toCamelCase
#macro(toCamelCase $s)
#set($datas = $s.split("_"))
#set($name = "")
#foreach($data in $datas)
#set($data = $data.substring(0,1).toUpperCase()+$data.substring(1))
#set($name = $name+$data)
#end
$name##
#end
###############################End macro toCamelCase
###############################Start macro tab
#macro(tab $nbreTotal)
#if($nbreTotal >= 1)
#foreach($nbre in [1..$nbreTotal])
##
#end
#end
#end
###############################End macro tab
###############################Start macro javaType
#macro(javaType $f, $nbreTab)
#if($f.equals("string"))
#tab($nbreTab)String##
#elseif($f.equals("boolean"))
#tab($nbreTab)Boolean##
#elseif($f.equals("long"))
#tab($nbreTab)Long##
#elseif($f.equals("float"))
#tab($nbreTab)Float##
#elseif($f.equals("double"))
#tab($nbreTab)Double##
#elseif($f.equals("int"))
#tab($nbreTab)Integer##
#elseif($f.equals("integer"))
#tab($nbreTab)Integer##
#elseif($f.equals("date"))
#tab($nbreTab)String##
#elseif($f.equals("array"))
#tab($nbreTab)java.util.List<#javaType($f)>##
#else
#tab($nbreTab)$f##
#end
#end
###############################End macro javaType
#############################################
#set($templateName = $json.template)
#set($entity = "#toCamelCase($json.template)")
#set($entityDto = $entity+"Dto")
#set($param = "_param")
/*
Java dto for elasticSearch template $templateName
Created on $today.date ( Time $today.time )
Generator tool : $generator.name ( version $generator.version )
*/
package $target.javaPackageFromFolder($SRC);
import java.util.Date;
import $ROOT_PKG.helper.contract.SearchParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
DTO for elasticSearch template "$templateName"
@author Lazare yao
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder(alphabetic = true)
@getter
@Setter
@NoArgsConstructor
@tostring
public class $entityDto implements Cloneable
#set($properties = $json.mappings.data.properties)
private String#tab(3)_id;
#foreach($key in $properties.keySet())
#set($field = $key.toLowerCase())
#tab(1)private #javaType($properties.get($key).type,0)#tab(3)$field ;
#end
private SearchParam<String>#tab(3)_id$param;
#foreach($key in $properties.keySet())
#set($field = $key.toLowerCase())
#tab(1)private SearchParam<#javaType($properties.get($key).type,0)>#tab(3)$field$param;
#end
private String orderDirection;
private String orderField;
What i need now is to:
1- browse my json directory, get each json file and apply the templates on that json to create the java classes for that json file.
2- properly configure the file templates.cfg to create java class file with the java class name. Concerning this point, i heve tried to modify the variable $BEANNAME, $BEANNAME_UC, $BEANNAME_LC (given by default by telosys) since the template. But it did not work: They still empty and No file is generated. This is the content of the file templates.cfg :
#---------------------------------------------------------
# Templates configuration file
# Values separated by ";"
# . value 1 : the label
# . value 2 : the file to be generated ( var allowed : $BEANNAME, $BEANNAME_UC, $BEANNAME_LC )
# . value 3 : the project folder where to generate ( var allowed : $BEANNAME, $BEANNAME_UC, $BEANNAME_LC )
# . value 4 : the template to use
# . value 5 : number of execution : "1" for "ONCE" for all entities, default is multiple executions ( executed for each entity )
#---------------------------------------------------------
# Since v 2.0 the project's variables can be used in file and folder name
#---------------------------------------------------------
Dto ; $BEANNAMEDto.java ; $SRC/$ROOT_PKG/helper/dto ; dto.vm
CustomDto ; _$BEANNAMEDto.java ; $SRC/$ROOT_PKG/helper/dto/customize ; _dto.vm
Enum ; $BEANNAMEEnum.java ; $SRC/$ROOT_PKG/helper/enums ; enum.vm
Repository ; $BEANNAMERepository.java ; $SRC/$ROOT_PKG/dao/repository/es ; repository.vm ;
Custom Repository ; _$BEANNAMERepository.java ; $SRC/$ROOT_PKG/dao/repository/es/customize ; _repository.vm ;
Business ; $BEANNAMEBusiness.java ; $SRC/$ROOT_PKG/business/ ; business.vm
Controller ; $BEANNAMEController.java ; $SRC/$ROOT_PKG/rest/api ; controller.vm
Thank you for helping me please !
java json vtl telosys
I am trying to write templates in VTL to generate java classes with telosys. My starting point is a directory (src/main/resources/templates/es) that contains json files (mapping1.json, mapping2.json, ...). The number and names of json files are unknown and may vary. I have to generate several java classes per json files.
I have already write a template for each java classe that i have to generate. But these templates work with a static embedded json object.
This an example:
#set($json =
"template":"acces_formation",
"mappings":
"data":
"properties":
"MATRICULE":
"type":"string",
"index":"not_analyzed"
,
"NOM":
"type":"string",
"index":"not_analyzed"
,
"DATE_NAIS":
"type":"date",
"format":"dd/MM/yyyy"
,
"SEXE":
"type":"string",
"index":"not_analyzed"
,
"GRADE":
"type":"string",
"index":"not_analyzed"
)
#macro(javaName $s)$s.substring(0,1).toUpperCase()$s.substring(1)#end
#macro(setter $s)set#javaName($s)#end
#macro(getter $s)get#javaName($s)#end
###############################start macro toCamelCase
#macro(toCamelCase $s)
#set($datas = $s.split("_"))
#set($name = "")
#foreach($data in $datas)
#set($data = $data.substring(0,1).toUpperCase()+$data.substring(1))
#set($name = $name+$data)
#end
$name##
#end
###############################End macro toCamelCase
###############################Start macro tab
#macro(tab $nbreTotal)
#if($nbreTotal >= 1)
#foreach($nbre in [1..$nbreTotal])
##
#end
#end
#end
###############################End macro tab
###############################Start macro javaType
#macro(javaType $f, $nbreTab)
#if($f.equals("string"))
#tab($nbreTab)String##
#elseif($f.equals("boolean"))
#tab($nbreTab)Boolean##
#elseif($f.equals("long"))
#tab($nbreTab)Long##
#elseif($f.equals("float"))
#tab($nbreTab)Float##
#elseif($f.equals("double"))
#tab($nbreTab)Double##
#elseif($f.equals("int"))
#tab($nbreTab)Integer##
#elseif($f.equals("integer"))
#tab($nbreTab)Integer##
#elseif($f.equals("date"))
#tab($nbreTab)String##
#elseif($f.equals("array"))
#tab($nbreTab)java.util.List<#javaType($f)>##
#else
#tab($nbreTab)$f##
#end
#end
###############################End macro javaType
#############################################
#set($templateName = $json.template)
#set($entity = "#toCamelCase($json.template)")
#set($entityDto = $entity+"Dto")
#set($param = "_param")
/*
Java dto for elasticSearch template $templateName
Created on $today.date ( Time $today.time )
Generator tool : $generator.name ( version $generator.version )
*/
package $target.javaPackageFromFolder($SRC);
import java.util.Date;
import $ROOT_PKG.helper.contract.SearchParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
DTO for elasticSearch template "$templateName"
@author Lazare yao
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder(alphabetic = true)
@getter
@Setter
@NoArgsConstructor
@tostring
public class $entityDto implements Cloneable
#set($properties = $json.mappings.data.properties)
private String#tab(3)_id;
#foreach($key in $properties.keySet())
#set($field = $key.toLowerCase())
#tab(1)private #javaType($properties.get($key).type,0)#tab(3)$field ;
#end
private SearchParam<String>#tab(3)_id$param;
#foreach($key in $properties.keySet())
#set($field = $key.toLowerCase())
#tab(1)private SearchParam<#javaType($properties.get($key).type,0)>#tab(3)$field$param;
#end
private String orderDirection;
private String orderField;
What i need now is to:
1- browse my json directory, get each json file and apply the templates on that json to create the java classes for that json file.
2- properly configure the file templates.cfg to create java class file with the java class name. Concerning this point, i heve tried to modify the variable $BEANNAME, $BEANNAME_UC, $BEANNAME_LC (given by default by telosys) since the template. But it did not work: They still empty and No file is generated. This is the content of the file templates.cfg :
#---------------------------------------------------------
# Templates configuration file
# Values separated by ";"
# . value 1 : the label
# . value 2 : the file to be generated ( var allowed : $BEANNAME, $BEANNAME_UC, $BEANNAME_LC )
# . value 3 : the project folder where to generate ( var allowed : $BEANNAME, $BEANNAME_UC, $BEANNAME_LC )
# . value 4 : the template to use
# . value 5 : number of execution : "1" for "ONCE" for all entities, default is multiple executions ( executed for each entity )
#---------------------------------------------------------
# Since v 2.0 the project's variables can be used in file and folder name
#---------------------------------------------------------
Dto ; $BEANNAMEDto.java ; $SRC/$ROOT_PKG/helper/dto ; dto.vm
CustomDto ; _$BEANNAMEDto.java ; $SRC/$ROOT_PKG/helper/dto/customize ; _dto.vm
Enum ; $BEANNAMEEnum.java ; $SRC/$ROOT_PKG/helper/enums ; enum.vm
Repository ; $BEANNAMERepository.java ; $SRC/$ROOT_PKG/dao/repository/es ; repository.vm ;
Custom Repository ; _$BEANNAMERepository.java ; $SRC/$ROOT_PKG/dao/repository/es/customize ; _repository.vm ;
Business ; $BEANNAMEBusiness.java ; $SRC/$ROOT_PKG/business/ ; business.vm
Controller ; $BEANNAMEController.java ; $SRC/$ROOT_PKG/rest/api ; controller.vm
Thank you for helping me please !
java json vtl telosys
java json vtl telosys
asked Mar 27 at 12:49
user6441481user6441481
236 bronze badges
236 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
If I understand correctly you want to replace the Telosys entity model with a set of JSON files, is that it?
I think it is possible but we will have to divert the behavior of Telosys…
First it’s impossible to launch Telosys code generation without a model so you must create a void DSL model, for example the DSL model “void-model.model” with a single “fake entity” (eg “Fake” entity with only an ‘id’ attribute)
Second, the "templates.cfg" file applies to all the entities defined in the model and in your case there’s no entity, only JSON files. For each line of the "templates.cfg" file, you must specify a cardinality of "1" so that each template is executed once regardless of the number of entities.
You just have to add "1" after the last ";" each line, example :
Dto ; Dto.txt ; log ; dto.vm ; 1
At this step it’s possible to launch once each template defined in "templates.cfg"
The idea is now to iterate all the JSON files in each template and to execute a "sub-template" for each JSON file. This “sub-template” is the template that will do the real job.
To browse the directory it will be necessary to create a specific Java class that will provide the list of JSON files. Then the $generator object can be used to execute a “sub-template” for each JSON file.
Main template example :
## This template generates only a log file (see templates.cfg)
## Create instance of the specific class
#set($dir = $loader.newInstance('mypackage.MyClass'))
## Use specific class instance to get all the JSON files
#set($jsonFiles = $dir.getJSONFiles() )
#foreach($json in $jsonFiles)
## Printed in log file
Processing $json
#set( $fileName = "$json-file.txt")
#set( $folder = 'dest' )
## Execute the sub-template 'dto_sub.vm'
$generator.generate('Fake', $fileName , $folder, "dto_sub.vm" )
#end
In the sub-template ( eg "dto_sub.vm" ) use $target.file to identify the target and hence the JSON file needed
And use another specific class to load the JSON file content and just use it to generate the code.
See documentation :
Specific Java class : http://www.telosys.org/templates-doc/objects/loader.html
Sub-template generation : http://www.telosys.org/templates-doc/objects/generator.html
Thank, you @lgu. I'am trying it
– user6441481
Apr 12 at 17:57
Thank you @lgu. I did what you explained to me and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. look at my answer below
– user6441481
Apr 24 at 11:46
add a comment |
Thank you for your help.
I did what @lgu explained to me above and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. I followed this tutorial to fill the dbrep xml tag with the json files elements. Each json file becomes a <table>
element in the the <tableList>
element. And the json file properties become the <column>
elements in the <table>
element. The final dbrep file look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
<tableList databaseId="1" databaseName="test" databaseProductName="MySQL" generation="2019-04-18 16:52:19">
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeTrendHorarire" name="airtime_trend_horarire" schema="trend_horaire_airtime">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch tete_de_pont field" dbDefaultValue="" dbName="tete_de_pont" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="teteDePont" javaType="java.lang.String" jdbcTypeCode="12" label="tete de pont" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch trend_horaire field" dbDefaultValue="" dbName="trend_horaire" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="22" dbTypeName="DOUBLE" inputType="number" javaName="trendHoraire" javaType="java.lang.Double" jdbcTypeCode="8" label="trend horaire" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_alerte field" dbDefaultValue="" dbName="date_alerte" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateAlerte" javaType="java.util.Date" jdbcTypeCode="93" label="date alerte" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="7" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="OmerDetailPdvSolde" name="omer_detail_pdv_solde" schema="airtime_detail_pdv_*">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMMERCIAL field" dbDefaultValue="" dbName="COMMERCIAL" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch PDV field" dbDefaultValue="" dbName="PDV" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="pDV" javaType="java.lang.String" jdbcTypeCode="12" label="PDV" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch RUPTURE field" dbDefaultValue="" dbName="RUPTURE" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rUPTURE" javaType="java.lang.String" jdbcTypeCode="12" label="RUPTURE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch Canal field" dbDefaultValue="" dbName="Canal" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="canal" javaType="java.lang.String" jdbcTypeCode="12" label="Canal" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch BALANCE field" dbDefaultValue="" dbName="BALANCE" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="bALANCE" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="BALANCE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch SEUIL field" dbDefaultValue="" dbName="SEUIL" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="sEUIL" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="SEUIL" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_id field" dbDefaultValue="" dbName="date_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateId" javaType="java.util.Date" jdbcTypeCode="93" label="date id" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="11" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeReseauDistribution" name="airtime_reseau_distribution" schema="reseau_distribution">
<column dbComment="ElasticSearch UID field" dbDefaultValue="" dbName="UID" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="uID" javaType="java.lang.String" jdbcTypeCode="12" label="UID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_STK field" dbDefaultValue="" dbName="COMPTE_STK" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESTK" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_STK field" dbDefaultValue="" dbName="NOM_STK" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSTK" javaType="java.lang.String" jdbcTypeCode="12" label="NOM STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_STK field" dbDefaultValue="" dbName="TYPE_STK" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPESTK" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_COMMERCIAL field" dbDefaultValue="" dbName="COMPTE_COMMERCIAL" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_COMMERCIAL field" dbDefaultValue="" dbName="NOM_COMMERCIAL" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="NOM COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_DEMI_GROSSISTE field" dbDefaultValue="" dbName="COMPTE_DEMI_GROSSISTE" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_DEMI_GROSSISTE field" dbDefaultValue="" dbName="NOM_DEMI_GROSSISTE" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_PUCE_MERE field" dbDefaultValue="" dbName="COMPTE_PUCE_MERE" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEPUCEMERE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE PUCE MERE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_PARTENAIRE field" dbDefaultValue="" dbName="NOM_PARTENAIRE" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMPARTENAIRE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM PARTENAIRE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_CPP field" dbDefaultValue="" dbName="COMPTE_CPP" dbNotNull="false" dbPosition="11" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECPP" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_MANAGER_OCI field" dbDefaultValue="" dbName="COMPTE_MANAGER_OCI" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SPD field" dbDefaultValue="" dbName="COMPTE_SPD" dbNotNull="false" dbPosition="13" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESPD" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SUPERVISEUR field" dbDefaultValue="" dbName="COMPTE_SUPERVISEUR" dbNotNull="false" dbPosition="14" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CUID field" dbDefaultValue="" dbName="CUID" dbNotNull="false" dbPosition="15" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cUID" javaType="java.lang.String" jdbcTypeCode="12" label="CUID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_CPP field" dbDefaultValue="" dbName="NOM_CPP" dbNotNull="false" dbPosition="16" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCPP" javaType="java.lang.String" jdbcTypeCode="12" label="NOM CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_MANAGER_OCI field" dbDefaultValue="" dbName="NOM_MANAGER_OCI" dbNotNull="false" dbPosition="17" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="NOM MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SPD field" dbDefaultValue="" dbName="NOM_SPD" dbNotNull="false" dbPosition="18" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSPD" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SUPERVISEUR field" dbDefaultValue="" dbName="NOM_SUPERVISEUR" dbNotNull="false" dbPosition="19" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch REGION_OCI field" dbDefaultValue="" dbName="REGION_OCI" dbNotNull="false" dbPosition="20" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rEGIONOCI" javaType="java.lang.String" jdbcTypeCode="12" label="REGION OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_CODE field" dbDefaultValue="" dbName="TYPE_CODE" dbNotNull="false" dbPosition="21" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPECODE" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE CODE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="22" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="23" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="SubsAggZoneCom" name="subs_agg_zone_com" schema="subs_agg_zone_com">
<column dbComment="ElasticSearch ACTIVATION field" dbDefaultValue="" dbName="ACTIVATION" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="aCTIVATION" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="ACTIVATION" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch CREATION_DATE field" dbDefaultValue="" dbName="CREATION_DATE" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="cREATIONDATE" javaType="java.util.Date" jdbcTypeCode="93" label="CREATION DATE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CHANNEL_ZONE_COMMERCIALE field" dbDefaultValue="" dbName="CHANNEL_ZONE_COMMERCIALE" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cHANNELZONECOMMERCIALE" javaType="java.lang.String" jdbcTypeCode="12" label="CHANNEL ZONE COMMERCIALE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="4" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
</tableList>
</root>
I did not need to write more templates. I used the same tempates I use for generation from Mysql and everything is done
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377622%2fbrowse-a-directory-in-velocity-template-language-with-telosys%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If I understand correctly you want to replace the Telosys entity model with a set of JSON files, is that it?
I think it is possible but we will have to divert the behavior of Telosys…
First it’s impossible to launch Telosys code generation without a model so you must create a void DSL model, for example the DSL model “void-model.model” with a single “fake entity” (eg “Fake” entity with only an ‘id’ attribute)
Second, the "templates.cfg" file applies to all the entities defined in the model and in your case there’s no entity, only JSON files. For each line of the "templates.cfg" file, you must specify a cardinality of "1" so that each template is executed once regardless of the number of entities.
You just have to add "1" after the last ";" each line, example :
Dto ; Dto.txt ; log ; dto.vm ; 1
At this step it’s possible to launch once each template defined in "templates.cfg"
The idea is now to iterate all the JSON files in each template and to execute a "sub-template" for each JSON file. This “sub-template” is the template that will do the real job.
To browse the directory it will be necessary to create a specific Java class that will provide the list of JSON files. Then the $generator object can be used to execute a “sub-template” for each JSON file.
Main template example :
## This template generates only a log file (see templates.cfg)
## Create instance of the specific class
#set($dir = $loader.newInstance('mypackage.MyClass'))
## Use specific class instance to get all the JSON files
#set($jsonFiles = $dir.getJSONFiles() )
#foreach($json in $jsonFiles)
## Printed in log file
Processing $json
#set( $fileName = "$json-file.txt")
#set( $folder = 'dest' )
## Execute the sub-template 'dto_sub.vm'
$generator.generate('Fake', $fileName , $folder, "dto_sub.vm" )
#end
In the sub-template ( eg "dto_sub.vm" ) use $target.file to identify the target and hence the JSON file needed
And use another specific class to load the JSON file content and just use it to generate the code.
See documentation :
Specific Java class : http://www.telosys.org/templates-doc/objects/loader.html
Sub-template generation : http://www.telosys.org/templates-doc/objects/generator.html
Thank, you @lgu. I'am trying it
– user6441481
Apr 12 at 17:57
Thank you @lgu. I did what you explained to me and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. look at my answer below
– user6441481
Apr 24 at 11:46
add a comment |
If I understand correctly you want to replace the Telosys entity model with a set of JSON files, is that it?
I think it is possible but we will have to divert the behavior of Telosys…
First it’s impossible to launch Telosys code generation without a model so you must create a void DSL model, for example the DSL model “void-model.model” with a single “fake entity” (eg “Fake” entity with only an ‘id’ attribute)
Second, the "templates.cfg" file applies to all the entities defined in the model and in your case there’s no entity, only JSON files. For each line of the "templates.cfg" file, you must specify a cardinality of "1" so that each template is executed once regardless of the number of entities.
You just have to add "1" after the last ";" each line, example :
Dto ; Dto.txt ; log ; dto.vm ; 1
At this step it’s possible to launch once each template defined in "templates.cfg"
The idea is now to iterate all the JSON files in each template and to execute a "sub-template" for each JSON file. This “sub-template” is the template that will do the real job.
To browse the directory it will be necessary to create a specific Java class that will provide the list of JSON files. Then the $generator object can be used to execute a “sub-template” for each JSON file.
Main template example :
## This template generates only a log file (see templates.cfg)
## Create instance of the specific class
#set($dir = $loader.newInstance('mypackage.MyClass'))
## Use specific class instance to get all the JSON files
#set($jsonFiles = $dir.getJSONFiles() )
#foreach($json in $jsonFiles)
## Printed in log file
Processing $json
#set( $fileName = "$json-file.txt")
#set( $folder = 'dest' )
## Execute the sub-template 'dto_sub.vm'
$generator.generate('Fake', $fileName , $folder, "dto_sub.vm" )
#end
In the sub-template ( eg "dto_sub.vm" ) use $target.file to identify the target and hence the JSON file needed
And use another specific class to load the JSON file content and just use it to generate the code.
See documentation :
Specific Java class : http://www.telosys.org/templates-doc/objects/loader.html
Sub-template generation : http://www.telosys.org/templates-doc/objects/generator.html
Thank, you @lgu. I'am trying it
– user6441481
Apr 12 at 17:57
Thank you @lgu. I did what you explained to me and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. look at my answer below
– user6441481
Apr 24 at 11:46
add a comment |
If I understand correctly you want to replace the Telosys entity model with a set of JSON files, is that it?
I think it is possible but we will have to divert the behavior of Telosys…
First it’s impossible to launch Telosys code generation without a model so you must create a void DSL model, for example the DSL model “void-model.model” with a single “fake entity” (eg “Fake” entity with only an ‘id’ attribute)
Second, the "templates.cfg" file applies to all the entities defined in the model and in your case there’s no entity, only JSON files. For each line of the "templates.cfg" file, you must specify a cardinality of "1" so that each template is executed once regardless of the number of entities.
You just have to add "1" after the last ";" each line, example :
Dto ; Dto.txt ; log ; dto.vm ; 1
At this step it’s possible to launch once each template defined in "templates.cfg"
The idea is now to iterate all the JSON files in each template and to execute a "sub-template" for each JSON file. This “sub-template” is the template that will do the real job.
To browse the directory it will be necessary to create a specific Java class that will provide the list of JSON files. Then the $generator object can be used to execute a “sub-template” for each JSON file.
Main template example :
## This template generates only a log file (see templates.cfg)
## Create instance of the specific class
#set($dir = $loader.newInstance('mypackage.MyClass'))
## Use specific class instance to get all the JSON files
#set($jsonFiles = $dir.getJSONFiles() )
#foreach($json in $jsonFiles)
## Printed in log file
Processing $json
#set( $fileName = "$json-file.txt")
#set( $folder = 'dest' )
## Execute the sub-template 'dto_sub.vm'
$generator.generate('Fake', $fileName , $folder, "dto_sub.vm" )
#end
In the sub-template ( eg "dto_sub.vm" ) use $target.file to identify the target and hence the JSON file needed
And use another specific class to load the JSON file content and just use it to generate the code.
See documentation :
Specific Java class : http://www.telosys.org/templates-doc/objects/loader.html
Sub-template generation : http://www.telosys.org/templates-doc/objects/generator.html
If I understand correctly you want to replace the Telosys entity model with a set of JSON files, is that it?
I think it is possible but we will have to divert the behavior of Telosys…
First it’s impossible to launch Telosys code generation without a model so you must create a void DSL model, for example the DSL model “void-model.model” with a single “fake entity” (eg “Fake” entity with only an ‘id’ attribute)
Second, the "templates.cfg" file applies to all the entities defined in the model and in your case there’s no entity, only JSON files. For each line of the "templates.cfg" file, you must specify a cardinality of "1" so that each template is executed once regardless of the number of entities.
You just have to add "1" after the last ";" each line, example :
Dto ; Dto.txt ; log ; dto.vm ; 1
At this step it’s possible to launch once each template defined in "templates.cfg"
The idea is now to iterate all the JSON files in each template and to execute a "sub-template" for each JSON file. This “sub-template” is the template that will do the real job.
To browse the directory it will be necessary to create a specific Java class that will provide the list of JSON files. Then the $generator object can be used to execute a “sub-template” for each JSON file.
Main template example :
## This template generates only a log file (see templates.cfg)
## Create instance of the specific class
#set($dir = $loader.newInstance('mypackage.MyClass'))
## Use specific class instance to get all the JSON files
#set($jsonFiles = $dir.getJSONFiles() )
#foreach($json in $jsonFiles)
## Printed in log file
Processing $json
#set( $fileName = "$json-file.txt")
#set( $folder = 'dest' )
## Execute the sub-template 'dto_sub.vm'
$generator.generate('Fake', $fileName , $folder, "dto_sub.vm" )
#end
In the sub-template ( eg "dto_sub.vm" ) use $target.file to identify the target and hence the JSON file needed
And use another specific class to load the JSON file content and just use it to generate the code.
See documentation :
Specific Java class : http://www.telosys.org/templates-doc/objects/loader.html
Sub-template generation : http://www.telosys.org/templates-doc/objects/generator.html
answered Mar 30 at 23:41
lgulgu
1,47715 silver badges24 bronze badges
1,47715 silver badges24 bronze badges
Thank, you @lgu. I'am trying it
– user6441481
Apr 12 at 17:57
Thank you @lgu. I did what you explained to me and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. look at my answer below
– user6441481
Apr 24 at 11:46
add a comment |
Thank, you @lgu. I'am trying it
– user6441481
Apr 12 at 17:57
Thank you @lgu. I did what you explained to me and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. look at my answer below
– user6441481
Apr 24 at 11:46
Thank, you @lgu. I'am trying it
– user6441481
Apr 12 at 17:57
Thank, you @lgu. I'am trying it
– user6441481
Apr 12 at 17:57
Thank you @lgu. I did what you explained to me and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. look at my answer below
– user6441481
Apr 24 at 11:46
Thank you @lgu. I did what you explained to me and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. look at my answer below
– user6441481
Apr 24 at 11:46
add a comment |
Thank you for your help.
I did what @lgu explained to me above and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. I followed this tutorial to fill the dbrep xml tag with the json files elements. Each json file becomes a <table>
element in the the <tableList>
element. And the json file properties become the <column>
elements in the <table>
element. The final dbrep file look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
<tableList databaseId="1" databaseName="test" databaseProductName="MySQL" generation="2019-04-18 16:52:19">
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeTrendHorarire" name="airtime_trend_horarire" schema="trend_horaire_airtime">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch tete_de_pont field" dbDefaultValue="" dbName="tete_de_pont" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="teteDePont" javaType="java.lang.String" jdbcTypeCode="12" label="tete de pont" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch trend_horaire field" dbDefaultValue="" dbName="trend_horaire" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="22" dbTypeName="DOUBLE" inputType="number" javaName="trendHoraire" javaType="java.lang.Double" jdbcTypeCode="8" label="trend horaire" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_alerte field" dbDefaultValue="" dbName="date_alerte" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateAlerte" javaType="java.util.Date" jdbcTypeCode="93" label="date alerte" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="7" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="OmerDetailPdvSolde" name="omer_detail_pdv_solde" schema="airtime_detail_pdv_*">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMMERCIAL field" dbDefaultValue="" dbName="COMMERCIAL" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch PDV field" dbDefaultValue="" dbName="PDV" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="pDV" javaType="java.lang.String" jdbcTypeCode="12" label="PDV" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch RUPTURE field" dbDefaultValue="" dbName="RUPTURE" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rUPTURE" javaType="java.lang.String" jdbcTypeCode="12" label="RUPTURE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch Canal field" dbDefaultValue="" dbName="Canal" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="canal" javaType="java.lang.String" jdbcTypeCode="12" label="Canal" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch BALANCE field" dbDefaultValue="" dbName="BALANCE" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="bALANCE" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="BALANCE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch SEUIL field" dbDefaultValue="" dbName="SEUIL" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="sEUIL" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="SEUIL" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_id field" dbDefaultValue="" dbName="date_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateId" javaType="java.util.Date" jdbcTypeCode="93" label="date id" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="11" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeReseauDistribution" name="airtime_reseau_distribution" schema="reseau_distribution">
<column dbComment="ElasticSearch UID field" dbDefaultValue="" dbName="UID" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="uID" javaType="java.lang.String" jdbcTypeCode="12" label="UID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_STK field" dbDefaultValue="" dbName="COMPTE_STK" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESTK" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_STK field" dbDefaultValue="" dbName="NOM_STK" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSTK" javaType="java.lang.String" jdbcTypeCode="12" label="NOM STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_STK field" dbDefaultValue="" dbName="TYPE_STK" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPESTK" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_COMMERCIAL field" dbDefaultValue="" dbName="COMPTE_COMMERCIAL" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_COMMERCIAL field" dbDefaultValue="" dbName="NOM_COMMERCIAL" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="NOM COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_DEMI_GROSSISTE field" dbDefaultValue="" dbName="COMPTE_DEMI_GROSSISTE" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_DEMI_GROSSISTE field" dbDefaultValue="" dbName="NOM_DEMI_GROSSISTE" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_PUCE_MERE field" dbDefaultValue="" dbName="COMPTE_PUCE_MERE" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEPUCEMERE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE PUCE MERE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_PARTENAIRE field" dbDefaultValue="" dbName="NOM_PARTENAIRE" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMPARTENAIRE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM PARTENAIRE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_CPP field" dbDefaultValue="" dbName="COMPTE_CPP" dbNotNull="false" dbPosition="11" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECPP" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_MANAGER_OCI field" dbDefaultValue="" dbName="COMPTE_MANAGER_OCI" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SPD field" dbDefaultValue="" dbName="COMPTE_SPD" dbNotNull="false" dbPosition="13" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESPD" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SUPERVISEUR field" dbDefaultValue="" dbName="COMPTE_SUPERVISEUR" dbNotNull="false" dbPosition="14" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CUID field" dbDefaultValue="" dbName="CUID" dbNotNull="false" dbPosition="15" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cUID" javaType="java.lang.String" jdbcTypeCode="12" label="CUID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_CPP field" dbDefaultValue="" dbName="NOM_CPP" dbNotNull="false" dbPosition="16" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCPP" javaType="java.lang.String" jdbcTypeCode="12" label="NOM CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_MANAGER_OCI field" dbDefaultValue="" dbName="NOM_MANAGER_OCI" dbNotNull="false" dbPosition="17" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="NOM MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SPD field" dbDefaultValue="" dbName="NOM_SPD" dbNotNull="false" dbPosition="18" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSPD" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SUPERVISEUR field" dbDefaultValue="" dbName="NOM_SUPERVISEUR" dbNotNull="false" dbPosition="19" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch REGION_OCI field" dbDefaultValue="" dbName="REGION_OCI" dbNotNull="false" dbPosition="20" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rEGIONOCI" javaType="java.lang.String" jdbcTypeCode="12" label="REGION OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_CODE field" dbDefaultValue="" dbName="TYPE_CODE" dbNotNull="false" dbPosition="21" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPECODE" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE CODE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="22" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="23" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="SubsAggZoneCom" name="subs_agg_zone_com" schema="subs_agg_zone_com">
<column dbComment="ElasticSearch ACTIVATION field" dbDefaultValue="" dbName="ACTIVATION" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="aCTIVATION" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="ACTIVATION" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch CREATION_DATE field" dbDefaultValue="" dbName="CREATION_DATE" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="cREATIONDATE" javaType="java.util.Date" jdbcTypeCode="93" label="CREATION DATE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CHANNEL_ZONE_COMMERCIALE field" dbDefaultValue="" dbName="CHANNEL_ZONE_COMMERCIALE" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cHANNELZONECOMMERCIALE" javaType="java.lang.String" jdbcTypeCode="12" label="CHANNEL ZONE COMMERCIALE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="4" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
</tableList>
</root>
I did not need to write more templates. I used the same tempates I use for generation from Mysql and everything is done
add a comment |
Thank you for your help.
I did what @lgu explained to me above and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. I followed this tutorial to fill the dbrep xml tag with the json files elements. Each json file becomes a <table>
element in the the <tableList>
element. And the json file properties become the <column>
elements in the <table>
element. The final dbrep file look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
<tableList databaseId="1" databaseName="test" databaseProductName="MySQL" generation="2019-04-18 16:52:19">
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeTrendHorarire" name="airtime_trend_horarire" schema="trend_horaire_airtime">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch tete_de_pont field" dbDefaultValue="" dbName="tete_de_pont" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="teteDePont" javaType="java.lang.String" jdbcTypeCode="12" label="tete de pont" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch trend_horaire field" dbDefaultValue="" dbName="trend_horaire" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="22" dbTypeName="DOUBLE" inputType="number" javaName="trendHoraire" javaType="java.lang.Double" jdbcTypeCode="8" label="trend horaire" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_alerte field" dbDefaultValue="" dbName="date_alerte" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateAlerte" javaType="java.util.Date" jdbcTypeCode="93" label="date alerte" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="7" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="OmerDetailPdvSolde" name="omer_detail_pdv_solde" schema="airtime_detail_pdv_*">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMMERCIAL field" dbDefaultValue="" dbName="COMMERCIAL" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch PDV field" dbDefaultValue="" dbName="PDV" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="pDV" javaType="java.lang.String" jdbcTypeCode="12" label="PDV" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch RUPTURE field" dbDefaultValue="" dbName="RUPTURE" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rUPTURE" javaType="java.lang.String" jdbcTypeCode="12" label="RUPTURE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch Canal field" dbDefaultValue="" dbName="Canal" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="canal" javaType="java.lang.String" jdbcTypeCode="12" label="Canal" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch BALANCE field" dbDefaultValue="" dbName="BALANCE" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="bALANCE" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="BALANCE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch SEUIL field" dbDefaultValue="" dbName="SEUIL" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="sEUIL" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="SEUIL" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_id field" dbDefaultValue="" dbName="date_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateId" javaType="java.util.Date" jdbcTypeCode="93" label="date id" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="11" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeReseauDistribution" name="airtime_reseau_distribution" schema="reseau_distribution">
<column dbComment="ElasticSearch UID field" dbDefaultValue="" dbName="UID" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="uID" javaType="java.lang.String" jdbcTypeCode="12" label="UID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_STK field" dbDefaultValue="" dbName="COMPTE_STK" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESTK" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_STK field" dbDefaultValue="" dbName="NOM_STK" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSTK" javaType="java.lang.String" jdbcTypeCode="12" label="NOM STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_STK field" dbDefaultValue="" dbName="TYPE_STK" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPESTK" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_COMMERCIAL field" dbDefaultValue="" dbName="COMPTE_COMMERCIAL" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_COMMERCIAL field" dbDefaultValue="" dbName="NOM_COMMERCIAL" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="NOM COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_DEMI_GROSSISTE field" dbDefaultValue="" dbName="COMPTE_DEMI_GROSSISTE" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_DEMI_GROSSISTE field" dbDefaultValue="" dbName="NOM_DEMI_GROSSISTE" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_PUCE_MERE field" dbDefaultValue="" dbName="COMPTE_PUCE_MERE" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEPUCEMERE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE PUCE MERE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_PARTENAIRE field" dbDefaultValue="" dbName="NOM_PARTENAIRE" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMPARTENAIRE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM PARTENAIRE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_CPP field" dbDefaultValue="" dbName="COMPTE_CPP" dbNotNull="false" dbPosition="11" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECPP" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_MANAGER_OCI field" dbDefaultValue="" dbName="COMPTE_MANAGER_OCI" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SPD field" dbDefaultValue="" dbName="COMPTE_SPD" dbNotNull="false" dbPosition="13" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESPD" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SUPERVISEUR field" dbDefaultValue="" dbName="COMPTE_SUPERVISEUR" dbNotNull="false" dbPosition="14" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CUID field" dbDefaultValue="" dbName="CUID" dbNotNull="false" dbPosition="15" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cUID" javaType="java.lang.String" jdbcTypeCode="12" label="CUID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_CPP field" dbDefaultValue="" dbName="NOM_CPP" dbNotNull="false" dbPosition="16" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCPP" javaType="java.lang.String" jdbcTypeCode="12" label="NOM CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_MANAGER_OCI field" dbDefaultValue="" dbName="NOM_MANAGER_OCI" dbNotNull="false" dbPosition="17" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="NOM MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SPD field" dbDefaultValue="" dbName="NOM_SPD" dbNotNull="false" dbPosition="18" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSPD" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SUPERVISEUR field" dbDefaultValue="" dbName="NOM_SUPERVISEUR" dbNotNull="false" dbPosition="19" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch REGION_OCI field" dbDefaultValue="" dbName="REGION_OCI" dbNotNull="false" dbPosition="20" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rEGIONOCI" javaType="java.lang.String" jdbcTypeCode="12" label="REGION OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_CODE field" dbDefaultValue="" dbName="TYPE_CODE" dbNotNull="false" dbPosition="21" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPECODE" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE CODE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="22" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="23" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="SubsAggZoneCom" name="subs_agg_zone_com" schema="subs_agg_zone_com">
<column dbComment="ElasticSearch ACTIVATION field" dbDefaultValue="" dbName="ACTIVATION" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="aCTIVATION" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="ACTIVATION" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch CREATION_DATE field" dbDefaultValue="" dbName="CREATION_DATE" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="cREATIONDATE" javaType="java.util.Date" jdbcTypeCode="93" label="CREATION DATE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CHANNEL_ZONE_COMMERCIALE field" dbDefaultValue="" dbName="CHANNEL_ZONE_COMMERCIALE" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cHANNELZONECOMMERCIALE" javaType="java.lang.String" jdbcTypeCode="12" label="CHANNEL ZONE COMMERCIALE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="4" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
</tableList>
</root>
I did not need to write more templates. I used the same tempates I use for generation from Mysql and everything is done
add a comment |
Thank you for your help.
I did what @lgu explained to me above and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. I followed this tutorial to fill the dbrep xml tag with the json files elements. Each json file becomes a <table>
element in the the <tableList>
element. And the json file properties become the <column>
elements in the <table>
element. The final dbrep file look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
<tableList databaseId="1" databaseName="test" databaseProductName="MySQL" generation="2019-04-18 16:52:19">
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeTrendHorarire" name="airtime_trend_horarire" schema="trend_horaire_airtime">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch tete_de_pont field" dbDefaultValue="" dbName="tete_de_pont" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="teteDePont" javaType="java.lang.String" jdbcTypeCode="12" label="tete de pont" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch trend_horaire field" dbDefaultValue="" dbName="trend_horaire" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="22" dbTypeName="DOUBLE" inputType="number" javaName="trendHoraire" javaType="java.lang.Double" jdbcTypeCode="8" label="trend horaire" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_alerte field" dbDefaultValue="" dbName="date_alerte" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateAlerte" javaType="java.util.Date" jdbcTypeCode="93" label="date alerte" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="7" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="OmerDetailPdvSolde" name="omer_detail_pdv_solde" schema="airtime_detail_pdv_*">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMMERCIAL field" dbDefaultValue="" dbName="COMMERCIAL" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch PDV field" dbDefaultValue="" dbName="PDV" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="pDV" javaType="java.lang.String" jdbcTypeCode="12" label="PDV" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch RUPTURE field" dbDefaultValue="" dbName="RUPTURE" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rUPTURE" javaType="java.lang.String" jdbcTypeCode="12" label="RUPTURE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch Canal field" dbDefaultValue="" dbName="Canal" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="canal" javaType="java.lang.String" jdbcTypeCode="12" label="Canal" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch BALANCE field" dbDefaultValue="" dbName="BALANCE" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="bALANCE" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="BALANCE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch SEUIL field" dbDefaultValue="" dbName="SEUIL" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="sEUIL" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="SEUIL" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_id field" dbDefaultValue="" dbName="date_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateId" javaType="java.util.Date" jdbcTypeCode="93" label="date id" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="11" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeReseauDistribution" name="airtime_reseau_distribution" schema="reseau_distribution">
<column dbComment="ElasticSearch UID field" dbDefaultValue="" dbName="UID" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="uID" javaType="java.lang.String" jdbcTypeCode="12" label="UID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_STK field" dbDefaultValue="" dbName="COMPTE_STK" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESTK" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_STK field" dbDefaultValue="" dbName="NOM_STK" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSTK" javaType="java.lang.String" jdbcTypeCode="12" label="NOM STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_STK field" dbDefaultValue="" dbName="TYPE_STK" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPESTK" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_COMMERCIAL field" dbDefaultValue="" dbName="COMPTE_COMMERCIAL" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_COMMERCIAL field" dbDefaultValue="" dbName="NOM_COMMERCIAL" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="NOM COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_DEMI_GROSSISTE field" dbDefaultValue="" dbName="COMPTE_DEMI_GROSSISTE" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_DEMI_GROSSISTE field" dbDefaultValue="" dbName="NOM_DEMI_GROSSISTE" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_PUCE_MERE field" dbDefaultValue="" dbName="COMPTE_PUCE_MERE" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEPUCEMERE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE PUCE MERE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_PARTENAIRE field" dbDefaultValue="" dbName="NOM_PARTENAIRE" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMPARTENAIRE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM PARTENAIRE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_CPP field" dbDefaultValue="" dbName="COMPTE_CPP" dbNotNull="false" dbPosition="11" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECPP" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_MANAGER_OCI field" dbDefaultValue="" dbName="COMPTE_MANAGER_OCI" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SPD field" dbDefaultValue="" dbName="COMPTE_SPD" dbNotNull="false" dbPosition="13" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESPD" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SUPERVISEUR field" dbDefaultValue="" dbName="COMPTE_SUPERVISEUR" dbNotNull="false" dbPosition="14" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CUID field" dbDefaultValue="" dbName="CUID" dbNotNull="false" dbPosition="15" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cUID" javaType="java.lang.String" jdbcTypeCode="12" label="CUID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_CPP field" dbDefaultValue="" dbName="NOM_CPP" dbNotNull="false" dbPosition="16" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCPP" javaType="java.lang.String" jdbcTypeCode="12" label="NOM CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_MANAGER_OCI field" dbDefaultValue="" dbName="NOM_MANAGER_OCI" dbNotNull="false" dbPosition="17" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="NOM MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SPD field" dbDefaultValue="" dbName="NOM_SPD" dbNotNull="false" dbPosition="18" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSPD" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SUPERVISEUR field" dbDefaultValue="" dbName="NOM_SUPERVISEUR" dbNotNull="false" dbPosition="19" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch REGION_OCI field" dbDefaultValue="" dbName="REGION_OCI" dbNotNull="false" dbPosition="20" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rEGIONOCI" javaType="java.lang.String" jdbcTypeCode="12" label="REGION OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_CODE field" dbDefaultValue="" dbName="TYPE_CODE" dbNotNull="false" dbPosition="21" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPECODE" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE CODE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="22" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="23" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="SubsAggZoneCom" name="subs_agg_zone_com" schema="subs_agg_zone_com">
<column dbComment="ElasticSearch ACTIVATION field" dbDefaultValue="" dbName="ACTIVATION" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="aCTIVATION" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="ACTIVATION" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch CREATION_DATE field" dbDefaultValue="" dbName="CREATION_DATE" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="cREATIONDATE" javaType="java.util.Date" jdbcTypeCode="93" label="CREATION DATE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CHANNEL_ZONE_COMMERCIALE field" dbDefaultValue="" dbName="CHANNEL_ZONE_COMMERCIALE" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cHANNELZONECOMMERCIALE" javaType="java.lang.String" jdbcTypeCode="12" label="CHANNEL ZONE COMMERCIALE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="4" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
</tableList>
</root>
I did not need to write more templates. I used the same tempates I use for generation from Mysql and everything is done
Thank you for your help.
I did what @lgu explained to me above and it works very well. But with this version i can't choose which json file i want to generate the java classes. I can not also choose which template file i want to apply. These 2 problems make me think to an other version with an other way to do what i want: I thought about taking advantage of the dbrep file. So in 2nd version, i generate the dbrep file (which is an xml file) with the DOM of java. I followed this tutorial to fill the dbrep xml tag with the json files elements. Each json file becomes a <table>
element in the the <tableList>
element. And the json file properties become the <column>
elements in the <table>
element. The final dbrep file look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
<tableList databaseId="1" databaseName="test" databaseProductName="MySQL" generation="2019-04-18 16:52:19">
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeTrendHorarire" name="airtime_trend_horarire" schema="trend_horaire_airtime">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch tete_de_pont field" dbDefaultValue="" dbName="tete_de_pont" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="teteDePont" javaType="java.lang.String" jdbcTypeCode="12" label="tete de pont" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch trend_horaire field" dbDefaultValue="" dbName="trend_horaire" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="22" dbTypeName="DOUBLE" inputType="number" javaName="trendHoraire" javaType="java.lang.Double" jdbcTypeCode="8" label="trend horaire" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_alerte field" dbDefaultValue="" dbName="date_alerte" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateAlerte" javaType="java.util.Date" jdbcTypeCode="93" label="date alerte" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="7" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="OmerDetailPdvSolde" name="omer_detail_pdv_solde" schema="airtime_detail_pdv_*">
<column dbComment="ElasticSearch zone_commerciale field" dbDefaultValue="" dbName="zone_commerciale" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="zoneCommerciale" javaType="java.lang.String" jdbcTypeCode="12" label="zone commerciale" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMMERCIAL field" dbDefaultValue="" dbName="COMMERCIAL" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch PDV field" dbDefaultValue="" dbName="PDV" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="pDV" javaType="java.lang.String" jdbcTypeCode="12" label="PDV" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch RUPTURE field" dbDefaultValue="" dbName="RUPTURE" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rUPTURE" javaType="java.lang.String" jdbcTypeCode="12" label="RUPTURE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch Canal field" dbDefaultValue="" dbName="Canal" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="canal" javaType="java.lang.String" jdbcTypeCode="12" label="Canal" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch BALANCE field" dbDefaultValue="" dbName="BALANCE" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="bALANCE" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="BALANCE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch SEUIL field" dbDefaultValue="" dbName="SEUIL" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="sEUIL" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="SEUIL" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_id field" dbDefaultValue="" dbName="date_id" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateId" javaType="java.util.Date" jdbcTypeCode="93" label="date id" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch date_jour field" dbDefaultValue="" dbName="date_jour" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="dateJour" javaType="java.util.Date" jdbcTypeCode="93" label="date jour" notNull="false" selected="true"/>
<column dbComment="ElasticSearch heure field" dbDefaultValue="" dbName="heure" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="heure" javaType="java.lang.String" jdbcTypeCode="12" label="heure" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="11" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="AirtimeReseauDistribution" name="airtime_reseau_distribution" schema="reseau_distribution">
<column dbComment="ElasticSearch UID field" dbDefaultValue="" dbName="UID" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="uID" javaType="java.lang.String" jdbcTypeCode="12" label="UID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_STK field" dbDefaultValue="" dbName="COMPTE_STK" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESTK" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_STK field" dbDefaultValue="" dbName="NOM_STK" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSTK" javaType="java.lang.String" jdbcTypeCode="12" label="NOM STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_STK field" dbDefaultValue="" dbName="TYPE_STK" dbNotNull="false" dbPosition="4" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPESTK" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE STK" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_COMMERCIAL field" dbDefaultValue="" dbName="COMPTE_COMMERCIAL" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_COMMERCIAL field" dbDefaultValue="" dbName="NOM_COMMERCIAL" dbNotNull="false" dbPosition="6" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCOMMERCIAL" javaType="java.lang.String" jdbcTypeCode="12" label="NOM COMMERCIAL" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_DEMI_GROSSISTE field" dbDefaultValue="" dbName="COMPTE_DEMI_GROSSISTE" dbNotNull="false" dbPosition="7" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_DEMI_GROSSISTE field" dbDefaultValue="" dbName="NOM_DEMI_GROSSISTE" dbNotNull="false" dbPosition="8" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMDEMIGROSSISTE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM DEMI GROSSISTE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_PUCE_MERE field" dbDefaultValue="" dbName="COMPTE_PUCE_MERE" dbNotNull="false" dbPosition="9" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEPUCEMERE" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE PUCE MERE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_PARTENAIRE field" dbDefaultValue="" dbName="NOM_PARTENAIRE" dbNotNull="false" dbPosition="10" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMPARTENAIRE" javaType="java.lang.String" jdbcTypeCode="12" label="NOM PARTENAIRE" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_CPP field" dbDefaultValue="" dbName="COMPTE_CPP" dbNotNull="false" dbPosition="11" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTECPP" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_MANAGER_OCI field" dbDefaultValue="" dbName="COMPTE_MANAGER_OCI" dbNotNull="false" dbPosition="12" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTEMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SPD field" dbDefaultValue="" dbName="COMPTE_SPD" dbNotNull="false" dbPosition="13" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESPD" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch COMPTE_SUPERVISEUR field" dbDefaultValue="" dbName="COMPTE_SUPERVISEUR" dbNotNull="false" dbPosition="14" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cOMPTESUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="COMPTE SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CUID field" dbDefaultValue="" dbName="CUID" dbNotNull="false" dbPosition="15" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cUID" javaType="java.lang.String" jdbcTypeCode="12" label="CUID" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_CPP field" dbDefaultValue="" dbName="NOM_CPP" dbNotNull="false" dbPosition="16" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMCPP" javaType="java.lang.String" jdbcTypeCode="12" label="NOM CPP" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_MANAGER_OCI field" dbDefaultValue="" dbName="NOM_MANAGER_OCI" dbNotNull="false" dbPosition="17" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMMANAGEROCI" javaType="java.lang.String" jdbcTypeCode="12" label="NOM MANAGER OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SPD field" dbDefaultValue="" dbName="NOM_SPD" dbNotNull="false" dbPosition="18" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSPD" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SPD" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch NOM_SUPERVISEUR field" dbDefaultValue="" dbName="NOM_SUPERVISEUR" dbNotNull="false" dbPosition="19" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="nOMSUPERVISEUR" javaType="java.lang.String" jdbcTypeCode="12" label="NOM SUPERVISEUR" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch REGION_OCI field" dbDefaultValue="" dbName="REGION_OCI" dbNotNull="false" dbPosition="20" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="rEGIONOCI" javaType="java.lang.String" jdbcTypeCode="12" label="REGION OCI" maxLength="65000" notNull="false" selected="true"/>
<column dbComment="ElasticSearch TYPE_CODE field" dbDefaultValue="" dbName="TYPE_CODE" dbNotNull="false" dbPosition="21" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="tYPECODE" javaType="java.lang.String" jdbcTypeCode="12" label="TYPE CODE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="22" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="23" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
<table catalog="bd_om_analytics" databaseType="TABLE" javaBean="SubsAggZoneCom" name="subs_agg_zone_com" schema="subs_agg_zone_com">
<column dbComment="ElasticSearch ACTIVATION field" dbDefaultValue="" dbName="ACTIVATION" dbNotNull="false" dbPosition="1" dbPrimaryKey="false" dbSize="20" dbTypeName="BIGINT" inputType="number" javaName="aCTIVATION" javaType="java.lang.Long" jdbcTypeCode="java.lang.Long" label="ACTIVATION" notNull="false" selected="true"/>
<column dateType="DT" dbComment="ElasticSearch CREATION_DATE field" dbDefaultValue="" dbName="CREATION_DATE" dbNotNull="false" dbPosition="2" dbPrimaryKey="false" dbSize="19" dbTypeName="DATETIME" inputType="" javaName="cREATIONDATE" javaType="java.util.Date" jdbcTypeCode="93" label="CREATION DATE" notNull="false" selected="true"/>
<column dbComment="ElasticSearch CHANNEL_ZONE_COMMERCIALE field" dbDefaultValue="" dbName="CHANNEL_ZONE_COMMERCIALE" dbNotNull="false" dbPosition="3" dbPrimaryKey="false" dbSize="65000" dbTypeName="VARCHAR" inputType="text" javaName="cHANNELZONECOMMERCIALE" javaType="java.lang.String" jdbcTypeCode="12" label="CHANNEL ZONE COMMERCIALE" maxLength="65000" notNull="false" selected="true"/>
<column dbAutoIncremented="true" dbComment="" dbDefaultValue="" dbName="id" dbNotNull="true" dbPosition="4" dbPrimaryKey="true" dbSize="10" dbTypeName="INT" inputType="number" javaName="id" javaType="java.lang.Integer" jdbcTypeCode="4" label="Id" notNull="true" selected="true"/>
<column dbComment="ElasticSearch source _id" dbDefaultValue="" dbName="_id" dbNotNull="false" dbPosition="5" dbPrimaryKey="false" dbSize="255" dbTypeName="VARCHAR" inputType="text" javaName="_id" javaType="java.lang.String" jdbcTypeCode="12" label="Id" maxLength="255" notNull="true" selected="true"/>
</table>
</tableList>
</root>
I did not need to write more templates. I used the same tempates I use for generation from Mysql and everything is done
edited Apr 24 at 12:23
answered Apr 24 at 12:10
user6441481user6441481
236 bronze badges
236 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377622%2fbrowse-a-directory-in-velocity-template-language-with-telosys%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown