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.
16 * Modifications copyright (c) 2021 Nokia
19 package org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule;
21 import org.openecomp.core.utilities.file.FileContentHandler;
22 import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
23 import org.openecomp.sdc.datatypes.error.ErrorMessage;
24 import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
25 import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
26 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
27 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
28 import org.openecomp.sdc.vendorsoftwareproduct.types.CandidateDataEntityTo;
29 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.AnalyzedZipHeatFiles;
30 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
31 import org.openecomp.sdc.versioning.dao.types.Version;
33 import java.io.ByteArrayInputStream;
34 import java.io.IOException;
35 import java.io.InputStream;
36 import java.nio.ByteBuffer;
37 import java.util.List;
39 import java.util.Optional;
41 public interface CandidateService {
42 Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream heatFileToUpload,
45 Optional<ErrorMessage> validateRawZipData(String fileSuffix, byte[] uploadedFileData);
47 OrchestrationTemplateCandidateData createCandidateDataEntity(
48 CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest,
49 AnalyzedZipHeatFiles analyzedZipHeatFiles);
51 void updateCandidateUploadData(String vspId, Version version,
52 OrchestrationTemplateCandidateData uploadData);
54 Optional<FilesDataStructure> getOrchestrationTemplateCandidateFileDataStructure(String vspId,
57 void updateOrchestrationTemplateCandidateFileDataStructure(String vspId, Version version,
58 FilesDataStructure fileDataStructure);
60 Optional<OrchestrationTemplateCandidateData> getOrchestrationTemplateCandidate(String vspId,
63 Optional<OrchestrationTemplateCandidateData> getOrchestrationTemplateCandidateInfo(String vspId,
66 byte[] getZipData(ByteBuffer contentData) throws IOException;
68 void deleteOrchestrationTemplateCandidate(String vspId, Version version);
70 Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
71 OrchestrationTemplateCandidateData candidateDataEntity,
73 OnboardingTypesEnum type,
74 Map<String, List<ErrorMessage>> uploadErrors);
76 byte[] replaceManifestInZip(ByteBuffer contentData, String manifest,
77 OnboardingTypesEnum type) throws IOException;
79 Optional<ManifestContent> createManifest(VspDetails vspDetails,
80 FileContentHandler fileContentHandler,
81 AnalyzedZipHeatFiles analyzedZipHeatFiles);
83 String createManifest(VspDetails vspDetails, FilesDataStructure structure);
85 String createManifestFromExisting(VspDetails vspDetails, FilesDataStructure structure, ManifestContent existingManifest);
87 Optional<List<ErrorMessage>> validateFileDataStructure(FilesDataStructure filesDataStructure);
89 void updateValidationData(String vspId, Version version, ValidationStructureList validationData);