Package com.orientechnologies.orient.core.id

Examples of com.orientechnologies.orient.core.id.ORID


  public Map<String, Object> toMap() {
    final Map<String, Object> map = new HashMap<String, Object>();
    for (String field : fieldNames())
      map.put(field, field(field));

    final ORID id = getIdentity();
    if (id.isValid())
      map.put("@rid", id);

    final String className = getClassName();
    if (className != null)
      map.put("@class", className);
View Full Code Here


          public OIdentifiable call() {
            return myIterator.next();
          }
        });

        final ORID otherRid;
        if (ridMapper != null) {
          ORID convertedRid = ridMapper.map(myIdentifiable.getIdentity());
          if (convertedRid != null)
            otherRid = convertedRid;
          else
            otherRid = myIdentifiable.getIdentity();
        } else
View Full Code Here

      else if (isFloat(myNumberValue) && isFloat(otherNumberValue))
        return myNumberValue.doubleValue() == otherNumberValue.doubleValue();
    }

    if (ridMapper != null && myValue instanceof ORID && otherValue instanceof ORID && ((ORID) myValue).isPersistent()) {
      ORID convertedValue = ridMapper.map((ORID) myValue);
      if (convertedValue != null)
        myValue = convertedValue;
    }

    return myValue.equals(otherValue);
View Full Code Here

        // I'M COMMITTING: BYPASS LOCAL BUFFER
        switch (iStatus) {
        case ORecordOperation.CREATED:
        case ORecordOperation.UPDATED:
          final ORID oldRid = iRecord.getIdentity().copy();
          database.executeSaveRecord(iRecord, iClusterName, iRecord.getRecordVersion(), false, OPERATION_MODE.SYNCHRONOUS, false,
              null, null);
          updateIdentityAfterCommit(oldRid, iRecord.getIdentity());
          break;
        case ORecordOperation.DELETED:
View Full Code Here

    return id;
  }

  public void clearRecordEntries() {
    for (Entry<ORID, ORecordOperation> entry : recordEntries.entrySet()) {
      final ORID key = entry.getKey();

      // ID NEW CREATE A COPY OF RID TO AVOID IT CHANGES IDENTITY+HASHCODE AND IT'S UNREACHEABLE THEREAFTER
      allEntries.put(key.isNew() ? key.copy() : key, entry.getValue());
    }

    recordEntries.clear();
  }
View Full Code Here

    }
    Assert.assertNotNull(test.getDuplicationTestSet());
    Assert.assertEquals(test.getDuplicationTestSet().size(), 1);
    database.save(test);
    // Assert.assertEquals(test.getSet().size(), 100);
    ORID rid = database.getIdentity(test);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");

    test = database.load(rid);
    Assert.assertNotNull(test.getDuplicationTestSet());
View Full Code Here

    }
    Assert.assertNotNull(test.getSet());
    Assert.assertEquals(test.getSet().size(), 100);
    database.save(test);
    // Assert.assertEquals(test.getSet().size(), 100);
    ORID rid = database.getIdentity(test);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");

    test = database.load(rid);
    Assert.assertNotNull(test.getSet());
View Full Code Here

    ODocument doc = database.getRecordByUserObject(a, false);
    Assert.assertEquals(((Collection<?>) doc.field("list")).size(), 4);
    Assert.assertEquals(((Collection<?>) doc.field("set")).size(), 4);

    a = database.save(a);
    ORID rid = database.getIdentity(a);

    Assert.assertEquals(a.getList().size(), 4);
    Assert.assertEquals(a.getSet().size(), 4);
    doc = database.getRecordByUserObject(a, false);
    Assert.assertEquals(((Collection<?>) doc.field("list")).size(), 4);
View Full Code Here

    JavaCascadeDeleteTestClass test = database.newInstance(JavaCascadeDeleteTestClass.class);
    JavaSimpleTestClass simple = database.newInstance(JavaSimpleTestClass.class);
    simple.setText("asdasd");
    test.setSimpleClass(simple);
    database.save(test);
    ORID testRid = database.getRecordByUserObject(test, false).getIdentity();
    ORID simpleRid = database.getRecordByUserObject(simple, false).getIdentity();
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");

    database.delete(testRid);
    simple = database.load(simpleRid);
View Full Code Here

    Child setChild3 = database.newInstance(Child.class);
    setChild3.setName("set3");
    test.getSet().add(setChild3);

    database.save(test);
    ORID testRid = database.getRecordByUserObject(test, false).getIdentity();
    ORID list1Rid = database.getRecordByUserObject(listChild1, false).getIdentity();
    ORID list2Rid = database.getRecordByUserObject(listChild2, false).getIdentity();
    ORID list3Rid = database.getRecordByUserObject(listChild3, false).getIdentity();
    ORID set1Rid = database.getRecordByUserObject(setChild1, false).getIdentity();
    ORID set2Rid = database.getRecordByUserObject(setChild2, false).getIdentity();
    ORID set3Rid = database.getRecordByUserObject(setChild3, false).getIdentity();
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");

    database.delete(testRid);
    listChild1 = database.load(list1Rid);
    listChild2 = database.load(list2Rid);
    listChild3 = database.load(list3Rid);
    setChild1 = database.load(set1Rid);
    setChild2 = database.load(set2Rid);
    setChild3 = database.load(set3Rid);
    Assert.assertNull(listChild1);
    Assert.assertNull(listChild2);
    Assert.assertNull(listChild3);
    Assert.assertNull(setChild1);
    Assert.assertNull(setChild2);
    Assert.assertNull(setChild3);

    // LIST UPDATE TEST
    test = database.newInstance(JavaCascadeDeleteTestClass.class);
    listChild1 = database.newInstance(Child.class);
    listChild1.setName("list1");
    test.getList().add(listChild1);
    listChild2 = database.newInstance(Child.class);
    listChild2.setName("list2");
    test.getList().add(listChild2);
    listChild3 = database.newInstance(Child.class);
    listChild3.setName("list3");
    test.getList().add(listChild3);
    Child listChild4 = database.newInstance(Child.class);
    listChild4.setName("list4");
    test.getList().add(listChild4);

    setChild1 = database.newInstance(Child.class);
    setChild1.setName("set1");
    test.getSet().add(setChild1);
    setChild2 = database.newInstance(Child.class);
    setChild2.setName("set2");
    test.getSet().add(setChild2);
    setChild3 = database.newInstance(Child.class);
    setChild3.setName("set3");
    test.getSet().add(setChild3);
    Child setChild4 = database.newInstance(Child.class);
    setChild4.setName("set4");
    test.getSet().add(setChild4);

    database.save(test);
    testRid = database.getRecordByUserObject(test, false).getIdentity();
    list1Rid = database.getRecordByUserObject(listChild1, false).getIdentity();
    list2Rid = database.getRecordByUserObject(listChild2, false).getIdentity();
    list3Rid = database.getRecordByUserObject(listChild3, false).getIdentity();
    ORID list4Rid = database.getRecordByUserObject(listChild4, false).getIdentity();
    set1Rid = database.getRecordByUserObject(setChild1, false).getIdentity();
    set2Rid = database.getRecordByUserObject(setChild2, false).getIdentity();
    set3Rid = database.getRecordByUserObject(setChild3, false).getIdentity();
    ORID set4Rid = database.getRecordByUserObject(setChild4, false).getIdentity();
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");

    test = database.load(testRid);
    test.getList().remove(listChild4);
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.id.ORID

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.