Examples of DBObject


Examples of com.mongodb.DBObject

  private DBObject getProjectionDBObject() {
    if ( projections.isEmpty() ) {
      return null;
    }

    DBObject projectionDBObject = new BasicDBObject();

    for ( String projection : projections ) {
      projectionDBObject.put( projection, 1 );
    }

    return projectionDBObject;
  }
View Full Code Here

Examples of com.mongodb.DBObject

        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();
    this.checkLoading( assocObject );

    session.delete( mongodb );
    session.delete( infinispan );
    session.delete( hibernateOGM );
View Full Code Here

Examples of com.mongodb.DBObject

    throw new UnsupportedOperationException( "The MongoDB GridDialect does not support locking" );
  }

  @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
View Full Code Here

Examples of com.mongodb.DBObject

    return new Tuple( new MongoDBTupleSnapshot( new BasicDBObject(), entityKeyMetadata, SnapshotType.INSERT ) );
  }

  @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 com.mongodb.DBObject

  /**
   * Returns a {@link DBObject} representing the entity which embeds the specified association.
   */
  private DBObject getEmbeddingEntity(AssociationKey key, AssociationContext associationContext) {
    DBObject embeddingEntityDocument = associationContext.getEntityTuple() != null ? ( (MongoDBTupleSnapshot) associationContext.getEntityTuple().getSnapshot() ).getDbObject() : null;

    if ( embeddingEntityDocument != null ) {
      return embeddingEntityDocument;
    }
    else {
      ReadPreference readPreference = getReadPreference( associationContext );

      DBCollection collection = getCollection( key.getEntityKey() );
      DBObject searchObject = prepareIdObject( key.getEntityKey() );
      DBObject projection = getProjection( key, true );

      return collection.findOne( searchObject, projection, readPreference );
    }
  }
View Full Code Here

Examples of com.mongodb.DBObject

  private DBObject getObject(EntityKey key, TupleContext tupleContext) {
    ReadPreference readPreference = getReadPreference( tupleContext );

    DBCollection collection = getCollection( key );
    DBObject searchObject = prepareIdObject( key );
    BasicDBObject projection = getProjection( tupleContext );

    return collection.findOne( searchObject, projection, readPreference );
  }
View Full Code Here

Examples of com.mongodb.DBObject

    if ( columnNames.length == 1 ) {
      object = new BasicDBObject( ID_FIELDNAME, columnValues[0] );
    }
    else {
      object = new BasicDBObject();
      DBObject idObject = new BasicDBObject();
      for ( int i = 0; i < columnNames.length; i++ ) {
        String columnName = columnNames[i];
        Object columnValue = columnValues[i];

        if ( columnName.contains( PROPERTY_SEPARATOR ) ) {
          int dotIndex = columnName.indexOf( PROPERTY_SEPARATOR );
          String shortColumnName = columnName.substring( dotIndex + 1 );
          idObject.put( shortColumnName, columnValue );
        }
        else {
          idObject.put( columnNames[i], columnValue );
        }

      }
      object.put( ID_FIELDNAME, idObject );
    }
View Full Code Here

Examples of com.mongodb.DBObject

  @Override
  public void insertOrUpdateTuple(EntityKey key, Tuple tuple, TupleContext tupleContext) {
    BasicDBObject idObject = this.prepareIdObject( key );

    DBObject updater = objectForUpdate( tuple, idObject );
    WriteConcern writeConcern = getWriteConcern( tupleContext );

    getCollection( key ).update( idObject, updater, true, false, writeConcern );
  }
View Full Code Here

Examples of com.mongodb.DBObject

    for ( String versionColumn : oldLockState.getColumnNames() ) {
      idObject.put( versionColumn, oldLockState.get( versionColumn ) );
    }

    DBObject updater = objectForUpdate( tuple, idObject );
    DBObject doc = getCollection( entityKey ).findAndModify( idObject, updater );

    return doc != null;
  }
View Full Code Here

Examples of com.mongodb.DBObject

  }

  @Override
  public void insertTuple(EntityKeyMetadata entityKeyMetadata, Tuple tuple, TupleContext tupleContext) {
    WriteConcern writeConcern = getWriteConcern( tupleContext );
    DBObject objectWithId = insertDBObject( entityKeyMetadata, tuple, writeConcern );
    String idColumnName = entityKeyMetadata.getColumnNames()[0];
    tuple.put( idColumnName, objectWithId.get( ID_FIELDNAME ) );
  }
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.