summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
index 6fe7f9dd0a..e8ee6b3c4b 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
@@ -32,6 +32,7 @@ import static org.openecomp.sdc.common.errors.Messages.NO_FILE_WAS_UPLOADED_OR_F
import static org.openecomp.sdc.common.errors.Messages.PACKAGE_PROCESS_ERROR;
import static org.openecomp.sdc.common.errors.Messages.UNEXPECTED_PROBLEM_HAPPENED_WHILE_GETTING;
+import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -183,8 +184,12 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
final var vspDetails = vendorSoftwareProductManager.getVsp(vspId, version);
final Response response = processOnboardPackage(onboardPackageInfo, vspDetails, errorMessages);
final UploadFileResponseDto entity = (UploadFileResponseDto) response.getEntity();
- if (artifactStorageManager.isEnabled() && !entity.getErrors().isEmpty()) {
- artifactStorageManager.delete(artifactInfo);
+ if (artifactStorageManager.isEnabled()) {
+ if (!entity.getErrors().isEmpty()) {
+ artifactStorageManager.delete(artifactInfo);
+ } else {
+ artifactStorageManager.put(vspId, versionId + ".reduced", new ByteArrayInputStream(fileToUploadBytes));
+ }
}
return response;
}
@@ -255,7 +260,8 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
FilesDataStructure fileDataStructure = copyFilesDataStructureDtoToFilesDataStructure(fileDataStructureDto);
ValidationResponse response = candidateManager.updateFilesDataStructure(vspId, new Version(versionId), fileDataStructure);
if (!response.isValid()) {
- return Response.status(EXPECTATION_FAILED).entity(new MapValidationResponseToDto().applyMapping(response, ValidationResponseDto.class))
+ return Response.status(EXPECTATION_FAILED)
+ .entity(new MapValidationResponseToDto().applyMapping(response, ValidationResponseDto.class))
.build();
}
return Response.ok(fileDataStructureDto).build();