movie importer and show planner
This commit is contained in:
@@ -5,6 +5,8 @@ Eintrittskarte {
|
|||||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
id: int { @Id @AutoIncremented @ObjectType } ;
|
||||||
show: Vorstellung { } ;
|
show: Vorstellung { } ;
|
||||||
seat: Sitzplatz { } ;
|
seat: Sitzplatz { } ;
|
||||||
code: string { @Unique } ;
|
code: string { @Unique @NotNull } ;
|
||||||
state: Kartenstatus { } ;
|
reserved: timestamp { @NotNull } ;
|
||||||
|
booked: timestamp { } ;
|
||||||
|
cancelled: timestamp {} ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ Film {
|
|||||||
description: string { @NotNull @MaxLen(2000) } ;
|
description: string { @NotNull @MaxLen(2000) } ;
|
||||||
duration: int { @NotNull } ;
|
duration: int { @NotNull } ;
|
||||||
image: string { @NotNull } ;
|
image: string { @NotNull } ;
|
||||||
rating: short { } ;
|
rating: short { @NotNull } ;
|
||||||
category: Filmkategorie { } ;
|
category: Filmkategorie { } ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
// Entity Kartenstatus
|
|
||||||
|
|
||||||
#BaseModel
|
|
||||||
Kartenstatus {
|
|
||||||
id: int { @Id @AutoIncremented @ObjectType } ;
|
|
||||||
name: string { @NotNull @Unique } ;
|
|
||||||
}
|
|
||||||
15
TelosysTools/models/InfiniMotion/OmdbMovie.entity
Normal file
15
TelosysTools/models/InfiniMotion/OmdbMovie.entity
Normal 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 {} ;
|
||||||
|
}
|
||||||
6
TelosysTools/models/InfiniMotion/OmdbSearch.entity
Normal file
6
TelosysTools/models/InfiniMotion/OmdbSearch.entity
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Entity OmdbSearch
|
||||||
|
|
||||||
|
#Omdb
|
||||||
|
OmdbSearch {
|
||||||
|
search: OmdbMovie[] {} ;
|
||||||
|
}
|
||||||
11
TelosysTools/models/InfiniMotion/Plan.entity
Normal file
11
TelosysTools/models/InfiniMotion/Plan.entity
Normal 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 } ;
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ ENTITY_PKG=de.infinimotion.model.bean
|
|||||||
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.67
|
ProjectVariable.PROJECT_VERSION=0.0.76
|
||||||
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,6 +1,6 @@
|
|||||||
## --------------------------------------------------
|
## --------------------------------------------------
|
||||||
#if ( !($entity.hasTag("BaseModel")) )
|
#if ( !($entity.hasTag("BaseModel") || $entity.hasTag("Omdb")) )
|
||||||
#cancel("Not a Base Model")
|
#cancel("Not a Base or Omdb Model")
|
||||||
#end
|
#end
|
||||||
## --------------------------------------------------
|
## --------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
package ${target.javaPackageFromFolder("backend/${SRC}")};
|
package ${target.javaPackageFromFolder("backend/${SRC}")};
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
#foreach( $import in $java.imports($entity) )
|
#foreach( $import in $java.imports($entity) )
|
||||||
import $import;
|
import $import;
|
||||||
@@ -29,6 +30,7 @@ import $import;
|
|||||||
* @author Telosys Tools Generator
|
* @author Telosys Tools Generator
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(with = JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
|
||||||
public class ${entity.name} implements Serializable {
|
public class ${entity.name} implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Create" )
|
#set( $commandType = "Create" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Delete" )
|
#set( $commandType = "Delete" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Get" )
|
#set( $commandType = "Get" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "List" )
|
#set( $commandType = "List" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Create" )
|
#set( $commandType = "Create" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Delete" )
|
#set( $commandType = "Delete" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Get" )
|
#set( $commandType = "Get" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "List" )
|
#set( $commandType = "List" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Update" )
|
#set( $commandType = "Update" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Create" )
|
#set( $commandType = "Create" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Delete" )
|
#set( $commandType = "Delete" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Get" )
|
#set( $commandType = "Get" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "List" )
|
#set( $commandType = "List" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Update" )
|
#set( $commandType = "Update" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "backend" )
|
#set( $component = "backend" )
|
||||||
#set( $commandType = "Update" )
|
#set( $commandType = "Update" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,167 +1,2 @@
|
|||||||
## --------------------------------------------------
|
#set( $component = "backend" )
|
||||||
#if ( !($entity.hasTag("Command")) )
|
#parse( "include/command_entity.vm" )
|
||||||
#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)
|
|
||||||
}
|
|
||||||
186
TelosysTools/templates/infinimotion/include/command_entity.vm
Normal file
186
TelosysTools/templates/infinimotion/include/command_entity.vm
Normal 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)
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Create" )
|
#set( $commandType = "Create" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Delete" )
|
#set( $commandType = "Delete" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Get" )
|
#set( $commandType = "Get" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "List" )
|
#set( $commandType = "List" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Create" )
|
#set( $commandType = "Create" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Delete" )
|
#set( $commandType = "Delete" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Get" )
|
#set( $commandType = "Get" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "List" )
|
#set( $commandType = "List" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Update" )
|
#set( $commandType = "Update" )
|
||||||
#parse( "include_command_processor.vm" )
|
#parse( "include/command_processor.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Create" )
|
#set( $commandType = "Create" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Delete" )
|
#set( $commandType = "Delete" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Get" )
|
#set( $commandType = "Get" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "List" )
|
#set( $commandType = "List" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Update" )
|
#set( $commandType = "Update" )
|
||||||
#parse( "include_command_response.vm" )
|
#parse( "include/command_response.vm" )
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#set( $component = "persistence" )
|
#set( $component = "persistence" )
|
||||||
#set( $commandType = "Update" )
|
#set( $commandType = "Update" )
|
||||||
#parse( "include_command.vm" )
|
#parse( "include/command.vm" )
|
||||||
@@ -1,180 +1,2 @@
|
|||||||
## --------------------------------------------------
|
#set( $component = "persistence" )
|
||||||
#if ( !($entity.hasTag("Command")) )
|
#parse( "include/command_entity.vm" )
|
||||||
#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)
|
|
||||||
}
|
|
||||||
@@ -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" )
|
|
||||||
##
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created on $now.date ( $now.time )
|
|
||||||
* Generated by Telosys ( http://www.telosys.org/ ) version $generator.version
|
|
||||||
*/
|
|
||||||
@@ -1,6 +1,17 @@
|
|||||||
#checkId($entity)
|
#checkId($entity)
|
||||||
#parse("persistence/include/init_var_entity.vm")
|
## #set($recordClass = "${entity.name}Record" )
|
||||||
#parse("persistence/include/java_header.vm")
|
## #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}")};
|
package ${target.javaPackageFromFolder("persistence/${SRC}")};
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,19 @@
|
|||||||
#end
|
#end
|
||||||
## --------------------------------------------------
|
## --------------------------------------------------
|
||||||
#checkId($entity)
|
#checkId($entity)
|
||||||
#parse("persistence/include/init_var_entity.vm")
|
## #set($recordClass = "${entity.name}Record" )
|
||||||
#parse("persistence/include/java_header.vm")
|
## #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
|
## JPA CONFIGURATION
|
||||||
##---------------------------------------------------------------------------------------
|
##---------------------------------------------------------------------------------------
|
||||||
@@ -85,8 +96,11 @@ $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) )
|
## Workaround, sonst undefined...
|
||||||
@Column(nullable = false)
|
#if( "${link.optional}" == "true" )
|
||||||
|
@JoinColumn(nullable = true)
|
||||||
|
#else
|
||||||
|
@JoinColumn(nullable = false)
|
||||||
#end
|
#end
|
||||||
private ${link.formattedFieldType(10)} $link.fieldName ;
|
private ${link.formattedFieldType(10)} $link.fieldName ;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user