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

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


      final Iterable<Object> iterable = (Iterable<Object>) iLeft;

      if (condition != null) {
        // CHECK AGAINST A CONDITION
        for (final Object o : iterable) {
          final OIdentifiable id;
          if (o instanceof OIdentifiable)
            id = (OIdentifiable) o;
          else if (o instanceof Map<?, ?>) {
            final Iterator<Object> iter = ((Map<?, Object>) o).values().iterator();
            final Object v = iter.hasNext() ? iter.next() : null;
View Full Code Here


        return true;
      }
    } else if (iMergeSingleItemsOfMultiValueFields) {
      final Iterator<OIdentifiable> iter = otherValue.rawIterator();
      while (iter.hasNext()) {
        final OIdentifiable value = iter.next();
        if (value != null) {
          final Iterator<OIdentifiable> localIter = rawIterator();
          boolean found = false;
          while (localIter.hasNext()) {
            final OIdentifiable v = localIter.next();
            if (value.equals(v)) {
              found = true;
              break;
            }
          }
View Full Code Here

    public OIdentifiable convert(OIdentifiable value) {
      final ORID rid = value.getIdentity();
      if (!rid.isPersistent())
        return value;

      final OIdentifiable newRid = exportImportHashTable.get(rid);
      if (newRid == null)
        return value;

      return newRid.getIdentity();
    }
View Full Code Here

          // RETURNS ALL THE DELETED RECORDS
          OIndexCursor cursor = index.cursor();
          Map.Entry<Object, OIdentifiable> entry;

          while ((entry=cursor.nextEntry()) != null) {
            OIdentifiable rec = entry.getValue();
            rec = rec.getRecord();
            if (rec != null)
              allDeletedRecords.add((ORecord) rec);
          }

          index.clear();
View Full Code Here

  @Override
  public ODocument checkEntry(final OIdentifiable iRecord, final Object iKey) {
    // CHECK IF ALREADY EXISTS IN TX
    String storageType = database.getStorage().getType();
    if (!database.getTransaction().isActive()) {
      final OIdentifiable previousRecord = get(iKey);
      if (previousRecord != null && !previousRecord.equals(iRecord)) {
        final ODocument metadata = getMetadata();
        final boolean mergeSameKey = metadata != null && (Boolean) metadata.field(OIndex.MERGE_KEYS);
        if (mergeSameKey) {
          return (ODocument) previousRecord.getRecord();
        } else
          throw new ORecordDuplicatedException(String.format(
              "Cannot index record %s: found duplicated key '%s' in index '%s' previously assigned to the record %s", iRecord,
              iKey, getName(), previousRecord), previousRecord.getIdentity());
      }
      return super.checkEntry(iRecord, iKey);
    }
    return null;
  }
View Full Code Here

    final OTransactionIndexChanges indexChanges = database.getTransaction().getIndexChanges(delegate.getName());

    if (indexChanges == null)
      return super.get(key);

    OIdentifiable result;
    if (!indexChanges.cleared)
      // BEGIN FROM THE UNDERLYING RESULT SET
      result = super.get(key);
    else
      // BEGIN FROM EMPTY RESULT SET
View Full Code Here

        return null;
      else
        return createMapEntry(key, backendValue);
    }

    OIdentifiable result = backendValue;

    for (OTransactionIndexEntry entry : changesPerKey.entries) {
      if (entry.operation == OPERATION.REMOVE)
        result = null;
      else if (entry.operation == OPERATION.PUT)
        result = entry.value;
    }

    if (result == null)
      return null;

    final OIdentifiable resultValue = result;
    return createMapEntry(key, resultValue);
  }
View Full Code Here

    if (iValue instanceof Boolean || iValue instanceof Number)
      buffer.append(iValue.toString());

    else if (iValue instanceof OIdentifiable) {
      final OIdentifiable linked = (OIdentifiable) iValue;
      if (linked.getIdentity().isValid()) {
        buffer.append('\"');
        linked.getIdentity().toString(buffer);
        buffer.append('\"');
      } else {
        if (iFormat != null && iFormat.contains("shallow"))
          buffer.append("{}");
        else {
          final ORecord rec = linked.getRecord();
          if (rec != null)
            buffer.append(rec.toJSON(iFormat));
          else
            buffer.append("null");
        }
View Full Code Here

    // CHECK RESULT
    int tot = 0;
    for (OrientVertex v : result) {
      tot++;
      ODocument fromTo = v.getRecord();
      OIdentifiable from = fromTo.field("old");
      OIdentifiable to = fromTo.field("new");

      // CHECK FROM
      Assert.assertEquals(from, v1.getIdentity());

      // CHECK DESTINATION
      Assert.assertEquals(to.getIdentity().getClusterId(), customerGeniusCluster);
      ODocument newDocument = to.getRecord();

      Assert.assertEquals(newDocument.field("name"), "Jay1");
      Assert.assertEquals(newDocument.field("test"), "testMoveSingleRecordToAnotherCluster");
    }
View Full Code Here

    // CHECK RESULT
    ODocument fromTo = result.iterator().next().getRecord();

    Assert.assertFalse(result.iterator().hasNext());

    OIdentifiable from = fromTo.field("old");
    OIdentifiable to = fromTo.field("new");

    // CHECK FROM
    Assert.assertEquals(from, doc.getIdentity());

    // CHECK DESTINATION
    Assert.assertEquals(to.getIdentity().getClusterId(), provider.getDefaultClusterId());
    ODocument newDocument = to.getRecord();
    Assert.assertEquals(newDocument.getClassName(), "Provider");

    Assert.assertEquals(newDocument.field("name"), "Jay");
    Assert.assertEquals(newDocument.field("test"), "testMoveSingleRecordToAnotherClass");
  }
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.