summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
diff options
context:
space:
mode:
authorshrikantawachar <shrikant.awachar@amdocs.com>2018-03-08 13:33:17 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-03-08 08:46:07 +0000
commit2b60bd08c6b209c0817fac84970c35df4abca6ed (patch)
tree46483522798ca139bce9ce8c08c988001aad730d /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
parent9a79dcedfaaf173d2f301bb18b1832a799b1bc2f (diff)
Download processed file
Download processed file Change-Id: Ieaaea0ce231bc0418d9d997d652f85f1743031f0 Issue-ID: SDC-1087 Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java26
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java4
4 files changed, 30 insertions, 10 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
index 423f9a51bb..1b07f681ac 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
@@ -16,6 +16,7 @@
package org.openecomp.sdc.vendorsoftwareproduct;
+import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateEntity;
@@ -68,6 +69,7 @@ public interface VendorSoftwareProductManager {
File getInformationArtifact(String vspId, Version version);
+ public Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException;
Collection<ComputeEntity> getComputeByVsp(String vspId, Version version);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
index 97a4a213af..cfb4c9dbfd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
@@ -22,10 +22,8 @@ import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -52,8 +50,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
-import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
-
public class OrchestrationTemplateCandidateManagerImpl
implements OrchestrationTemplateCandidateManager {
private static final Logger LOGGER =
@@ -128,10 +124,6 @@ public class OrchestrationTemplateCandidateManagerImpl
fetchCandidateDataEntity(vspId, version);
if (!candidateDataEntity.isPresent()) {
- ErrorMessage errorMessage = new ErrorMessage(ErrorLevel.ERROR,
- getErrorWithParameters(Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage(),
- ""));
- LOGGER.error(errorMessage.getMessage());
return Optional.empty();
}
OnboardingTypesEnum type =
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index ada88b8e1b..f116abef16 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -18,6 +18,8 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.core.dao.UniqueValueDao;
import org.openecomp.core.enrichment.api.EnrichmentManager;
import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory;
@@ -82,6 +84,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilde
import org.openecomp.sdc.vendorsoftwareproduct.errors.TranslationFileCreationErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator;
+import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult;
@@ -144,6 +147,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private final ImageDao imageDao;
private final ManualVspToscaManager manualVspToscaManager;
private final UniqueValueUtil uniqueValueUtil;
+ private final CandidateService candidateService;
public VendorSoftwareProductManagerImpl(
VspMergeDao vspMergeDao,
@@ -163,7 +167,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
ComputeDao computeDao,
ImageDao imageDao,
ManualVspToscaManager manualVspToscaManager,
- UniqueValueDao uniqueValueDao) {
+ UniqueValueDao uniqueValueDao,
+ CandidateService candidateService) {
this.vspMergeDao = vspMergeDao;
this.orchestrationTemplateDao = orchestrationTemplateDataDao;
this.orchestrationTemplateCandidateManager = orchestrationTemplateCandidateManager;
@@ -182,6 +187,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
this.imageDao = imageDao;
this.manualVspToscaManager = manualVspToscaManager;
this.uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
+ this.candidateService = candidateService;
registerToVersioning();
}
@@ -817,6 +823,24 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
.generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, schemaInput);
}
+ @Override
+ public Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException {
+
+ OrchestrationTemplateEntity orchestrationTemplateEntity =
+ orchestrationTemplateDao.get(vspId, version);
+
+ if (isOrchestrationTemplateMissing(orchestrationTemplateEntity)) {
+ return Optional.empty();
+ }
+
+ if (CommonUtil.isFileOriginFromZip(orchestrationTemplateEntity.getFileSuffix())) {
+ return Optional.of(new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(), candidateService
+ .getZipData(orchestrationTemplateEntity.getContentData())));
+ }
+ return Optional.of(new ImmutablePair<>(orchestrationTemplateEntity.getFileSuffix(),
+ orchestrationTemplateEntity.getContentData().array()));
+ }
+
void updateUniqueName(String oldVspName, String newVspName) {
uniqueValueUtil.updateUniqueValue(
VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME,
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
index da4328dd91..75351e2fc5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java
@@ -25,6 +25,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateMan
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.*;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
import org.openecomp.sdc.vendorsoftwareproduct.factory.InformationArtifactGeneratorFactory;
public class VspManagerFactoryImpl extends VspManagerFactory {
@@ -47,7 +48,8 @@ public class VspManagerFactoryImpl extends VspManagerFactory {
ComputeDaoFactory.getInstance().createInterface(),
ImageDaoFactory.getInstance().createInterface(),
new ManualVspToscaManagerImpl(),
- UniqueValueDaoFactory.getInstance().createInterface());
+ UniqueValueDaoFactory.getInstance().createInterface(), CandidateServiceFactory
+ .getInstance().createInterface());
@Override
public VendorSoftwareProductManager createInterface() {