Skip to content

Commit 71e70b7

Browse files
committed
Bug fixing in topology templates
1 parent fa0804d commit 71e70b7

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

ToscaDesigner/src/main/java/fr/softeam/toscadesigner/export/AbstractToscaFileGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ private Handlebars setupHandlebars() {
6767

6868
TRequirement tRequirement = TRequirement.safeInstantiate((Class) context);
6969
if (searchedPropertyName.equals("node")) {
70-
propertyStringValue = tRequirement.getNode().getName();
70+
TNodeTemplate node = tRequirement.getNode();
71+
propertyStringValue = node != null ? node.getName() : "''";
7172
} else if (searchedPropertyName.equals("capability")) {
7273
propertyStringValue = tRequirement.getCapability().getElement().getName();
7374
}

ToscaDesigner/src/main/resources/fr/softeam/templates/TNodeTemplate.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
{{../name}}: "{{../value}}"
1010
{{/eq}}{{/extension}}{{/each}}
1111
{{#unless (noStereotypeApplications this "RequirementsType")}}requirements:{{/unless}}
12-
{{#each ../ownedElement}}{{#extension}}{{#eq name "RequirementsType"}}{{#each ../ownedAttribute}}{{#extension}}{{#eq name "TRequirement"}}
12+
{{#each ../ownedElement}}{{#extension}}{{#eq name "RequirementsType"}}{{#each ../ownedElement}}{{#extension}}{{#eq name "TRequirement"}}
1313
- {{../name}}:
14-
node: {{getProperty ../this "node"}}
14+
node: {{getProperty ../this "node"}}{{/if}}
1515
relationship: {{relationship}}
1616
capability: {{getProperty ../this "capability"}}
1717
{{#unless (noStereotypeApplications this "TPropertyDef")}}properties:{{/unless}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{name}}
2+
type: {{type.name}}
3+
default: '{{value}}'

ToscaDesigner/src/main/resources/fr/softeam/templates/TTopologyTemplate.hbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
{{/eq}}{{/extension}}{{/each}}
55
{{imports this}}
66
topology_template:
7+
{{#unless (noStereotypeApplications this "InputParameterType")}}inputs:{{/unless}}
8+
{{#ownedElement}}{{#extension}}{{#eq name "InputParameterType"}}{{#ownedAttribute}}{{#extension}}{{#eq name "TParameter"}}
9+
{{> (lookup this.name) ../this}}
10+
{{/eq}}{{/extension}}{{/ownedAttribute}}{{/eq}}{{/extension}}{{/ownedElement}}
711
{{#unless (noStereotypeApplications this "TNodeTemplate")}}node_templates:{{/unless}}
812
{{#ownedElement}}{{#extension}}{{#eq name "TNodeTemplate"}}
913
{{> (lookup this.name) ../this}}
1014
{{/eq}}{{/extension}}{{/ownedElement}}
1115
{{#unless (noStereotypeApplications this "TGroup")}}groups:{{/unless}}
1216
{{#ownedElement}}{{#extension}}{{#eq name "TGroup"}}
13-
{{> (lookup this.name) ../this}}
17+
{{> (lookup this.name) ../this}}
1418
{{/eq}}{{/extension}}{{/ownedElement}}
1519
relationship_templates:
1620
{{#ownedElement}}{{#targetingEnd}}{{#association}}{{#extension}}{{#eq name "TRelationshipTemplate"}}

0 commit comments

Comments
 (0)