Examples of OCompositeKey


Examples of com.orientechnologies.common.collection.OCompositeKey

        if (!doc.getIdentity().isValid())
            doc.save();

        graph.autoStartTransaction();
        underlying.put(keyTemp, doc);
        recordKeyValueIndex.put(new OCompositeKey(element.getIdentity(), keyTemp), element.getIdentity());
    }
View Full Code Here

Examples of com.orientechnologies.common.collection.OCompositeKey

    public void remove(final String key, final Object value, final T element) {
        final String keyTemp = key + SEPARATOR + value;
        graph.autoStartTransaction();
        try {
            underlying.remove(keyTemp, element.getRecord());
            recordKeyValueIndex.remove(new OCompositeKey(element.getIdentity(), keyTemp), element.getIdentity());
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of com.orientechnologies.common.collection.OCompositeKey

        return StringFactory.indexString(this);
    }

    protected void removeElement(final T element) {
        graph.autoStartTransaction();
        Collection<ODocument> entries = recordKeyValueIndex.getEntriesBetween(new OCompositeKey(element.getIdentity()),
                new OCompositeKey(element.getIdentity()));
        for (ODocument entry : entries) {
            OCompositeKey key = entry.field("key");
            List<Object> keys = key.getKeys();
            underlying.remove(keys.get(1).toString(), element.getIdentity());
            recordKeyValueIndex.remove(key, element.getIdentity());
        }
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

    doc.save();

    final OIndex<?> index = database.getMetadata().getIndexManager().getIndex("classIndexManagerTestIndexValueAndCollection");
    Assert.assertEquals(index.getSize(), 2);

    Assert.assertEquals(index.get(new OCompositeKey("test1", 1)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 2)), doc.getIdentity());

    doc.delete();

    Assert.assertEquals(index.getSize(), 0);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

    doc.field("prop1", "test2");

    doc.save();

    Assert.assertEquals(index.get(new OCompositeKey("test2", 1)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test2", 2)), doc.getIdentity());

    Assert.assertEquals(index.getSize(), 2);

    doc.delete();
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

    doc.field("prop2", Arrays.asList(1, 3));

    doc.save();

    Assert.assertEquals(index.get(new OCompositeKey("test1", 1)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 3)), doc.getIdentity());

    Assert.assertEquals(index.getSize(), 2);

    doc.delete();
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

    docList.remove(0);

    doc.save();

    Assert.assertEquals(index.get(new OCompositeKey("test1", 2)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 3)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 4)), doc.getIdentity());
    Assert.assertEquals(index.get(new OCompositeKey("test1", 5)), doc.getIdentity());

    Assert.assertEquals(index.getSize(), 4);

    doc.delete();
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

  @BeforeMethod
  public void beforeMethod() {
    for (double i = 1; i < 4; i++) {
      for (double j = 1; j < 10; j++) {
        final OCompositeKey compositeKey = new OCompositeKey();
        compositeKey.addKey(i);
        compositeKey.addKey(j);
        localSBTree.put(compositeKey, new ORecordId((int) i, new OClusterPositionLong((long) (j))));
      }
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

        assertTrue(orids.contains(new ORecordId(i, new OClusterPositionLong((j)))));
      }
  }

  private OCompositeKey compositeKey(Comparable<?>... params) {
    return new OCompositeKey(Arrays.asList(params));
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

  }

  public void testEmbeddedObjectSerialization() {
    final ODocument originalDoc = new ODocument();

    final OCompositeKey compositeKey = new OCompositeKey(123, "56", new Date(), new ORecordId("#0:12"));
    originalDoc.field("compositeKey", compositeKey);
    originalDoc.field("int", 12);
    originalDoc.field("val""test");
    originalDoc.save();

    final ODocument loadedDoc = database.load(originalDoc.getIdentity(), "*:-1", true);
    Assert.assertNotSame(loadedDoc, originalDoc);

    final OCompositeKey loadedCompositeKey = loadedDoc.field("compositeKey");
    Assert.assertEquals(loadedCompositeKey, compositeKey);

    originalDoc.delete();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.