aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorAbhai Singh <Abhai.Singh@amdocs.com>2018-01-03 19:42:55 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-01-04 10:04:35 +0000
commit172834d00381a5ad3b4c9d7a15699a31162c14bb (patch)
tree20276513a7f07b3d8cf7acc013c756ef9b1093ff /openecomp-be
parent11848a9de277b2b99ad369cb6ae7ed66611d4eef (diff)
Fix Sonar VendorSoftwareProductInfoDaoZusammenImpl
Fixed reported sonar issue Change-Id: Ifc827f6e1ac4c10272969e643d10b86171a0d963 Issue-ID: SDC-343 Signed-off-by: Abhai Singh <Abhai.Singh@amdocs.com>
Diffstat (limited to 'openecomp-be')
-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.java83
-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/convertor/ElementToVSPGeneralConvertor.java24
2 files changed, 45 insertions, 62 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 aa192ede17..c6909d8d07 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
@@ -45,16 +45,12 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
@Override
public Collection<VspDetails> list(VspDetails entity) {
- ElementToVSPGeneralConvertor convertor = new ElementToVSPGeneralConvertor();
-
-
return zusammenAdaptor.listItems(createSessionContext()).stream()
.filter(item -> "VendorSoftwareProduct".equals(item.getInfo().getProperty("item_type")))
- .map(item -> convertor.convert(item))
+ .map(new ElementToVSPGeneralConvertor()::convert)
.collect(Collectors.toList());
}
-
@Override
public void create(VspDetails vspDetails) {
ZusammenElement generalElement = mapVspDetailsToZusammenElement(vspDetails, Action.CREATE);
@@ -186,19 +182,6 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
questionnaireElement, "Update VSP Questionnaire");
}
-
- /* @Override
- public String getQuestionnaireData(String vspId, Version version) {
- SessionContext context = createSessionContext();
-
- return zusammenAdaptor
- .getElementByName(context, new ElementContext(vspId, version.getId()), null,
- ElementType.Questionnaire.name())
- .map(questionnaireElement ->
- new String(FileUtils.toByteArray(questionnaireElement.getData())))
- .orElse(null);
- }*/
-
@Override
public VspQuestionnaireEntity getQuestionnaire(String vspId, Version version) {
@@ -215,10 +198,8 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
@Override
public boolean isManual(String vspId, Version version) {
final VspDetails vspDetails = get(new VspDetails(vspId, version));
- if (vspDetails != null) {
- if ("Manual".equals(vspDetails.getOnboardingMethod())) {
+ if (vspDetails != null && "Manual".equals(vspDetails.getOnboardingMethod())) {
return true;
- }
}
return false;
}
@@ -237,41 +218,43 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
return questionnaireElement;
}
- private ZusammenElement mapTestElementToZusammenElement(String elementData) {
- ZusammenElement testElement =
- buildStructuralElement(ElementType.test, Action.UPDATE);
- testElement.setData(new ByteArrayInputStream(elementData.getBytes()));
- return testElement;
- }
-
private void addVspDetailsToInfo(Info info, VspDetails vspDetails) {
- info.addProperty(InfoPropertyName.name.name(), vspDetails.getName());
- info.addProperty(InfoPropertyName.description.name(), vspDetails.getDescription());
- info.addProperty(InfoPropertyName.icon.name(), vspDetails.getIcon());
- info.addProperty(InfoPropertyName.category.name(), vspDetails.getCategory());
- info.addProperty(InfoPropertyName.subCategory.name(), vspDetails.getSubCategory());
- info.addProperty(InfoPropertyName.vendorId.name(), vspDetails.getVendorId());
- info.addProperty(InfoPropertyName.vendorName.name(), vspDetails.getVendorName());
+ info.addProperty(InfoPropertyName.NAME.getValue(), vspDetails.getName());
+ info.addProperty(InfoPropertyName.DESCRIPTION.getValue(), vspDetails.getDescription());
+ info.addProperty(InfoPropertyName.ICON.getValue(), vspDetails.getIcon());
+ info.addProperty(InfoPropertyName.CATEGORY.getValue(), vspDetails.getCategory());
+ info.addProperty(InfoPropertyName.SUB_CATEGORY.getValue(), vspDetails.getSubCategory());
+ info.addProperty(InfoPropertyName.VENDOR_ID.getValue(), vspDetails.getVendorId());
+ info.addProperty(InfoPropertyName.VENDOR_NAME.getValue(), vspDetails.getVendorName());
if (vspDetails.getVlmVersion() != null) {
- info.addProperty(InfoPropertyName.vendorVersion.name(), vspDetails.getVlmVersion().getId());
+ info.addProperty(InfoPropertyName.VENDOR_VERSION.getValue(), vspDetails.getVlmVersion().getId());
}
- info.addProperty(InfoPropertyName.licenseAgreement.name(), vspDetails.getLicenseAgreement());
- info.addProperty(InfoPropertyName.featureGroups.name(), vspDetails.getFeatureGroups());
- info.addProperty(InfoPropertyName.onboardingMethod.name(), vspDetails.getOnboardingMethod());
+ info.addProperty(InfoPropertyName.LICENSE_AGREEMENT.getValue(), vspDetails.getLicenseAgreement());
+ info.addProperty(InfoPropertyName.FEATURE_GROUPS.getValue(), vspDetails.getFeatureGroups());
+ info.addProperty(InfoPropertyName.ON_BOARDING_METHOD.getValue(), vspDetails.getOnboardingMethod());
}
public enum InfoPropertyName {
- name,
- description,
- icon,
- category,
- subCategory,
- vendorId,
- vendorName,
- vendorVersion,
- licenseAgreement,
- featureGroups,
- onboardingMethod
+ NAME("name"),
+ DESCRIPTION("description"),
+ ICON("icon"),
+ CATEGORY("category"),
+ SUB_CATEGORY("subCategory"),
+ VENDOR_ID("vendorId"),
+ VENDOR_NAME("vendorName"),
+ VENDOR_VERSION("vendorVersion"),
+ LICENSE_AGREEMENT("licenseAgreement"),
+ FEATURE_GROUPS("featureGroups"),
+ ON_BOARDING_METHOD("onboardingMethod");
+
+ private String value;
+ InfoPropertyName(String value){
+ this.value=value;
+ }
+
+ public String getValue(){
+ return value;
+ }
}
}
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/convertor/ElementToVSPGeneralConvertor.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/convertor/ElementToVSPGeneralConvertor.java
index c5c2f91595..a69b8da271 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/convertor/ElementToVSPGeneralConvertor.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/convertor/ElementToVSPGeneralConvertor.java
@@ -45,31 +45,31 @@ public class ElementToVSPGeneralConvertor extends ElementConvertor {
VspDetails vspDetails = new VspDetails();
vspDetails.setName(info.getProperty(VendorSoftwareProductInfoDaoZusammenImpl
- .InfoPropertyName.name.name()));
+ .InfoPropertyName.NAME.getValue()));
vspDetails.setDescription(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.description.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.DESCRIPTION.getValue()));
vspDetails.setIcon(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.icon.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.ICON.getValue()));
vspDetails.setCategory(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.category.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.CATEGORY.getValue()));
vspDetails.setSubCategory(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.subCategory.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.SUB_CATEGORY.getValue()));
vspDetails.setVendorId(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.vendorId.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_ID.getValue()));
vspDetails.setVendorName(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.vendorName.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_NAME.getValue()));
if (info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.vendorVersion.name()) != null) {
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_VERSION.getValue()) != null) {
vspDetails.setVlmVersion(new Version(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.vendorVersion.name())));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_VERSION.getValue())));
}
vspDetails.setLicenseAgreement(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.licenseAgreement.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.LICENSE_AGREEMENT.getValue()));
vspDetails.setFeatureGroups(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.featureGroups.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.FEATURE_GROUPS.getValue()));
vspDetails.setOnboardingMethod(info.getProperty(
- VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.onboardingMethod.name()));
+ VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.ON_BOARDING_METHOD.getValue()));
return vspDetails;
}