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

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


        final List<ODocument> operations = (List<ODocument>) entry.field("ops");
        if (operations != null) {
          for (ODocument op : operations) {
            final int operation = (Integer) op.rawField("o");
            final OIdentifiable value = op.field("v");

            if (operation == OPERATION.PUT.ordinal())
              put(key, value);
            else if (operation == OPERATION.REMOVE.ordinal()) {
              if (key.equals("*"))
 
View Full Code Here


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

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

        final OIdentifiable item = it.next();

        linkToStream(buffer, iRecord, item);
      }
    }
View Full Code Here

        iOutput.append(OStringSerializerHelper.RECORD_SEPARATOR);

      if (o == null)
        continue;

      OIdentifiable id = null;
      ODocument doc = null;

      final OClass linkedClass;
      if (!(o instanceof OIdentifiable)) {
        final String fieldBound = OObjectSerializerHelper.getDocumentBoundField(o.getClass());
        if (fieldBound != null) {
          OObjectSerializerHelper.invokeCallback(o, null, OBeforeSerialization.class);
          doc = (ODocument) OObjectSerializerHelper.getFieldValue(o, fieldBound);
          OObjectSerializerHelper.invokeCallback(o, doc, OAfterSerialization.class);
          id = doc;
        }
        linkedClass = iLinkedClass;
      } else {
        id = (OIdentifiable) o;

        if (iLinkedType == null)
          // AUTO-DETERMINE LINKED TYPE
          if (id.getIdentity().isValid())
            iLinkedType = OType.LINK;
          else
            iLinkedType = OType.EMBEDDED;

        if (id instanceof ODocument) {
          doc = (ODocument) id;

          if (id.getIdentity().isTemporary())
            doc.save();

          linkedClass = doc.getSchemaClass();
        } else
          linkedClass = null;
View Full Code Here

  private static OIdentifiable linkToStream(final StringBuilder buffer, final ORecordSchemaAware<?> iParentRecord, Object iLinked) {
    if (iLinked == null)
      // NULL REFERENCE
      return null;

    OIdentifiable resultRid = null;
    ORID rid;

    if (iLinked instanceof ORID) {
      // JUST THE REFERENCE
      rid = (ORID) iLinked;
View Full Code Here

  public <RET extends T> RET get(final String iKey) {
    final Collection<OIdentifiable> values = index.get(iKey);
    if (values.isEmpty())
      return null;

    final OIdentifiable id = values.iterator().next();

    return (RET) id.getRecord();
  }
View Full Code Here

  public <RET extends T> RET get(final String iKey, final String iFetchPlan) {
    final Collection<OIdentifiable> values = index.get(iKey);
    if (values.isEmpty())
      return null;

    final OIdentifiable id = values.iterator().next();

    if (id instanceof ORID)
      return (RET) ODatabaseRecordThreadLocal.INSTANCE.get().load(((ORID) values.iterator().next()), iFetchPlan);

    return (RET) ((ODocument) values.iterator().next()).load(iFetchPlan);
View Full Code Here

  }

  protected boolean addResult(final OIdentifiable iRecord) {
    resultCount++;

    final OIdentifiable recordCopy = iRecord instanceof ORecord<?> ? ((ORecord<?>) iRecord).copy() : iRecord.getIdentity().copy();

    if (orderedFields != null || flattenTarget != null) {
      // ORDER BY CLAUSE: COLLECT ALL THE RECORDS AND ORDER THEM AT THE END
      if (tempResult == null)
        tempResult = new ArrayList<OIdentifiable>();
View Full Code Here

            case 'l':
              final int tot = network.readInt();
              final Collection<OIdentifiable> list = new ArrayList<OIdentifiable>();
              for (int i = 0; i < tot; ++i) {
                final OIdentifiable resultItem = readIdentifiable(network, iCommand.getDatabase());
                if (resultItem instanceof ORecord<?>)
                  iCommand.getDatabase().getLevel1Cache().updateRecord((ORecordInternal<?>) resultItem);
                list.add(resultItem);
              }
              result = list;
View Full Code Here

    final int limit = Integer.parseInt((String) properties.get("limit"));

    long start = System.currentTimeMillis();
    currentDatabase.query(new OSQLAsynchQuery<ODocument>(iQueryText, limit, new OCommandResultListener() {
      public boolean result(final Object iRecord) {
        final OIdentifiable record = (OIdentifiable) iRecord;

        dumpRecordInTable(currentResultSet.size(), record, columns);
        currentResultSet.add(record);
        return true;
      }
View Full Code Here

TOP

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

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.