aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
diff options
context:
space:
mode:
authorayalaben <ayala.benzvi@amdocs.com>2018-03-05 14:24:21 +0200
committerayalaben <ayala.benzvi@amdocs.com>2018-03-05 14:24:21 +0200
commit0067871bc673ffa76c7232292156301e734fc922 (patch)
tree1103dfc3a757d298ba3e4fbcefce4ef35a19c0a3 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager
parent7d5ccf3d6207008321595ec45149a370ba80ffe8 (diff)
Delete VSP merge Hint - fix sonar issues
Change-Id: I7e8d3efd9db3ec714ab97d740cc71e826713b467 Issue-ID: SDC-1014 Signed-off-by: ayalaben <ayala.benzvi@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/VendorSoftwareProductManagerImpl.java72
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java2
4 files changed, 41 insertions, 46 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 7528110d37..423f9a51bb 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
@@ -41,7 +41,7 @@ public interface VendorSoftwareProductManager {
VspDetails getVsp(String vspId, Version version);
- void deleteVsp(String vspIdToDelete);
+ void deleteVsp(String vspId, Version version);
ValidationResponse validate(String vspId, Version version) throws IOException;
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 ad5717af25..ada88b8e1b 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
@@ -57,6 +57,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VspMergeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.errors.VendorSoftwareProductNotFoundErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
@@ -125,6 +126,7 @@ import java.util.zip.ZipOutputStream;
public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager {
+ private final VspMergeDao vspMergeDao;
private final OrchestrationTemplateDao orchestrationTemplateDao;
private final OrchestrationTemplateCandidateManager orchestrationTemplateCandidateManager;
private final VendorSoftwareProductInfoDao vspInfoDao;
@@ -144,6 +146,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private final UniqueValueUtil uniqueValueUtil;
public VendorSoftwareProductManagerImpl(
+ VspMergeDao vspMergeDao,
OrchestrationTemplateDao orchestrationTemplateDataDao,
OrchestrationTemplateCandidateManager orchestrationTemplateCandidateManager,
VendorSoftwareProductInfoDao vspInfoDao,
@@ -161,6 +164,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
ImageDao imageDao,
ManualVspToscaManager manualVspToscaManager,
UniqueValueDao uniqueValueDao) {
+ this.vspMergeDao = vspMergeDao;
this.orchestrationTemplateDao = orchestrationTemplateDataDao;
this.orchestrationTemplateCandidateManager = orchestrationTemplateCandidateManager;
this.vspInfoDao = vspInfoDao;
@@ -210,8 +214,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
orchestrationTemplateDao.get(vspId, version);
ToscaServiceModel serviceModel =
serviceModelDao.getServiceModel(vspId, vspDetails.getVersion());
- if (!isOrchestrationTemplateExist(orchestrationTemplate)
- || !isServiceModelExist(serviceModel)) {
+ if (isOrchestrationTemplateMissing(orchestrationTemplate)
+ || isServiceModelMissing(serviceModel)) {
vspErrors.add(VendorSoftwareProductInvalidErrorBuilder
.vendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(),
vspDetails.getVersion()));
@@ -299,7 +303,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
.generateToscaModel(manualVspToscaManager.gatherVspInformation(vspId, version))
: serviceModelDao.getServiceModel(vspId, version);
- return compile(vspId, version, serviceModel);
+ return compile(vspId, version, serviceModel);
}
private boolean validateComponentDependencies(
@@ -320,28 +324,28 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
if (!CollectionUtils.isEmpty(deploymentFlavors)) {
deploymentFlavors.forEach(deploymentFlavor -> {
DeploymentFlavorEntity deployment = deploymentFlavorDao.get(deploymentFlavor);
- DeploymentFlavor deploymentlocalFlavor = deployment.getDeploymentFlavorCompositionData();
- if (deploymentlocalFlavor != null) {
- if (deploymentlocalFlavor.getFeatureGroupId() == null) {
+ DeploymentFlavor deploymentLocalFlavor = deployment.getDeploymentFlavorCompositionData();
+ if (deploymentLocalFlavor != null) {
+ if (deploymentLocalFlavor.getFeatureGroupId() == null) {
ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder.
- getFeatureGroupMandatoryErrorBuilder(deploymentlocalFlavor.getModel());
+ getFeatureGroupMandatoryErrorBuilder(deploymentLocalFlavor.getModel());
errorCodeList.add(deploymentFlavorErrorBuilder);
}
- validateComponetComputeAssociations(errorCodeList, deploymentFlavor,
- deployment, deploymentlocalFlavor);
+ validateComponentComputeAssociations(errorCodeList, deploymentFlavor,
+ deployment, deploymentLocalFlavor);
}
});
}
return errorCodeList;
}
- private void validateComponetComputeAssociations(Collection<ErrorCode> errorCodeList,
- DeploymentFlavorEntity deploymentFlavor,
- DeploymentFlavorEntity deployment,
- DeploymentFlavor deploymentlocalFlavor) {
- List<ComponentComputeAssociation> componetComputeAssociations =
+ private void validateComponentComputeAssociations(Collection<ErrorCode> errorCodeList,
+ DeploymentFlavorEntity deploymentFlavor,
+ DeploymentFlavorEntity deployment,
+ DeploymentFlavor deploymentlocalFlavor) {
+ List<ComponentComputeAssociation> componentComputeAssociations =
deploymentlocalFlavor.getComponentComputeAssociations();
- if (CollectionUtils.isEmpty(componetComputeAssociations)) {
+ if (CollectionUtils.isEmpty(componentComputeAssociations)) {
CompositionEntityValidationData compositionEntityValidationData = new
CompositionEntityValidationData(CompositionEntityType.deployment, deploymentFlavor
.getId());
@@ -353,10 +357,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
errorCodeList.add(deploymentFlavorErrorBuilder);
} else {
- componetComputeAssociations.forEach(componetComputeAssociation -> {
- if (componetComputeAssociation == null
- || !(componetComputeAssociation.getComponentId() != null
- && componetComputeAssociation.getComputeFlavorId() != null)) {
+ componentComputeAssociations.forEach(componentComputeAssociation -> {
+ if (componentComputeAssociation == null
+ || !(componentComputeAssociation.getComponentId() != null
+ && componentComputeAssociation.getComputeFlavorId() != null)) {
CompositionEntityValidationData compositionEntityValidationData = new
CompositionEntityValidationData(CompositionEntityType.deployment,
deploymentFlavor.getId());
@@ -473,7 +477,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private Map<String, List<ErrorMessage>> compile(String vendorSoftwareProductId, Version version,
ToscaServiceModel serviceModel) {
- if (!isServiceModelExist(serviceModel)) {
+ if (isServiceModelMissing(serviceModel)) {
return null;
}
@@ -515,8 +519,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
VspDetails retrieved = vspInfoDao.get(vspDetails);
if (retrieved == null) {
throw new CoreException((new ErrorCode.ErrorCodeBuilder()
- .withMessage(String.format("Vsp with id %s and version %s does not exist.",
- vspDetails.getId(), vspDetails.getVersion().getId()))).build());
+ .withMessage(String.format("Vsp with id %s and version %s does not exist.",
+ vspDetails.getId(), vspDetails.getVersion().getId()))).build());
}
vspDetails.setOnboardingMethod(retrieved.getOnboardingMethod());
@@ -559,7 +563,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
public VspDetails getVsp(String vspId, Version version) {
- return getValidatedVsp(vspId, version);
+ return getValidatedVsp(vspId, version);
}
private VspDetails getValidatedVsp(String vspId, Version version) {
@@ -571,9 +575,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
- public void deleteVsp(String vspId) {
- throw new UnsupportedOperationException(
- VendorSoftwareProductConstants.UNSUPPORTED_OPERATION_ERROR);
+ public void deleteVsp(String vspId, Version version) {
+ vspMergeDao.deleteHint(vspId, version);
}
@Override
@@ -605,7 +608,6 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
@Override
-
public byte[] getOrchestrationTemplateFile(String vspId, Version version) {
OrchestrationTemplateEntity uploadData = orchestrationTemplateDao.get(vspId, version);
ByteBuffer contentData = uploadData.getContentData();
@@ -714,7 +716,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
private Map<String, List<ErrorMessage>> validateOrchestrationTemplate(
OrchestrationTemplateEntity orchestrationTemplate) throws IOException {
- if (!isOrchestrationTemplateExist(orchestrationTemplate)) {
+ if (isOrchestrationTemplateMissing(orchestrationTemplate)) {
return null;
}
Map<String, List<ErrorMessage>> validationErrors = new HashMap<>();
@@ -826,15 +828,15 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return computeDao.listByVsp(vspId, version);
}
- private boolean isOrchestrationTemplateExist(OrchestrationTemplateEntity orchestrationTemplate) {
- return orchestrationTemplate != null
- && orchestrationTemplate.getContentData() != null
- && orchestrationTemplate.getFileSuffix() != null
- && orchestrationTemplate.getFileName() != null;
+ private boolean isOrchestrationTemplateMissing(OrchestrationTemplateEntity orchestrationTemplate) {
+ return orchestrationTemplate == null
+ || orchestrationTemplate.getContentData() == null
+ || orchestrationTemplate.getFileSuffix() == null
+ || orchestrationTemplate.getFileName() == null;
}
- private boolean isServiceModelExist(ToscaServiceModel serviceModel) {
- return serviceModel != null && serviceModel.getEntryDefinitionServiceTemplate() != null;
+ private boolean isServiceModelMissing(ToscaServiceModel serviceModel) {
+ return serviceModel == null || serviceModel.getEntryDefinitionServiceTemplate() == null;
}
}
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 177af3a8bc..da4328dd91 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
@@ -24,20 +24,13 @@ import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.*;
import org.openecomp.sdc.vendorsoftwareproduct.factory.InformationArtifactGeneratorFactory;
public class VspManagerFactoryImpl extends VspManagerFactory {
private static final VendorSoftwareProductManager INSTANCE =
new VendorSoftwareProductManagerImpl(
+ VspMergeDaoFactory.getInstance().createInterface(),
OrchestrationTemplateDaoFactory.getInstance().createInterface(),
OrchestrationTemplateCandidateManagerFactory.getInstance().createInterface(),
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
index 71890bb9e8..6a195d72fb 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
@@ -324,7 +324,7 @@ public class OrchestrationUtil {
orchestrationTemplateDataDao.update(vspDetails.getId(), vspDetails.getVersion(), uploadData);
VspMergeDaoFactory.getInstance().createInterface()
- .updateVspModelId(vspDetails.getId(), vspDetails.getVersion());
+ .updateHint(vspDetails.getId(), vspDetails.getVersion());
}
public void saveServiceModel(String vspId, Version version,