summaryrefslogtreecommitdiffstats
path: root/catalog-dao
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-dao')
-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;
}
/**