import org.openecomp.sdc.be.model.ComponentInstanceAttribute;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
import org.openecomp.sdc.be.model.ComponentInstanceInterface;
+import org.openecomp.sdc.be.model.ComponentInstanceOutput;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.DistributionStatusEnum;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.MapInterfaceInstanceDataDefinition;
+import org.openecomp.sdc.be.model.OutputDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.RelationshipImpl;
convertInputs(topologyTemplate, service);
+ convertOutputs(topologyTemplate, service);
+
convertProperties(topologyTemplate, service);
convertPolicies(topologyTemplate, service);
convertComponentInstances(topologyTemplate, resource);
convertRelations(topologyTemplate, resource);
convertInputs(topologyTemplate, resource);
+ convertOutputs(topologyTemplate, resource);
convertGroups(topologyTemplate, resource);
setCapabilitiesToComponentAndGroups(topologyTemplate, resource);
convertPolicies(topologyTemplate, resource);
setComponentInstancesInputsToComponent(topologyTemplate, component);
+ setComponentInstancesOutputsToComponent(topologyTemplate, component);
+
setComponentInstancesToComponent(topologyTemplate, component);
setComponentInstancesCapabilitiesToComponentAndCI(topologyTemplate, component);
}
}
+ private static void convertOutputs(final TopologyTemplate topologyTemplate, final Component component) {
+ final Map<String, AttributeDataDefinition> outputsMap = topologyTemplate.getOutputs();
+ if (MapUtils.isEmpty(outputsMap)) {
+ return;
+ }
+ final List<OutputDefinition> outputList = outputsMap.values()
+ .stream()
+ .map(OutputDefinition::new)
+ .collect(Collectors.toList());
+ component.setOutputs(outputList);
+ }
+
private static void convertProperties(Component component, TopologyTemplate topologyTemplate) {
List<PropertyDefinition> propertiesList = component.getProperties();
if (propertiesList != null && !propertiesList.isEmpty()) {
}
}
+ private static void setComponentInstancesOutputsToComponent(final TopologyTemplate topologyTemplate, final Component component) {
+ if (topologyTemplate.getInstOutputs() != null) {
+ final Map<String, List<ComponentInstanceOutput>> outputs = new HashMap<>();
+ for (final Entry<String, MapAttributesDataDefinition> entry : topologyTemplate.getInstOutputs().entrySet()) {
+ if (entry.getValue() != null && entry.getValue().getMapToscaDataDefinition() != null) {
+ final String key = entry.getKey();
+ final List<ComponentInstanceOutput> componentInstanceAttributes = entry.getValue().getMapToscaDataDefinition().entrySet().stream()
+ .map(e -> new ComponentInstanceOutput(e.getValue())).collect(Collectors.toList());
+ outputs.put(key, componentInstanceAttributes);
+ }
+ }
+ component.setComponentInstancesOutputs(outputs);
+ }
+ }
+
private static void setComponentInstancesPropertiesToComponent(TopologyTemplate topologyTemplate, Component component) {
if (topologyTemplate.getInstProperties() != null) {
Map<String, List<ComponentInstanceProperty>> properties = new HashMap<>();