Package com.orientechnologies.orient.core.db.record

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet


    try {
      final ONavigableMap<Object, Set<OIdentifiable>> subSet = map.subMap(iRangeFrom, iInclusive, iRangeTo, iInclusive);
      if (subSet == null)
        return ORecordLazySet.EMPTY_SET;

      final Set<OIdentifiable> result = new ORecordLazySet(configuration.getDatabase());
      for (Set<OIdentifiable> v : subSet.values()) {
        result.addAll(v);
      }

      return result;

    } finally {
View Full Code Here


    } else if (iFieldValue.startsWith("[") && iFieldValue.endsWith("]")) {

      // EMBEDDED VALUES
      final Collection<?> embeddedCollection;
      if (iType == OType.LINKSET)
        embeddedCollection = new ORecordLazySet(iRecord);
      else if (iType == OType.EMBEDDEDSET)
        embeddedCollection = new OTrackedSet<Object>(iRecord);
      else if (iType == OType.LINKLIST)
        embeddedCollection = new ORecordLazyList(iRecord);
      else
View Full Code Here

      final ODocument edge = new ODocument(this, iClassName != null ? iClassName : EDGE_CLASS_NAME);
      edge.field(EDGE_FIELD_OUT, iOutVertex);
      edge.field(EDGE_FIELD_IN, iInVertex);

      ORecordLazySet outEdges = ((ORecordLazySet) iOutVertex.field(VERTEX_FIELD_OUT_EDGES));
      if (outEdges == null) {
        outEdges = new ORecordLazySet(iOutVertex);
        iOutVertex.field(VERTEX_FIELD_OUT_EDGES, outEdges);
      }
      outEdges.add(edge);

      ORecordLazySet inEdges = ((ORecordLazySet) iInVertex.field(VERTEX_FIELD_IN_EDGES));
      if (inEdges == null) {
        inEdges = new ORecordLazySet(iInVertex);
        iInVertex.field(VERTEX_FIELD_IN_EDGES, inEdges);
      }
      inEdges.add(edge);

      if (safeMode) {
        save(edge);
        commitBlock(safeMode);
      }
View Full Code Here

   * @return
   */
  public Set<OIdentifiable> getOutEdges(final ODocument iVertex, final String iLabel) {
    checkVertexClass(iVertex);

    final ORecordLazySet set = iVertex.field(VERTEX_FIELD_OUT_EDGES);

    if (iLabel == null)
      // RETURN THE ENTIRE COLLECTION
      if (set != null)
        return Collections.unmodifiableSet(set);
      else
        return Collections.emptySet();

    // FILTER BY LABEL
    final ORecordLazySet result = new ORecordLazySet(underlying);
    if (set != null)
      for (OIdentifiable item : set) {
        if (iLabel == null || iLabel.equals(((ODocument) item).field(LABEL)))
          result.add(item);
      }

    return result;
  }
View Full Code Here

  }

  public Set<OIdentifiable> getInEdges(final ODocument iVertex, final String iLabel) {
    checkVertexClass(iVertex);

    final ORecordLazySet set = iVertex.field(VERTEX_FIELD_IN_EDGES);

    if (iLabel == null)
      // RETURN THE ENTIRE COLLECTION
      if (set != null)
        return Collections.unmodifiableSet(set);
      else
        return Collections.emptySet();

    // FILTER BY LABEL
    final ORecordLazySet result = new ORecordLazySet(underlying);
    if (set != null)
      for (OIdentifiable item : set) {
        if (iLabel == null || iLabel.equals(((ODocument) item).field(LABEL)))
          result.add(item);
      }

    return result;
  }
View Full Code Here

        return Collections.unmodifiableSet(iEdges);
      else
        return Collections.emptySet();

    // FILTER BY PROPERTY VALUES
    final ORecordLazySet result = new ORecordLazySet(underlying);
    if (iEdges != null)
      for (OIdentifiable item : iEdges) {
        final ODocument doc = (ODocument) item;
        for (String propName : iPropertyNames) {
          if (doc.containsField(propName))
            // FOUND: ADD IT
            result.add(item);
        }
      }

    return result;
  }
View Full Code Here

        return Collections.unmodifiableSet(iEdges);
      else
        return Collections.emptySet();

    // FILTER BY PROPERTY VALUES
    final ORecordLazySet result = new ORecordLazySet(underlying);
    if (iEdges != null)
      for (OIdentifiable item : iEdges) {
        final ODocument doc = (ODocument) item;
        for (Entry<String, Object> prop : iProperties.entrySet()) {
          if (prop.getKey() != null && doc.containsField(prop.getKey())) {
            if (prop.getValue() == null) {
              if (doc.field(prop.getKey()) == null)
                // BOTH NULL: ADD IT
                result.add(item);
            } else if (prop.getValue().equals(doc.field(prop.getKey())))
              // SAME VALUE: ADD IT
              result.add(item);
          }
        }
      }

    return result;
View Full Code Here

      // REMOVE BEGIN & END COLLECTIONS CHARACTERS IF IT'S A COLLECTION
      final String value = iValue.startsWith("[") ? iValue.substring(1, iValue.length() - 1) : iValue;

      return iType == OType.LINKLIST ? new ORecordLazyList(iSourceRecord).setStreamedContent(new StringBuilder(value))
          : new ORecordLazySet(iSourceRecord).setStreamedContent(new StringBuilder(value));
    }

    case LINKMAP: {
      if (iValue.length() == 0)
        return null;
View Full Code Here

      OProfiler.getInstance().stopChrono("serializer.rec.str.linkList2string", timer);
      break;
    }

    case LINKSET: {
      final ORecordLazySet coll;

      if (!(iValue instanceof ORecordLazySet)) {
        // FIRST TIME: CONVERT THE ENTIRE COLLECTION
        coll = new ORecordLazySet(iRecord);
        coll.addAll((Collection<? extends OIdentifiable>) iValue);
        ((Collection<? extends OIdentifiable>) iValue).clear();

        iRecord.field(iName, coll);
      } else
        // LAZY SET
View Full Code Here

    final Collection<?> coll;
    if (iLinkedType == OType.LINK) {
      if (iDocument != null)
        coll = iType == OType.EMBEDDEDLIST ? new ORecordLazyList(iDocument).setStreamedContent(new StringBuilder(value))
            : new ORecordLazySet(iDocument).setStreamedContent(new StringBuilder(value));
      else
        coll = iType == OType.EMBEDDEDLIST ? new ORecordLazyList(iDatabase).setStreamedContent(new StringBuilder(value))
            : new ORecordLazySet(iDatabase).setStreamedContent(new StringBuilder(value));

      // LAZY LOADED: RETURN
      return coll;
    }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.db.record.ORecordLazySet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.