diff --git a/CHANGELOG.md b/CHANGELOG.md index 591a7af9..a451e235 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### Added + +- daogen property : dao-rest-ng-mode ('dao.rest.ng' will be selected and no serialization) + ### Changed - fj-bom version set to 1.6.3 diff --git a/fj-daogen-base/src/main/java/org/fugerit/java/daogen/base/config/DaogenCatalogConstants.java b/fj-daogen-base/src/main/java/org/fugerit/java/daogen/base/config/DaogenCatalogConstants.java index f2c24c0b..7fbd0c2c 100644 --- a/fj-daogen-base/src/main/java/org/fugerit/java/daogen/base/config/DaogenCatalogConstants.java +++ b/fj-daogen-base/src/main/java/org/fugerit/java/daogen/base/config/DaogenCatalogConstants.java @@ -90,6 +90,11 @@ private DaogenCatalogConstants() {} public static final String GEN_PROP_DAO_FINDER_NG_MODE_ENABLED = "enabled"; public static final String GEN_PROP_DAO_FINDER_NG_MODE_DISABLED = "disabled"; + public static final String GEN_PROP_DAO_REST_NG_MODE = "dao-rest-ng-mode"; + + public static final String GEN_PROP_DAO_REST_NG_MODE_ENABLED = "enabled"; + public static final String GEN_PROP_DAO_REST_NG_MODE_DISABLED = "disabled"; + public static final String PREFIX_MODEL = "Model"; public static final String PREFIX_HELPER = "Helper"; diff --git a/fj-daogen-base/src/main/java/org/fugerit/java/daogen/base/gen/helper/BaseRestLoadHelperGenerator.java b/fj-daogen-base/src/main/java/org/fugerit/java/daogen/base/gen/helper/BaseRestLoadHelperGenerator.java index f2450ff8..122dd3c2 100644 --- a/fj-daogen-base/src/main/java/org/fugerit/java/daogen/base/gen/helper/BaseRestLoadHelperGenerator.java +++ b/fj-daogen-base/src/main/java/org/fugerit/java/daogen/base/gen/helper/BaseRestLoadHelperGenerator.java @@ -178,7 +178,8 @@ private void generateDaogenBodyHandleField() { @Override public void generateDaogenBody() throws IOException { - this.addSerialVerUID(); + String daoRestNgMode = this.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_DAO_REST_NG_MODE, DaogenCatalogConstants.GEN_PROP_DAO_REST_NG_MODE_DISABLED ); + this.generateSerial( DaogenCatalogConstants.GEN_PROP_DAO_REST_NG_MODE_DISABLED.equalsIgnoreCase( daoRestNgMode ) ); String factoryClassName = GeneratorNameHelper.classFromPackage( this.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_FACTORY_DEF ) ); // load by id if ( StringUtils.isNotEmpty( this.getCurrentEntity().getPrimaryKey() ) ) { diff --git a/fj-daogen-base/src/main/resources/config/daogen-config-1-0.xsd b/fj-daogen-base/src/main/resources/config/daogen-config-1-0.xsd index 131fe250..6845a224 100644 --- a/fj-daogen-base/src/main/resources/config/daogen-config-1-0.xsd +++ b/fj-daogen-base/src/main/resources/config/daogen-config-1-0.xsd @@ -184,6 +184,12 @@ The entry point for daogen-config documentation is : https://marsdocs.fugerit.or NOTE: when enabled, Finder entities will not be made serializable. + + + If set to 'enabled' the 'dao.rest.ng' property set will be selected. + NOTE: when enabled, Rest entities will not be made serializable. + + The package to be used for database java.sql.String classes, for each entity. @@ -258,7 +264,7 @@ The entry point for daogen-config documentation is : https://marsdocs.fugerit.or NOTE: The junit generation is a very simple stub to start with. - + Path to the reflect-config.json file to be created (e.g. 'daogen-reflect-config.json'). diff --git a/fj-daogen-base/src/test/java/test/org/fugerit/java/daogen/base/config/TestDaogenRun.java b/fj-daogen-base/src/test/java/test/org/fugerit/java/daogen/base/config/TestDaogenRun.java index aa1484d5..81ea37bf 100644 --- a/fj-daogen-base/src/test/java/test/org/fugerit/java/daogen/base/config/TestDaogenRun.java +++ b/fj-daogen-base/src/test/java/test/org/fugerit/java/daogen/base/config/TestDaogenRun.java @@ -66,6 +66,9 @@ public void testDaoGenerationClassicalEntity() throws IOException, ConfigExcepti overrideProperties.setProperty( DaogenCatalogConstants.GEN_PROP_DAO_FINDER_NG_MODE , DaogenCatalogConstants.GEN_PROP_DAO_FINDER_NG_MODE_DISABLED ); + overrideProperties.setProperty( + DaogenCatalogConstants.GEN_PROP_DAO_REST_NG_MODE , + DaogenCatalogConstants.GEN_PROP_DAO_REST_NG_MODE_DISABLED ); int result = this.testDaoGenerationWorker(file, overrideProperties); Assert.assertTrue( file.exists() ); Assert.assertEquals( Result.RESULT_CODE_OK, result ); diff --git a/src/docs/config/daogen-config-xsd-ref.html b/src/docs/config/daogen-config-xsd-ref.html index 22eea949..a69219e0 100644 --- a/src/docs/config/daogen-config-xsd-ref.html +++ b/src/docs/config/daogen-config-xsd-ref.html @@ -4,6 +4,7 @@ Reference daogen-config.xsd documentation for Mars - Fugerit DAO Generation Framework (fj-daogen) + @@ -388,21 +389,21 @@

Reference daogen-config.xsd documentation for Ma - package-struct + dao-rest-ng-mode - The package to be used for database java.sql.String classes, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.struct'). The relevant generators and decorators will only by run if this property is set. + If set to 'enabled' the 'dao.rest.ng' property set will be selected. NOTE: when enabled, Rest entities will not be made serializable. - string + enabledDisabledType , base : string , enumeration : [ enabled , disabled ] - package-rse + package-struct - The package to be used for database org.fugerit.java.core.db.dao.RSExtractor classes, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.rse'). The relevant generators and decorators will only by run if this property is set. + The package to be used for database java.sql.String classes, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.struct'). The relevant generators and decorators will only by run if this property is set. string @@ -410,10 +411,10 @@

Reference daogen-config.xsd documentation for Ma - package-facade-def + package-rse - The package to be used for DAO facade interfaces, for each entity. (e.g. 'org.fugerit.java.daogen.sample.def.facade'). The relevant generators and decorators will only by run if this property is set. + The package to be used for database org.fugerit.java.core.db.dao.RSExtractor classes, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.rse'). The relevant generators and decorators will only by run if this property is set. string @@ -421,10 +422,10 @@

Reference daogen-config.xsd documentation for Ma - package-facade-data-impl + package-facade-def - The package to be used for DAO facade basic implementation, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.facade.data'). The relevant generators and decorators will only by run if this property is set. + The package to be used for DAO facade interfaces, for each entity. (e.g. 'org.fugerit.java.daogen.sample.def.facade'). The relevant generators and decorators will only by run if this property is set. string @@ -432,10 +433,10 @@

Reference daogen-config.xsd documentation for Ma - factory-def + package-facade-data-impl - The fully qualified name to be used for DAO factory interface. (e.g. 'org.fugerit.java.daogen.sample.def.facade.FugeritLogicFacade'). The relevant generators and decorators will only by run if this property is set. + The package to be used for DAO facade basic implementation, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.facade.data'). The relevant generators and decorators will only by run if this property is set. string @@ -443,10 +444,10 @@

Reference daogen-config.xsd documentation for Ma - factory-data-impl + factory-def - The fully qualified name to be used for DAO factory basic implementation. (e.g. 'org.fugerit.java.daogen.sample.impl.facade.data.FugeritDataLogicFacade'). The relevant generators and decorators will only by run if this property is set. + The fully qualified name to be used for DAO factory interface. (e.g. 'org.fugerit.java.daogen.sample.def.facade.FugeritLogicFacade'). The relevant generators and decorators will only by run if this property is set. string @@ -454,10 +455,10 @@

Reference daogen-config.xsd documentation for Ma - package-rest-load + factory-data-impl - The package to be used for a basic rest service implementation, for load methods, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.rest.load'). The relevant generators and decorators will only by run if this property is set. NOTE: REST services generation is not recommended, if not as a starting stub. + The fully qualified name to be used for DAO factory basic implementation. (e.g. 'org.fugerit.java.daogen.sample.impl.facade.data.FugeritDataLogicFacade'). The relevant generators and decorators will only by run if this property is set. string @@ -465,10 +466,10 @@

Reference daogen-config.xsd documentation for Ma - package-spring-rest-load + package-rest-load - The package to be used for a basic spring rest service implementation, for load methods, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.spring.rest.load'). The relevant generators and decorators will only by run if this property is set. NOTE: REST services generation is not recommended, if not as a starting stub. + The package to be used for a basic rest service implementation, for load methods, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.rest.load'). The relevant generators and decorators will only by run if this property is set. NOTE: REST services generation is not recommended, if not as a starting stub. string @@ -476,10 +477,10 @@

Reference daogen-config.xsd documentation for Ma - package-junit4-model + package-spring-rest-load - The package to be used for a basic junit 4 implementation, for each entity. (e.g. 'org.fugerit.java.daogen.sample.junit4test.model'). The relevant generators and decorators will only by run if this property is set. NOTE: The junit generation is a very simple stub to start with. + The package to be used for a basic spring rest service implementation, for load methods, for each entity. (e.g. 'org.fugerit.java.daogen.sample.impl.spring.rest.load'). The relevant generators and decorators will only by run if this property is set. NOTE: REST services generation is not recommended, if not as a starting stub. string @@ -487,10 +488,10 @@

Reference daogen-config.xsd documentation for Ma - package-junit5-model + package-junit4-model - The package to be used for a basic junit 5 implementation, for each entity. (e.g. 'org.fugerit.java.daogen.sample.junit5test.model'). The relevant generators and decorators will only by run if this property is set. NOTE: The junit generation is a very simple stub to start with. + The package to be used for a basic junit 4 implementation, for each entity. (e.g. 'org.fugerit.java.daogen.sample.junit4test.model'). The relevant generators and decorators will only by run if this property is set. NOTE: The junit generation is a very simple stub to start with. string @@ -498,10 +499,10 @@

Reference daogen-config.xsd documentation for Ma - graalvm-reflect-config= + package-junit5-model - Path to the reflect-config.json file to be created (e.g. 'daogen-reflect-config.json'). Initial folder is defined by 'src-main-resources' property. NOTE: Only one file for all the project will be created. + The package to be used for a basic junit 5 implementation, for each entity. (e.g. 'org.fugerit.java.daogen.sample.junit5test.model'). The relevant generators and decorators will only by run if this property is set. NOTE: The junit generation is a very simple stub to start with. string @@ -509,10 +510,10 @@

Reference daogen-config.xsd documentation for Ma - base-rest-service + graalvm-reflect-config - The base class for REST services. (e.g. 'org.fugerit.java.daogen.sample.helper.ServiceProviderHelper'). NOTE: REST services generation is not recommended, if not as a starting stub. + Path to the reflect-config.json file to be created (e.g. 'daogen-reflect-config.json'). Initial folder is defined by 'src-main-resources' property. NOTE: Only one file for all the project will be created. string @@ -520,32 +521,32 @@

Reference daogen-config.xsd documentation for Ma - openapi_host + base-rest-service - The host to be used for openapi specification and implementation specification. + The base class for REST services. (e.g. 'org.fugerit.java.daogen.sample.helper.ServiceProviderHelper'). NOTE: REST services generation is not recommended, if not as a starting stub. - anyURI + string - openapi_path + openapi_host - The path to be used for openapi specification and implementation specification. + The host to be used for openapi specification and implementation specification. - string + anyURI - default-sequence + openapi_path - The default sequence name to be used for the entities (it is possible to override it). + The path to be used for openapi specification and implementation specification. string @@ -553,10 +554,10 @@

Reference daogen-config.xsd documentation for Ma - check-empty-interface + default-sequence - If set to '1' will check if interfaces have no methods. NOTE: currently ignored. + The default sequence name to be used for the entities (it is possible to override it). string @@ -564,23 +565,34 @@

Reference daogen-config.xsd documentation for Ma - jdk-target-version + check-empty-interface - The jdk target version. + If set to '1' will check if interfaces have no methods. NOTE: currently ignored. - jdkTargetVersionType , base : string , enumeration : [ 8 , 11 , 17 , 21 ] + string - jee-target-mode + jdk-target-version - The enterprise edition target environment. + The jdk target version. + jdkTargetVersionType , base : string , enumeration : [ 8 , 11 , 17 , 21 ] + + + + + jee-target-mode + + + The enterprise edition target environment. + + jeeTargetModeType , base : string , enumeration : [ javax , jakarta ]