use of org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary in project sdc by onap.
the class InMemoryJanusGraphClient method createJanusGraphSchema.
private void createJanusGraphSchema() {
JanusGraphManagement graphMgt = graph.openManagement();
JanusGraphIndex index = null;
for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
PropertyKey propKey = null;
if (!graphMgt.containsPropertyKey(prop.getProperty())) {
Class<?> clazz = prop.getClazz();
if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) {
propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
}
} else {
propKey = graphMgt.getPropertyKey(prop.getProperty());
}
if (prop.isIndexed()) {
if (!graphMgt.containsGraphIndex(prop.getProperty())) {
if (prop.isUnique()) {
index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex();
// Ensures
graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK);
// only
// one
// name
// per
// vertex
// Ensures
graphMgt.setConsistency(index, ConsistencyModifier.LOCK);
// name
// uniqueness
// in
// the
// graph
} else {
graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex();
}
}
}
}
graphMgt.commit();
}
use of org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary in project sdc by onap.
the class JanusGraphInitializer method createVertexIndixes.
private static void createVertexIndixes() {
logger.info("** createVertexIndixes started");
JanusGraphManagement graphMgt = graph.openManagement();
JanusGraphIndex index = null;
for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
PropertyKey propKey = null;
if (!graphMgt.containsPropertyKey(prop.getProperty())) {
Class<?> clazz = prop.getClazz();
if (!clazz.isAssignableFrom(ArrayList.class) && !clazz.isAssignableFrom(HashMap.class)) {
propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
}
} else {
propKey = graphMgt.getPropertyKey(prop.getProperty());
}
if (prop.isIndexed()) {
if (!graphMgt.containsGraphIndex(prop.getProperty())) {
if (prop.isUnique()) {
index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex();
// Ensures
graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK);
// only
// one
// name
// per
// vertex
// Ensures
graphMgt.setConsistency(index, ConsistencyModifier.LOCK);
// name
// uniqueness
// in
// the
// graph
} else {
graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex();
}
}
}
}
graphMgt.commit();
logger.info("** createVertexIndixes ended");
}
use of org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary in project sdc by onap.
the class JanusGraphClient method createJanusGraphSchema.
private void createJanusGraphSchema() {
JanusGraphManagement graphMgt = graph.openManagement();
JanusGraphIndex index = null;
for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
PropertyKey propKey = null;
if (!graphMgt.containsPropertyKey(prop.getProperty())) {
Class<?> clazz = prop.getClazz();
if (!clazz.isAssignableFrom(ArrayList.class) && !clazz.isAssignableFrom(HashMap.class)) {
propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
}
} else {
propKey = graphMgt.getPropertyKey(prop.getProperty());
}
if (prop.isIndexed() && !graphMgt.containsGraphIndex(prop.getProperty())) {
if (prop.isUnique()) {
index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex();
// Ensures only one name per vertex
graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK);
// Ensures name uniqueness in the graph
graphMgt.setConsistency(index, ConsistencyModifier.LOCK);
} else {
graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex();
}
}
}
graphMgt.commit();
}
use of org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary in project sdc by onap.
the class JanusGraphTestSetup method createVertexIndixes.
private static void createVertexIndixes() {
logger.info("** createVertexIndixes started");
JanusGraphManagement graphMgt = graph.openManagement();
JanusGraphIndex index = null;
for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
PropertyKey propKey = null;
if (!graphMgt.containsPropertyKey(prop.getProperty())) {
Class<?> clazz = prop.getClazz();
if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) {
propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
}
} else {
propKey = graphMgt.getPropertyKey(prop.getProperty());
}
if (prop.isIndexed()) {
if (!graphMgt.containsGraphIndex(prop.getProperty())) {
if (prop.isUnique()) {
index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex();
// Ensures
graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK);
// only
// one
// name
// per
// vertex
// Ensures
graphMgt.setConsistency(index, ConsistencyModifier.LOCK);
// name
// uniqueness
// in
// the
// graph
} else {
graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex();
}
}
}
}
graphMgt.commit();
logger.info("** createVertexIndixes ended");
}
Aggregations