2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule;
19 import org.apache.commons.collections4.CollectionUtils;
20 import org.openecomp.core.utilities.file.FileContentHandler;
21 import org.openecomp.core.utilities.json.JsonUtil;
22 import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
23 import org.openecomp.sdc.common.errors.CoreException;
24 import org.openecomp.sdc.common.errors.ErrorCategory;
25 import org.openecomp.sdc.common.errors.ErrorCode;
26 import org.openecomp.sdc.common.errors.Messages;
27 import org.openecomp.sdc.common.utils.SdcCommon;
28 import org.openecomp.sdc.datatypes.error.ErrorLevel;
29 import org.openecomp.sdc.datatypes.error.ErrorMessage;
30 import org.openecomp.sdc.heat.datatypes.manifest.FileData;
31 import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
32 import org.openecomp.sdc.heat.datatypes.structure.Artifact;
33 import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
34 import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
35 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
36 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDaoFactory;
37 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
38 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
39 import org.openecomp.sdc.vendorsoftwareproduct.errors.utils.ErrorsUtil;
40 import org.openecomp.sdc.vendorsoftwareproduct.services.HeatFileAnalyzer;
41 import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
42 import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.ManifestCreator;
43 import org.openecomp.sdc.vendorsoftwareproduct.services.utils.CandidateServiceValidator;
44 import org.openecomp.sdc.vendorsoftwareproduct.types.CandidateDataEntityTo;
45 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.AnalyzedZipHeatFiles;
46 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
47 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.Module;
48 import org.openecomp.sdc.versioning.dao.types.Version;
49 import org.slf4j.Logger;
50 import org.slf4j.LoggerFactory;
52 import java.io.ByteArrayInputStream;
53 import java.io.ByteArrayOutputStream;
54 import java.io.IOException;
55 import java.io.InputStream;
56 import java.nio.ByteBuffer;
57 import java.nio.charset.StandardCharsets;
58 import java.util.ArrayList;
59 import java.util.HashSet;
60 import java.util.List;
62 import java.util.Objects;
63 import java.util.Optional;
65 import java.util.stream.Collectors;
66 import java.util.zip.ZipEntry;
67 import java.util.zip.ZipInputStream;
68 import java.util.zip.ZipOutputStream;
70 import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
72 public class CandidateServiceImpl implements CandidateService {
73 private static final Logger logger = LoggerFactory.getLogger(CandidateServiceImpl.class);
74 private CandidateServiceValidator candidateServiceValidator = new CandidateServiceValidator();
75 private ManifestCreator manifestCreator;
76 private OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDao;
78 public CandidateServiceImpl(ManifestCreator manifestCreator,
79 OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDao) {
80 this.manifestCreator = manifestCreator;
81 this.orchestrationTemplateCandidateDao = orchestrationTemplateCandidateDao;
84 public CandidateServiceImpl() {
88 public Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream fileToUpload,
91 getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage(),
94 if (Objects.isNull(fileToUpload)) {
95 return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
99 int available = fileToUpload.available();
100 if (available == 0) {
101 return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
104 } catch (IOException e) {
105 logger.debug(e.getMessage(), e);
106 return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
110 return Optional.empty();
114 public Optional<ErrorMessage> validateRawZipData(String fileSuffix,
115 byte[] uploadedFileData) {
116 if (Objects.isNull(uploadedFileData)) {
117 return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
118 getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage(),
121 return Optional.empty();
124 private String heatStructureTreeToFileDataStructure(HeatStructureTree tree,
125 FileContentHandler zipContentMap,
126 Map<String, List<ErrorMessage>> uploadErrors,
127 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
128 FilesDataStructure structure = new FilesDataStructure();
129 Set<String> usedEnvFiles = new HashSet<>();
130 addHeatsToFileDataStructure(tree, usedEnvFiles, structure, uploadErrors,
131 analyzedZipHeatFiles);
132 handleOtherResources(tree, usedEnvFiles, structure);
133 FilesDataStructure fileDataStructureFromManifest =
134 createFileDataStructureFromManifest(zipContentMap.getFileContent(SdcCommon.MANIFEST_NAME));
135 List<String> structureArtifacts = structure.getArtifacts();
136 structureArtifacts.addAll(fileDataStructureFromManifest.getArtifacts().stream().filter
137 (artifact -> isNotStrctureArtifact(structureArtifacts, artifact))
138 .collect(Collectors.toList()));
139 handleArtifactsFromTree(tree, structure);
141 return JsonUtil.object2Json(structure);
144 private boolean isNotStrctureArtifact(List<String> structureArtifacts, String artifact) {
145 return !structureArtifacts.contains(artifact);
149 public OrchestrationTemplateCandidateData createCandidateDataEntity(
150 CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest,
151 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
152 FileContentHandler zipContentMap = candidateDataEntityTo.getContentMap();
153 FilesDataStructure filesDataStructure;
154 String dataStructureJson;
156 if (zipFileManifest != null) {
157 // create data structure from manifest
158 filesDataStructure = createFileDataStructureFromManifest(zipFileManifest);
159 Set<String> zipFileList = zipContentMap.getFileList();
160 balanceManifestFilesWithZipFiles(filesDataStructure,
161 zipContentMap, analyzedZipHeatFiles);
162 Set<String> filesDataStructureFiles = getFlatFileNames(filesDataStructure);
163 filesDataStructure.getUnassigned().addAll(zipFileList.stream()
164 .filter(fileName -> (!filesDataStructureFiles.contains(fileName)
165 && !filesDataStructure.getNested().contains(fileName)
166 && !fileName.equals(SdcCommon.MANIFEST_NAME)))
167 .collect(Collectors.toList()));
168 dataStructureJson = JsonUtil.object2Json(filesDataStructure);
170 // create data structure from based on naming convention
172 heatStructureTreeToFileDataStructure(candidateDataEntityTo.getTree(), zipContentMap,
173 candidateDataEntityTo.getErrors(), analyzedZipHeatFiles);
176 OrchestrationTemplateCandidateData candidateData = new OrchestrationTemplateCandidateData();
177 candidateData.setContentData(ByteBuffer.wrap(candidateDataEntityTo.getUploadedFileData()));
178 candidateData.setFilesDataStructure(dataStructureJson);
179 return candidateData;
182 private void balanceManifestFilesWithZipFiles(
183 FilesDataStructure filesDataStructure,
184 FileContentHandler fileContentHandler, AnalyzedZipHeatFiles analyzedZipHeatFiles) {
185 Set<String> zipFileList = fileContentHandler.getFileList();
186 filesDataStructure.getNested().addAll(analyzedZipHeatFiles.getNestedFiles());
187 List<Module> modules = filesDataStructure.getModules();
188 if (CollectionUtils.isEmpty(modules)) {
192 for (int i = 0; i < modules.size(); i++) {
193 Module module = modules.get(i);
194 if (!isFileExistInZipContains(zipFileList, module.getYaml())) {
195 addFileToUnassigned(filesDataStructure, zipFileList, module.getEnv());
196 addFileToUnassigned(filesDataStructure, zipFileList, module.getVol());
197 addFileToUnassigned(filesDataStructure, zipFileList, module.getVolEnv());
199 } else if (Objects.nonNull(module.getVol()) && !zipFileList.contains(module.getVol())) {
202 .addIgnoreNull(filesDataStructure.getUnassigned(), module.getVolEnv());
204 if (filesDataStructure.getNested().contains(module.getYaml())) {
205 moveModuleFileToNested(filesDataStructure, i--, module);
211 private void addFileToUnassigned(FilesDataStructure filesDataStructure, Set<String> zipFileList,
213 if (isFileExistInZipContains(zipFileList, fileName)) {
214 filesDataStructure.getUnassigned().add(fileName);
218 private boolean isFileExistInZipContains(Set<String> zipFileList, String fileName) {
219 return Objects.nonNull(fileName) && zipFileList.contains(fileName);
222 private void moveModuleFileToNested(FilesDataStructure filesDataStructure, int i,
224 if (!filesDataStructure.getNested().contains(module.getYaml())) {
225 filesDataStructure.getNested().add(module.getYaml());
227 if (Objects.nonNull(module.getEnv())) {
228 filesDataStructure.getNested().add(module.getEnv());
230 if (Objects.nonNull(module.getVol())) {
231 filesDataStructure.getNested().add(module.getVol());
233 if (Objects.nonNull(module.getVolEnv())) {
234 filesDataStructure.getNested().add(module.getVolEnv());
236 filesDataStructure.getModules().remove(i);
239 private Set<String> getFlatFileNames(FilesDataStructure filesDataStructure) {
240 Set<String> fileNames = new HashSet<>();
241 if (!CollectionUtils.isEmpty(filesDataStructure.getModules())) {
242 for (Module module : filesDataStructure.getModules()) {
243 CollectionUtils.addIgnoreNull(fileNames, module.getEnv());
244 CollectionUtils.addIgnoreNull(fileNames, module.getVol());
245 CollectionUtils.addIgnoreNull(fileNames, module.getVolEnv());
246 CollectionUtils.addIgnoreNull(fileNames, module.getYaml());
249 fileNames.addAll(filesDataStructure.getArtifacts());
250 fileNames.addAll(filesDataStructure.getNested());
251 fileNames.addAll(filesDataStructure.getUnassigned());
256 private FilesDataStructure createFileDataStructureFromManifest(InputStream isManifestContent) {
257 ManifestContent manifestContent =
258 JsonUtil.json2Object(isManifestContent, ManifestContent.class);
259 FilesDataStructure structure = new FilesDataStructure();
260 for (FileData fileData : manifestContent.getData()) {
261 if (Objects.nonNull(fileData.getType()) &&
262 fileData.getType().equals(FileData.Type.HEAT)) {
263 Module module = new Module();
264 module.setYaml(fileData.getFile());
265 module.setIsBase(fileData.getBase());
266 addHeatDependenciesToModule(module, fileData.getData());
267 structure.getModules().add(module);
268 } else if (HeatFileAnalyzer.isYamlOrEnvFile(fileData.getFile()) &&
269 !FileData.Type.isArtifact(fileData.getType())) {
270 structure.getUnassigned().add(fileData.getFile());
272 structure.getArtifacts().add(fileData.getFile());
278 private void addHeatDependenciesToModule(Module module, List<FileData> data) {
279 if (CollectionUtils.isEmpty(data)) {
283 for (FileData fileData : data) {
284 if (fileData.getType().equals(FileData.Type.HEAT_ENV)) {
285 module.setEnv(fileData.getFile());
286 } else if (fileData.getType().equals(FileData.Type.HEAT_VOL)) { // must be volume
287 module.setVol(fileData.getFile());
288 if (!CollectionUtils.isEmpty(fileData.getData())) {
289 FileData volEnv = fileData.getData().get(0);
290 if (volEnv.getType().equals(FileData.Type.HEAT_ENV)) {
291 module.setVolEnv(volEnv.getFile());
293 throw new CoreException((new ErrorCode.ErrorCodeBuilder())
294 .withMessage(Messages.ILLEGAL_MANIFEST.getErrorMessage())
295 .withId(Messages.ILLEGAL_MANIFEST.getErrorMessage())
296 .withCategory(ErrorCategory.APPLICATION).build());
300 throw new CoreException((new ErrorCode.ErrorCodeBuilder())
301 .withMessage(Messages.FILE_TYPE_NOT_LEGAL.getErrorMessage())
302 .withId(Messages.FILE_TYPE_NOT_LEGAL.getErrorMessage())
303 .withCategory(ErrorCategory.APPLICATION).build());
309 public void updateCandidateUploadData(String vspId, Version version,
310 OrchestrationTemplateCandidateData uploadData) {
311 orchestrationTemplateCandidateDao.update(vspId, version, uploadData);
315 public Optional<FilesDataStructure> getOrchestrationTemplateCandidateFileDataStructure(
316 String vspId, Version version) {
317 Optional<String> jsonFileDataStructure =
318 orchestrationTemplateCandidateDao.getStructure(vspId, version);
320 if (jsonFileDataStructure.isPresent() && JsonUtil.isValidJson(jsonFileDataStructure.get())) {
322 .of(JsonUtil.json2Object(jsonFileDataStructure.get(), FilesDataStructure.class));
324 return Optional.empty();
329 public void updateOrchestrationTemplateCandidateFileDataStructure(String vspId, Version version,
330 FilesDataStructure fileDataStructure) {
331 OrchestrationTemplateCandidateDaoFactory.getInstance().createInterface()
332 .updateStructure(vspId, version, fileDataStructure);
336 public Optional<OrchestrationTemplateCandidateData> getOrchestrationTemplateCandidate(String vspId,
338 return orchestrationTemplateCandidateDao.get(vspId, version);
342 public Optional<OrchestrationTemplateCandidateData> getOrchestrationTemplateCandidateInfo(
345 return orchestrationTemplateCandidateDao.getInfo(vspId, version);
349 public String createManifest(VspDetails vspDetails, FilesDataStructure structure) {
350 return JsonUtil.object2Json(manifestCreator.createManifest(vspDetails, structure)
351 .orElseThrow(() -> new CoreException(new ErrorCode.ErrorCodeBuilder()
352 .withMessage(Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage()).build())));
356 public Optional<ManifestContent> createManifest(VspDetails vspDetails,
357 FileContentHandler fileContentHandler,
358 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
359 return manifestCreator.createManifest(vspDetails, fileContentHandler, analyzedZipHeatFiles);
363 public Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
364 OrchestrationTemplateCandidateData candidateDataEntity,
366 OnboardingTypesEnum type,
367 Map<String, List<ErrorMessage>> uploadErrors) {
369 ByteArrayInputStream byteArrayInputStream = null;
371 file = replaceManifestInZip(candidateDataEntity.getContentData(), manifest, type);
372 byteArrayInputStream = new ByteArrayInputStream(
373 Objects.isNull(file) ? candidateDataEntity.getContentData().array()
375 } catch (IOException e) {
376 ErrorMessage errorMessage =
377 new ErrorMessage(ErrorLevel.ERROR,
378 Messages.CANDIDATE_PROCESS_FAILED.getErrorMessage());
379 logger.error(errorMessage.getMessage(), e);
381 .addStructureErrorToErrorMap(SdcCommon.UPLOAD_FILE, errorMessage, uploadErrors);
383 return Optional.ofNullable(byteArrayInputStream);
387 public byte[] replaceManifestInZip(ByteBuffer contentData, String manifest,
388 OnboardingTypesEnum type)
390 ByteArrayOutputStream baos = new ByteArrayOutputStream();
392 try (final ZipOutputStream zos = new ZipOutputStream(baos);
393 ZipInputStream zipStream = new ZipInputStream(
394 new ByteArrayInputStream(contentData.array()))) {
396 boolean manifestWritten = false;
397 while ((zipEntry = zipStream.getNextEntry()) != null) {
398 if (!zipEntry.getName().equalsIgnoreCase(SdcCommon.MANIFEST_NAME)) {
399 ZipEntry loc_ze = new ZipEntry(zipEntry.getName());
400 zos.putNextEntry(loc_ze);
401 byte[] buf = new byte[1024];
403 while ((len = zipStream.read(buf)) > 0) {
404 zos.write(buf, 0, (len < buf.length) ? len : buf.length);
407 manifestWritten = true;
408 writeManifest(manifest, type, zos);
412 if (!manifestWritten) {
413 writeManifest(manifest, type, zos);
417 return baos.toByteArray();
421 public byte[] getZipData(ByteBuffer contentData)
423 ByteArrayOutputStream baos = new ByteArrayOutputStream();
425 try (final ZipOutputStream zos = new ZipOutputStream(baos);
426 ZipInputStream zipStream = new ZipInputStream(
427 new ByteArrayInputStream(contentData.array()))) {
429 while ((zipEntry = zipStream.getNextEntry()) != null) {
430 ZipEntry locZipEntry = new ZipEntry(zipEntry.getName());
431 zos.putNextEntry(locZipEntry);
432 byte[] buf = new byte[1024];
434 while ((len = zipStream.read(buf)) > 0) {
435 zos.write(buf, 0, (len < buf.length) ? len : buf.length);
440 return baos.toByteArray();
444 public Optional<List<ErrorMessage>> validateFileDataStructure(
445 FilesDataStructure filesDataStructure) {
446 return candidateServiceValidator.validateFileDataStructure(filesDataStructure);
450 public void deleteOrchestrationTemplateCandidate(String vspId, Version versionId) {
451 orchestrationTemplateCandidateDao.delete(vspId, versionId);
455 public void updateValidationData(String vspId, Version version, ValidationStructureList
457 orchestrationTemplateCandidateDao.updateValidationData(vspId, version, validationData);
460 private void writeManifest(String manifest,
461 OnboardingTypesEnum type,
462 ZipOutputStream zos) throws IOException {
464 if (isManifestNeedsToGetWritten(type)) {
468 zos.putNextEntry(new ZipEntry(SdcCommon.MANIFEST_NAME));
469 try (InputStream manifestStream = new ByteArrayInputStream(
470 manifest.getBytes(StandardCharsets.UTF_8))) {
471 byte[] buf = new byte[1024];
473 while ((len = (manifestStream.read(buf))) > 0) {
474 zos.write(buf, 0, (len < buf.length) ? len : buf.length);
479 private boolean isManifestNeedsToGetWritten(OnboardingTypesEnum type) {
480 return type.equals(OnboardingTypesEnum.CSAR);
483 private void handleArtifactsFromTree(HeatStructureTree tree, FilesDataStructure structure) {
485 if (Objects.isNull(tree) || Objects.isNull(tree.getArtifacts())) {
489 if (CollectionUtils.isNotEmpty(tree.getArtifacts())) {
490 structure.getArtifacts().addAll(
493 .map(Artifact::getFileName)
494 .filter(fileName -> !structure.getArtifacts().contains(fileName))
495 .collect(Collectors.toList()));
499 private void handleOtherResources(HeatStructureTree tree, Set<String> usedEnvFiles,
500 FilesDataStructure structure) {
501 Set<HeatStructureTree> others = tree.getOther();
502 if (Objects.isNull(others)) {
506 List<String> artifacts = new ArrayList<>();
507 List<String> unassigned = new ArrayList<>();
508 for (HeatStructureTree other : others) {
509 if (HeatFileAnalyzer.isYamlOrEnvFile(other.getFileName())) {
510 if (isEnvFileUsedByHeatFile(usedEnvFiles, other)) {
513 unassigned.add(other.getFileName());
515 artifacts.add(other.getFileName());
517 handleArtifactsFromTree(other, structure);
519 structure.getArtifacts().addAll(artifacts);
520 structure.getUnassigned().addAll(unassigned);
523 private boolean isEnvFileUsedByHeatFile(Set<String> usedEnvFiles, HeatStructureTree other) {
524 return HeatFileAnalyzer.isEnvFile(other.getFileName()) &&
525 usedEnvFiles.contains(other.getFileName());
528 private void addHeatsToFileDataStructure(HeatStructureTree tree, Set<String> usedEnvFiles,
529 FilesDataStructure structure,
530 Map<String, List<ErrorMessage>> uploadErrors,
531 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
532 List<Module> modules = new ArrayList<>();
533 Set<HeatStructureTree> heatsSet = tree.getHeat();
534 if (Objects.isNull(heatsSet)) {
537 for (HeatStructureTree heat : heatsSet) {
538 if (isFileBaseFile(heat.getFileName())) {
539 handleSingleHeat(structure, modules, heat, uploadErrors);
540 } else if (isFileModuleFile(heat.getFileName(),
541 analyzedZipHeatFiles.getModuleFiles())) {
542 handleSingleHeat(structure, modules, heat, uploadErrors);
544 structure.getUnassigned().add(heat.getFileName());
545 addNestedToFileDataStructure(heat, structure);
547 if (!Objects.isNull(heat.getEnv())) {
548 usedEnvFiles.add(heat.getEnv() == null ? null : heat.getEnv().getFileName());
551 structure.setModules(modules);
555 private boolean isFileModuleFile(String fileName, Set<String> modulesFileNames) {
556 return modulesFileNames.contains(fileName);
559 private boolean isFileBaseFile(String fileName) {
560 return manifestCreator.isFileBaseFile(fileName);
563 private void handleSingleHeat(FilesDataStructure structure, List<Module> modules,
564 HeatStructureTree heat,
565 Map<String, List<ErrorMessage>> uploadErrors) {
566 Module module = new Module();
567 module.setYaml(heat.getFileName());
568 module.setIsBase(heat.getBase());
569 addNestedToFileDataStructure(heat, structure);
570 Set<HeatStructureTree> volumeSet = heat.getVolume();
572 if (Objects.nonNull(volumeSet)) {
573 handleVolumes(module, volumeSet, structure, inx, uploadErrors);
575 handleEnv(module, heat, false, structure);
579 private void handleVolumes(Module module, Set<HeatStructureTree> volumeSet,
580 FilesDataStructure structure, int inx,
581 Map<String, List<ErrorMessage>> uploadErrors) {
582 for (HeatStructureTree volume : volumeSet) {
583 Objects.requireNonNull(volume, "volume cannot be null!");
585 ErrorsUtil.addStructureErrorToErrorMap(SdcCommon.UPLOAD_FILE,
586 new ErrorMessage(ErrorLevel.WARNING,
587 Messages.MORE_THEN_ONE_VOL_FOR_HEAT.getErrorMessage()), uploadErrors);
590 handleArtifactsFromTree(volume, structure);
591 module.setVol(volume.getFileName());
592 handleEnv(module, volume, true, structure);
593 addNestedToFileDataStructure(volume, structure);
597 private void handleEnv(Module module, HeatStructureTree tree, boolean isVolEnv,
598 FilesDataStructure structure) {
599 if (Objects.nonNull(tree.getEnv())) {
601 module.setVolEnv(tree.getEnv().getFileName());
603 module.setEnv(tree.getEnv().getFileName());
605 handleArtifactsFromTree(tree.getEnv(), structure);
609 private void addNestedToFileDataStructure(HeatStructureTree heat,
610 FilesDataStructure structure) {
611 Set<HeatStructureTree> nestedSet = heat.getNested();
612 if (Objects.isNull(nestedSet)) {
615 for (HeatStructureTree nested : nestedSet) {
616 if (structure.getNested().contains(nested.getFileName())) {
619 structure.getNested().add(nested.getFileName());
620 if (CollectionUtils.isNotEmpty(nested.getArtifacts())) {
621 handleArtifactsFromTree(nested, structure);
623 addNestedToFileDataStructure(nested, structure);