Examples of MongoDBTupleSnapshot


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

                "modules"
            ),
            new AssociatedEntityKeyMetadata( null, null ),
            null
        ),
        new Tuple( new MongoDBTupleSnapshot( null, null, null ) )
    );

    final Association association = getService( GridDialect.class ).getAssociation( associationKey, associationContext );
    final MongoDBAssociationSnapshot associationSnapshot = (MongoDBAssociationSnapshot) association.getSnapshot();
    final DBObject assocObject = associationSnapshot.getDBObject();
View Full Code Here

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

    }

    @Override
    public Tuple next() {
      DBObject dbObject = cursor.next();
      return new Tuple( new MongoDBTupleSnapshot( dbObject, metadata, UPDATE ) );
    }
View Full Code Here

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

  @Override
  public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    DBObject found = this.getObject( key, tupleContext );
    if ( found != null ) {
      return new Tuple( new MongoDBTupleSnapshot( 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 MongoDBTupleSnapshot( prepareIdObject( key ), key.getMetadata(), INSERT ) );
    }
    else {
      return null;
    }
  }
View Full Code Here

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

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

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

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

  }

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

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

  /**
   * Creates a dbObject that can be pass to the mongoDB batch insert function
   */
  private DBObject objectForInsert(Tuple tuple, DBObject dbObject) {
    MongoDBTupleSnapshot snapshot = (MongoDBTupleSnapshot) 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.MongoDBTupleSnapshot

    }
    return dbObject;
  }

  private DBObject objectForUpdate(Tuple tuple, DBObject idObject) {
    MongoDBTupleSnapshot snapshot = (MongoDBTupleSnapshot) 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.MongoDBTupleSnapshot

  public void forEachTuple(ModelConsumer consumer, EntityKeyMetadata... entityKeyMetadatas) {
    DB db = provider.getDatabase();
    for ( EntityKeyMetadata entityKeyMetadata : entityKeyMetadatas ) {
      DBCollection collection = db.getCollection( entityKeyMetadata.getTable() );
      for ( DBObject dbObject : collection.find() ) {
        consumer.consume( new Tuple( new MongoDBTupleSnapshot( dbObject, entityKeyMetadata, UPDATE ) ) );
      }
    }
  }
View Full Code Here

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

      while ( operation != null ) {
        if ( operation instanceof InsertOrUpdateTupleOperation ) {
          InsertOrUpdateTupleOperation update = (InsertOrUpdateTupleOperation) operation;
          executeBatchUpdate( inserts, update );
          MongoDBTupleSnapshot snapshot = (MongoDBTupleSnapshot) update.getTuple().getSnapshot();
          if ( snapshot.getSnapshotType() == INSERT ) {
            insertSnapshots.add( snapshot );
          }
        }
        else if ( operation instanceof RemoveTupleOperation ) {
          RemoveTupleOperation tupleOp = (RemoveTupleOperation) operation;
View Full Code Here

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

  }

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

    if ( INSERT == snapshot.getSnapshotType() ) {
      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
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.