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 static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
21 import java.io.ByteArrayInputStream;
22 import java.io.ByteArrayOutputStream;
23 import java.io.IOException;
24 import java.io.InputStream;
25 import java.nio.ByteBuffer;
26 import java.nio.charset.StandardCharsets;
27 import java.util.ArrayList;
28 import java.util.HashSet;
29 import java.util.List;
31 import java.util.Objects;
32 import java.util.Optional;
34 import java.util.stream.Collectors;
35 import java.util.zip.ZipEntry;
36 import java.util.zip.ZipInputStream;
37 import java.util.zip.ZipOutputStream;
38 import org.apache.commons.collections4.CollectionUtils;
39 import org.openecomp.core.utilities.file.FileContentHandler;
40 import org.openecomp.core.utilities.json.JsonUtil;
41 import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
42 import org.openecomp.sdc.common.errors.CoreException;
43 import org.openecomp.sdc.common.errors.ErrorCategory;
44 import org.openecomp.sdc.common.errors.ErrorCode;
45 import org.openecomp.sdc.common.errors.Messages;
46 import org.openecomp.sdc.common.utils.SdcCommon;
47 import org.openecomp.sdc.common.zip.ZipUtils;
48 import org.openecomp.sdc.common.zip.exception.ZipSlipException;
49 import org.openecomp.sdc.datatypes.error.ErrorLevel;
50 import org.openecomp.sdc.datatypes.error.ErrorMessage;
51 import org.openecomp.sdc.heat.datatypes.manifest.FileData;
52 import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
53 import org.openecomp.sdc.heat.datatypes.structure.Artifact;
54 import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
55 import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
56 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
57 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDaoFactory;
58 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
59 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
60 import org.openecomp.sdc.vendorsoftwareproduct.errors.utils.ErrorsUtil;
61 import org.openecomp.sdc.vendorsoftwareproduct.services.HeatFileAnalyzer;
62 import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
63 import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.ManifestCreator;
64 import org.openecomp.sdc.vendorsoftwareproduct.services.utils.CandidateServiceValidator;
65 import org.openecomp.sdc.vendorsoftwareproduct.types.CandidateDataEntityTo;
66 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.AnalyzedZipHeatFiles;
67 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
68 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.Module;
69 import org.openecomp.sdc.versioning.dao.types.Version;
70 import org.slf4j.Logger;
71 import org.slf4j.LoggerFactory;
73 public class CandidateServiceImpl implements CandidateService {
74 private static final Logger logger = LoggerFactory.getLogger(CandidateServiceImpl.class);
75 private CandidateServiceValidator candidateServiceValidator = new CandidateServiceValidator();
76 private ManifestCreator manifestCreator;
77 private OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDao;
79 public CandidateServiceImpl(ManifestCreator manifestCreator,
80 OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDao) {
81 this.manifestCreator = manifestCreator;
82 this.orchestrationTemplateCandidateDao = orchestrationTemplateCandidateDao;
85 public CandidateServiceImpl() {
89 public Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream fileToUpload,
92 getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage(),
95 if (Objects.isNull(fileToUpload)) {
96 return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
100 int available = fileToUpload.available();
101 if (available == 0) {
102 return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
105 } catch (IOException e) {
106 logger.debug(e.getMessage(), e);
107 return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
111 return Optional.empty();
115 public Optional<ErrorMessage> validateRawZipData(String fileSuffix,
116 byte[] uploadedFileData) {
117 if (Objects.isNull(uploadedFileData)) {
118 return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
119 getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage(),
122 return Optional.empty();
125 private String heatStructureTreeToFileDataStructure(HeatStructureTree tree,
126 FileContentHandler zipContentMap,
127 Map<String, List<ErrorMessage>> uploadErrors,
128 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
129 FilesDataStructure structure = new FilesDataStructure();
130 Set<String> usedEnvFiles = new HashSet<>();
131 addHeatsToFileDataStructure(tree, usedEnvFiles, structure, uploadErrors,
132 analyzedZipHeatFiles);
133 handleOtherResources(tree, usedEnvFiles, structure);
134 FilesDataStructure fileDataStructureFromManifest =
135 createFileDataStructureFromManifest(zipContentMap.getFileContentAsStream(SdcCommon.MANIFEST_NAME));
136 List<String> structureArtifacts = structure.getArtifacts();
137 structureArtifacts.addAll(fileDataStructureFromManifest.getArtifacts().stream().filter
138 (artifact -> isNotStrctureArtifact(structureArtifacts, artifact))
139 .collect(Collectors.toList()));
140 handleArtifactsFromTree(tree, structure);
142 return JsonUtil.object2Json(structure);
145 private boolean isNotStrctureArtifact(List<String> structureArtifacts, String artifact) {
146 return !structureArtifacts.contains(artifact);
150 public OrchestrationTemplateCandidateData createCandidateDataEntity(
151 CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest,
152 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
153 FileContentHandler zipContentMap = candidateDataEntityTo.getContentMap();
154 FilesDataStructure filesDataStructure;
155 String dataStructureJson;
157 if (zipFileManifest != null) {
158 // create data structure from manifest
159 filesDataStructure = createFileDataStructureFromManifest(zipFileManifest);
160 Set<String> zipFileList = zipContentMap.getFileList();
161 balanceManifestFilesWithZipFiles(filesDataStructure,
162 zipContentMap, analyzedZipHeatFiles);
163 Set<String> filesDataStructureFiles = getFlatFileNames(filesDataStructure);
164 filesDataStructure.getUnassigned().addAll(zipFileList.stream()
165 .filter(fileName -> (!filesDataStructureFiles.contains(fileName)
166 && !filesDataStructure.getNested().contains(fileName)
167 && !fileName.equals(SdcCommon.MANIFEST_NAME)))
168 .collect(Collectors.toList()));
169 dataStructureJson = JsonUtil.object2Json(filesDataStructure);
171 // create data structure from based on naming convention
173 heatStructureTreeToFileDataStructure(candidateDataEntityTo.getTree(), zipContentMap,
174 candidateDataEntityTo.getErrors(), analyzedZipHeatFiles);
177 OrchestrationTemplateCandidateData candidateData = new OrchestrationTemplateCandidateData();
178 candidateData.setContentData(ByteBuffer.wrap(candidateDataEntityTo.getUploadedFileData()));
179 candidateData.setFilesDataStructure(dataStructureJson);
180 return candidateData;
183 private void balanceManifestFilesWithZipFiles(
184 FilesDataStructure filesDataStructure,
185 FileContentHandler fileContentHandler, AnalyzedZipHeatFiles analyzedZipHeatFiles) {
186 Set<String> zipFileList = fileContentHandler.getFileList();
187 filesDataStructure.getNested().addAll(analyzedZipHeatFiles.getNestedFiles());
188 List<Module> modules = filesDataStructure.getModules();
189 if (CollectionUtils.isEmpty(modules)) {
193 for (int i = 0; i < modules.size(); i++) {
194 Module module = modules.get(i);
195 if (!isFileExistInZipContains(zipFileList, module.getYaml())) {
196 addFileToUnassigned(filesDataStructure, zipFileList, module.getEnv());
197 addFileToUnassigned(filesDataStructure, zipFileList, module.getVol());
198 addFileToUnassigned(filesDataStructure, zipFileList, module.getVolEnv());
200 } else if (Objects.nonNull(module.getVol()) && !zipFileList.contains(module.getVol())) {
203 .addIgnoreNull(filesDataStructure.getUnassigned(), module.getVolEnv());
205 if (filesDataStructure.getNested().contains(module.getYaml())) {
206 moveModuleFileToNested(filesDataStructure, i--, module);
212 private void addFileToUnassigned(FilesDataStructure filesDataStructure, Set<String> zipFileList,
214 if (isFileExistInZipContains(zipFileList, fileName)) {
215 filesDataStructure.getUnassigned().add(fileName);
219 private boolean isFileExistInZipContains(Set<String> zipFileList, String fileName) {
220 return Objects.nonNull(fileName) && zipFileList.contains(fileName);
223 private void moveModuleFileToNested(FilesDataStructure filesDataStructure, int i,
225 if (!filesDataStructure.getNested().contains(module.getYaml())) {
226 filesDataStructure.getNested().add(module.getYaml());
228 if (Objects.nonNull(module.getEnv())) {
229 filesDataStructure.getNested().add(module.getEnv());
231 if (Objects.nonNull(module.getVol())) {
232 filesDataStructure.getNested().add(module.getVol());
234 if (Objects.nonNull(module.getVolEnv())) {
235 filesDataStructure.getNested().add(module.getVolEnv());
237 filesDataStructure.getModules().remove(i);
240 private Set<String> getFlatFileNames(FilesDataStructure filesDataStructure) {
241 Set<String> fileNames = new HashSet<>();
242 if (!CollectionUtils.isEmpty(filesDataStructure.getModules())) {
243 for (Module module : filesDataStructure.getModules()) {
244 CollectionUtils.addIgnoreNull(fileNames, module.getEnv());
245 CollectionUtils.addIgnoreNull(fileNames, module.getVol());
246 CollectionUtils.addIgnoreNull(fileNames, module.getVolEnv());
247 CollectionUtils.addIgnoreNull(fileNames, module.getYaml());
250 fileNames.addAll(filesDataStructure.getArtifacts());
251 fileNames.addAll(filesDataStructure.getNested());
252 fileNames.addAll(filesDataStructure.getUnassigned());
257 private FilesDataStructure createFileDataStructureFromManifest(InputStream isManifestContent) {
258 ManifestContent manifestContent =
259 JsonUtil.json2Object(isManifestContent, ManifestContent.class);
260 FilesDataStructure structure = new FilesDataStructure();
261 for (FileData fileData : manifestContent.getData()) {
262 if (Objects.nonNull(fileData.getType()) &&
263 fileData.getType().equals(FileData.Type.HEAT)) {
264 Module module = new Module();
265 module.setYaml(fileData.getFile());
266 module.setIsBase(fileData.getBase());
267 addHeatDependenciesToModule(module, fileData.getData());
268 structure.getModules().add(module);
269 } else if (HeatFileAnalyzer.isYamlOrEnvFile(fileData.getFile()) &&
270 !FileData.Type.isArtifact(fileData.getType())) {
271 structure.getUnassigned().add(fileData.getFile());
273 structure.getArtifacts().add(fileData.getFile());
279 private void addHeatDependenciesToModule(Module module, List<FileData> data) {
280 if (CollectionUtils.isEmpty(data)) {
284 for (FileData fileData : data) {
285 if (fileData.getType().equals(FileData.Type.HEAT_ENV)) {
286 module.setEnv(fileData.getFile());
287 } else if (fileData.getType().equals(FileData.Type.HEAT_VOL)) { // must be volume
288 module.setVol(fileData.getFile());
289 if (!CollectionUtils.isEmpty(fileData.getData())) {
290 FileData volEnv = fileData.getData().get(0);
291 if (volEnv.getType().equals(FileData.Type.HEAT_ENV)) {
292 module.setVolEnv(volEnv.getFile());
294 throw new CoreException((new ErrorCode.ErrorCodeBuilder())
295 .withMessage(Messages.ILLEGAL_MANIFEST.getErrorMessage())
296 .withId(Messages.ILLEGAL_MANIFEST.getErrorMessage())
297 .withCategory(ErrorCategory.APPLICATION).build());
301 throw new CoreException((new ErrorCode.ErrorCodeBuilder())
302 .withMessage(Messages.FILE_TYPE_NOT_LEGAL.getErrorMessage())
303 .withId(Messages.FILE_TYPE_NOT_LEGAL.getErrorMessage())
304 .withCategory(ErrorCategory.APPLICATION).build());
310 public void updateCandidateUploadData(final String vspId, final Version version,
311 final OrchestrationTemplateCandidateData uploadData) {
312 orchestrationTemplateCandidateDao.update(vspId, version, uploadData);
316 public Optional<FilesDataStructure> getOrchestrationTemplateCandidateFileDataStructure(
317 String vspId, Version version) {
318 Optional<String> jsonFileDataStructure =
319 orchestrationTemplateCandidateDao.getStructure(vspId, version);
321 if (jsonFileDataStructure.isPresent() && JsonUtil.isValidJson(jsonFileDataStructure.get())) {
323 .of(JsonUtil.json2Object(jsonFileDataStructure.get(), FilesDataStructure.class));
325 return Optional.empty();
330 public void updateOrchestrationTemplateCandidateFileDataStructure(String vspId, Version version,
331 FilesDataStructure fileDataStructure) {
332 OrchestrationTemplateCandidateDaoFactory.getInstance().createInterface()
333 .updateStructure(vspId, version, fileDataStructure);
337 public Optional<OrchestrationTemplateCandidateData> getOrchestrationTemplateCandidate(String vspId,
339 return orchestrationTemplateCandidateDao.get(vspId, version);
343 public Optional<OrchestrationTemplateCandidateData> getOrchestrationTemplateCandidateInfo(
346 return orchestrationTemplateCandidateDao.getInfo(vspId, version);
350 public String createManifest(VspDetails vspDetails, FilesDataStructure structure) {
351 return JsonUtil.object2Json(manifestCreator.createManifest(vspDetails, structure)
352 .orElseThrow(() -> new CoreException(new ErrorCode.ErrorCodeBuilder()
353 .withMessage(Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage()).build())));
357 public Optional<ManifestContent> createManifest(VspDetails vspDetails,
358 FileContentHandler fileContentHandler,
359 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
360 return manifestCreator.createManifest(vspDetails, fileContentHandler, analyzedZipHeatFiles);
364 public Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
365 OrchestrationTemplateCandidateData candidateDataEntity,
367 OnboardingTypesEnum type,
368 Map<String, List<ErrorMessage>> uploadErrors) {
370 ByteArrayInputStream byteArrayInputStream = null;
372 file = replaceManifestInZip(candidateDataEntity.getContentData(), manifest, type);
373 byteArrayInputStream = new ByteArrayInputStream(
374 Objects.isNull(file) ? candidateDataEntity.getContentData().array()
376 } catch (IOException e) {
377 ErrorMessage errorMessage =
378 new ErrorMessage(ErrorLevel.ERROR,
379 Messages.CANDIDATE_PROCESS_FAILED.getErrorMessage());
380 logger.error(errorMessage.getMessage(), e);
382 .addStructureErrorToErrorMap(SdcCommon.UPLOAD_FILE, errorMessage, uploadErrors);
384 return Optional.ofNullable(byteArrayInputStream);
388 public byte[] replaceManifestInZip(ByteBuffer contentData, String manifest,
389 OnboardingTypesEnum type)
391 ByteArrayOutputStream baos = new ByteArrayOutputStream();
393 try (final ZipOutputStream zos = new ZipOutputStream(baos);
394 ZipInputStream zipStream = new ZipInputStream(
395 new ByteArrayInputStream(contentData.array()))) {
397 boolean manifestWritten = false;
398 while ((zipEntry = zipStream.getNextEntry()) != null) {
399 if (!zipEntry.getName().equalsIgnoreCase(SdcCommon.MANIFEST_NAME)) {
400 ZipEntry loc_ze = new ZipEntry(zipEntry.getName());
401 zos.putNextEntry(loc_ze);
402 byte[] buf = new byte[1024];
404 while ((len = zipStream.read(buf)) > 0) {
405 zos.write(buf, 0, (len < buf.length) ? len : buf.length);
408 manifestWritten = true;
409 writeManifest(manifest, type, zos);
413 if (!manifestWritten) {
414 writeManifest(manifest, type, zos);
418 return baos.toByteArray();
422 public byte[] getZipData(ByteBuffer contentData)
424 ByteArrayOutputStream baos = new ByteArrayOutputStream();
426 try (final ZipOutputStream zos = new ZipOutputStream(baos);
427 ZipInputStream zipStream = new ZipInputStream(
428 new ByteArrayInputStream(contentData.array()))) {
430 while ((zipEntry = zipStream.getNextEntry()) != null) {
432 ZipUtils.checkForZipSlipInRead(zipEntry);
433 } catch (ZipSlipException e) {
434 throw new IOException(e);
436 ZipEntry locZipEntry = new ZipEntry(zipEntry.getName());
437 zos.putNextEntry(locZipEntry);
438 byte[] buf = new byte[1024];
440 while ((len = zipStream.read(buf)) > 0) {
441 zos.write(buf, 0, (len < buf.length) ? len : buf.length);
446 return baos.toByteArray();
450 public Optional<List<ErrorMessage>> validateFileDataStructure(
451 FilesDataStructure filesDataStructure) {
452 return candidateServiceValidator.validateFileDataStructure(filesDataStructure);
456 public void deleteOrchestrationTemplateCandidate(String vspId, Version versionId) {
457 orchestrationTemplateCandidateDao.delete(vspId, versionId);
461 public void updateValidationData(String vspId, Version version, ValidationStructureList
463 orchestrationTemplateCandidateDao.updateValidationData(vspId, version, validationData);
466 private void writeManifest(String manifest,
467 OnboardingTypesEnum type,
468 ZipOutputStream zos) throws IOException {
470 if (isManifestNeedsToGetWritten(type)) {
474 zos.putNextEntry(new ZipEntry(SdcCommon.MANIFEST_NAME));
475 try (InputStream manifestStream = new ByteArrayInputStream(
476 manifest.getBytes(StandardCharsets.UTF_8))) {
477 byte[] buf = new byte[1024];
479 while ((len = (manifestStream.read(buf))) > 0) {
480 zos.write(buf, 0, (len < buf.length) ? len : buf.length);
485 private boolean isManifestNeedsToGetWritten(OnboardingTypesEnum type) {
486 return type.equals(OnboardingTypesEnum.CSAR);
489 private void handleArtifactsFromTree(HeatStructureTree tree, FilesDataStructure structure) {
491 if (Objects.isNull(tree) || Objects.isNull(tree.getArtifacts())) {
495 if (CollectionUtils.isNotEmpty(tree.getArtifacts())) {
496 structure.getArtifacts().addAll(
499 .map(Artifact::getFileName)
500 .filter(fileName -> !structure.getArtifacts().contains(fileName))
501 .collect(Collectors.toList()));
505 private void handleOtherResources(HeatStructureTree tree, Set<String> usedEnvFiles,
506 FilesDataStructure structure) {
507 Set<HeatStructureTree> others = tree.getOther();
508 if (Objects.isNull(others)) {
512 List<String> artifacts = new ArrayList<>();
513 List<String> unassigned = new ArrayList<>();
514 for (HeatStructureTree other : others) {
515 if (HeatFileAnalyzer.isYamlOrEnvFile(other.getFileName())) {
516 if (isEnvFileUsedByHeatFile(usedEnvFiles, other)) {
519 unassigned.add(other.getFileName());
521 artifacts.add(other.getFileName());
523 handleArtifactsFromTree(other, structure);
525 structure.getArtifacts().addAll(artifacts);
526 structure.getUnassigned().addAll(unassigned);
529 private boolean isEnvFileUsedByHeatFile(Set<String> usedEnvFiles, HeatStructureTree other) {
530 return HeatFileAnalyzer.isEnvFile(other.getFileName()) &&
531 usedEnvFiles.contains(other.getFileName());
534 private void addHeatsToFileDataStructure(HeatStructureTree tree, Set<String> usedEnvFiles,
535 FilesDataStructure structure,
536 Map<String, List<ErrorMessage>> uploadErrors,
537 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
538 List<Module> modules = new ArrayList<>();
539 Set<HeatStructureTree> heatsSet = tree.getHeat();
540 if (Objects.isNull(heatsSet)) {
543 for (HeatStructureTree heat : heatsSet) {
544 if (isFileBaseFile(heat.getFileName())) {
545 handleSingleHeat(structure, modules, heat, uploadErrors);
546 } else if (isFileModuleFile(heat.getFileName(),
547 analyzedZipHeatFiles.getModuleFiles())) {
548 handleSingleHeat(structure, modules, heat, uploadErrors);
550 structure.getUnassigned().add(heat.getFileName());
551 addNestedToFileDataStructure(heat, structure);
553 if (!Objects.isNull(heat.getEnv())) {
554 usedEnvFiles.add(heat.getEnv() == null ? null : heat.getEnv().getFileName());
557 structure.setModules(modules);
561 private boolean isFileModuleFile(String fileName, Set<String> modulesFileNames) {
562 return modulesFileNames.contains(fileName);
565 private boolean isFileBaseFile(String fileName) {
566 return manifestCreator.isFileBaseFile(fileName);
569 private void handleSingleHeat(FilesDataStructure structure, List<Module> modules,
570 HeatStructureTree heat,
571 Map<String, List<ErrorMessage>> uploadErrors) {
572 Module module = new Module();
573 module.setYaml(heat.getFileName());
574 module.setIsBase(heat.getBase());
575 addNestedToFileDataStructure(heat, structure);
576 Set<HeatStructureTree> volumeSet = heat.getVolume();
578 if (Objects.nonNull(volumeSet)) {
579 handleVolumes(module, volumeSet, structure, inx, uploadErrors);
581 handleEnv(module, heat, false, structure);
585 private void handleVolumes(Module module, Set<HeatStructureTree> volumeSet,
586 FilesDataStructure structure, int inx,
587 Map<String, List<ErrorMessage>> uploadErrors) {
588 for (HeatStructureTree volume : volumeSet) {
589 Objects.requireNonNull(volume, "volume cannot be null!");
591 ErrorsUtil.addStructureErrorToErrorMap(SdcCommon.UPLOAD_FILE,
592 new ErrorMessage(ErrorLevel.WARNING,
593 Messages.MORE_THEN_ONE_VOL_FOR_HEAT.getErrorMessage()), uploadErrors);
596 handleArtifactsFromTree(volume, structure);
597 module.setVol(volume.getFileName());
598 handleEnv(module, volume, true, structure);
599 addNestedToFileDataStructure(volume, structure);
603 private void handleEnv(Module module, HeatStructureTree tree, boolean isVolEnv,
604 FilesDataStructure structure) {
605 if (Objects.nonNull(tree.getEnv())) {
607 module.setVolEnv(tree.getEnv().getFileName());
609 module.setEnv(tree.getEnv().getFileName());
611 handleArtifactsFromTree(tree.getEnv(), structure);
615 private void addNestedToFileDataStructure(HeatStructureTree heat,
616 FilesDataStructure structure) {
617 Set<HeatStructureTree> nestedSet = heat.getNested();
618 if (Objects.isNull(nestedSet)) {
621 for (HeatStructureTree nested : nestedSet) {
622 if (structure.getNested().contains(nested.getFileName())) {
625 structure.getNested().add(nested.getFileName());
626 if (CollectionUtils.isNotEmpty(nested.getArtifacts())) {
627 handleArtifactsFromTree(nested, structure);
629 addNestedToFileDataStructure(nested, structure);