org.hibernate.ogm.model.key.spi.EntityKey - java examples

Here are the examples of the java api org.hibernate.ogm.model.key.spi.EntityKey taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : MapDatastoreProvider.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * Acquires a write lock on a specific key.
 * @param key The key to lock
 * @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
 */
public void writeLock(EnreplacedyKey key, int timeout) {
    ReadWriteLock lock = getLock(key);
    Lock writeLock = lock.writeLock();
    acquireLock(key, timeout, writeLock);
}

19 View Complete Implementation : OperationsQueue.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
public boolean isMarkedForRemoval(EnreplacedyKey enreplacedyKey) {
    for (Operation operation : operations) {
        if (!(operation instanceof RemoveTupleOperation)) {
            continue;
        }
        if (((RemoveTupleOperation) operation).getEnreplacedyKey().equals(enreplacedyKey)) {
            return true;
        }
    }
    return false;
}

19 View Complete Implementation : MapDatastoreProvider.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * Acquires a read lock on a specific key.
 * @param key The key to lock
 * @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
 */
public void readLock(EnreplacedyKey key, int timeout) {
    ReadWriteLock lock = getLock(key);
    Lock readLock = lock.readLock();
    acquireLock(key, timeout, readLock);
}

19 View Complete Implementation : CreateTupleWithKeyImpl.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * @author Gunnar Morling
 */
public clreplaced CreateTupleWithKeyImpl implements CreateTupleWithKey {

    private final EnreplacedyKey enreplacedyKey;

    public CreateTupleWithKeyImpl(EnreplacedyKey enreplacedyKey) {
        this.enreplacedyKey = enreplacedyKey;
    }

    @Override
    public EnreplacedyKey getEnreplacedyKey() {
        return enreplacedyKey;
    }

    @Override
    public <T extends GridDialectOperation> T as(Clreplaced<T> type) {
        if (CreateTupleWithKey.clreplaced.isreplacedignableFrom(type)) {
            return type.cast(this);
        }
        throw new IllegalArgumentException("Unexpected type: " + type);
    }

    @Override
    public OperationType getType() {
        return OperationType.CREATE_TUPLE_WITH_KEY;
    }

    @Override
    public String toString() {
        return "CreateTupleWithKeyImpl [enreplacedyKey=" + enreplacedyKey + "]";
    }
}

19 View Complete Implementation : EmbeddedNeo4jAssociationQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * Give an embedded replacedociation, creates all the nodes and relationships required to represent it.
 * It replacedumes that the enreplacedy node containing the replacedociation already exists in the db.
 *
 * @param executionEngine the {@link GraphDatabaseService} to run the query
 * @param replacedociationKey the {@link replacedociationKey} identifying the replacedociation
 * @param embeddedKey the {@link EnreplacedyKey} identifying the embedded component
 * @return the created {@link Relationship} that represents the replacedociation
 */
public Relationship createRelationshipForEmbeddedreplacedociation(GraphDatabaseService executionEngine, replacedociationKey replacedociationKey, EnreplacedyKey embeddedKey) {
    String query = initCreateEmbeddedreplacedociationQuery(replacedociationKey, embeddedKey);
    Object[] queryValues = createRelationshipForEmbeddedQueryValues(replacedociationKey, embeddedKey);
    return executeQuery(executionEngine, query, queryValues);
}

19 View Complete Implementation : BaseNeo4jAssociationQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * Give an embedded replacedociation, creates all the nodes and relationships required to represent it. It replacedumes that
 * the enreplacedy node containing the replacedociation already exists in the db.
 *
 * @param executionEngine the {@link GraphDatabaseService} to run the query
 * @param replacedociationKey the {@link replacedociationKey} identifying the replacedociation
 * @param embeddedKey the {@link EnreplacedyKey} identifying the embedded component
 * @return the created {@link Relationship} that represents the replacedociation
 */
public Relationship createRelationshipForEmbeddedreplacedociation(GraphDatabaseService executionEngine, replacedociationKey replacedociationKey, EnreplacedyKey embeddedKey, Object[] relValues) {
    String query = initCreateEmbeddedreplacedociationQuery(replacedociationKey, embeddedKey);
    Object[] queryValues = createRelationshipForEmbeddedQueryValues(replacedociationKey, embeddedKey, relValues);
    return executeQuery(executionEngine, query, queryValues);
}

18 View Complete Implementation : MultiGetMultiColumnsIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithAllNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { NOT_IN_THE_DB, NOT_IN_THE_DB, NOT_IN_THE_DB, NOT_IN_THE_DB };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            tx.commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

18 View Complete Implementation : MultiGetEmbeddedIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithAllNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { NOT_IN_THE_DB, NOT_IN_THE_DB, NOT_IN_THE_DB, NOT_IN_THE_DB };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            replacedertThat(tuples).containsExactly(null, null, null, null);
            tx.commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

18 View Complete Implementation : BaseNeo4jAssociationQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
protected String initCreateEmbeddedreplacedociationQuery(replacedociationKey replacedociationKey, EnreplacedyKey embeddedKey) {
    String collectionRole = replacedociationKey.getMetadata().getCollectionRole();
    String[] embeddedColumnNames = embeddedKey.getColumnNames();
    Object[] embeddedColumnValues = embeddedKey.getColumnValues();
    String[] columnNames = replacedociationKey.getEnreplacedyKey().getMetadata().getColumnNames();
    StringBuilder queryBuilder = new StringBuilder();
    queryBuilder.append(matchOwnerEnreplacedyNode);
    if (isCollectionOfPrimitives(collectionRole, embeddedColumnNames)) {
        createRelationshipForCollectionOfPrimitivesOrMap(replacedociationKey, collectionRole, columnNames, queryBuilder);
    } else {
        createRelationshipforCollectionOfComponents(replacedociationKey, collectionRole, embeddedColumnNames, embeddedColumnValues, queryBuilder);
    }
    return queryBuilder.toString();
}

18 View Complete Implementation : BaseNeo4jEntityQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/*
	 * When the id is mapped on several properties
	 */
protected String getMultiGetQueryCacheQuery(EnreplacedyKey[] keys) {
    int numberOfKeys = keys.length;
    String query = multiGetQueryCache.get(numberOfKeys);
    if (query == null) {
        query = createMultiGetOnMultiplePropertiesId(numberOfKeys);
        String cached = multiGetQueryCache.putIfAbsent(numberOfKeys, query);
        if (cached != null) {
            query = cached;
        }
    }
    return query;
}

18 View Complete Implementation : RemoveTupleOperation.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * Contains the data required to remove a tuple
 *
 * @author Davide D'Alto <[email protected]>
 */
public clreplaced RemoveTupleOperation implements Operation {

    private final EnreplacedyKey enreplacedyKey;

    private final TupleContext tupleContext;

    public RemoveTupleOperation(EnreplacedyKey enreplacedyKey, TupleContext tupleContext) {
        this.enreplacedyKey = enreplacedyKey;
        this.tupleContext = tupleContext;
    }

    public EnreplacedyKey getEnreplacedyKey() {
        return enreplacedyKey;
    }

    public TupleContext getTupleContext() {
        return tupleContext;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClreplaced().getSimpleName());
        sb.append("[");
        sb.append(enreplacedyKey);
        sb.append("]");
        return sb.toString();
    }
}

18 View Complete Implementation : HttpNeo4jEntityQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * Find the nodes corresponding to an array of enreplacedy keys.
 *
 * @param executionEngine the {@link HttpNeo4jClient} used to run the query
 * @param keys an array of keys identifying the nodes to return
 * @return the list of nodes representing the enreplacedies
 */
public ClosableIterator<NodeWithEmbeddedNodes> findEnreplacedies(HttpNeo4jClient executionEngine, EnreplacedyKey[] keys, Long txId) {
    if (singlePropertyKey) {
        return singlePropertyIdFindEnreplacedies(executionEngine, keys, txId);
    } else {
        return multiPropertiesIdFindEnreplacedies(executionEngine, keys, txId);
    }
}

18 View Complete Implementation : EmbeddedNeo4jAssociationQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
protected String initCreateEmbeddedreplacedociationQuery(replacedociationKey replacedociationKey, EnreplacedyKey embeddedKey) {
    String collectionRole = replacedociationKey.getMetadata().getCollectionRole();
    String[] embeddedColumnNames = embeddedKey.getColumnNames();
    Object[] embeddedColumnValues = embeddedKey.getColumnValues();
    String[] columnNames = replacedociationKey.getEnreplacedyKey().getMetadata().getColumnNames();
    StringBuilder queryBuilder = new StringBuilder();
    queryBuilder.append(matchOwnerEnreplacedyNode);
    if (isCollectionOfPrimitives(collectionRole, embeddedColumnNames)) {
        createRelationshipForCollectionOfPrimitivesOrMap(replacedociationKey, collectionRole, columnNames, queryBuilder);
    } else {
        createRelationshipforCollectionOfComponents(replacedociationKey, collectionRole, embeddedColumnNames, embeddedColumnValues, queryBuilder);
    }
    return queryBuilder.toString();
}

18 View Complete Implementation : EmbeddedNeo4jEntityQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * Find the nodes corresponding to an array of enreplacedy keys.
 *
 * @param executionEngine the {@link GraphDatabaseService} used to run the query
 * @param keys an array of keys identifying the nodes to return
 * @return the list of nodes representing the enreplacedies
 */
public ResourceIterator<Node> findEnreplacedies(GraphDatabaseService executionEngine, EnreplacedyKey[] keys) {
    if (singlePropertyKey) {
        return singlePropertyIdFindEnreplacedies(executionEngine, keys);
    } else {
        return multiPropertiesIdFindEnreplacedies(executionEngine, keys);
    }
}

18 View Complete Implementation : MultiGetSingleColumnIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithAllNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { NOT_IN_THE_DB, NOT_IN_THE_DB, NOT_IN_THE_DB, NOT_IN_THE_DB };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            replacedertThat(tuples).containsExactly(null, null, null, null);
            tx.commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

17 View Complete Implementation : UnsupportedProceduresGridDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public void insertOrUpdateTuple(EnreplacedyKey key, TuplePointer tuplePointer, TupleContext tupleContext) throws TupleAlreadyExistsException {
}

17 View Complete Implementation : InvokedOperationsLoggingDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public boolean updateTupleWithOptimisticLock(EnreplacedyKey enreplacedyKey, Tuple oldLockState, Tuple tuple, TupleContext tupleContext) {
    boolean success = super.updateTupleWithOptimisticLock(enreplacedyKey, oldLockState, tuple, tupleContext);
    log("updateTuple", enreplacedyKey.toString() + ", " + tuple.toString(), String.valueOf(success));
    return success;
}

17 View Complete Implementation : HttpNeo4jDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
private HibernateException extractException(EnreplacedyKey key, ErrorResponse errorResponse) {
    if (TUPLE_ALREADY_EXISTS_EXCEPTION_PATTERN.matcher(errorResponse.getMessage()).matches()) {
        // This is the exception we expect for this kind of error by the CompensationAPI and some unit tests
        return new TupleAlreadyExistsException(key, errorResponse.getMessage());
    } else {
        return log.constraintViolation(key, errorResponse.getMessage(), null);
    }
}

17 View Complete Implementation : EntityKeyExternalizer.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public void writeObject(ObjectOutput output, EnreplacedyKey key) throws IOException {
    output.writeInt(VERSION);
    output.writeUTF(key.getTable());
    output.writeObject(key.getColumnNames());
    output.writeObject(key.getColumnValues());
}

17 View Complete Implementation : MultiGetMultiColumnsIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { NOT_IN_THE_DB, key(KING_OF_TOKYO), NOT_IN_THE_DB, NOT_IN_THE_DB };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            replacedertThat(tuples.get(1).get("publisher")).isEqualTo(KING_OF_TOKYO.getPublisher());
            replacedertThat(tuples.get(1).get("name")).isEqualTo(KING_OF_TOKYO.getName());
            replacedertThat(tuples.get(2)).isNull();
            replacedertThat(tuples.get(3)).isNull();
            tx.commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

17 View Complete Implementation : BatchOperationsDelegator.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public void insertOrUpdateTuple(EnreplacedyKey key, TuplePointer tuplePointer, TupleContext tupleContext) {
    if (isBatchDisabled()) {
        super.insertOrUpdateTuple(key, tuplePointer, tupleContext);
    } else {
        getOperationQueue().add(new InsertOrUpdateTupleOperation(tuplePointer, key, tupleContext));
    }
}

17 View Complete Implementation : OperationsQueueTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testContainsKeyIsFalseWhenAddingRemoveTupleOperation() throws Exception {
    EnreplacedyKey key = enreplacedyKey();
    RemoveTupleOperation expected = new RemoveTupleOperation(key, emptyTupleContext());
    queue.add(expected);
    replacedertions.replacedertThat(queue.isInTheInsertionQueue(key)).isFalse();
}

17 View Complete Implementation : MapDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public void removeTuple(EnreplacedyKey key, TupleContext tupleContext) {
    provider.removeEnreplacedyTuple(key);
}

17 View Complete Implementation : BoltNeo4jAssociationQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
public Relationship createRelationshipForEmbeddedreplacedociation(Transaction tx, replacedociationKey replacedociationKey, EnreplacedyKey embeddedKey, Object[] relationshipProperties) {
    String query = initCreateEmbeddedreplacedociationQuery(replacedociationKey, embeddedKey);
    Object[] queryValues = createRelationshipForEmbeddedQueryValues(replacedociationKey, embeddedKey, relationshipProperties);
    StatementResult statementResult = tx.run(query, params(queryValues));
    return relationship(statementResult);
}

17 View Complete Implementation : ForwardingGridDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public Tuple getTuple(EnreplacedyKey key, OperationContext operationContext) {
    return gridDialect.getTuple(key, operationContext);
}

17 View Complete Implementation : HttpNeo4jEntityQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/*
	 * When the id is mapped on several properties
	 */
private ClosableIterator<NodeWithEmbeddedNodes> multiPropertiesIdFindEnreplacedies(HttpNeo4jClient executionEngine, EnreplacedyKey[] keys, Long txId) {
    String query = getMultiGetQueryCacheQuery(keys);
    Map<String, Object> params = multiGetParams(keys);
    List<StatementResult> results = executeQuery(executionEngine, txId, query, params);
    return closableIterator(results);
}

17 View Complete Implementation : InvokedOperationsLoggingDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public boolean removeTupleWithOptimisticLock(EnreplacedyKey enreplacedyKey, Tuple oldLockState, TupleContext tupleContext) {
    boolean success = super.removeTupleWithOptimisticLock(enreplacedyKey, oldLockState, tupleContext);
    log("removeTuple", enreplacedyKey.toString(), String.valueOf(success));
    return success;
}

17 View Complete Implementation : BaseNeo4jEntityQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
protected Map<String, Object> multiGetParams(EnreplacedyKey[] keys) {
    // We replacedume only one metadata type
    int numberOfColumnNames = keys[0].getColumnNames().length;
    int numberOfParams = keys.length * numberOfColumnNames;
    int counter = 0;
    Map<String, Object> params = new HashMap<>(numberOfParams);
    for (int row = 0; row < keys.length; row++) {
        for (int col = 0; col < keys[row].getColumnValues().length; col++) {
            params.put(String.valueOf(counter++), keys[row].getColumnValues()[col]);
        }
    }
    return params;
}

17 View Complete Implementation : BoltNeo4jEntityQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/*
	 * When the id is mapped on several properties
	 */
private ClosableIterator<NodeWithEmbeddedNodes> multiPropertiesIdFindEnreplacedies(EnreplacedyKey[] keys, Transaction tx) {
    String query = getMultiGetQueryCacheQuery(keys);
    Map<String, Object> params = multiGetParams(keys);
    StatementResult results = tx.run(query, params);
    return closableIterator(results);
}

17 View Complete Implementation : HttpNeo4jAssociationQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
public Relationship createRelationshipForEmbeddedreplacedociation(HttpNeo4jClient executionEngine, Long txId, replacedociationKey replacedociationKey, EnreplacedyKey embeddedKey, Object[] relationshipProperties) {
    String query = initCreateEmbeddedreplacedociationQuery(replacedociationKey, embeddedKey);
    Object[] queryValues = createRelationshipForEmbeddedQueryValues(replacedociationKey, embeddedKey, relationshipProperties);
    Map<String, Object> params = params(queryValues);
    Graph result = executeQuery(executionEngine, txId, query, params);
    return result.getRelationships().get(0);
}

17 View Complete Implementation : CompositeProtobufCoDec.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public ProtostreamreplacedociationPayload createreplacedociationPayload(EnreplacedyKey key, Versionedreplacedociation replacedoc, TupleContext tupleContext) {
    return new ProtostreamreplacedociationPayload(replacedoc);
}

17 View Complete Implementation : MultiGetEmbeddedIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { NOT_IN_THE_DB, key(KING_OF_TOKYO), NOT_IN_THE_DB, NOT_IN_THE_DB };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            replacedertThat(tuples.get(0)).isNull();
            replacedertThat(tuples.get(1).get("id.publisher")).isEqualTo(KING_OF_TOKYO.getId().getPublisher());
            replacedertThat(tuples.get(1).get("id.name")).isEqualTo(KING_OF_TOKYO.getId().getName());
            replacedertThat(tuples.get(2)).isNull();
            replacedertThat(tuples.get(3)).isNull();
            tx.commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

17 View Complete Implementation : InvocationCollectingGridDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public Tuple createTuple(EnreplacedyKey key, OperationContext operationContext) {
    Tuple tuple = null;
    CreateTupleWithKey createTupleWithKey = new CreateTupleWithKeyImpl(key);
    try {
        tuple = super.createTuple(key, operationContext);
    } catch (Exception e) {
        handleException(createTupleWithKey, e);
    }
    handleAppliedOperation(createTupleWithKey);
    return tuple;
}

17 View Complete Implementation : HttpNeo4jDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
private void putProperty(EnreplacedyKey enreplacedyKey, Map<String, Object> node, TupleOperation operation) {
    node.put(operation.getColumn(), operation.getValue());
}

17 View Complete Implementation : MockStoredProcedureDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public void removeTuple(EnreplacedyKey key, TupleContext tupleContext) {
}

17 View Complete Implementation : OperationsQueueTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testAddRemoveTupleOperation() throws Exception {
    EnreplacedyKey key = enreplacedyKey();
    RemoveTupleOperation expected = new RemoveTupleOperation(key, emptyTupleContext());
    queue.add(expected);
    replacedertions.replacedertThat(queue.poll()).isEqualTo(expected);
}

17 View Complete Implementation : BoltNeo4jDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
private void putProperty(EnreplacedyKey enreplacedyKey, Map<String, Object> node, TupleOperation operation) {
    node.put(operation.getColumn(), operation.getValue());
}

17 View Complete Implementation : BoltNeo4jDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
private HibernateException extractException(EnreplacedyKey key, ClientException exception) {
    if (TUPLE_ALREADY_EXISTS_EXCEPTION_PATTERN.matcher(exception.getMessage()).matches()) {
        // This is the exception we expect for this kind of error by the CompensationAPI and some unit tests
        return new TupleAlreadyExistsException(key, exception.getMessage());
    } else {
        return log.constraintViolation(key, exception.getMessage(), null);
    }
}

17 View Complete Implementation : MultiGetSingleColumnIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { NOT_IN_THE_DB, key(KING_OF_TOKYO), NOT_IN_THE_DB, NOT_IN_THE_DB };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            replacedertThat(tuples.get(0)).isNull();
            replacedertThat(id(tuples.get(1))).isEqualTo(KING_OF_TOKYO.getId());
            replacedertThat(name(tuples.get(1))).isEqualTo(KING_OF_TOKYO.getName());
            replacedertThat(tuples.get(2)).isNull();
            replacedertThat(tuples.get(3)).isNull();
            tx.commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

17 View Complete Implementation : InvokedOperationsLoggingDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public void removeTuple(EnreplacedyKey key, TupleContext tupleContext) {
    super.removeTuple(key, tupleContext);
    log("removeTuple", key.toString(), "VOID");
}

17 View Complete Implementation : MapDatastoreProvider.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
private void acquireLock(EnreplacedyKey key, int timeout, Lock writeLock) {
    try {
        if (timeout == -1) {
            writeLock.lockInterruptibly();
        } else if (timeout == 0) {
            boolean locked = writeLock.tryLock();
            if (!locked) {
                throw new PessimisticLockException("lock on key " + key + " was not available");
            }
        } else {
            writeLock.tryLock(timeout, TimeUnit.MILLISECONDS);
        }
    } catch (InterruptedException e) {
        throw new PessimisticLockException("timed out waiting for lock on key " + key, e);
    }
    acquiredLocksPerThread.get().add(writeLock);
}

17 View Complete Implementation : BoltNeo4jEntityQueries.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
private int findKeyIndex(EnreplacedyKey[] keys, Node owner) {
    for (int i = 0; i < keys.length; i++) {
        if (RemoteNeo4jHelper.matches(owner.asMap(), keys[i].getColumnNames(), keys[i].getColumnValues())) {
            return i;
        }
    }
    return -1;
}

17 View Complete Implementation : MultiGetMultiColumnsIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithoutNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { key(SPLENDOR), key(DOMINION), key(KING_OF_TOKYO) };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            replacedertThat(tuples.get(0).get("publisher")).isEqualTo(SPLENDOR.getPublisher());
            replacedertThat(tuples.get(0).get("name")).isEqualTo(SPLENDOR.getName());
            replacedertThat(tuples.get(1).get("publisher")).isEqualTo(DOMINION.getPublisher());
            replacedertThat(tuples.get(1).get("name")).isEqualTo(DOMINION.getName());
            replacedertThat(tuples.get(2).get("publisher")).isEqualTo(KING_OF_TOKYO.getPublisher());
            replacedertThat(tuples.get(2).get("name")).isEqualTo(KING_OF_TOKYO.getName());
            tx.commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

17 View Complete Implementation : MapDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public Tuple createTuple(EnreplacedyKey key, OperationContext operationContext) {
    HashMap<String, Object> tuple = new HashMap<String, Object>();
    provider.putEnreplacedy(key, tuple);
    return new Tuple(new MapTupleSnapshot(tuple), SnapshotType.INSERT);
}

17 View Complete Implementation : AbstractGroupingByEntityDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public void insertOrUpdateTuple(EnreplacedyKey key, TuplePointer tuplePointer, TupleContext tupleContext) {
    throw new UnsupportedOperationException("Method not supported by GroupingByEnreplacedyDialect implementations");
}

17 View Complete Implementation : InvocationCollectingGridDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public boolean removeTupleWithOptimisticLock(EnreplacedyKey enreplacedyKey, Tuple oldLockState, TupleContext tupleContext) {
    RemoveTupleWithOptimisticLockImpl removeTupleWithOptimisticLock = new RemoveTupleWithOptimisticLockImpl(enreplacedyKey, oldLockState);
    boolean success = false;
    try {
        success = super.removeTupleWithOptimisticLock(enreplacedyKey, oldLockState, tupleContext);
    } catch (Exception e) {
        handleException(removeTupleWithOptimisticLock, e);
    }
    // applied/failed operation logging triggered by persister as per operation outcome
    return success;
}

17 View Complete Implementation : MultiGetEmbeddedIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithoutNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { key(SPLENDOR), key(DOMINION), key(KING_OF_TOKYO) };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            replacedertThat(tuples.get(0).get("id.publisher")).isEqualTo(SPLENDOR.getId().getPublisher());
            replacedertThat(tuples.get(0).get("id.name")).isEqualTo(SPLENDOR.getId().getName());
            replacedertThat(tuples.get(1).get("id.publisher")).isEqualTo(DOMINION.getId().getPublisher());
            replacedertThat(tuples.get(1).get("id.name")).isEqualTo(DOMINION.getId().getName());
            replacedertThat(tuples.get(2).get("id.publisher")).isEqualTo(KING_OF_TOKYO.getId().getPublisher());
            replacedertThat(tuples.get(2).get("id.name")).isEqualTo(KING_OF_TOKYO.getId().getName());
            session.getTransaction().commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

17 View Complete Implementation : MultiGetSingleColumnIdTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testGetTuplesWithoutNulls() throws Exception {
    try (OgmSession session = openSession()) {
        Transaction tx = session.beginTransaction();
        try {
            MultigetGridDialect dialect = multiGetGridDialect();
            EnreplacedyKey[] keys = new EnreplacedyKey[] { key(SPLENDOR), key(DOMINION), key(KING_OF_TOKYO) };
            List<Tuple> tuples = dialect.getTuples(keys, tupleContext(session));
            replacedertThat(id(tuples.get(0))).isEqualTo(SPLENDOR.getId());
            replacedertThat(name(tuples.get(0))).isEqualTo(SPLENDOR.getName());
            replacedertThat(id(tuples.get(1))).isEqualTo(DOMINION.getId());
            replacedertThat(name(tuples.get(1))).isEqualTo(DOMINION.getName());
            replacedertThat(id(tuples.get(2))).isEqualTo(KING_OF_TOKYO.getId());
            replacedertThat(name(tuples.get(2))).isEqualTo(KING_OF_TOKYO.getName());
            tx.commit();
        } catch (Exception e) {
            rollback(tx);
            throw e;
        }
    }
}

17 View Complete Implementation : OperationsQueueTest.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Test
public void testContainsKeyWhenAddingUpdateTupleOperation() throws Exception {
    EnreplacedyKey key = enreplacedyKey();
    InsertOrUpdateTupleOperation expected = new InsertOrUpdateTupleOperation(null, key, emptyTupleContext());
    queue.add(expected);
    replacedertions.replacedertThat(queue.isInTheInsertionQueue(key)).isTrue();
}

17 View Complete Implementation : ForwardingGridDialect.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Override
public void removeTuple(EnreplacedyKey key, TupleContext tupleContext) {
    gridDialect.removeTuple(key, tupleContext);
}