update model for commands
This commit is contained in:
4
TelosysTools/models/InfiniMotion/Command.entity
Normal file
4
TelosysTools/models/InfiniMotion/Command.entity
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@Abstract
|
||||||
|
#Command
|
||||||
|
Command {
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#Command
|
||||||
|
@Extends(Command)
|
||||||
|
CommandCreateKinosaal {
|
||||||
|
name: string {} ;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#Command
|
||||||
|
@Extends(Command)
|
||||||
|
CommandCreateKinosaalResponse {
|
||||||
|
hall: Kinosaal {} ;
|
||||||
|
}
|
||||||
5
TelosysTools/models/InfiniMotion/CommandException.entity
Normal file
5
TelosysTools/models/InfiniMotion/CommandException.entity
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#Command
|
||||||
|
@Extends(Command)
|
||||||
|
CommandException {
|
||||||
|
exception: string { } ;
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#Command
|
||||||
|
@Extends(Command)
|
||||||
|
CommandListKinosaal {
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#Command
|
||||||
|
@Extends(Command)
|
||||||
|
CommandListKinosaalResponse {
|
||||||
|
list: Kinosaal[] {} ;
|
||||||
|
}
|
||||||
7
TelosysTools/models/InfiniMotion/CommandWrapper.entity
Normal file
7
TelosysTools/models/InfiniMotion/CommandWrapper.entity
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#Command
|
||||||
|
CommandWrapper {
|
||||||
|
transaction: string { } ; // Random Transaction ID
|
||||||
|
request: string {} ; // Random Request ID
|
||||||
|
type: string {} ; // Command Type
|
||||||
|
payload: binary {} ;
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
// Entity Eintrittskarte
|
// Entity Eintrittskarte
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Eintrittskarte {
|
Eintrittskarte {
|
||||||
id: int { @Id @AutoIncremented } ;
|
id: int { @Id @AutoIncremented } ;
|
||||||
show: Vorstellung { } ;
|
show: Vorstellung { } ;
|
||||||
seat: Sitzplatz { } ;
|
seat: Sitzplatz { } ;
|
||||||
code: string {} ;
|
code: string { @Unique } ;
|
||||||
state: Kartenstatus { } ;
|
state: Kartenstatus { } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
// Entity Film
|
// Entity Film
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Film {
|
Film {
|
||||||
id: int { @Id @AutoIncremented } ;
|
id: int { @Id @AutoIncremented } ;
|
||||||
title: string {} ;
|
title: string { @NotNull } ;
|
||||||
description: string {} ;
|
description: string { @NotNull } ;
|
||||||
duration: int {} ;
|
duration: int { @NotNull } ;
|
||||||
image: string {} ;
|
image: string { @NotNull } ;
|
||||||
rating: short { } ;
|
rating: short { } ;
|
||||||
category: Filmkategorie { } ;
|
category: Filmkategorie { } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Entity Filmkategorie
|
// Entity Filmkategorie
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Filmkategorie {
|
Filmkategorie {
|
||||||
id: int { @Id @AutoIncremented } ;
|
id: int { @Id @AutoIncremented } ;
|
||||||
name: string {} ;
|
name: string { @NotNull @Unique } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Entity Kartenstatus
|
// Entity Kartenstatus
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Kartenstatus {
|
Kartenstatus {
|
||||||
id: int { @Id @AutoIncremented } ;
|
id: int { @Id @AutoIncremented } ;
|
||||||
name: string {} ;
|
name: string { @NotNull @Unique } ;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
// Entity Kinosaal
|
// Entity Kinosaal
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Kinosaal {
|
Kinosaal {
|
||||||
id : int { @Id @AutoIncremented } ;
|
id : int { @Id @AutoIncremented } ;
|
||||||
name : string {} ;
|
name : string { @NotNull @Unique } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Entity Sitzkategorie
|
// Entity Sitzkategorie
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Sitzkategorie {
|
Sitzkategorie {
|
||||||
id: int { @Id @AutoIncremented } ;
|
id: int { @Id @AutoIncremented } ;
|
||||||
name: string { } ;
|
name: string { @NotNull @Unique } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
// Entity Sitzplatz
|
// Entity Sitzplatz
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Sitzplatz {
|
Sitzplatz {
|
||||||
id: int { @Id @AutoIncremented } ;
|
id: int { @Id @AutoIncremented } ;
|
||||||
row: Sitzreihe { } ;
|
row: Sitzreihe { } ;
|
||||||
position: int {} ;
|
position: int { @NotNull } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// Entity Sitzreihe
|
// Entity Sitzreihe
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Sitzreihe {
|
Sitzreihe {
|
||||||
id: int { @Id @AutoIncremented } ;
|
id: int { @Id @AutoIncremented } ;
|
||||||
hall: Kinosaal { } ;
|
hall: Kinosaal { } ;
|
||||||
position: int {} ;
|
position: int { @NotNull } ;
|
||||||
category: Sitzkategorie { } ;
|
category: Sitzkategorie { } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// Entity Vorstellung
|
// Entity Vorstellung
|
||||||
|
|
||||||
|
#BaseModel
|
||||||
Vorstellung {
|
Vorstellung {
|
||||||
id: int { @Id @AutoIncremented } ;
|
id: int { @Id @AutoIncremented } ;
|
||||||
hall: Kinosaal { } ;
|
hall: Kinosaal { } ;
|
||||||
movie: Film { } ;
|
movie: Film { } ;
|
||||||
start: date {} ;
|
start: date { @NotNull } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ DOC=doc
|
|||||||
TMP=tmp
|
TMP=tmp
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# --- Project Packages (standard variables)
|
# --- Project Packages (standard variables)
|
||||||
ROOT_PKG=de.infinimotion
|
ROOT_PKG=de.infinimotion.model
|
||||||
ENTITY_PKG=de.infinimotion.bean
|
ENTITY_PKG=de.infinimotion.model.bean
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# --- Project Specific Variables
|
# --- Project Specific Variables
|
||||||
ProjectVariable.MAVEN_ARTIFACT_ID=model
|
ProjectVariable.MAVEN_ARTIFACT_ID=model
|
||||||
ProjectVariable.MAVEN_GROUP_ID=de.infinimotion
|
ProjectVariable.MAVEN_GROUP_ID=de.infinimotion
|
||||||
ProjectVariable.PROJECT_NAME=infinimodel
|
ProjectVariable.PROJECT_NAME=infinimodel
|
||||||
ProjectVariable.PROJECT_VERSION=0.0.6
|
ProjectVariable.PROJECT_VERSION=0.0.38
|
||||||
ProjectVariable.REST_SERVER_PORT=3000
|
ProjectVariable.REST_SERVER_PORT=3000
|
||||||
ProjectVariable.REST_API_ROOT=/api/v1
|
ProjectVariable.REST_API_ROOT=/api/v1
|
||||||
ProjectVariable.REST_URL_ROOT=http://localhost:3000
|
ProjectVariable.REST_URL_ROOT=http://localhost:3000
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
## --------------------------------------------------
|
||||||
|
#if ( !($entity.hasTag("BaseModel")) )
|
||||||
|
#cancel("Not a Base Model")
|
||||||
|
#end
|
||||||
|
## --------------------------------------------------
|
||||||
/*
|
/*
|
||||||
* Java backend model class for entity "${entity.name}"
|
* Java backend model class for entity "${entity.name}"
|
||||||
* Created on $now.date ( $now.time )
|
* Created on $now.date ( $now.time )
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
@@ -16,6 +16,19 @@
|
|||||||
<maven.compiler.target>21</maven.compiler.target>
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.20.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>2.20</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
## --------------------------------------------------
|
||||||
|
#if ( !($entity.hasTag("BaseModel")) )
|
||||||
|
#cancel("Not a Base Model")
|
||||||
|
#end
|
||||||
|
## --------------------------------------------------
|
||||||
#set( $env.language = 'TypeScript' )
|
#set( $env.language = 'TypeScript' )
|
||||||
#foreach( $link in $entity.links )
|
#foreach( $link in $entity.links )
|
||||||
import $link.fieldType from "./${link.fieldType}";
|
import $link.fieldType from "./${link.fieldType}";
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
#foreach( $entity in $model.allEntities )
|
#foreach( $entity in $model.allEntities )
|
||||||
|
#if ( $entity.hasTag("BaseModel") )
|
||||||
import $entity.name from "./${entity.name}";
|
import $entity.name from "./${entity.name}";
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
#foreach( $entity in $model.allEntities )
|
#foreach( $entity in $model.allEntities )
|
||||||
|
#if ( $entity.hasTag("BaseModel") )
|
||||||
$entity.name,
|
$entity.name,
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
## --------------------------------------------------
|
## --------------------------------------------------
|
||||||
|
#if ( !($entity.hasTag("BaseModel")) )
|
||||||
|
#cancel("Not a Base Model")
|
||||||
|
#end
|
||||||
|
## --------------------------------------------------
|
||||||
#if ( $entity.isJoinEntity() )
|
#if ( $entity.isJoinEntity() )
|
||||||
#cancel("No JPA class for join entity")
|
#cancel("No JPA class for join entity")
|
||||||
#end
|
#end
|
||||||
@@ -81,6 +85,9 @@ $jpa.linkAnnotations(4, $link, $entity.attributes)
|
|||||||
##--- Just @JoinColumn(s) annotation(s)
|
##--- Just @JoinColumn(s) annotation(s)
|
||||||
## $jpa.linkJoinAnnotation(4, $link)
|
## $jpa.linkJoinAnnotation(4, $link)
|
||||||
## $jpa.linkJoinAnnotation(4, $link, $entity.attributes)
|
## $jpa.linkJoinAnnotation(4, $link, $entity.attributes)
|
||||||
|
#if( !($link.optional) )
|
||||||
|
@Column(nullable = false)
|
||||||
|
#end
|
||||||
private ${link.formattedFieldType(10)} $link.fieldName ;
|
private ${link.formattedFieldType(10)} $link.fieldName ;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|||||||
@@ -22,6 +22,16 @@
|
|||||||
<artifactId>jakarta.persistence-api</artifactId>
|
<artifactId>jakarta.persistence-api</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.20.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>2.20</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -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 )
|
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
### PlantUML ###
|
### PlantUML ###
|
||||||
Model diagram ; model.plantuml ; plantuml ; plantuml/class-diag_txt.vm ; 1
|
Model diagram ; model.plantuml ; plantuml ; plantuml/class-diag_txt.vm ; 1
|
||||||
|
|
||||||
### PostgreSQL Datenbank ###
|
### PostgreSQL Datenbank ### (durch Hibernate generiert)
|
||||||
PostgreSQL create tables ; postgresql-create-tables.sql ; sql ; sql/postgresql-create-tables_sql.vm ; 1
|
#PostgreSQL create tables ; postgresql-create-tables.sql ; sql ; sql/postgresql-create-tables_sql.vm ; 1
|
||||||
|
|
||||||
### Frontend ###
|
### Frontend ###
|
||||||
.npmrc ; .npmrc ; frontend ; frontend/.npmrc.vm ; 1
|
.npmrc ; .npmrc ; frontend ; frontend/.npmrc.vm ; 1
|
||||||
@@ -24,8 +24,10 @@ TypeScript Models ; ${BEANNAME}.ts ; frontend
|
|||||||
|
|
||||||
### Backend ###
|
### Backend ###
|
||||||
Java Backend Models ; ${BEANNAME}.java ; backend/${SRC}/${ROOT_PKG}/backend ; backend/backend_entity_java.vm
|
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
|
Maven Backend pom.xml ; pom.xml ; backend ; backend/pom_xml.vm ; 1
|
||||||
|
|
||||||
### Persistence ###
|
### Persistence ###
|
||||||
Java Persistence Models ; ${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/persistence_entity_java.vm
|
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
|
Maven Persistence pom.xml ; pom.xml ; persistence ; persistence/pom_xml.vm ; 1
|
||||||
|
|||||||
Reference in New Issue
Block a user