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


Java ODocument.fieldNames方法代码示例

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


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

示例1: getMap

import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
protected Map<String, Object> getMap(final ORecord record) {
  Map<String, Object> map = null;

  if (record instanceof ODocument) {
    final ODocument doc = (ODocument) record;

    final Set<String> syncFields = esClient.getSyncFields(doc);
    if (syncFields == null)
      return null;

    map = new HashMap<String, Object>();

    map.put("@rid", doc.getIdentity());
    map.put("@class", doc.getClassName());

    for (String f : doc.fieldNames()) {
      if (!syncFields.isEmpty() && !syncFields.contains(f))
        // SKIP FIELD
        continue;

      final Object value = doc.field(f);

      if (value instanceof ORidBag) {
        final List<OIdentifiable> list = new ArrayList<OIdentifiable>();
        for (Iterator<OIdentifiable> it = ((ORidBag) value).rawIterator(); it.hasNext(); ) {
          list.add(it.next());
        }
        map.put(f, list);

      } else if (value instanceof ORecord && ((ORecord) value).getIdentity().isPersistent()) {
        map.put(f, ((ORecord) value).getIdentity());
      } else
        map.put(f, value);
    }
  }

  return map;
}
 
开发者ID:orientechnologies,项目名称:orientdb-elasticsearch,代码行数:39,代码来源:OElasticSearchDatabaseSync.java

示例2: load

import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
@Override
public ODBVertex load(ODocument document) {

    for (String key : document.fieldNames()) {
        loadPropertyToModel(document, key);
    }

    loadRelationsToModel(document);
    return vertex(vertex);
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:11,代码来源:ODBVertex.java

示例3: vertices

import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
public Iterator<Vertex> vertices(final Direction direction, final String... labels) {
    final ODocument doc = getRawDocument();

    final List<Stream<Vertex>> streamVertices = new ArrayList<>();

    for (String fieldName : doc.fieldNames()) {
        final OPair<Direction, String> connection = getConnection(direction, fieldName, labels);
        if (connection == null)
            // SKIP THIS FIELD
            continue;

        final Object fieldValue = doc.field(fieldName);
        if (fieldValue == null)
            continue;

        if (fieldValue instanceof ORidBag)
            streamVertices.add(asStream(((ORidBag) fieldValue).rawIterator())
                    .map(oIdentifiable -> new OrientEdge(graph, oIdentifiable.getRecord()))
                    .map(edge -> edge.vertices(direction.opposite()))
                    .flatMap(vertices -> asStream(vertices)));
        else
            throw new IllegalStateException("Invalid content found in " + fieldName + " field: " + fieldValue);
    }

    return streamVertices.stream()
            .flatMap(vertices -> vertices)
            .iterator();

}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:30,代码来源:OrientVertex.java

示例4: edges

import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
public Iterator<Edge> edges(final Direction direction, String... edgeLabels) {
    final ODocument doc = getRawDocument();

    final List<List<OIdentifiable>> streamVertices = new ArrayList<>();

    for (String fieldName : doc.fieldNames()) {
        final OPair<Direction, String> connection = getConnection(direction, fieldName, edgeLabels);
        if (connection == null)
            // SKIP THIS FIELD
            continue;

        final Object fieldValue = doc.field(fieldName);
        if (fieldValue == null)
            continue;

        if (fieldValue instanceof ORidBag)
            streamVertices.add(asStream(((ORidBag) fieldValue).iterator()).collect(Collectors.toList()));
        else
            throw new IllegalStateException("Invalid content found in " + fieldName + " field: " + fieldValue);
    }

    return streamVertices.stream()
            .flatMap(edges -> edges.stream())
            .filter(oId -> oId != null)
            .map(oIdentifiable -> new OrientEdge(graph, oIdentifiable.getRecord()))
            .map(edge -> (Edge) edge)
            .iterator();
}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:29,代码来源:OrientVertex.java

示例5: getPropertyKeys

import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
@Override
public Set<String> getPropertyKeys() {
	final Set<String> keys = new HashSet<>();
	ODocument tmpVertex = getDocument();
	for (String s : tmpVertex.fieldNames()) {
		if (s != null && s.startsWith(PREFIX_PROPERTY)) {
			keys.add(OrientNameCleaner.unescapeFromField(s.substring(PREFIX_PROPERTY.length())));
		}
	}
	return keys;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:12,代码来源:OrientNode.java

示例6: getEdges

import com.orientechnologies.orient.core.record.impl.ODocument; //导入方法依赖的package包/类
private List<IGraphEdge> getEdges(final Direction dir) {
	final List<IGraphEdge> edges = new ArrayList<>();
	final ODocument tmpVertex = getDocument();
	for (String propName : tmpVertex.fieldNames()) {
		String edgeLabel = null;
		Direction propDir = null;
		if (propName.startsWith(PREFIX_INCOMING) && dir != Direction.OUT) {
			edgeLabel = OrientNameCleaner.unescapeFromField(propName.substring(PREFIX_INCOMING.length()));
			propDir = Direction.IN;
		} else if (propName.startsWith(PREFIX_OUTGOING) && dir != Direction.IN) {
			edgeLabel = OrientNameCleaner.unescapeFromField(propName.substring(PREFIX_OUTGOING.length()));
			propDir = Direction.OUT;
		} else if (propName.startsWith(PREFIX_INCOMING_OLD) && dir != Direction.OUT) {
			edgeLabel = OrientNameCleaner.unescapeFromField(propName.substring(PREFIX_INCOMING_OLD.length()));
			propDir = Direction.IN;
		} else if (propName.startsWith(PREFIX_OUTGOING_OLD) && dir != Direction.IN) {
			edgeLabel = OrientNameCleaner.unescapeFromField(propName.substring(PREFIX_OUTGOING_OLD.length()));
			propDir = Direction.OUT;
		}

		if (edgeLabel != null) {
			Iterable<Object> odocs = tmpVertex.field(propName);
			addAllOIdentifiable(edges, odocs, propDir, edgeLabel);
		}
	}
	return edges;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:28,代码来源:OrientNode.java


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