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


Java OClass.addSuperClass方法代码示例

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


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

示例1: ensureClassExists

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
private void ensureClassExists(final String className) {
	ODatabaseDocumentTx db = getGraph();
	final OSchemaProxy schema = db.getMetadata().getSchema();
	if (!schema.existsClass(className)) {
		final boolean wasInTX = db.getTransaction().isActive();
		if (wasInTX) {
			LOGGER.warn("Warning: premature commit needed to create class {}", className);
			saveDirty();
			getGraph().commit();
		}

		/*
		 * In order to be treated by OrientDB's query layer as a vertex (e.g. the "Graph" viewer
		 * in the OrientDB Studio), the vertex classes need to have V as a superclass and refer
		 * to outgoing edges as out_X and incoming edges as in_X. All edge documents must then
		 * belong to E or a subclass of and use out and in for the source and target of the edge.
		 */
		final OClass oClass = schema.createClass(className);
		if (className.startsWith(VERTEX_TYPE_PREFIX)) {
			OClass baseVertexClass = schema.getClass("V");
			if (baseVertexClass == null) {
				baseVertexClass = schema.createClass("V");
				baseVertexClass.setOverSize(2);
			}
			oClass.addSuperClass(baseVertexClass);
			OrientNode.setupDocumentClass(oClass);
		} else if (EDGE_TYPE.equals(className)) {
			OrientEdge.setupDocumentClass(oClass);
		}

		if (wasInTX) {
			db.begin();
		}
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:36,代码来源:OrientDatabase.java


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