use of org.onap.so.db.catalog.beans.HeatFiles in project so by onap.
the class ToscaResourceInstaller method setHeatInformationForVfModule.
protected void setHeatInformationForVfModule(ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, VfModule vfModule, VfModuleCustomization vfModuleCustomization, Metadata vfMetadata) {
Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream().filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID().equalsIgnoreCase(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID))).findFirst();
if (matchingObject.isPresent()) {
List<HeatFiles> heatFilesList = new ArrayList<>();
List<HeatTemplate> volumeHeatChildTemplates = new ArrayList<>();
List<HeatTemplate> heatChildTemplates = new ArrayList<>();
HeatTemplate parentHeatTemplate = new HeatTemplate();
String parentArtifactType = null;
Set<String> artifacts = new HashSet<>(matchingObject.get().getVfModuleMetadata().getArtifacts());
for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
List<HeatTemplate> childNestedHeatTemplates = new ArrayList<>();
if (artifacts.contains(vfModuleArtifact.getArtifactInfo().getArtifactUUID())) {
checkVfModuleArtifactType(vfModule, vfModuleCustomization, heatFilesList, vfModuleArtifact, childNestedHeatTemplates, parentHeatTemplate, vfResourceStructure);
}
if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_NESTED)) {
parentArtifactType = identifyParentOfNestedTemplate(matchingObject.get(), vfModuleArtifact);
if (!childNestedHeatTemplates.isEmpty()) {
if (parentArtifactType != null && parentArtifactType.equalsIgnoreCase(ASDCConfiguration.HEAT_VOL)) {
volumeHeatChildTemplates.add(childNestedHeatTemplates.get(0));
} else {
heatChildTemplates.add(childNestedHeatTemplates.get(0));
}
}
}
}
if (!heatFilesList.isEmpty()) {
vfModule.setHeatFiles(heatFilesList);
}
// Set all Child Templates related to HEAT_VOLUME
if (!volumeHeatChildTemplates.isEmpty()) {
if (vfModule.getVolumeHeatTemplate() != null) {
vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates);
} else {
logger.debug("VolumeHeatTemplate not set in setHeatInformationForVfModule()");
}
}
// Set all Child Templates related to HEAT
if (!heatChildTemplates.isEmpty()) {
if (vfModule.getModuleHeatTemplate() != null) {
vfModule.getModuleHeatTemplate().setChildTemplates(heatChildTemplates);
} else {
logger.debug("ModuleHeatTemplate not set in setHeatInformationForVfModule()");
}
}
}
}
Aggregations