From a8a96339680fa1c4df5577285442e902b5637631 Mon Sep 17 00:00:00 2001 From: vasraz Date: Wed, 19 Aug 2020 18:01:52 +0100 Subject: Fix Vulnerabilities reported by SONAR Change-Id: I8f4e173a4ea5111db55eebaf15be86f1583082ad Signed-off-by: Vasyl Razinkov Issue-ID: SDC-3248 --- .../be/dao/cassandra/schema/SdcSchemaBuilder.java | 16 ++++------- .../sdc/be/dao/neo4j/GraphEdgeLabels.java | 18 ++++--------- .../dao/neo4j/GraphEdgePropertiesDictionary.java | 29 +++++--------------- .../be/dao/neo4j/GraphPropertiesDictionary.java | 31 +++++----------------- .../sdc/be/resources/data/ComponentCacheData.java | 10 +++---- .../sdc/be/resources/data/DAOArtifactData.java | 2 +- 6 files changed, 28 insertions(+), 78 deletions(-) (limited to 'catalog-dao') diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java index c5e578ced2..03c08baf92 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java @@ -27,6 +27,8 @@ import com.datastax.driver.core.schemabuilder.Alter; import com.datastax.driver.core.schemabuilder.Create; import com.datastax.driver.core.schemabuilder.SchemaBuilder; import com.datastax.driver.core.schemabuilder.SchemaStatement; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.dao.cassandra.schema.tables.OldExternalApiEventTableDesc; @@ -384,20 +386,12 @@ public class SdcSchemaBuilder { return query; } - - + @AllArgsConstructor public enum ReplicationStrategy { NETWORK_TOPOLOGY_STRATEGY("NetworkTopologyStrategy"), SIMPLE_STRATEGY("SimpleStrategy"); - public String strategyName; - - private ReplicationStrategy(String strategyName) { - this.strategyName = strategyName; - } - - public String getStrategyName() { - return strategyName; - } + @Getter + private final String strategyName; } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java index 5b386f18bb..fc30a7e8f3 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java @@ -22,7 +22,10 @@ package org.openecomp.sdc.be.dao.neo4j; import java.util.ArrayList; import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +@AllArgsConstructor public enum GraphEdgeLabels { // field name @@ -41,19 +44,8 @@ public enum GraphEdgeLabels { GROUP("GROUP"), GROUP_ARTIFACT_REF("GROUP_ARTIFACT_REF"), GROUP_MEMBER("GROUP_MEMBER"), INPUT("EDGE_INPUT"), GET_INPUT("GET_INPUT"), GROUP_INST("GROUP_INST"), GROUP_TYPE_CAPABILITY_TYPE("GROUP_TYPE_CAPABILITY_TYPE"), GROUP_TYPE_CAPABILITY("GROUP_TYPE_CAPABILITY"); - private String property; - - GraphEdgeLabels(String property) { - this.property = property; - } - - public String getProperty() { - return property; - } - - public void setProperty(String property) { - this.property = property; - } + @Getter + private final String property; public static List getAllProperties() { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java index 58bd098d77..b8209e8d03 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java @@ -22,7 +22,11 @@ package org.openecomp.sdc.be.dao.neo4j; import java.util.ArrayList; import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +@AllArgsConstructor +@Getter public enum GraphEdgePropertiesDictionary { // field name class type @@ -36,29 +40,8 @@ public enum GraphEdgePropertiesDictionary { LEFT_OCCURRENCES("leftOccurrences", String.class), GET_INPUT_INDEX("get_input_index", String.class); - private String property; - private Class clazz; - - GraphEdgePropertiesDictionary(String property, Class clazz) { - this.property = property; - this.clazz = clazz; - } - - public String getProperty() { - return property; - } - - public void setProperty(String property) { - this.property = property; - } - - public Class getClazz() { - return clazz; - } - - public void setClazz(Class clazz) { - this.clazz = clazz; - } + private final String property; + private final Class clazz; public static List getAllProperties() { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java index e27839ecb9..da6e5d5d44 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java @@ -20,6 +20,11 @@ package org.openecomp.sdc.be.dao.neo4j; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter public enum GraphPropertiesDictionary { // field name class type unique indexed // stored in graph index @@ -151,33 +156,9 @@ public enum GraphPropertiesDictionary { IS_VSP_ARCHIVED ("isVspArchived", Boolean.class, false, true), ARCHIVE_TIME ("archiveTime", Long.class, false, true); - private final String property; - private final Class clazz; + private final Class clazz; private final boolean unique; private final boolean indexed; - GraphPropertiesDictionary(String property,Class clazz, boolean unique,boolean indexed) { - this.property = property; - this.clazz = clazz; - this.unique = unique; - this.indexed = indexed; - } - - - public String getProperty() { - return property; - } - - public Class getClazz() { - return clazz; - } - - public boolean isUnique() { - return unique; - } - - public boolean isIndexed() { - return indexed; - } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentCacheData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentCacheData.java index bf17383c07..7c960ae06e 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentCacheData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentCacheData.java @@ -29,13 +29,13 @@ import java.util.Date; @Table(keyspace = "sdccomponent", name = "componentcache") public class ComponentCacheData { - public final static String RRESOURCE_ID_FIELD = "resourceId"; + public static final String RESOURCE_ID_FIELD = "resourceId"; - public final static String SERVICE_NAME_FIELD = "serviceName"; - public final static String SERVICE_VERSION_FIELD = "serviceVersion"; - public final static String ARTIFACT_NAME_FIELD = "artifactName"; + public static final String SERVICE_NAME_FIELD = "serviceName"; + public static final String SERVICE_VERSION_FIELD = "serviceVersion"; + public static final String ARTIFACT_NAME_FIELD = "artifactName"; - public static String delim = ":"; + public static final String delim = ":"; @PartitionKey @Column(name = "id") diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DAOArtifactData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DAOArtifactData.java index 6d0a32d1d8..28a5d3569a 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DAOArtifactData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DAOArtifactData.java @@ -35,7 +35,7 @@ public class DAOArtifactData { public static final String SERVICE_VERSION_FIELD = "serviceVersion"; public static final String ARTIFACT_NAME_FIELD = "artifactName"; - public static String delim = ":"; + public static final String delim = ":"; @PartitionKey @Column(name = "id") -- cgit 1.2.3-korg