Search in sources :

Example 36 with Entity

use of jetbrains.exodus.entitystore.Entity in project xodus by JetBrains.

the class ProcessRunner method step.

private void step() throws Exception {
    Entity entity = txn.newEntity("Person");
    entity.setProperty("name", "Vadim");
    entity.setProperty("password", "dummypassword");
    byte[] blob = new byte[1024 * 1024];
    Arrays.fill(blob, (byte) 1);
    entity.setBlob("weight", new ByteArrayInputStream(blob));
    txn.flush();
    // txn.flush() can skip writing to file, manual flush is required
    ((EnvironmentImpl) store.getEnvironment()).flushAndSync();
}
Also used : Entity(jetbrains.exodus.entitystore.Entity) ByteArrayInputStream(java.io.ByteArrayInputStream) EnvironmentImpl(jetbrains.exodus.env.EnvironmentImpl)

Example 37 with Entity

use of jetbrains.exodus.entitystore.Entity in project xodus by JetBrains.

the class QueryTreeTest method prepare.

private void prepare() {
    final PersistentStoreTransaction txn = getStoreTransaction();
    final Entity enumeration = e(txn, 1);
    t1(txn, enumeration);
    t1(txn, enumeration);
    t2(txn, e(txn, 2), "value", 9);
    propertyEqual = new PropertyEqual("s", "value");
    propertyEqualNull = new PropertyEqual("s", null);
    propertyNotNull = new PropertyNotNull("s");
    linkEqual = new LinkEqual("myEnum", enumeration);
    linkEqualNull = new LinkEqual("itself", null);
    linkNotNull = new LinkNotNull("itself");
    concat = new Concat(propertyEqual, linkNotNull);
}
Also used : Entity(jetbrains.exodus.entitystore.Entity) PersistentStoreTransaction(jetbrains.exodus.entitystore.PersistentStoreTransaction)

Example 38 with Entity

use of jetbrains.exodus.entitystore.Entity in project xodus by JetBrains.

the class QueryTreeTest method t2.

private Entity t2(PersistentStoreTransaction txn, Entity enumeration, String s, int v) {
    final Entity e = t1(txn, enumeration);
    e.setProperty("s", s);
    e.setProperty("i", v);
    return e;
}
Also used : Entity(jetbrains.exodus.entitystore.Entity)

Example 39 with Entity

use of jetbrains.exodus.entitystore.Entity in project xodus by JetBrains.

the class QueryTreeTest method e.

private Entity e(PersistentStoreTransaction txn, int number) {
    final Entity result = txn.newEntity("MyEnum");
    result.setProperty("number", number);
    return result;
}
Also used : Entity(jetbrains.exodus.entitystore.Entity)

Example 40 with Entity

use of jetbrains.exodus.entitystore.Entity in project xodus by JetBrains.

the class QueryTreeTest method testGenericSort.

public void testGenericSort() throws Exception {
    ComparableGetterSort sortNode = new ComparableGetterSort(concat, new ComparableGetter() {

        @Override
        public Comparable select(Entity entity) {
            return entity.getProperty("i");
        }
    }, true);
    Assert.assertEquals(sortNode, sortNode.getClone());
    Assert.assertEquals(4, QueryUtil.getSize(instantiate(sortNode)));
    Assert.assertEquals(4, QueryUtil.getSize(instantiate(new And(sortNode, NodeFactory.all()))));
    Assert.assertFalse(sortNode.equals(propertyEqual));
    Assert.assertFalse(propertyEqual.equals(sortNode));
}
Also used : Entity(jetbrains.exodus.entitystore.Entity) ComparableGetter(jetbrains.exodus.entitystore.ComparableGetter)

Aggregations

Entity (jetbrains.exodus.entitystore.Entity)44 EntityIterable (jetbrains.exodus.entitystore.EntityIterable)23 IOException (java.io.IOException)13 EntityIterableBase (jetbrains.exodus.entitystore.iterate.EntityIterableBase)7 InputStream (java.io.InputStream)6 UncheckedIOException (java.io.UncheckedIOException)5 ArrayList (java.util.ArrayList)5 ComparableGetter (jetbrains.exodus.entitystore.ComparableGetter)4 EntityStoreException (jetbrains.exodus.entitystore.EntityStoreException)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 EntityId (jetbrains.exodus.entitystore.EntityId)3 File (java.io.File)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 NoSuchElementException (java.util.NoSuchElementException)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Nonnull (javax.annotation.Nonnull)2 ExodusException (jetbrains.exodus.ExodusException)2 EntityMetaData (jetbrains.exodus.query.metadata.EntityMetaData)2 Serializable (java.io.Serializable)1