Skip to content

Commit

Permalink
Added daogen property : dao-rest-ng-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Apr 18, 2024
1 parent 4150e17 commit b5c2ef2
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ The entry point for daogen-config documentation is : https://marsdocs.fugerit.or
<xsd:documentation>NOTE: when enabled, Finder entities will not be made serializable.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute type="daogen:enabledDisabledType" name="dao-rest-ng-mode" use="optional" default="disabled">
<xsd:annotation>
<xsd:documentation>If set to 'enabled' the 'dao.rest.ng' property set will be selected.</xsd:documentation>
<xsd:documentation>NOTE: when enabled, Rest entities will not be made serializable.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute type="xsd:string" name="package-struct" use="optional">
<xsd:annotation>
<xsd:documentation>The package to be used for database java.sql.String classes, for each entity.</xsd:documentation>
Expand Down Expand Up @@ -258,7 +264,7 @@ The entry point for daogen-config documentation is : https://marsdocs.fugerit.or
<xsd:documentation>NOTE: The junit generation is a very simple stub to start with.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute type="xsd:string" name="graalvm-reflect-config=" use="optional">
<xsd:attribute type="xsd:string" name="graalvm-reflect-config" use="optional">
<xsd:annotation>
<xsd:documentation>Path to the reflect-config.json file to be created</xsd:documentation>
<xsd:documentation>(e.g. 'daogen-reflect-config.json').</xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Loading

0 comments on commit b5c2ef2

Please sign in to comment.