Examples of BatchableMongoDBTupleSnapshot


Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

  @Override
  public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    DBObject found = this.getObject( key, tupleContext );
    if ( found != null ) {
      return new Tuple( new BatchableMongoDBTupleSnapshot( found, key.getMetadata(), UPDATE ) );
    }
    else if ( isInTheQueue( key, tupleContext ) ) {
      // The key has not been inserted in the db but it is in the queue
      return new Tuple( new BatchableMongoDBTupleSnapshot( prepareIdObject( key ), key.getMetadata(), INSERT ) );
    }
    else {
      return null;
    }
  }
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

    return queue != null && queue.contains( key );
  }

  @Override
  public Tuple createTuple(EntityKeyMetadata entityKeyMetadata, TupleContext tupleContext) {
    return new Tuple( new BatchableMongoDBTupleSnapshot( new BasicDBObject(), entityKeyMetadata, SnapshotType.INSERT ) );
  }
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

  }

  @Override
  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    DBObject toSave = this.prepareIdObject( key );
    return new Tuple( new BatchableMongoDBTupleSnapshot( toSave, key.getMetadata(), SnapshotType.INSERT ) );
  }
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

  /**
   * Creates a dbObject that can be pass to the mongoDB batch insert function
   */
  private DBObject objectForInsert(Tuple tuple, DBObject dbObject) {
    BatchableMongoDBTupleSnapshot snapshot = (BatchableMongoDBTupleSnapshot) tuple.getSnapshot();
    for ( TupleOperation operation : tuple.getOperations() ) {
      String column = operation.getColumn();
      if ( notInIdField( snapshot, column ) ) {
        switch ( operation.getType() ) {
          case PUT_NULL:
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

    }
    return dbObject;
  }

  private DBObject objectForUpdate(Tuple tuple, EntityKey key, DBObject idObject) {
    BatchableMongoDBTupleSnapshot snapshot = (BatchableMongoDBTupleSnapshot) tuple.getSnapshot();

    BasicDBObject updater = new BasicDBObject();
    for ( TupleOperation operation : tuple.getOperations() ) {
      String column = operation.getColumn();
      if ( notInIdField( snapshot, column ) ) {
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

  }

  private void executeBatchUpdate(Map<DBCollection, BatchInsertionTask> inserts, UpdateTupleOperation tupleOperation) {
    EntityKey entityKey = tupleOperation.getEntityKey();
    Tuple tuple = tupleOperation.getTuple();
    BatchableMongoDBTupleSnapshot snapshot = (BatchableMongoDBTupleSnapshot) tupleOperation.getTuple().getSnapshot();
    WriteConcern writeConcern = getWriteConcern( tupleOperation.getTupleContext() );

    if ( INSERT == snapshot.getOperationType() && columnNamesAllowBatchInsert( tupleOperation ) ) {
      prepareForInsert( inserts, snapshot, entityKey, tuple, writeConcern );
    }
    else {
      // Object already exists in the db or has invalid fields:
      insertOrUpdateTuple( entityKey, tuple, tupleOperation.getTupleContext() );
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

  @Override
  public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    DBObject found = this.getObject( key, tupleContext );
    if ( found != null ) {
      return new Tuple( new BatchableMongoDBTupleSnapshot( found, key, UPDATE ) );
    }
    else if ( isInTheQueue( key, tupleContext ) ) {
      // The key has not been inserted in the db but it is in the queue
      return new Tuple( new BatchableMongoDBTupleSnapshot( prepareIdObject( key ), key, INSERT ) );
    }
    else {
      return null;
    }
  }
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

  }

  @Override
  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    DBObject toSave = this.prepareIdObject( key );
    return new Tuple( new BatchableMongoDBTupleSnapshot( toSave, key, SnapshotType.INSERT ) );
  }
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

  /**
   * Creates a dbObject that can be pass to the mongoDB batch insert function
   */
  private DBObject objectForInsert(Tuple tuple, DBObject dbObject) {
    BatchableMongoDBTupleSnapshot snapshot = (BatchableMongoDBTupleSnapshot) tuple.getSnapshot();
    for ( TupleOperation operation : tuple.getOperations() ) {
      String column = operation.getColumn();
      if ( notInIdField( snapshot, column ) ) {
        switch ( operation.getType() ) {
          case PUT_NULL:
View Full Code Here

Examples of org.hibernate.ogm.datastore.mongodb.dialect.impl.BatchableMongoDBTupleSnapshot

    }
    return dbObject;
  }

  private DBObject objectForUpdate(Tuple tuple, EntityKey key, DBObject idObject) {
    BatchableMongoDBTupleSnapshot snapshot = (BatchableMongoDBTupleSnapshot) tuple.getSnapshot();

    BasicDBObject updater = new BasicDBObject();
    for ( TupleOperation operation : tuple.getOperations() ) {
      String column = operation.getColumn();
      if ( notInIdField( snapshot, column ) ) {
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.