use of org.eclipse.winery.model.tosca.HasTags in project winery by eclipse.
the class TopologyTemplateResource method getAvailableFeatures.
@GET
@Path("availablefeatures")
@Produces(MediaType.APPLICATION_JSON)
public ArrayList<AvailableFeaturesApiData> getAvailableFeatures() {
ArrayList<AvailableFeaturesApiData> apiData = new ArrayList<>();
List<DeploymentTechnologyDescriptor> deploymentTechnologies = Collections.emptyList();
if (this.parent.getElement() instanceof HasTags && ((HasTags) this.parent.getElement()).getTags() != null) {
ObjectMapper objectMapper = new ObjectMapper();
deploymentTechnologies = ModelUtilities.extractDeploymentTechnologiesFromTags(((HasTags) this.parent.getElement()).getTags(), objectMapper);
}
EnhancementUtils.getAvailableFeaturesForTopology(this.topologyTemplate, deploymentTechnologies).forEach((nodeTemplateId, featuresMap) -> {
ArrayList<AvailableFeaturesApiData.Features> features = new ArrayList<>();
featuresMap.forEach((featureType, featureName) -> features.add(new AvailableFeaturesApiData.Features(featureType, featureName)));
apiData.add(new AvailableFeaturesApiData(nodeTemplateId, features));
});
return apiData;
}
Aggregations