aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-12-27 14:46:35 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-27 13:52:55 +0000
commit2f5ef8c70eca7c17445efb5f6f9e637c60dd180e (patch)
tree01ee3671bdfa6632d616ee9c0b87a819cf61aaf7
parent7784ac0089bbd7b64b45a07d81cecb877eb77f36 (diff)
Refactored as per given comment
Removed exception handling fixes Change-Id: Ie5a89783a63ebcf4b404db4f2b8be2c7b2140e50 Issue-ID: SDC-343 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java36
1 files changed, 27 insertions, 9 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
index b0e1e17f57..1db8875a05 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
import org.apache.commons.collections4.MapUtils;
@@ -37,15 +53,15 @@ import java.util.Optional;
public class OrchestrationTemplateProcessCsarHandler
implements OrchestrationTemplateProcessHandler {
- private static final Logger LOGGER =
- LoggerFactory.getLogger(OrchestrationTemplateProcessCsarHandler.class);
- private CandidateService candidateService =
- CandidateServiceFactory.getInstance().createInterface();
- ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(OrchestrationTemplateProcessCsarHandler.class);
+ private final CandidateService candidateService = CandidateServiceFactory
+ .getInstance().createInterface();
+ private final ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
@Override
public OrchestrationTemplateActionResponse process(VspDetails vspDetails,
- OrchestrationTemplateCandidateData candidateData) {
+ OrchestrationTemplateCandidateData candidateData) {
LOGGER.audit(
AuditMessages.AUDIT_MSG + AuditMessages.CSAR_VALIDATION_STARTED + vspDetails.getId());
@@ -102,11 +118,13 @@ public class OrchestrationTemplateProcessCsarHandler
OnboardingTypesEnum.CSAR, errors);
orchestrationUtil.deleteUploadDataAndContent(vspDetails.getId(), vspDetails.getVersion());
- orchestrationUtil.saveUploadData(vspDetails, candidateData, zipByteArrayInputStream.get(),
- fileContentHandler, tree);
+ zipByteArrayInputStream.ifPresent(byteArrayInputStream -> orchestrationUtil
+ .saveUploadData(vspDetails, candidateData, byteArrayInputStream,
+ fileContentHandler, tree));
ToscaServiceModel toscaServiceModel = new ToscaConverterImpl().convert(fileContentHandler);
- orchestrationUtil.saveServiceModel(vspDetails.getId(), vspDetails.getVersion(), toscaServiceModel,
+ orchestrationUtil.saveServiceModel(vspDetails.getId(),
+ vspDetails.getVersion(), toscaServiceModel,
toscaServiceModel);
}