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


Java OrientGraphNoTx.getVertexType方法代码示例

本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx.getVertexType方法的典型用法代码示例。如果您正苦于以下问题:Java OrientGraphNoTx.getVertexType方法的具体用法?Java OrientGraphNoTx.getVertexType怎么用?Java OrientGraphNoTx.getVertexType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx的用法示例。


在下文中一共展示了OrientGraphNoTx.getVertexType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: removeVertexType

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Override
public void removeVertexType(String typeName) {
	if (log.isDebugEnabled()) {
		log.debug("Removing vertex type with name {" + typeName + "}");
	}
	OrientGraphNoTx noTx = factory.getNoTx();
	try {
		OrientVertexType type = noTx.getVertexType(typeName);
		if (type != null) {
			noTx.dropVertexType(typeName);
		}
	} finally {
		noTx.shutdown();
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:16,代码来源:OrientDBDatabase.java

示例3: addVertexIndex

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Override
public void addVertexIndex(String indexName, Class<?> clazzOfVertices, boolean unique, String fieldKey, FieldType fieldType) {
	if (log.isDebugEnabled()) {
		log.debug("Adding vertex index  for class {" + clazzOfVertices.getName() + "}");
	}
	OrientGraphNoTx noTx = factory.getNoTx();
	try {
		String name = clazzOfVertices.getSimpleName();
		OrientVertexType v = noTx.getVertexType(name);
		if (v == null) {
			throw new RuntimeException("Vertex type {" + name + "} is unknown. Can't create index {" + indexName + "}");
		}

		if (v.getProperty(fieldKey) == null) {
			OType type = convertType(fieldType);
			OType subType = convertToSubType(fieldType);
			if (subType != null) {
				v.createProperty(fieldKey, type, subType);
			} else {
				v.createProperty(fieldKey, type);
			}
		}

		if (v.getClassIndex(indexName) == null) {
			v.createIndex(indexName, unique ? OClass.INDEX_TYPE.UNIQUE_HASH_INDEX.toString() : OClass.INDEX_TYPE.NOTUNIQUE_HASH_INDEX.toString(),
					null, new ODocument().fields("ignoreNullValues", true), new String[] { fieldKey });
		}
	} finally {
		noTx.shutdown();
	}

}
 
开发者ID:gentics,项目名称:mesh,代码行数:33,代码来源:OrientDBDatabase.java

示例4: 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.getVertexType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。