本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx.createVertexType方法的典型用法代码示例。如果您正苦于以下问题:Java OrientGraphNoTx.createVertexType方法的具体用法?Java OrientGraphNoTx.createVertexType怎么用?Java OrientGraphNoTx.createVertexType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx
的用法示例。
在下文中一共展示了OrientGraphNoTx.createVertexType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createVertexType
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
protected void createVertexType() {
OrientGraphNoTx graph = dbServer.getGraphNoTx();
if (!graph.getRawGraph().getMetadata().getSchema().existsClass(NAME)) {
if (PARENT_NAME != ODBVertex.class.getSimpleName()) {
if (!graph.getRawGraph().getMetadata().getSchema().existsClass(PARENT_NAME)) {
graph.createVertexType(PARENT_NAME);
}
graph.createVertexType(NAME, PARENT_NAME);
} else {
graph.createVertexType(NAME);
}
}
}
示例2: addVertexType
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Override
public void addVertexType(Class<?> clazzOfVertex, Class<?> superClazzOfVertex) {
if (log.isDebugEnabled()) {
log.debug("Adding vertex type for class {" + clazzOfVertex.getName() + "}");
}
OrientGraphNoTx noTx = factory.getNoTx();
try {
OrientVertexType vertexType = noTx.getVertexType(clazzOfVertex.getSimpleName());
if (vertexType == null) {
String superClazz = "V";
if (superClazzOfVertex != null) {
superClazz = superClazzOfVertex.getSimpleName();
}
vertexType = noTx.createVertexType(clazzOfVertex.getSimpleName(), superClazz);
} else {
// Update the existing vertex type and set the super class
if (superClazzOfVertex != null) {
OrientVertexType superType = noTx.getVertexType(superClazzOfVertex.getSimpleName());
if (superType == null) {
throw new RuntimeException("The supertype for vertices of type {" + clazzOfVertex + "} can't be set since the supertype {"
+ superClazzOfVertex.getSimpleName() + "} was not yet added to orientdb.");
}
vertexType.setSuperClass(superType);
}
}
} finally {
noTx.shutdown();
}
}
示例3: saveDataModule
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
private Module saveDataModule(Module module) {
DataModel dataModel;
if (module.getModel() == null) {
dataModel = DataModel.createDefault();
dataModel.setName(module.getName());
module.setModel(HybridbpmCoreUtil.objectToJson(dataModel));
} else {
dataModel = HybridbpmCoreUtil.jsonToObject(module.getModel(), DataModel.class);
}
module.setCode(HybridbpmCoreUtil.createDataCode(dataModel));
OrientGraphNoTx graphNoTx = getOrientGraphNoTx();
OrientVertexType vertexType;
if (!graphNoTx.getRawGraph().getMetadata().getSchema().existsClass(module.getName())) {
vertexType = graphNoTx.createVertexType(module.getName());
} else {
vertexType = graphNoTx.getVertexType(module.getName());
}
for (FieldModel fieldModel : dataModel.getFields()) {
createProperty(vertexType, fieldModel, graphNoTx);
}
// TODO: check if we need to remove or not
// for (OProperty property : vertexType.declaredProperties()) {
// try {
// if (!dataModel.containsField(property.getName())) {
// vertexType.dropProperty(property.getName());
// }
// } catch (Exception ex) {
// Logger.getLogger(DevelopmentAPI.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
// }
// }
graphNoTx.commit();
try (OObjectDatabaseTx database = getOObjectDatabaseTx()) {
module.setUpdateDate(new Date());
module = database.save(module);
database.commit();
module = detach(module);
}
regenerateGroovySources();
return module;
}