Skip to content

Commit

Permalink
BEE-33485 EC-DslDeploy: generateDslToDirectory should support new opt…
Browse files Browse the repository at this point in the history
…ion suppressEmpty (#104)

BEE-33485 EC-DslDeploy: generateDslToDirectory and Export DSL catalog item should support new option suppressEmpty
  • Loading branch information
karakurty authored Jul 7, 2023
1 parent ffe876c commit 387d92d
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
2023-07.04 Valera Fessler <[email protected]>
* 4.2.1: BEE-35400 - Fixed issue with import environment reservations
BEE-33485 - Supported new option 'suppressEmpty' in the 'generateDsl' plugin procedure

2023-04.25 Valera Fessler <[email protected]>
* 4.2.0: BEE-32453 - Added 'httpIdleTimeout' argument into the 'generateDsl' plugin procedure
Expand Down
11 changes: 11 additions & 0 deletions dsl/procedures/generateDslToDirectory/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@
<documentation>Exclude from the generated DSL properties with default value.</documentation>
</formElement>

<formElement>
<type>checkbox</type>
<label>Suppress Empty</label>
<property>suppressEmpty</property>
<required>0</required>
<checkedValue>1</checkedValue>
<uncheckedValue>0</uncheckedValue>
<value>0</value>
<documentation>Exclude from the generated DSL properties with empty value.</documentation>
</formElement>

<formElement>
<type>checkbox</type>
<label>Suppress Parent</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ new GenerateDslBuilder(ef)
.suppressParent('$[suppressParent]'.equals('1'))
.suppressNulls('$[suppressNulls]'.equals('1'))
.suppressDefaults('$[suppressDefaults]'.equals('1'))
.suppressEmpty('$[suppressEmpty]'.equals('1'))
.build()
.generateDsl();
16 changes: 15 additions & 1 deletion dsl/properties/scripts/GenerateDslHelper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class GenerateDslHelper {
private boolean includeChildrenInSameFile
private boolean suppressNulls
private boolean suppressDefault
private boolean suppressEmpty
private boolean suppressParent
private final Deque<EntityTypeDetail> childrenStack = new LinkedList<>()
private FileTemplateItem difFileTemplateRoot = new FileTemplateItem()
Expand All @@ -34,6 +35,7 @@ class GenerateDslHelper {
String toDir,
boolean suppressNulls,
boolean suppressDefault,
boolean suppressEmpty,
boolean suppressParent,
boolean includeAcls,
boolean includeAclsInDifferentFile,
Expand All @@ -53,6 +55,7 @@ class GenerateDslHelper {
this.includeChildrenInSameFile = includeChildrenInSameFile
this.suppressNulls = suppressNulls
this.suppressDefault = suppressDefault
this.suppressEmpty = suppressEmpty
this.suppressParent = suppressParent
this.includeAllChildren = includeAllChildren
this.includeChildren = includeChildren
Expand Down Expand Up @@ -144,7 +147,7 @@ class GenerateDslHelper {

//All in one file including all commands
objDslFile << electricFlow.generateDsl(path: obj.path, suppressNulls: suppressNulls, withAcls: includeAcls,
suppressDefaults: suppressDefault, suppressParent: suppressParent).value
suppressDefaults: suppressDefault, suppressEmpty: suppressEmpty, suppressParent: suppressParent).value
return
}

Expand Down Expand Up @@ -196,6 +199,7 @@ class GenerateDslHelper {
includeChildren: includeChildrenValue,
suppressNulls: suppressNulls,
suppressDefaults: suppressDefault,
suppressEmpty: suppressEmpty,
suppressChildren: true,
suppressParent: suppressParent,
withAcls: includeAcl,
Expand All @@ -220,6 +224,7 @@ class GenerateDslHelper {
includeChildren: includeChildrenValue,
suppressNulls: suppressNulls,
suppressDefaults: suppressDefault,
suppressEmpty: suppressEmpty,
suppressChildren: true,
suppressParent: suppressParent,
withAcls: includeAcl,
Expand Down Expand Up @@ -369,6 +374,7 @@ class GenerateDslHelper {
def propDsl = electricFlow.generateDsl(path: pathToProp,
suppressNulls: suppressNulls,
suppressDefaults: suppressDefault,
suppressEmpty: suppressEmpty,
suppressChildren: true,
suppressParent: suppressParent)?.value

Expand All @@ -389,6 +395,7 @@ class GenerateDslHelper {
def propDsl = electricFlow.generateDsl(path: pathToProp,
suppressNulls: suppressNulls,
suppressDefaults: suppressDefault,
suppressEmpty: suppressEmpty,
suppressChildren: true,
suppressParent: suppressParent)?.value

Expand Down Expand Up @@ -554,6 +561,7 @@ class GenerateDslBuilder {
private boolean includeChildrenInSameFile
private boolean suppressNulls = true
private boolean suppressDefault
private boolean suppressEmpty
private boolean suppressParent


Expand All @@ -578,6 +586,7 @@ class GenerateDslBuilder {
toDirectory,
suppressNulls,
suppressDefault,
suppressEmpty,
suppressParent,
includeAcls,
includeAclsInDifferentFile,
Expand Down Expand Up @@ -633,6 +642,11 @@ class GenerateDslBuilder {
return this
}

GenerateDslBuilder suppressEmpty(boolean suppress) {
suppressEmpty = suppress
return this
}

GenerateDslBuilder suppressParent(boolean suppress) {
suppressParent = suppress
return this
Expand Down
1 change: 1 addition & 0 deletions help/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ NOTE: If the commit ID cannot be found or if the procedure or steps cannot find,
=== EC-DslDeploy 4.2.1

* Fixed issue with import environment reservations
* Supported new option 'suppressEmpty' in the 'generateDsl' plugin procedure

=== EC-DslDeploy 4.2.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ project '$projName', {
pool: "$defaultPool",
includeAllChildren: '1',
suppressNulls: '1',
suppressEmpty: '1',
objectType: 'project',
objectName: '$projName',
httpIdleTimeout: '180'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class Properties
pool: "$defaultPool",
includeAllChildren: '1',
suppressNulls: '1',
suppressEmpty: '1',
objectType: 'project',
objectName: 'proj_name',
httpIdleTimeout: '180'
Expand Down Expand Up @@ -120,6 +121,7 @@ class Properties
pool: "$defaultPool",
includeAllChildren: '1',
suppressNulls: '1',
suppressEmpty: '1',
objectType: 'project',
objectName: 'proj_name',
httpIdleTimeout: '180'
Expand Down Expand Up @@ -168,6 +170,7 @@ class Properties
pool: "$defaultPool",
includeAllChildren: '1',
suppressNulls: '1',
suppressEmpty: '1',
objectType: 'project',
objectName: 'BEE-30105',
httpIdleTimeout: '210'
Expand Down Expand Up @@ -216,6 +219,7 @@ class Properties
pool: "$defaultPool",
includeAllChildren: '1',
suppressNulls: '1',
suppressEmpty: '1',
objectType: 'project',
objectName: 'BEE-33074',
httpIdleTimeout: '240'
Expand Down Expand Up @@ -271,6 +275,7 @@ class Properties
pool: "$defaultPool",
includeAllChildren: '1',
suppressNulls: '1',
suppressEmpty: '1',
objectType: 'project',
objectName: 'projectName ?<>%*!@#\$^&()|:. projectName',
httpIdleTimeout: '270'
Expand Down Expand Up @@ -333,6 +338,7 @@ class Properties
pool: "$defaultPool",
includeAllChildren: '1',
suppressNulls: '1',
suppressEmpty: '1',
objectType: 'project',
objectName: 'projectName ÒÓÔÕÖ×ØÙÚÛÜÝÞß projectName',
httpIdleTimeout: '270'
Expand Down Expand Up @@ -393,6 +399,7 @@ class Properties
pool: "$defaultPool",
includeAllChildren: '1',
suppressNulls: '1',
suppressEmpty: '1',
objectType: 'project',
objectName: 'BEE-33683',
httpIdleTimeout: '270'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ trigger 'app-webhook', {
includeAclsInDifferentFile: '0',
suppressDefaults: '1',
suppressNulls: '1',
suppressEmpty: '1',
artifactName: "$artifactName",
artifactVersionVersion: '1.0',
runResourceName: '$defaultPool'
Expand Down
9 changes: 9 additions & 0 deletions specs/src/test/resources/generate_dsl_test_procedure.dsl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ procedure 'generateDslAndPublish', {
uncheckedValue = '0'
}

formalParameter 'suppressEmpty', defaultValue: '1', {
description = 'Exclude from the generated DSL properties with empty value.'
checkedValue = '1'
label = 'Suppress Empty'
type = 'checkbox'
uncheckedValue = '0'
}

formalParameter 'suppressParent', defaultValue: '0', {
description = 'Exclude from the generated DSL properties referred to object parent.'
checkedValue = '1'
Expand Down Expand Up @@ -127,6 +135,7 @@ procedure 'generateDslAndPublish', {
actualParameter 'pool', '$[runResourceName]'
actualParameter 'suppressDefaults', '$[suppressDefaults]'
actualParameter 'suppressNulls', '$[suppressNulls]'
actualParameter 'suppressEmpty', '$[suppressEmpty]'
actualParameter 'suppressParent', '$[suppressParent]'
}

Expand Down

0 comments on commit 387d92d

Please sign in to comment.