Git Product home page Git Product logo

telosys-tools-generator's Introduction

telosys-tools-generator

Telosys generator classes called by the Telosys API

  • The generator itslef
  • The "context" objects
  • Generation task
  • Documentation builder

telosys-tools-generator's People

Contributors

bewilcox avatar l-gu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

telosys-tools-generator's Issues

BigDecimalTest failed with Java 11

A BigDecimal created from 1AA23.456 value with lead to an exception with a null message in Java 8 but with a non null message in Java 11 (Character A is neither a decimal digit number, decimal point, nor "e" notation exponential mark.).

See: https://github.com/telosys-tools-bricks/telosys-tools-generator/blob/57cf78d/src/test/java/org/telosys/tools/generator/context/BigDecimalTest.java#L45

As the documentation mention "Java 8 (or +)" I was expecting to be able to build using Java 11.

Maybe the fix is to update the documentation.

Browse a directory in Velocity

Hello,
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). 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)&gt;#tab(3)${field}$param;
#end

private String orderDirection;
private String orderField;

}
`
What i need now is to browse my json directory, get each json file and apply the template on that json to create a java classe.
Thank you for helping me please !

Type Conversion is not working I need help

I tried to generate code with Telosys CLI
here's my settings

  • TelosysTools/oracle.properties

oracle.properties content

conv.tableName  = ANACONDA_CASE
conv.columnName = snake_case
conv.pkName = PascalCase
conv.fkName = camelCase

type.long= NUMBER

And in my template files(.vm)

#set ( $env.databaseConvFile = $fn.file('TelosysTools/oracle.properties') )

but..... It's not wokring
I follow Telosys Documentation
plz give me more example or solution

unique values feature added to the model

Hi,

It would be interesting to have access to a unique feature from the model in the same way we have currently access to .isNotBlank() , .isNotEmpty(), .isNotNull().

A more generic approach would be to add a features array to the model allowing people to add any type of informations they require.

File encoding not UTF8 with Telosys generator

Hi,
I encountred some issues when i generated file.
e.g : I generate file with $today.date, my local is "FR", so the month is "Déc". However the month was encoding like : "Created on 22 d�c. 2016 ( Time 11:12:59 )", and maven won't compile this (force utf 8 compilation).

Thanks you.

file encoding problem

Hi,I'm chuck.I'm a coder in china.I use your team project TelosysTool generate Code,but some chinese words happen encoding problem.My project encoding is 'UTF-8',I want know how let it right?

I read a little source code,in the 'Generator.java'
OutputStream out = new FileOutputStream(file);
if change it
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file),"UTF-8");
can make it right?
help me,please.

$generator (embedded generator) new feature

  1. Allow generation without current entity (just generate a specific file without entity dependency )
    $generator.generate($fileName, $folder, "template.vm" )

  2. Ability to pass an object map to transmit certain variables from the original template
    $generator.generate($entityName, $fileName, $folder, "template.vm", map )
    $generator.generate($fileName, $folder, "template.vm", map )

Probleme absolute path DSL model or Database model file

I use multi-module with spring. This is error when i double-click on file DSL model(.model) or .dbcfg

java.lang.RuntimeException: Model folder '/Users/frederic/Documents/workspace-sts-3.8.3.RELEASE/oci-bpm-telosys-module/TelosysTools/demo_model' not found
at org.telosys.tools.dsl.DslModelUtil.getEntitiesAbsoluteFileNames(DslModelUtil.java:122)

Add free annotations named "tags"

Tag identified by a special character like "#"
for example ‘#mytag’ or ‘#mytag2(123)’

usable in templates with something like
'$attribute.hasTag ("mytag")'
and
'$attribute.tagValue ("mytag2")'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.