本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertexType方法的典型用法代码示例。如果您正苦于以下问题:Java OrientBaseGraph.getVertexType方法的具体用法?Java OrientBaseGraph.getVertexType怎么用?Java OrientBaseGraph.getVertexType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tinkerpop.blueprints.impls.orient.OrientBaseGraph
的用法示例。
在下文中一共展示了OrientBaseGraph.getVertexType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkIndexUniqueness
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入方法依赖的package包/类
@Override
public <T extends MeshElement> T checkIndexUniqueness(String indexName, T element, Object key) {
FramedGraph graph = Tx.getActive().getGraph();
OrientBaseGraph orientBaseGraph = unwrapCurrentGraph();
OrientVertexType vertexType = orientBaseGraph.getVertexType(element.getClass().getSimpleName());
if (vertexType != null) {
OIndex<?> index = vertexType.getClassIndex(indexName);
if (index != null) {
Object recordId = index.get(key);
if (recordId != null) {
if (recordId.equals(element.getElement().getId())) {
return null;
} else {
return (T) graph.getFramedVertexExplicit(element.getClass(), recordId);
}
}
}
}
return null;
}
示例2: addVertrexType
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入方法依赖的package包/类
public static void addVertrexType(OrientBaseGraph graph, Class<?> clasz) {
if (clasz.isAnnotationPresent(DatabaseVertrex.class)) {
//Map<String, DatabaseProperty> mapSchemaProperty = new HashMap<String, DatabaseProperty>();
DatabaseVertrex classAnotation = clasz.getAnnotation(DatabaseVertrex.class);
String className = clasz.getSimpleName();
if(StringUtils.isNotBlank(classAnotation.name())) {
className = classAnotation.name();
}
OrientVertexType oClass = graph.getVertexType(className);
Class<?> parentClass = clasz.getSuperclass();
while(!parentClass.isAnnotationPresent(DatabaseVertrex.class) && (parentClass.getSuperclass() != null)) {
parentClass = parentClass.getSuperclass();
}
OrientVertexType oParentClass = graph.getVertexType(parentClass.getSimpleName());
if (parentClass.getSimpleName().equals(Object.class.getSimpleName())) {
oParentClass = graph.getVertexBaseType();
}
if (oClass == null) {
logger.warn("Add Vertrex @" + className + " child of @" + oParentClass);
graph.createVertexType(className, oParentClass.getName());
} else {
if (logger.isDebugEnabled())
logger.debug("Vertrex @" + className + " exist, child of @" + oParentClass);
}
}
}
示例3: initialize
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入方法依赖的package包/类
@Override
public void initialize() {
final OrientBaseGraph db = context.getConnection();
/**
* Avoid creating scheme if table already exist.
* Look method implementation: internally it use document api the same way as it was used in
* document sample.
*/
if (db.getVertexType(CLASS_NAME) != null) {
return;
}
/**
* In database scheme the only difference with other apis would be that
* Sample class would extend "V" in scheme (which marks type as Vertex type).
*/
final OrientVertexType vtype = db.createVertexType(CLASS_NAME);
vtype.createProperty("name", OType.STRING);
vtype.createProperty("amount", OType.INTEGER);
// registration of graph type is not mandatory (orient will create it on-the-fly)
// but with warning
// also note that edge name is case-insensitive and so used as "belongsTo" everywhere in code
db.createEdgeType("BelongsTo");
}
示例4: ensureNodeTypeExistence
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph; //导入方法依赖的package包/类
private void ensureNodeTypeExistence( OrientBaseGraph graph, String type ) {
if( graph.getVertexType( type ) == null ) {
graph.createVertexType( type );
}
}