diff --git a/TelosysTools/models/InfiniMotion/Command.entity b/TelosysTools/models/InfiniMotion/Command.entity new file mode 100644 index 0000000..8af495f --- /dev/null +++ b/TelosysTools/models/InfiniMotion/Command.entity @@ -0,0 +1,4 @@ +@Abstract +#Command +Command { +} diff --git a/TelosysTools/models/InfiniMotion/CommandCreateKinosaal.entity b/TelosysTools/models/InfiniMotion/CommandCreateKinosaal.entity new file mode 100644 index 0000000..3e5e85f --- /dev/null +++ b/TelosysTools/models/InfiniMotion/CommandCreateKinosaal.entity @@ -0,0 +1,5 @@ +#Command +@Extends(Command) +CommandCreateKinosaal { + name: string {} ; +} diff --git a/TelosysTools/models/InfiniMotion/CommandCreateKinosaalResponse.entity b/TelosysTools/models/InfiniMotion/CommandCreateKinosaalResponse.entity new file mode 100644 index 0000000..62aab91 --- /dev/null +++ b/TelosysTools/models/InfiniMotion/CommandCreateKinosaalResponse.entity @@ -0,0 +1,5 @@ +#Command +@Extends(Command) +CommandCreateKinosaalResponse { + hall: Kinosaal {} ; +} diff --git a/TelosysTools/models/InfiniMotion/CommandException.entity b/TelosysTools/models/InfiniMotion/CommandException.entity new file mode 100644 index 0000000..08b0f90 --- /dev/null +++ b/TelosysTools/models/InfiniMotion/CommandException.entity @@ -0,0 +1,5 @@ +#Command +@Extends(Command) +CommandException { + exception: string { } ; +} diff --git a/TelosysTools/models/InfiniMotion/CommandListKinosaal.entity b/TelosysTools/models/InfiniMotion/CommandListKinosaal.entity new file mode 100644 index 0000000..bc6dc88 --- /dev/null +++ b/TelosysTools/models/InfiniMotion/CommandListKinosaal.entity @@ -0,0 +1,4 @@ +#Command +@Extends(Command) +CommandListKinosaal { +} diff --git a/TelosysTools/models/InfiniMotion/CommandListKinosaalResponse.entity b/TelosysTools/models/InfiniMotion/CommandListKinosaalResponse.entity new file mode 100644 index 0000000..15349ec --- /dev/null +++ b/TelosysTools/models/InfiniMotion/CommandListKinosaalResponse.entity @@ -0,0 +1,5 @@ +#Command +@Extends(Command) +CommandListKinosaalResponse { + list: Kinosaal[] {} ; +} diff --git a/TelosysTools/models/InfiniMotion/CommandWrapper.entity b/TelosysTools/models/InfiniMotion/CommandWrapper.entity new file mode 100644 index 0000000..684a17d --- /dev/null +++ b/TelosysTools/models/InfiniMotion/CommandWrapper.entity @@ -0,0 +1,7 @@ +#Command +CommandWrapper { + transaction: string { } ; // Random Transaction ID + request: string {} ; // Random Request ID + type: string {} ; // Command Type + payload: binary {} ; +} diff --git a/TelosysTools/models/InfiniMotion/Eintrittskarte.entity b/TelosysTools/models/InfiniMotion/Eintrittskarte.entity index c886415..c86ed71 100644 --- a/TelosysTools/models/InfiniMotion/Eintrittskarte.entity +++ b/TelosysTools/models/InfiniMotion/Eintrittskarte.entity @@ -1,9 +1,10 @@ // Entity Eintrittskarte +#BaseModel Eintrittskarte { id: int { @Id @AutoIncremented } ; - show: Vorstellung {} ; - seat: Sitzplatz {} ; - code: string {} ; - state: Kartenstatus {} ; + show: Vorstellung { } ; + seat: Sitzplatz { } ; + code: string { @Unique } ; + state: Kartenstatus { } ; } diff --git a/TelosysTools/models/InfiniMotion/Film.entity b/TelosysTools/models/InfiniMotion/Film.entity index b23a24b..5471a9d 100644 --- a/TelosysTools/models/InfiniMotion/Film.entity +++ b/TelosysTools/models/InfiniMotion/Film.entity @@ -1,11 +1,12 @@ // Entity Film +#BaseModel Film { id: int { @Id @AutoIncremented } ; - title: string {} ; - description: string {} ; - duration: int {} ; - image: string {} ; - rating: short {} ; - category: Filmkategorie {} ; + title: string { @NotNull } ; + description: string { @NotNull } ; + duration: int { @NotNull } ; + image: string { @NotNull } ; + rating: short { } ; + category: Filmkategorie { } ; } diff --git a/TelosysTools/models/InfiniMotion/Filmkategorie.entity b/TelosysTools/models/InfiniMotion/Filmkategorie.entity index f65d749..6a65ef8 100644 --- a/TelosysTools/models/InfiniMotion/Filmkategorie.entity +++ b/TelosysTools/models/InfiniMotion/Filmkategorie.entity @@ -1,6 +1,7 @@ // Entity Filmkategorie +#BaseModel Filmkategorie { id: int { @Id @AutoIncremented } ; - name: string {} ; + name: string { @NotNull @Unique } ; } diff --git a/TelosysTools/models/InfiniMotion/Kartenstatus.entity b/TelosysTools/models/InfiniMotion/Kartenstatus.entity index 582734e..058ef08 100644 --- a/TelosysTools/models/InfiniMotion/Kartenstatus.entity +++ b/TelosysTools/models/InfiniMotion/Kartenstatus.entity @@ -1,6 +1,7 @@ // Entity Kartenstatus +#BaseModel Kartenstatus { id: int { @Id @AutoIncremented } ; - name: string {} ; + name: string { @NotNull @Unique } ; } \ No newline at end of file diff --git a/TelosysTools/models/InfiniMotion/Kinosaal.entity b/TelosysTools/models/InfiniMotion/Kinosaal.entity index bc90ea5..4068f2e 100644 --- a/TelosysTools/models/InfiniMotion/Kinosaal.entity +++ b/TelosysTools/models/InfiniMotion/Kinosaal.entity @@ -1,6 +1,7 @@ // Entity Kinosaal +#BaseModel Kinosaal { id : int { @Id @AutoIncremented } ; - name : string {} ; + name : string { @NotNull @Unique } ; } diff --git a/TelosysTools/models/InfiniMotion/Sitzkategorie.entity b/TelosysTools/models/InfiniMotion/Sitzkategorie.entity index 0c039bf..c509315 100644 --- a/TelosysTools/models/InfiniMotion/Sitzkategorie.entity +++ b/TelosysTools/models/InfiniMotion/Sitzkategorie.entity @@ -1,6 +1,7 @@ // Entity Sitzkategorie +#BaseModel Sitzkategorie { id: int { @Id @AutoIncremented } ; - name: string { } ; + name: string { @NotNull @Unique } ; } diff --git a/TelosysTools/models/InfiniMotion/Sitzplatz.entity b/TelosysTools/models/InfiniMotion/Sitzplatz.entity index f175cbb..0d36e7a 100644 --- a/TelosysTools/models/InfiniMotion/Sitzplatz.entity +++ b/TelosysTools/models/InfiniMotion/Sitzplatz.entity @@ -1,7 +1,8 @@ // Entity Sitzplatz +#BaseModel Sitzplatz { id: int { @Id @AutoIncremented } ; - row: Sitzreihe {} ; - position: int {} ; + row: Sitzreihe { } ; + position: int { @NotNull } ; } diff --git a/TelosysTools/models/InfiniMotion/Sitzreihe.entity b/TelosysTools/models/InfiniMotion/Sitzreihe.entity index cece3f1..1ea538f 100644 --- a/TelosysTools/models/InfiniMotion/Sitzreihe.entity +++ b/TelosysTools/models/InfiniMotion/Sitzreihe.entity @@ -1,8 +1,9 @@ // Entity Sitzreihe +#BaseModel Sitzreihe { id: int { @Id @AutoIncremented } ; - hall: Kinosaal {} ; - position: int {} ; - category: Sitzkategorie {} ; + hall: Kinosaal { } ; + position: int { @NotNull } ; + category: Sitzkategorie { } ; } diff --git a/TelosysTools/models/InfiniMotion/Vorstellung.entity b/TelosysTools/models/InfiniMotion/Vorstellung.entity index 97ed45d..3e544b2 100644 --- a/TelosysTools/models/InfiniMotion/Vorstellung.entity +++ b/TelosysTools/models/InfiniMotion/Vorstellung.entity @@ -1,8 +1,9 @@ // Entity Vorstellung +#BaseModel Vorstellung { id: int { @Id @AutoIncremented } ; - hall: Kinosaal {} ; - movie: Film {} ; - start: date {} ; + hall: Kinosaal { } ; + movie: Film { } ; + start: date { @NotNull } ; } diff --git a/TelosysTools/telosys-tools.cfg b/TelosysTools/telosys-tools.cfg index bd9ce03..75a7e4a 100644 --- a/TelosysTools/telosys-tools.cfg +++ b/TelosysTools/telosys-tools.cfg @@ -15,14 +15,14 @@ DOC=doc TMP=tmp # ------------------------------------------- # --- Project Packages (standard variables) -ROOT_PKG=de.infinimotion -ENTITY_PKG=de.infinimotion.bean +ROOT_PKG=de.infinimotion.model +ENTITY_PKG=de.infinimotion.model.bean # ------------------------------------------- # --- Project Specific Variables ProjectVariable.MAVEN_ARTIFACT_ID=model ProjectVariable.MAVEN_GROUP_ID=de.infinimotion ProjectVariable.PROJECT_NAME=infinimodel -ProjectVariable.PROJECT_VERSION=0.0.6 +ProjectVariable.PROJECT_VERSION=0.0.38 ProjectVariable.REST_SERVER_PORT=3000 ProjectVariable.REST_API_ROOT=/api/v1 ProjectVariable.REST_URL_ROOT=http://localhost:3000 diff --git a/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm b/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm index 485eda6..ff6e23a 100644 --- a/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm +++ b/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm @@ -1,3 +1,8 @@ +## -------------------------------------------------- +#if ( !($entity.hasTag("BaseModel")) ) +#cancel("Not a Base Model") +#end +## -------------------------------------------------- /* * Java backend model class for entity "${entity.name}" * Created on $now.date ( $now.time ) diff --git a/TelosysTools/templates/infinimotion/backend/command_entity_java.vm b/TelosysTools/templates/infinimotion/backend/command_entity_java.vm new file mode 100644 index 0000000..fc46a8b --- /dev/null +++ b/TelosysTools/templates/infinimotion/backend/command_entity_java.vm @@ -0,0 +1,155 @@ +## -------------------------------------------------- +#if ( !($entity.hasTag("Command")) ) +#cancel("Not a Command") +#end +## -------------------------------------------------- +/* + * Java command model class for entity "${entity.name}" + * Created on $now.date ( $now.time ) + * Generated by $generator.name ( version $generator.version ) + */ +package ${target.javaPackageFromFolder("backend/${SRC}")}; + +import java.io.Serializable; + +#foreach( $import in $java.imports($entity) ) +import $import; +#end + +##-------------------------------------------------------------------------------------------------------- +## Data fields = fields not in Primary Key and not in selected Links +#set( $dataFields = $entity.getAttributesByCriteria( $const.NOT_KEY, $const.NOT_IN_SELECTED_LINKS ) ) +##-------------------------------------------------------------------------------------------------------- +## Link fields = fields not in Primary Key and used as FK in selected Links +#set( $linkFields = $entity.getAttributesByCriteria( $const.NOT_KEY, $const.IN_SELECTED_LINKS ) ) +##-------------------------------------------------------------------------------------------------------- +/** + * Command model class for entity "${entity.name}" + * + * @author Telosys Tools Generator + * + */ +public#if( $entity.isAbstract() ) abstract#end class ${entity.name}#if( $entity.hasSuperClass() ) extends $entity.superClass#end implements Serializable { + + private static final long serialVersionUID = 1L; + + //---------------------------------------------------------------------- + // ENTITY PRIMARY KEY + //---------------------------------------------------------------------- +#foreach( $field in $entity.keyAttributes ) + private $field.formattedType(10) $field.formattedName(12) #if($field.hasInitialValue())= ${field.initialValue} #end; +#end + + //---------------------------------------------------------------------- + // ENTITY DATA FIELDS + //---------------------------------------------------------------------- +#foreach( $field in $dataFields ) + private $field.formattedType(10) $field.formattedName(12) #if($field.hasInitialValue())= ${field.initialValue} #end; +#end +#foreach( $field in $linkFields ) + // Attribute "$field.name" is a link +#end + + //---------------------------------------------------------------------- + // ENTITY LINKS ( RELATIONSHIP ) + //---------------------------------------------------------------------- +#foreach( $link in $entity.selectedLinks ) + private ${link.formattedFieldType(10)} $link.formattedFieldName(12) ; +#end + + //---------------------------------------------------------------------- + // CONSTRUCTOR(S) + //---------------------------------------------------------------------- + public ${entity.name}() { + super(); + } + + //---------------------------------------------------------------------- + // GETTER & SETTER FOR "KEY FIELD(S)" + //---------------------------------------------------------------------- +#foreach( $attribute in $entity.keyAttributes ) + public void ${attribute.setter}( $attribute.type $attribute.name ) { + this.$attribute.name = $attribute.name ; + } + public $attribute.type ${attribute.getter}() { + return this.$attribute.name; + } + +#end + + //---------------------------------------------------------------------- + // GETTERS & SETTERS FOR "DATA FIELDS" + //---------------------------------------------------------------------- +#foreach( $attribute in $dataFields ) + public void ${attribute.setter}( $attribute.type $attribute.name ) { + this.$attribute.name = $attribute.name ; + } + public $attribute.type ${attribute.getter}() { + return this.$attribute.name; + } + +#end + + //---------------------------------------------------------------------- + // GETTERS & SETTERS FOR LINKS + //---------------------------------------------------------------------- +#foreach( $link in $entity.selectedLinks ) + public void ${link.setter}( ${link.formattedFieldType(0)} ${link.formattedFieldName(0)} ) { + this.${link.formattedFieldName(0)} = ${link.formattedFieldName(0)}; + } + public ${link.formattedFieldType(0)} ${link.getter}() { + return this.${link.formattedFieldName(0)}; + } + +#end + +#if( $entity.isAbstract() ) + static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER + = new com.fasterxml.jackson.databind.ObjectMapper() + .setVisibility(com.fasterxml.jackson.annotation.PropertyAccessor.FIELD, com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY) + .configure(com.fasterxml.jackson.databind.SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + + public abstract CommandWrapper serialize() throws java.io.IOException; +#else +#if ( $entity.name != "CommandWrapper" ) + public CommandWrapper serialize() throws java.io.IOException { + CommandWrapper wrapper = new CommandWrapper(); + wrapper.setType(${entity.name}.class.getSimpleName()); + wrapper.setPayload(OBJECT_MAPPER.writeValueAsBytes(this)); + return wrapper; + } + + public static $entity.name deserialize(CommandWrapper wrapper) throws java.io.IOException { + return OBJECT_MAPPER.readValue(wrapper.getPayload(), ${entity.name}.class); + } + + public static boolean isType(CommandWrapper wrapper) { + return wrapper.getType().equals(${entity.name}.class.getSimpleName()); + } +#else + public $entity.name copyIds(CommandWrapper wrapper) { + setTransaction(wrapper.getTransaction()); + setRequest(wrapper.getRequest()); + return this; + } + + public $entity.name generateIds() { + setTransaction(java.util.UUID.randomUUID().toString()); + setRequest(java.util.UUID.randomUUID().toString()); + return this; + } + + public ${entity.name}(CommandWrapper wrapper) { + this(); + copyIds(wrapper); + } +#end +#end + + //---------------------------------------------------------------------- + // toString METHOD + //---------------------------------------------------------------------- +## This function generates a 'toString' method with 4 blanks before each line +## $java.toStringMethod($fn.concatLists($entity.keyAttributes, $dataFields), 4) +$java.toStringMethod($entity, 1) +} diff --git a/TelosysTools/templates/infinimotion/backend/pom_xml.vm b/TelosysTools/templates/infinimotion/backend/pom_xml.vm index 7c96013..aa335bf 100644 --- a/TelosysTools/templates/infinimotion/backend/pom_xml.vm +++ b/TelosysTools/templates/infinimotion/backend/pom_xml.vm @@ -16,6 +16,19 @@ 21 + + + com.fasterxml.jackson.core + jackson-databind + 2.20.0 + + + com.fasterxml.jackson.core + jackson-annotations + 2.20 + + + diff --git a/TelosysTools/templates/infinimotion/frontend/frontend_entity_ts.vm b/TelosysTools/templates/infinimotion/frontend/frontend_entity_ts.vm index 97fe1d6..a0f2dac 100644 --- a/TelosysTools/templates/infinimotion/frontend/frontend_entity_ts.vm +++ b/TelosysTools/templates/infinimotion/frontend/frontend_entity_ts.vm @@ -1,3 +1,8 @@ +## -------------------------------------------------- +#if ( !($entity.hasTag("BaseModel")) ) +#cancel("Not a Base Model") +#end +## -------------------------------------------------- #set( $env.language = 'TypeScript' ) #foreach( $link in $entity.links ) import $link.fieldType from "./${link.fieldType}"; diff --git a/TelosysTools/templates/infinimotion/frontend/index_ts.vm b/TelosysTools/templates/infinimotion/frontend/index_ts.vm index a87168f..69e20ef 100644 --- a/TelosysTools/templates/infinimotion/frontend/index_ts.vm +++ b/TelosysTools/templates/infinimotion/frontend/index_ts.vm @@ -1,9 +1,13 @@ #foreach( $entity in $model.allEntities ) +#if ( $entity.hasTag("BaseModel") ) import $entity.name from "./${entity.name}"; #end +#end export type { #foreach( $entity in $model.allEntities ) +#if ( $entity.hasTag("BaseModel") ) $entity.name, #end +#end } \ No newline at end of file diff --git a/TelosysTools/templates/infinimotion/persistence/command_entity_java.vm b/TelosysTools/templates/infinimotion/persistence/command_entity_java.vm new file mode 100644 index 0000000..c275715 --- /dev/null +++ b/TelosysTools/templates/infinimotion/persistence/command_entity_java.vm @@ -0,0 +1,155 @@ +## -------------------------------------------------- +#if ( !($entity.hasTag("Command")) ) +#cancel("Not a Command") +#end +## -------------------------------------------------- +/* + * Java command model class for entity "${entity.name}" + * Created on $now.date ( $now.time ) + * Generated by $generator.name ( version $generator.version ) + */ +package ${target.javaPackageFromFolder("persistence/${SRC}")}; + +import java.io.Serializable; + +#foreach( $import in $java.imports($entity) ) +import $import; +#end + +##-------------------------------------------------------------------------------------------------------- +## Data fields = fields not in Primary Key and not in selected Links +#set( $dataFields = $entity.getAttributesByCriteria( $const.NOT_KEY, $const.NOT_IN_SELECTED_LINKS ) ) +##-------------------------------------------------------------------------------------------------------- +## Link fields = fields not in Primary Key and used as FK in selected Links +#set( $linkFields = $entity.getAttributesByCriteria( $const.NOT_KEY, $const.IN_SELECTED_LINKS ) ) +##-------------------------------------------------------------------------------------------------------- +/** + * Command model class for entity "${entity.name}" + * + * @author Telosys Tools Generator + * + */ +public#if( $entity.isAbstract() ) abstract#end class ${entity.name}#if( $entity.hasSuperClass() ) extends $entity.superClass#end implements Serializable { + + private static final long serialVersionUID = 1L; + + //---------------------------------------------------------------------- + // ENTITY PRIMARY KEY + //---------------------------------------------------------------------- +#foreach( $field in $entity.keyAttributes ) + private $field.formattedType(10) $field.formattedName(12) #if($field.hasInitialValue())= ${field.initialValue} #end; +#end + + //---------------------------------------------------------------------- + // ENTITY DATA FIELDS + //---------------------------------------------------------------------- +#foreach( $field in $dataFields ) + private $field.formattedType(10) $field.formattedName(12) #if($field.hasInitialValue())= ${field.initialValue} #end; +#end +#foreach( $field in $linkFields ) + // Attribute "$field.name" is a link +#end + + //---------------------------------------------------------------------- + // ENTITY LINKS ( RELATIONSHIP ) + //---------------------------------------------------------------------- +#foreach( $link in $entity.selectedLinks ) + private ${link.formattedFieldType(10)} $link.formattedFieldName(12) ; +#end + + //---------------------------------------------------------------------- + // CONSTRUCTOR(S) + //---------------------------------------------------------------------- + public ${entity.name}() { + super(); + } + + //---------------------------------------------------------------------- + // GETTER & SETTER FOR "KEY FIELD(S)" + //---------------------------------------------------------------------- +#foreach( $attribute in $entity.keyAttributes ) + public void ${attribute.setter}( $attribute.type $attribute.name ) { + this.$attribute.name = $attribute.name ; + } + public $attribute.type ${attribute.getter}() { + return this.$attribute.name; + } + +#end + + //---------------------------------------------------------------------- + // GETTERS & SETTERS FOR "DATA FIELDS" + //---------------------------------------------------------------------- +#foreach( $attribute in $dataFields ) + public void ${attribute.setter}( $attribute.type $attribute.name ) { + this.$attribute.name = $attribute.name ; + } + public $attribute.type ${attribute.getter}() { + return this.$attribute.name; + } + +#end + + //---------------------------------------------------------------------- + // GETTERS & SETTERS FOR LINKS + //---------------------------------------------------------------------- +#foreach( $link in $entity.selectedLinks ) + public void ${link.setter}( ${link.formattedFieldType(0)} ${link.formattedFieldName(0)} ) { + this.${link.formattedFieldName(0)} = ${link.formattedFieldName(0)}; + } + public ${link.formattedFieldType(0)} ${link.getter}() { + return this.${link.formattedFieldName(0)}; + } + +#end + +#if( $entity.isAbstract() ) + static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER + = new com.fasterxml.jackson.databind.ObjectMapper() + .setVisibility(com.fasterxml.jackson.annotation.PropertyAccessor.FIELD, com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY) + .configure(com.fasterxml.jackson.databind.SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + + public abstract CommandWrapper serialize() throws java.io.IOException; +#else +#if ( $entity.name != "CommandWrapper" ) + public CommandWrapper serialize() throws java.io.IOException { + CommandWrapper wrapper = new CommandWrapper(); + wrapper.setType(${entity.name}.class.getSimpleName()); + wrapper.setPayload(OBJECT_MAPPER.writeValueAsBytes(this)); + return wrapper; + } + + public static $entity.name deserialize(CommandWrapper wrapper) throws java.io.IOException { + return OBJECT_MAPPER.readValue(wrapper.getPayload(), ${entity.name}.class); + } + + public static boolean isType(CommandWrapper wrapper) { + return wrapper.getType().equals(${entity.name}.class.getSimpleName()); + } +#else + public $entity.name copyIds(CommandWrapper wrapper) { + setTransaction(wrapper.getTransaction()); + setRequest(wrapper.getRequest()); + return this; + } + + public $entity.name generateIds() { + setTransaction(java.util.UUID.randomUUID().toString()); + setRequest(java.util.UUID.randomUUID().toString()); + return this; + } + + public ${entity.name}(CommandWrapper wrapper) { + this(); + copyIds(wrapper); + } +#end +#end + + //---------------------------------------------------------------------- + // toString METHOD + //---------------------------------------------------------------------- +## This function generates a 'toString' method with 4 blanks before each line +## $java.toStringMethod($fn.concatLists($entity.keyAttributes, $dataFields), 4) +$java.toStringMethod($entity, 1) +} diff --git a/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm b/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm index d854ccb..53888bb 100644 --- a/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm +++ b/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm @@ -1,4 +1,8 @@ ## -------------------------------------------------- +#if ( !($entity.hasTag("BaseModel")) ) +#cancel("Not a Base Model") +#end +## -------------------------------------------------- #if ( $entity.isJoinEntity() ) #cancel("No JPA class for join entity") #end @@ -81,6 +85,9 @@ $jpa.linkAnnotations(4, $link, $entity.attributes) ##--- Just @JoinColumn(s) annotation(s) ## $jpa.linkJoinAnnotation(4, $link) ## $jpa.linkJoinAnnotation(4, $link, $entity.attributes) +#if( !($link.optional) ) + @Column(nullable = false) +#end private ${link.formattedFieldType(10)} $link.fieldName ; #end diff --git a/TelosysTools/templates/infinimotion/persistence/pom_xml.vm b/TelosysTools/templates/infinimotion/persistence/pom_xml.vm index bb0314f..cf06d80 100644 --- a/TelosysTools/templates/infinimotion/persistence/pom_xml.vm +++ b/TelosysTools/templates/infinimotion/persistence/pom_xml.vm @@ -22,6 +22,16 @@ jakarta.persistence-api 3.2.0 + + com.fasterxml.jackson.core + jackson-databind + 2.20.0 + + + com.fasterxml.jackson.core + jackson-annotations + 2.20 + diff --git a/TelosysTools/templates/infinimotion/sql/postgresql-create-tables_sql.vm b/TelosysTools/templates/infinimotion/sql/postgresql-create-tables_sql.vm deleted file mode 100644 index a377004..0000000 --- a/TelosysTools/templates/infinimotion/sql/postgresql-create-tables_sql.vm +++ /dev/null @@ -1,45 +0,0 @@ --- Generated by Telosys ( https://www.telosys.org/ ) --- $now.date ($now.time) -#set( $env.database = 'PostgreSQL' ) -## --------------------------------------- -## For each entity : CREATE TABLE -## --------------------------------------- -#foreach( $entity in $model.allEntites ) -## CREATE TABLE IF NOT EXISTS $entity.sqlTableName -## use $entity.databaseSchema if necessary -CREATE TABLE $entity.sqlTableName -( -## COLUMNS DEFINITION : -#foreach( $attribute in $entity.attributes ) -#if( $foreach.hasNext() || $entity.hasPrimaryKey() ) -#set($EOL=",") -#else -#set($EOL="") -#end -## $sql.columnName($attribute) $sql.columnType($attribute) $sql.columnConstraints($attribute)$EOL - $attribute.sqlColumnName $attribute.sqlColumnType ${attribute.sqlColumnConstraints}$EOL -#end -## PRIMARY KEY DEFINITION : -#if( $entity.hasPrimaryKey() ) -## PRIMARY KEY ($sql.pkColumns($entity)) - PRIMARY KEY ($entity.sqlPrimaryKeyColumnsAsString) -#end -); - -#end## foreach( $entity ) - -## --------------------------------------------------------- -## For each Foreign Key in each entity : CREATE FOREIGN KEY -## --------------------------------------------------------- -#foreach( $entity in $model.allEntites ) -#if ( $entity.hasForeignKeys() ) -#set($tableName = $entity.sqlTableName ) -#foreach( $fk in $entity.databaseForeignKeys ) -ALTER TABLE $tableName - ADD CONSTRAINT "$fk.name" FOREIGN KEY($fk.sqlOriginColumnsAsString) - REFERENCES ${fk.sqlReferencedTableName}($fk.sqlReferencedColumnsAsString) ; -CREATE INDEX ON $tableName($fk.sqlOriginColumnsAsString) ; -#end## foreach( $fk ) - -#end## if has FK -#end## foreach( $entity ) diff --git a/TelosysTools/templates/infinimotion/templates.cfg b/TelosysTools/templates/infinimotion/templates.cfg index 8b2487d..d25a6a7 100644 --- a/TelosysTools/templates/infinimotion/templates.cfg +++ b/TelosysTools/templates/infinimotion/templates.cfg @@ -11,8 +11,8 @@ ### PlantUML ### Model diagram ; model.plantuml ; plantuml ; plantuml/class-diag_txt.vm ; 1 -### PostgreSQL Datenbank ### -PostgreSQL create tables ; postgresql-create-tables.sql ; sql ; sql/postgresql-create-tables_sql.vm ; 1 +### PostgreSQL Datenbank ### (durch Hibernate generiert) +#PostgreSQL create tables ; postgresql-create-tables.sql ; sql ; sql/postgresql-create-tables_sql.vm ; 1 ### Frontend ### .npmrc ; .npmrc ; frontend ; frontend/.npmrc.vm ; 1 @@ -24,8 +24,10 @@ TypeScript Models ; ${BEANNAME}.ts ; frontend ### Backend ### Java Backend Models ; ${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/backend_entity_java.vm +Java Command Models (B) ; ${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/command_entity_java.vm Maven Backend pom.xml ; pom.xml ; backend ; backend/pom_xml.vm ; 1 ### Persistence ### Java Persistence Models ; ${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/persistence_entity_java.vm +Java Command Models (P) ; ${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command_entity_java.vm Maven Persistence pom.xml ; pom.xml ; persistence ; persistence/pom_xml.vm ; 1