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

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


      if (!(iValue instanceof List)) {
        // CONVERT IT TO LIST
        final Collection<?> newValue;

        if (iValue instanceof ORecordLazySet || iValue instanceof ORecordLazyMap)
          newValue = new ORecordLazyList(this);
        else
          newValue = new OTrackedList<Object>(this);

        if (iValue instanceof Collection) {
          ((Collection<Object>) newValue).addAll((Collection<Object>) iValue);
View Full Code Here


      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
        embeddedCollection = new OTrackedList<Object>(iRecord);

      iFieldValue = iFieldValue.substring(1, iFieldValue.length() - 1);
View Full Code Here

        return null;

      // 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)
View Full Code Here

      if (iValue instanceof ORecordLazyList && ((ORecordLazyList) iValue).getStreamedContent() != null) {
        iOutput.append(((ORecordLazyList) iValue).getStreamedContent());
        OProfiler.getInstance().updateCounter("serializer.rec.str.linkList2string.cached", +1);
      } else {
        final ORecordLazyList coll;
        final Iterator<OIdentifiable> it;
        if (!(iValue instanceof ORecordLazyList)) {
          // FIRST TIME: CONVERT THE ENTIRE COLLECTION
          coll = new ORecordLazyList(iRecord);
          coll.addAll((Collection<? extends OIdentifiable>) iValue);
          ((Collection<? extends OIdentifiable>) iValue).clear();

          iRecord.field(iName, coll);
          it = coll.rawIterator();
        } else {
          // LAZY LIST
          coll = (ORecordLazyList) iValue;
          if (coll.getStreamedContent() != null) {
            // APPEND STREAMED CONTENT
            iOutput.append(coll.getStreamedContent());
            OProfiler.getInstance().updateCounter("serializer.rec.str.linkList2string.cached", +1);
            it = coll.newItemsIterator();
          } else
            it = coll.rawIterator();
        }

        if (it != null && it.hasNext()) {
          final StringBuilder buffer = new StringBuilder();
          for (int items = 0; it.hasNext(); items++) {
            if (items > 0)
              buffer.append(OStringSerializerHelper.RECORD_SEPARATOR);

            final OIdentifiable item = it.next();

            linkToStream(buffer, iRecord, item);
          }

          coll.convertRecords2Links();

          iOutput.append(buffer);

          // UPDATE THE STREAM
          coll.setStreamedContent(buffer);
        }
      }

      iOutput.append(OStringSerializerHelper.COLLECTION_END);
      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 String value = iValue.charAt(0) == '[' ? iValue.substring(1, iValue.length() - 1) : iValue;

    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

      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
        embeddedCollection = new OTrackedList<Object>(iRecord);

      iFieldValue = iFieldValue.substring(1, iFieldValue.length() - 1);
View Full Code Here

        return null;

      // 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)
View Full Code Here

      if (iValue instanceof ORecordLazyList && ((ORecordLazyList) iValue).getStreamedContent() != null) {
        iOutput.append(((ORecordLazyList) iValue).getStreamedContent());
        OProfiler.getInstance().updateCounter("serializer.rec.str.linkList2string.cached", +1);
      } else {
        final ORecordLazyList coll;
        final Iterator<OIdentifiable> it;
        if (!(iValue instanceof ORecordLazyList)) {
          // FIRST TIME: CONVERT THE ENTIRE COLLECTION
          coll = new ORecordLazyList(iRecord);
          coll.addAll((Collection<? extends OIdentifiable>) iValue);
          ((Collection<? extends OIdentifiable>) iValue).clear();

          iRecord.field(iName, coll);
          it = coll.rawIterator();
        } else {
          // LAZY LIST
          coll = (ORecordLazyList) iValue;
          if (coll.getStreamedContent() != null) {
            // APPEND STREAMED CONTENT
            iOutput.append(coll.getStreamedContent());
            OProfiler.getInstance().updateCounter("serializer.rec.str.linkList2string.cached", +1);
            it = coll.newItemsIterator();
          } else
            it = coll.rawIterator();
        }

        if (it != null && it.hasNext()) {
          final StringBuilder buffer = new StringBuilder();
          for (int items = 0; it.hasNext(); items++) {
            if (items > 0)
              buffer.append(OStringSerializerHelper.RECORD_SEPARATOR);

            final OIdentifiable item = it.next();

            linkToStream(buffer, iRecord, item);
          }

          coll.convertRecords2Links();

          iOutput.append(buffer);

          // UPDATE THE STREAM
          coll.setStreamedContent(buffer);
        }
      }

      iOutput.append(OStringSerializerHelper.COLLECTION_END);
      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

    } else if (List.class.isAssignableFrom(iType) && !(iValue instanceof List)) {
      // CONVERT IT TO LIST
      final Collection<?> newValue;

      if (iValue instanceof ORecordLazySet || iValue instanceof ORecordLazyMap)
        newValue = new ORecordLazyList(this);
      else
        newValue = new OTrackedList<Object>(this);

      if (iValue instanceof Collection)
        ((Collection<Object>) newValue).addAll((Collection<Object>) iValue);
View Full Code Here

    final String value = iValue.charAt(0) == '[' ? iValue.substring(1, iValue.length() - 1) : iValue;

    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.ORecordLazyList

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.