summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp')
-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.java15
1 files changed, 11 insertions, 4 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 acbb0cdd03..bf674d5dcd 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
@@ -50,6 +50,7 @@ import java.util.UUID;
import javax.activation.DataHandler;
import javax.inject.Named;
import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.openecomp.sdc.activitylog.ActivityLogManager;
@@ -176,12 +177,18 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
vspUploadStatus = orchestrationTemplateCandidateUploadManager.putUploadInProcessing(vspId, versionId, user);
response = processOnboardPackage(onboardPackageInfo, vspDetails, errorMessages);
final UploadFileResponseDto entity = (UploadFileResponseDto) response.getEntity();
- if (artifactStorageManager.isEnabled()) {
- if (entity.getErrors().isEmpty()) {
- artifactStorageManager.put(vspId, versionId + ".reduced", new ByteArrayInputStream(fileToUploadBytes));
- } else {
+ final Map<String, List<ErrorMessage>> errors = entity.getErrors();
+ if (MapUtils.isNotEmpty(errors)) {
+ if (artifactStorageManager.isEnabled()) {
artifactStorageManager.delete(artifactInfo);
}
+ orchestrationTemplateCandidateUploadManager
+ .putUploadAsFinished(vspId, versionId, vspUploadStatus.getLockId(), VspUploadStatus.ERROR, user);
+ return Response.status(NOT_ACCEPTABLE)
+ .entity(buildUploadResponseWithError(errors.values().stream().flatMap(List::stream).toArray(ErrorMessage[]::new))).build();
+ }
+ if (artifactStorageManager.isEnabled()) {
+ artifactStorageManager.put(vspId, versionId + ".reduced", new ByteArrayInputStream(fileToUploadBytes));
}
orchestrationTemplateCandidateUploadManager
.putUploadAsFinished(vspId, versionId, vspUploadStatus.getLockId(), VspUploadStatus.SUCCESS, user);