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


Java ORID.isPersistent方法代码示例

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


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

示例1: onConfigure

import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Override
public void onConfigure(Component component) {
	super.onConfigure(component);
	Object object = component.getDefaultModelObject();
	if(object!=null && object instanceof OIdentifiable) {
		ORID rid = ((OIdentifiable)object).getIdentity();
		if(rid.isPersistent()) {
			component.setEnabled(true);
		} else {
			// Is record scheduled for creation?
			OTransaction transaction = OrientDbWebSession.get().getDatabase().getTransaction();
			ORecordOperation operation = transaction.getRecordEntry(rid);
			component.setEnabled(operation!=null && operation.type==ORecordOperation.CREATED);
		}
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:17,代码来源:DisableIfDocumentNotSavedBehavior.java

示例2: iterator

import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
@Override
public Iterator<OIdentifiable> iterator() {
	final int clusterId = db.getGraph().getClusterIdByName(clusterName);
	if (clusterId == -1) {
		return Collections.emptyListIterator();
	}

	final ORecordIteratorCluster<ODocument> it = db.getGraph().browseCluster(clusterName);
	return new Iterator<OIdentifiable>(){
		@Override
		public boolean hasNext() {
			return it.hasNext();
		}

		@Override
		public OIdentifiable next() {
			final ODocument doc = it.next();
			final ORID id = doc.getIdentity();
			if (id.isPersistent()) {
				return id;
			} else {
				return doc;
			}
		}

		@Override
		public void remove() {
			it.remove();
		}
	};
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:32,代码来源:OrientClusterDocumentIterable.java

示例3: create

import com.orientechnologies.orient.core.id.ORID; //导入方法依赖的package包/类
public static IGraphEdge create(OrientDatabase graph, OrientNode start, OrientNode end, String type, String edgeTypeName, Map<String, Object> props) {
	if (props != null && !props.isEmpty()) {
		// Has properties - heavyweight edge
		ODocument newDoc = new ODocument(edgeTypeName);
		newDoc.field(TYPE_PROPERTY, type);

		final ODocument startDoc = start.getDocument();
		final ORID startId = startDoc.getIdentity();
		if (startId.isPersistent()) {
			newDoc.field(FROM_PROPERTY, startId);
		} else {
			newDoc.field(FROM_PROPERTY, startDoc);
		}

		final ODocument endDoc = end.getDocument();
		final ORID endId = endDoc.getIdentity();
		if (endId.isPersistent()) {
			newDoc.field(TO_PROPERTY, endId);
		} else {
			newDoc.field(TO_PROPERTY, endDoc);
		}

		if (props != null) {
			for (Entry<String, Object> entry : props.entrySet()) {
				newDoc.field(entry.getKey(), entry.getValue());
			}
		}
		newDoc.save(edgeTypeName);

		OrientEdge newEdge;
		if (newDoc.getIdentity().isPersistent()) {
			newEdge = new OrientEdge(newDoc.getIdentity(), graph);
		} else {
			newEdge = new OrientEdge(newDoc, graph);
		}
		start.addOutgoing(newDoc, type);
		end.addIncoming(newDoc, type);

		return newEdge;
	} else {
		// No properties - lightweight edge
		start.addOutgoing(end.getDocument(), type);
		end.addIncoming(start.getDocument(), type);
		return new OrientLightEdge(start, end, type);
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:47,代码来源:OrientEdge.java


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