Skip to content

Commit

Permalink
fix empty properties definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
lharzenetter committed May 29, 2019
1 parent 0c09cad commit 7b4216f
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,18 +294,14 @@ public static TTopologyTemplate applyFeaturesForTopology(TTopologyTemplate topol
// TODO:
// We need to set new Properties because the {@link TEntityTemplate#setProperties} is implemented
// badly and does not add new properties. Due to time constraints we do it that way for now.
TEntityTemplate.Properties p = new TEntityTemplate.Properties();
p.setKVProperties(kvProperties);
nodeTemplate.setProperties(p);
if (!kvProperties.isEmpty()) {
TEntityTemplate.Properties p = new TEntityTemplate.Properties();
p.setKVProperties(kvProperties);
nodeTemplate.setProperties(p);
}
}
});

// todo: think about a plugin system?
// call freeze methods to enable the freeze and defrost functionality for the topology
determineStatefulComponents(topology);
determineFreezableComponents(topology);
cleanFreezableComponents(topology);

return topology;
}

Expand Down Expand Up @@ -414,6 +410,14 @@ public static TNodeType createFeatureNodeType(TNodeTemplate nodeTemplate, Map<QN
});
});

// In the case that neither the basic type, nor the feature types define properties,
// remove them from the type to ensure a compliant XML.
if (Objects.nonNull(featureEnrichedNodeType.getWinerysPropertiesDefinition())
&& Objects.nonNull(featureEnrichedNodeType.getWinerysPropertiesDefinition().getPropertyDefinitionKVList())
&& featureEnrichedNodeType.getWinerysPropertiesDefinition().getPropertyDefinitionKVList().isEmpty()) {
ModelUtilities.removeWinerysPropertiesDefinition(featureEnrichedNodeType);
}

try {
repository.setElement(new NodeTypeId(featureEnrichedNodeType.getQName()), featureEnrichedNodeType);
repository.setElement(new NodeTypeImplementationId(generatedImplementation.getQName()), generatedImplementation);
Expand Down

0 comments on commit 7b4216f

Please sign in to comment.