summaryrefslogtreecommitdiffstats
path: root/catalog-dao/src
diff options
context:
space:
mode:
authorJulienBe <julien.bertozzi@intl.att.com>2021-01-19 10:54:52 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-01-20 10:34:31 +0000
commit5ce2da3100483eb505876b428c7c490ff445ba5c (patch)
treefdff7d173e531ed0f5a3f47652fc84b51a732bc9 /catalog-dao/src
parent3315931d554d25687737084ba70e23432e96c030 (diff)
Remove dead code
Remove unused variables Remove unnecessary statements Issue-ID: SDC-3428 Signed-off-by: JulienBe <julien.bertozzi@intl.att.com> Change-Id: Iddc8ffdc141edd409d50f90c03cb6612f6ebf042 Signed-off-by: JulienBe <julien.bertozzi@intl.att.com>
Diffstat (limited to 'catalog-dao/src')
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java6
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java15
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java6
3 files changed, 9 insertions, 18 deletions
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 03c08baf92..503ae856ca 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
@@ -76,7 +76,6 @@ public class SdcSchemaBuilder {
* @return true if the create operation was successful
*/
public boolean createSchema() {
- boolean res = false;
try(Cluster cluster = sdcSchemaUtils.createCluster();
Session session = cluster.connect()) {
log.info("creating Schema for Cassandra.");
@@ -99,12 +98,11 @@ public class SdcSchemaBuilder {
Map<String, List<String>> keyspaceMetadate = cassndraMetadata.get(keyspace.getKey());
createTables(keyspace.getValue(), keyspaceMetadate, session,metadataTablesStructure.get(keyspace.getKey()));
}
- res = true;
+ return true;
} catch (Exception e) {
log.error(EcompLoggerErrorCode.SCHEMA_ERROR, "creating Schema for Cassandra", "Cassandra", e.getLocalizedMessage());
- res = false;
+ return false;
}
- return res;
}
public boolean deleteSchema() {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
index 2174c8d295..8d2f24e6fa 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
@@ -1257,8 +1257,6 @@ public class JanusGraphGenericDao {
}
private JanusGraphOperationStatus lockNode(String lockId) {
- JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
-
GraphNodeLock lockNode = new GraphNodeLock(lockId);
Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew = createNode(lockNode, GraphNodeLock.class);
@@ -1271,19 +1269,17 @@ public class JanusGraphGenericDao {
JanusGraph tGraph = graph.left().value();
Either<JanusGraphVertex, JanusGraphOperationStatus> vertex = getVertexByProperty(lockNode.getUniqueIdKey(), lockNode.getUniqueId());
if (vertex.isLeft()) {
- status = relockNode(lockNode, lockNodeNew, tGraph, vertex);
+ return relockNode(lockNode, lockNodeNew, tGraph, vertex);
} else {
- status = vertex.right().value();
+ return vertex.right().value();
}
} else {
- status = graph.right().value();
+ return graph.right().value();
}
}
- return status;
}
private JanusGraphOperationStatus relockNode(GraphNodeLock lockNode, Either<GraphNodeLock, JanusGraphOperationStatus> lockNodeNew, JanusGraph tGraph, Either<JanusGraphVertex, JanusGraphOperationStatus> vertex) {
- JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
Long time = vertex.left().value().value(GraphPropertiesDictionary.CREATION_DATE.getProperty());
Long lockTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getJanusGraphLockTimeout();
if (time + lockTimeout * 1000 < System.currentTimeMillis()) {
@@ -1296,14 +1292,13 @@ public class JanusGraphGenericDao {
} else {
log.debug("Failed Lock node for {} . Commit transacton for deleted previous vertex .", lockNode.getUniqueIdKey());
janusGraphClient.commit();
- status = checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
+ return checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
}
} else {
log.debug("Failed Lock node for {} rollback transacton", lockNode.getUniqueIdKey());
janusGraphClient.rollback();
- status = checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
+ return checkLockError(lockNode.getUniqueIdKey(), lockNodeNew);
}
- return status;
}
public <T extends GraphNode> Either<List<ImmutablePair<T, GraphEdge>>, JanusGraphOperationStatus> getChildrenNodes(String key, String uniqueId, GraphEdgeLabels edgeType, NodeTypeEnum nodeTypeEnum, Class<T> clazz, boolean withEdges) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
index 3624bb353c..729d3c57da 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
@@ -985,18 +985,16 @@ public class JanusGraphDao {
public JanusGraphOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, EdgeLabelEnum prevLabel,
EdgeLabelEnum newLabel) {
- JanusGraphOperationStatus result = null;
Iterator<Edge> prevEdgeIter = toVertex.edges(Direction.IN, prevLabel.name());
if (prevEdgeIter == null || !prevEdgeIter.hasNext()) {
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG,
"Failed to replace edge with label {} to {} between vertices {} and {}", prevLabel, newLabel,
fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()),
toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()));
- result = JanusGraphOperationStatus.NOT_FOUND;
+ return JanusGraphOperationStatus.NOT_FOUND;
} else {
- result = replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel);
+ return replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel);
}
- return result;
}
/**