summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhai Singh <Abhai.Singh@amdocs.com>2018-01-03 18:35:21 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-01-03 14:22:30 +0000
commit247329c9f47f292428705d898a22948bb797e917 (patch)
tree0b3218c7e556d286a59f4126c09ff7765339d5e8
parent2d9c4b5fcb03c3ca36ce796e66a115f2fc640ac8 (diff)
Fix Sonar - ComponentArtifactDaoZusammenImpl
Fixed reported sonar issues Change-Id: I1d74c641d65d47a7ab810bef94b77ef3a55cd071 Issue-ID: SDC-343 Signed-off-by: Abhai Singh <Abhai.Singh@amdocs.com>
-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/ComponentArtifactDaoZusammenImpl.java35
1 files changed, 9 insertions, 26 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/ComponentArtifactDaoZusammenImpl.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/ComponentArtifactDaoZusammenImpl.java
index 01be738b56..1d55994aeb 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/ComponentArtifactDaoZusammenImpl.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/ComponentArtifactDaoZusammenImpl.java
@@ -17,6 +17,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploa
import java.io.ByteArrayInputStream;
import java.nio.ByteBuffer;
import java.util.Collection;
+import java.util.Collections;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -40,7 +41,7 @@ public class ComponentArtifactDaoZusammenImpl implements ComponentArtifactDao {
@Override
public void registerVersioning(String versionableEntityType) {
-
+ // registerVersioning is not implemented for ComponentArtifactDaoZusammenImpl
}
@Override
@@ -112,12 +113,11 @@ public class ComponentArtifactDaoZusammenImpl implements ComponentArtifactDao {
SessionContext context = createSessionContext();
ElementContext elementContext =
new ElementContext(mibEntity.getVspId(), mibEntity.getVersion().getId());
- ElementToComponentMonitoringUploadConvertor
- convertor = new ElementToComponentMonitoringUploadConvertor();
return zusammenAdaptor
.listElementsByName(context, elementContext, new Id(mibEntity.getComponentId()),
- ElementType.Mibs.toString()).stream()
- .map(elementInfo -> convertor.convert(elementInfo))
+ ElementType.Mibs.toString())
+ .stream()
+ .map(new ElementToComponentMonitoringUploadConvertor()::convert)
.map(mib -> {
mib.setVspId(mibEntity.getVspId());
mib.setVersion(mibEntity.getVersion());
@@ -129,20 +129,6 @@ public class ComponentArtifactDaoZusammenImpl implements ComponentArtifactDao {
@Override
public void deleteAll(ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
- /*ZusammenElement mibsElement =
- buildStructuralElement(ElementType.Mibs, Action.DELETE);
-
- ZusammenElement componentElement = buildComponentElement(componentMonitoringUploadEntity);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(componentMonitoringUploadEntity.getVspId(),
- componentMonitoringUploadEntity.getVersion().getId());
-
- zusammenAdaptor.saveElement(context, elementContext,
- VspaggregateElements(componentElement, mibsElement), "Delete mibs");
-
-*/
SessionContext context = createSessionContext();
ElementContext elementContext =
new ElementContext(componentMonitoringUploadEntity.getVspId(),
@@ -176,7 +162,7 @@ public class ComponentArtifactDaoZusammenImpl implements ComponentArtifactDao {
new Id(monitoringUploadEntity.getComponentId()), ElementType.Mibs.name());
if (!elementByName.isPresent()) {
- return null;
+ return Collections.emptyList();
} else {
final Id elementId = elementByName.get().getElementId();
return zusammenAdaptor.listElementData(context, elementContext, elementId).stream()
@@ -212,14 +198,11 @@ public class ComponentArtifactDaoZusammenImpl implements ComponentArtifactDao {
private ZusammenElement buildMibElementStructure(
ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
- ZusammenElement monitoringElement =
- buildStructuralElement(getMonitoringStructuralElement(componentMonitoringUploadEntity.getType()),
- Action.UPDATE);
- return monitoringElement;
+ return buildStructuralElement(getMonitoringStructuralElement(componentMonitoringUploadEntity
+ .getType()), Action.UPDATE);
}
- private ElementType getMonitoringStructuralElement(MonitoringUploadType type)
- throws IllegalArgumentException {
+ private ElementType getMonitoringStructuralElement(MonitoringUploadType type){
switch (type) {
case SNMP_POLL:
return ElementType.SNMP_POLL;