File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/main/java/fr/softeam/toscadesigner/export Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 2020import fr .softeam .toscadesigner .api .tosca .standard .class_ .TCapabilityType ;
2121import fr .softeam .toscadesigner .api .tosca .standard .class_ .TNodeTemplate ;
2222import fr .softeam .toscadesigner .api .tosca .standard .class_ .TNodeType ;
23+ import fr .softeam .toscadesigner .api .tosca .standard .class_ .TPolicy ;
2324import fr .softeam .toscadesigner .api .tosca .standard .class_ .TRelationshipType ;
2425import fr .softeam .toscadesigner .api .tosca .standard .class_ .TRequirement ;
2526import fr .softeam .toscadesigner .api .tosca .standard .class_ .TRequirementDefinition ;
@@ -122,6 +123,17 @@ private Handlebars setupHandlebars() {
122123 if (searchedPropertyName .equals ("capabilityType" )) {
123124 propertyStringValue = tCapabilityDefinition .getCapabilityType ().getElement ().getName ();
124125 }
126+ } else if (stereotype .getName ().equals ("TPolicy" )) {
127+ TPolicy tPolicy = TPolicy .safeInstantiate ((Class ) context );
128+ if (searchedPropertyName .equals ("type" )) {
129+ propertyStringValue = tPolicy .getType ().getElement ().getName ();
130+ } else if (searchedPropertyName .equals ("policyTargets" )){
131+ List <TNodeTemplate > targets = tPolicy .getTargets ();
132+ propertyStringValue = targets .stream ()
133+ .map (t -> t .getElement ().getName ())
134+ .collect (Collectors .joining (", " ));
135+
136+ }
125137 }
126138 // if it didn't find the property with this stereotype, look for the parent
127139 // stereotypes
You can’t perform that action at this time.
0 commit comments