diff --git a/TelosysTools/models/InfiniMotion/CommandListStatistics.entity b/TelosysTools/models/InfiniMotion/CommandListStatistics.entity new file mode 100644 index 0000000..0736c5a --- /dev/null +++ b/TelosysTools/models/InfiniMotion/CommandListStatistics.entity @@ -0,0 +1,4 @@ +#Command +@Extends(Command) +CommandListStatistics { +} diff --git a/TelosysTools/models/InfiniMotion/CommandListStatisticsResponse.entity b/TelosysTools/models/InfiniMotion/CommandListStatisticsResponse.entity new file mode 100644 index 0000000..555d50a --- /dev/null +++ b/TelosysTools/models/InfiniMotion/CommandListStatisticsResponse.entity @@ -0,0 +1,6 @@ +#Command +@Extends(Command) +CommandListStatisticsResponse { + movies: StatisticsFilm[] {}; + shows: StatisticsVorstellung[] {}; +} diff --git a/TelosysTools/models/InfiniMotion/StatisticsFilm.entity b/TelosysTools/models/InfiniMotion/StatisticsFilm.entity new file mode 100644 index 0000000..1fbb22f --- /dev/null +++ b/TelosysTools/models/InfiniMotion/StatisticsFilm.entity @@ -0,0 +1,8 @@ +// Entity StatisticsFilm + +#Statistics +StatisticsFilm { + movie: Film {}; + tickets: Eintrittskarte[] {}; + earnings: int {}; +} diff --git a/TelosysTools/models/InfiniMotion/StatisticsVorstellung.entity b/TelosysTools/models/InfiniMotion/StatisticsVorstellung.entity new file mode 100644 index 0000000..31dc2e1 --- /dev/null +++ b/TelosysTools/models/InfiniMotion/StatisticsVorstellung.entity @@ -0,0 +1,8 @@ +// Entity StatisticsVorstellung + +#Statistics +StatisticsVorstellung { + show: Vorstellung {}; + tickets: Eintrittskarte[] {}; + earnings: int {}; +} diff --git a/TelosysTools/telosys-tools.cfg b/TelosysTools/telosys-tools.cfg index cff9660..6aed700 100644 --- a/TelosysTools/telosys-tools.cfg +++ b/TelosysTools/telosys-tools.cfg @@ -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.89 +ProjectVariable.PROJECT_VERSION=0.0.101 ProjectVariable.REST_SERVER_PORT=3000 ProjectVariable.REST_API_ROOT=/api/v1 ProjectVariable.REST_URL_ROOT=http://localhost:3000 diff --git a/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm b/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm index a731a39..8d8bdb3 100644 --- a/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm +++ b/TelosysTools/templates/infinimotion/backend/backend_entity_java.vm @@ -1,5 +1,5 @@ ## -------------------------------------------------- -#if ( !($entity.hasTag("BaseModel") || $entity.hasTag("Omdb")) ) +#if ( !($entity.hasTag("BaseModel") || $entity.hasTag("Omdb") || $entity.hasTag("Statistics")) ) #cancel("Not a Base or Omdb Model") #end ## -------------------------------------------------- @@ -12,6 +12,7 @@ package ${target.javaPackageFromFolder("backend/${SRC}")}; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; #foreach( $import in $java.imports($entity) ) import $import; @@ -30,6 +31,7 @@ import $import; * @author Telosys Tools Generator * */ +@JsonIgnoreProperties(ignoreUnknown = true) @lombok.EqualsAndHashCode @JsonFormat(with = JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES) public class ${entity.name} implements Serializable { diff --git a/TelosysTools/templates/infinimotion/frontend/frontend_entity_ts.vm b/TelosysTools/templates/infinimotion/frontend/frontend_entity_ts.vm index 46f831a..a37f428 100644 --- a/TelosysTools/templates/infinimotion/frontend/frontend_entity_ts.vm +++ b/TelosysTools/templates/infinimotion/frontend/frontend_entity_ts.vm @@ -1,5 +1,5 @@ ## -------------------------------------------------- -#if ( !($entity.hasTag("BaseModel") || $entity.hasTag("Omdb")) ) +#if ( !($entity.hasTag("BaseModel") || $entity.hasTag("Omdb") || $entity.hasTag("Statistics")) ) #cancel("Not a Base or Omdb Model") #end ## -------------------------------------------------- diff --git a/TelosysTools/templates/infinimotion/frontend/index_ts.vm b/TelosysTools/templates/infinimotion/frontend/index_ts.vm index ee98391..805c91d 100644 --- a/TelosysTools/templates/infinimotion/frontend/index_ts.vm +++ b/TelosysTools/templates/infinimotion/frontend/index_ts.vm @@ -1,12 +1,12 @@ #foreach( $entity in $model.allEntities ) -#if ( $entity.hasTag("BaseModel") || $entity.hasTag("Omdb") ) +#if ( $entity.hasTag("BaseModel") || $entity.hasTag("Omdb") || $entity.hasTag("Statistics") ) import $entity.name from "./${entity.name}"; #end #end export type { #foreach( $entity in $model.allEntities ) -#if ( $entity.hasTag("BaseModel") || $entity.hasTag("Omdb") ) +#if ( $entity.hasTag("BaseModel") || $entity.hasTag("Omdb") || $entity.hasTag("Statistics") ) $entity.name, #end #end diff --git a/TelosysTools/templates/infinimotion/include/command_entity.vm b/TelosysTools/templates/infinimotion/include/command_entity.vm index 0d762d4..996259d 100644 --- a/TelosysTools/templates/infinimotion/include/command_entity.vm +++ b/TelosysTools/templates/infinimotion/include/command_entity.vm @@ -10,6 +10,7 @@ */ package ${target.javaPackageFromFolder("${component}/${SRC}")}; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.io.Serializable; #foreach( $import in $java.imports($entity) ) @@ -29,6 +30,7 @@ import $import; * @author Telosys Tools Generator * */ +@JsonIgnoreProperties(ignoreUnknown = true) @lombok.EqualsAndHashCode#if( $entity.hasSuperClass() )(callSuper=true)#else #end public#if( $entity.isAbstract() ) abstract#end class ${entity.name}#if( $entity.hasSuperClass() ) extends $entity.superClass#end implements Serializable { @@ -109,6 +111,7 @@ public#if( $entity.isAbstract() ) abstract#end class ${entity.name}#if( $entity. = 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) + .configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .findAndRegisterModules(); public abstract CommandWrapper serialize() throws java.io.IOException; diff --git a/TelosysTools/templates/infinimotion/include/command_response.vm b/TelosysTools/templates/infinimotion/include/command_response.vm index 0bede9f..f065e5e 100644 --- a/TelosysTools/templates/infinimotion/include/command_response.vm +++ b/TelosysTools/templates/infinimotion/include/command_response.vm @@ -10,6 +10,7 @@ */ package ${target.javaPackageFromFolder("${component}/${SRC}")}; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.io.Serializable; /** @@ -18,6 +19,7 @@ import java.io.Serializable; * @author Telosys Tools Generator * */ +@JsonIgnoreProperties(ignoreUnknown = true) @lombok.EqualsAndHashCode(callSuper=true) public class Command${commandType}${entity.name}Response extends Command implements Serializable { diff --git a/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm b/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm index 5ef2937..849fdf6 100644 --- a/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm +++ b/TelosysTools/templates/infinimotion/persistence/persistence_entity_java.vm @@ -47,6 +47,7 @@ package ${target.javaPackageFromFolder("persistence/${SRC}")}; $generator.generate($target.entityName , "${jpaEntityIdClass}.java", $target.folder, "persistence/persistence_entity_id_java.vm" ) #end +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.io.Serializable; #foreach( $import in $java.imports($entity) ) import $import; @@ -67,6 +68,7 @@ $jpa.entityAnnotations(0, $entity) #if ( $entity.hasCompositePrimaryKey() ) @IdClass(${jpaEntityIdClass}.class) #end +@JsonIgnoreProperties(ignoreUnknown = true) @lombok.EqualsAndHashCode public class ${entity.name} implements Serializable { diff --git a/TelosysTools/templates/infinimotion/persistence/pom_xml.vm b/TelosysTools/templates/infinimotion/persistence/pom_xml.vm index b2e68bb..39771cc 100644 --- a/TelosysTools/templates/infinimotion/persistence/pom_xml.vm +++ b/TelosysTools/templates/infinimotion/persistence/pom_xml.vm @@ -48,6 +48,11 @@ 3.28.4 + io.quarkus + quarkus-mongodb-panache + 3.28.4 + + org.projectlombok lombok 1.18.32 diff --git a/TelosysTools/templates/infinimotion/persistence/processor_entity_java.vm b/TelosysTools/templates/infinimotion/persistence/processor_entity_java.vm index a4ce64b..b2c5fd7 100644 --- a/TelosysTools/templates/infinimotion/persistence/processor_entity_java.vm +++ b/TelosysTools/templates/infinimotion/persistence/processor_entity_java.vm @@ -50,6 +50,7 @@ public class ${entity.name}Processor implements CommandGet${entity.name}Processo ${entity.name} entity = request.get${entity.name}(); entity.setId(null); em.persist(entity); + em.refresh(entity); return new CommandCreate${entity.name}Response(entity); } diff --git a/TelosysTools/templates/infinimotion/persistence/statistics_entity_java.vm b/TelosysTools/templates/infinimotion/persistence/statistics_entity_java.vm new file mode 100644 index 0000000..189029f --- /dev/null +++ b/TelosysTools/templates/infinimotion/persistence/statistics_entity_java.vm @@ -0,0 +1,61 @@ +## -------------------------------------------------- +#if ( !($entity.hasTag("Statistics")) ) +#cancel("Not a Statistics Model") +#end +## +/* + * Created on $now.date ( $now.time ) + * Generated by Telosys ( http://www.telosys.org/ ) version $generator.version + */ +package ${target.javaPackageFromFolder("persistence/${SRC}")}; + +import java.util.List; +import io.quarkus.mongodb.panache.PanacheMongoEntity; + +/** + * Statistics entity class for "${entity.name}" + * + * @author Telosys + * + */ +@lombok.EqualsAndHashCode +public class ${entity.name} extends PanacheMongoEntity { + +#foreach( $attribute in $entity.attributes ) + private $attribute.formattedType(10) $attribute.name #if($attribute.hasInitialValue())= ${attribute.ini} #end; + +#end + +#foreach( $link in $entity.links ) + private ${link.formattedFieldType(10)} $link.fieldName ; +#end + + /** + * Constructor + */ + public ${entity.name}() { + super(); + } + +#foreach( $attribute in $entity.attributes ) + public void ${attribute.setter}( $attribute.type $attribute.name ) { + this.$attribute.name = $attribute.name ; + } + public $attribute.type ${attribute.getter}() { + return this.$attribute.name; + } +#end + +#foreach( $link in $entity.links ) + public ${link.formattedFieldType(0)} ${link.getter}() { + return this.${link.formattedFieldName(0)}; + } + public void ${link.setter}( ${link.formattedFieldType(0)} $link.fieldName ) { + this.$link.fieldName = $link.fieldName ; + } +#end + + //--- toString specific method + @Override +$java.toStringMethod($entity, 1) +} diff --git a/TelosysTools/templates/infinimotion/templates.cfg b/TelosysTools/templates/infinimotion/templates.cfg index 517fb12..e9e0788 100644 --- a/TelosysTools/templates/infinimotion/templates.cfg +++ b/TelosysTools/templates/infinimotion/templates.cfg @@ -54,6 +54,7 @@ Java Command Models (P) ; ${BEANNAME}.java ; persis Java Command Processors (P) ; ${BEANNAME}Processor.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command_processor_java.vm Java Model Processors ; ${BEANNAME}Processor.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/processor_entity_java.vm Java Filter Query Interface ; GenericFilterQuery.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/generic_filter_query_java.vm ; 1 +Java Statistics Models ; ${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/statistics_entity_java.vm Java Command GetModels (P) ; CommandGet${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/get_java.vm Java Command ListModels (P) ; CommandList${BEANNAME}.java ; persistence/${SRC}/${ROOT_PKG}/persistence ; persistence/command/list_java.vm