当前位置: 首页>>代码示例>>Java>>正文


Java OrientGraphNoTx.createVertexType方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:15,代码来源:ODBElement.java

示例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();
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:30,代码来源:OrientDBDatabase.java

示例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;
    }
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:44,代码来源:DevelopmentAPI.java


注:本文中的com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx.createVertexType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。