aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-04-13 11:21:15 +0100
committerMichael Morris <michael.morris@est.tech>2022-04-21 09:48:05 +0000
commit30ff812c65389f5ca4c91d9774d425e81ef62049 (patch)
treeb7d293c23621df6c1084b9ff7dbde9c7d7d888ac /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
parent225dabdf0812d1a3d9eb3a96740507744bb2b807 (diff)
Check if VLM is used before deleting
Checks if the VLM is in use by any VSP before allowing to delete it. Add unit tests for the delete method, considering the restriction. Applies minor refactors with related code. Change-Id: I4ff6ddf3959a4ca92ab68b29c8913fc6f0ebdb3c Issue-ID: SDC-3966 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
index 78ab818927..6e17679e4c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
@@ -18,6 +18,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+import static org.openecomp.sdc.versioning.dao.impl.zusammen.ItemZusammenDaoImpl.ItemInfoProperty.ITEM_TYPE;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
import com.amdocs.zusammen.datatypes.SessionContext;
@@ -31,6 +32,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
+import org.openecomp.sdc.datatypes.model.ItemType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.convertor.ElementToVSPGeneralConvertor;
import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.convertor.ElementToVSPQuestionnaireConvertor;
@@ -60,7 +62,8 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
@Override
public Collection<VspDetails> list(VspDetails entity) {
return zusammenAdaptor.listItems(createSessionContext()).stream()
- .filter(item -> "VendorSoftwareProduct".equals(item.getInfo().getProperty("item_type"))).map(new ElementToVSPGeneralConvertor()::convert)
+ .filter(item -> ItemType.vsp.getName().equals(item.getInfo().getProperty(ITEM_TYPE.getName())))
+ .map(new ElementToVSPGeneralConvertor()::convert)
.collect(Collectors.toList());
}