movie importer and show planner

This commit is contained in:
2025-10-31 22:13:02 +01:00
parent 3db883ba71
commit f0fc12b5dc
48 changed files with 293 additions and 409 deletions

View File

@@ -5,6 +5,8 @@ Eintrittskarte {
id: int { @Id @AutoIncremented @ObjectType } ;
show: Vorstellung { } ;
seat: Sitzplatz { } ;
code: string { @Unique } ;
state: Kartenstatus { } ;
code: string { @Unique @NotNull } ;
reserved: timestamp { @NotNull } ;
booked: timestamp { } ;
cancelled: timestamp {} ;
}

View File

@@ -7,6 +7,6 @@ Film {
description: string { @NotNull @MaxLen(2000) } ;
duration: int { @NotNull } ;
image: string { @NotNull } ;
rating: short { } ;
rating: short { @NotNull } ;
category: Filmkategorie { } ;
}

View File

@@ -1,7 +0,0 @@
// Entity Kartenstatus
#BaseModel
Kartenstatus {
id: int { @Id @AutoIncremented @ObjectType } ;
name: string { @NotNull @Unique } ;
}

View File

@@ -0,0 +1,15 @@
// Entity OmdbMovie
#Omdb
OmdbMovie {
imdbID: string {} ;
title: string {} ;
year: string {} ;
rated: string {} ;
released: string {} ;
runtime: string {} ;
genre: string {} ;
plot: string {} ;
poster: string {} ;
imdbRating: string {} ;
}

View File

@@ -0,0 +1,6 @@
// Entity OmdbSearch
#Omdb
OmdbSearch {
search: OmdbMovie[] {} ;
}

View File

@@ -0,0 +1,11 @@
// Entity Plan
#BaseModel
Plan {
id: int { @Id @AutoIncremented @ObjectType } ;
hall: Kinosaal { } ;
movie: Film { } ;
weekday: byte { @NotNull } ;
time: time { @NotNull } ;
first: date { @NotNull } ;
}

View File

@@ -22,7 +22,7 @@ ENTITY_PKG=de.infinimotion.model.bean
ProjectVariable.MAVEN_ARTIFACT_ID=model
ProjectVariable.MAVEN_GROUP_ID=de.infinimotion
ProjectVariable.PROJECT_NAME=infinimodel
ProjectVariable.PROJECT_VERSION=0.0.67
ProjectVariable.PROJECT_VERSION=0.0.76
ProjectVariable.REST_SERVER_PORT=3000
ProjectVariable.REST_API_ROOT=/api/v1
ProjectVariable.REST_URL_ROOT=http://localhost:3000

View File

@@ -1,6 +1,6 @@
## --------------------------------------------------
#if ( !($entity.hasTag("BaseModel")) )
#cancel("Not a Base Model")
#if ( !($entity.hasTag("BaseModel") || $entity.hasTag("Omdb")) )
#cancel("Not a Base or Omdb Model")
#end
## --------------------------------------------------
/*
@@ -11,6 +11,7 @@
package ${target.javaPackageFromFolder("backend/${SRC}")};
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
#foreach( $import in $java.imports($entity) )
import $import;
@@ -29,6 +30,7 @@ import $import;
* @author Telosys Tools Generator
*
*/
@JsonFormat(with = JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
public class ${entity.name} implements Serializable {
private static final long serialVersionUID = 1L;

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Create" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Delete" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Get" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "List" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Create" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Delete" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Get" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "List" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Update" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Create" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Delete" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Get" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "List" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Update" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "backend" )
#set( $commandType = "Update" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,167 +1,2 @@
## --------------------------------------------------
#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)
.findAndRegisterModules();
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 tx(CommandWrapper wrapper) {
setTransaction(wrapper.getTransaction());
setRequest(java.util.UUID.randomUUID().toString());
return this;
}
public $entity.name commit() {
setCommit(true);
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)
}
#set( $component = "backend" )
#parse( "include/command_entity.vm" )

View File

@@ -0,0 +1,186 @@
## --------------------------------------------------
#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("${component}/${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)
.findAndRegisterModules();
public abstract CommandWrapper serialize() throws java.io.IOException;
#if ( $component == "persistence" )
public abstract Command process() throws Exception;
#end
#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());
}
#if ( $component == "persistence" )
@Override
public Command process() throws Exception {
return jakarta.enterprise.inject.spi.CDI.current().select(${entity.name}Processor.class).get().process${entity.name}(this);
}
#end
#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 tx(CommandWrapper wrapper) {
setTransaction(wrapper.getTransaction());
setRequest(java.util.UUID.randomUUID().toString());
return this;
}
public $entity.name commit() {
setCommit(true);
return this;
}
public ${entity.name}(CommandWrapper wrapper) {
this();
copyIds(wrapper);
}
#if ( $component == "persistence" )
public Command process() throws Exception {
Command command = (Command) Class.forName(getClass().getPackageName() + "." + this.getType()).getMethod("deserialize", getClass()).invoke(null, this);
return command.process();
}
#end
#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)
}

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Create" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Delete" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Get" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "List" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Create" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Delete" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Get" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "List" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Update" )
#parse( "include_command_processor.vm" )
#parse( "include/command_processor.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Create" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Delete" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Get" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "List" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Update" )
#parse( "include_command_response.vm" )
#parse( "include/command_response.vm" )

View File

@@ -1,3 +1,3 @@
#set( $component = "persistence" )
#set( $commandType = "Update" )
#parse( "include_command.vm" )
#parse( "include/command.vm" )

View File

@@ -1,180 +1,2 @@
## --------------------------------------------------
#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)
.findAndRegisterModules();
public abstract CommandWrapper serialize() throws java.io.IOException;
public abstract Command process() throws Exception;
#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());
}
@Override
public Command process() throws Exception {
return jakarta.enterprise.inject.spi.CDI.current().select(${entity.name}Processor.class).get().process${entity.name}(this);
}
#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 tx(CommandWrapper wrapper) {
setTransaction(wrapper.getTransaction());
setRequest(java.util.UUID.randomUUID().toString());
return this;
}
public $entity.name commit() {
setCommit(true);
return this;
}
public ${entity.name}(CommandWrapper wrapper) {
this();
copyIds(wrapper);
}
public Command process() throws Exception {
Command command = (Command) Class.forName(getClass().getPackageName() + "." + this.getType()).getMethod("deserialize", getClass()).invoke(null, this);
return command.process();
}
#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)
}
#set( $component = "persistence" )
#parse( "include/command_entity.vm" )

View File

@@ -1,9 +0,0 @@
## #set($recordClass = "${entity.name}Record" )
## #set($recordInstance = $fn.uncapitalize($entity.name) )
##
#set($jpaEntityClass = "${entity.name}" )
#set($jpaEntityIdClass = "${entity.name}Id" )
##
## #set($jpaMapperClass = "${entity.name}RecordMapper" )
## #set($jpaMapperInstance = "${recordInstance}Mapper" )
##

View File

@@ -1,4 +0,0 @@
/*
* Created on $now.date ( $now.time )
* Generated by Telosys ( http://www.telosys.org/ ) version $generator.version
*/

View File

@@ -1,6 +1,17 @@
#checkId($entity)
#parse("persistence/include/init_var_entity.vm")
#parse("persistence/include/java_header.vm")
## #set($recordClass = "${entity.name}Record" )
## #set($recordInstance = $fn.uncapitalize($entity.name) )
##
#set($jpaEntityClass = "${entity.name}" )
#set($jpaEntityIdClass = "${entity.name}Id" )
##
## #set($jpaMapperClass = "${entity.name}RecordMapper" )
## #set($jpaMapperInstance = "${recordInstance}Mapper" )
##
/*
* Created on $now.date ( $now.time )
* Generated by Telosys ( http://www.telosys.org/ ) version $generator.version
*/
##--------------------------------------------------------------------------------------------------------
package ${target.javaPackageFromFolder("persistence/${SRC}")};

View File

@@ -8,8 +8,19 @@
#end
## --------------------------------------------------
#checkId($entity)
#parse("persistence/include/init_var_entity.vm")
#parse("persistence/include/java_header.vm")
## #set($recordClass = "${entity.name}Record" )
## #set($recordInstance = $fn.uncapitalize($entity.name) )
##
#set($jpaEntityClass = "${entity.name}" )
#set($jpaEntityIdClass = "${entity.name}Id" )
##
## #set($jpaMapperClass = "${entity.name}RecordMapper" )
## #set($jpaMapperInstance = "${recordInstance}Mapper" )
##
/*
* Created on $now.date ( $now.time )
* Generated by Telosys ( http://www.telosys.org/ ) version $generator.version
*/
##---------------------------------------------------------------------------------------
## JPA CONFIGURATION
##---------------------------------------------------------------------------------------
@@ -85,8 +96,11 @@ $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)
## Workaround, sonst undefined...
#if( "${link.optional}" == "true" )
@JoinColumn(nullable = true)
#else
@JoinColumn(nullable = false)
#end
private ${link.formattedFieldType(10)} $link.fieldName ;