Package com.bazaarvoice.commons.data.dao.mongo.dbo

Examples of com.bazaarvoice.commons.data.dao.mongo.dbo.QueryMongoDBObject


        return getDB().getCollection(_sequenceCollectionName);
    }

    @Override
    public int nextSequenceValue(String sequenceName) {
        QueryMongoDBObject query = new QueryMongoDBObject().forID(sequenceName);
        UpdateMongoDBObject update = new UpdateMongoDBObject().$inc(SEQUENCE_VALUE_PROPERTY_NAME);

        MongoDBObject modifiedObject = new MongoDBObject(getSequenceCollection().findAndModify(query, null, null, false, update, true, true));
        return modifiedObject.getInt(SEQUENCE_VALUE_PROPERTY_NAME);
    }
View Full Code Here


        T object = getCachedObject(objectID);
        if (object != null) {
            return object;
        }

        DBCursor dbCursor = getPrimaryCollection().find(new QueryMongoDBObject().forID(objectID)).limit(1);
        try {
            Iterator<DBObject> iterator = dbCursor.iterator();
            if (!iterator.hasNext()) {
                return null;
            }
View Full Code Here

    @Override
    public List<T> get(List<String> objectIDs) {
        // enhance: cache objects
        // enhance: support lazy-loading of objects

        DBCursor dbCursor = getPrimaryCollection().find(new QueryMongoDBObject().forIDs(objectIDs)).batchSize(Integer.MAX_VALUE);

        Map<String, T> index = Maps.newHashMap();
        try {
            for (DBObject dbObject : dbCursor) {
                if (dbObject != null) {
View Full Code Here

    protected void saveModelChanges(String objectID, ModelChanges<T> modelChanges) {
        Assert.isInstanceOf(MongoModelChanges.class, modelChanges);
        MongoModelChanges<T> mongoModelChanges = (MongoModelChanges<T>) modelChanges;

        DBCollection primaryCollection = getPrimaryCollection();
        primaryCollection.update(new QueryMongoDBObject().forID(objectID), mongoModelChanges.toDBObject(), false, false);
    }
View Full Code Here

    }

    @Timed
    @ExceptionMetered
    public void deleteAllByID(Collection<String> objectIDs) {
        getPrimaryCollection().remove(new QueryMongoDBObject().forIDs(objectIDs));
    }
View Full Code Here

        T object = getCachedObject(objectID);
        if (object != null) {
            return object;
        }

        DBObject dbObject = getPrimaryCollection().findOne(new QueryMongoDBObject().forID(objectID));
        if (dbObject == null) {
            return null;
        }

        object = _modelMarshaller.fromDBObject(new MongoDBObject(dbObject));
View Full Code Here

    @Override
    public List<T> get(List<String> objectIDs) {
        // enhance: cache objects
        // enhance: support lazy-loading of objects

        DBCursor dbCursor = getPrimaryCollection().find(new QueryMongoDBObject().forIDs(objectIDs)).
                batchSize(Integer.MAX_VALUE);

        Map<String, T> index = Maps.newHashMap();
        try {
            for (DBObject dbObject : dbCursor) {
View Full Code Here

    protected void saveModelChanges(String objectID, ModelChanges<T> modelChanges) {
        Assert.isInstanceOf(MongoModelChanges.class, modelChanges);
        MongoModelChanges<T> mongoModelChanges = (MongoModelChanges<T>) modelChanges;

        DBCollection primaryCollection = getPrimaryCollection();
        primaryCollection.update(new QueryMongoDBObject().forID(objectID), mongoModelChanges.toDBObject(), false, false, WriteConcern.SAFE);
    }
View Full Code Here

    }

    @Timed
    @ExceptionMetered
    public void deleteAllByID(Collection<String> objectIDs) {
        getPrimaryCollection().remove(new QueryMongoDBObject().forIDs(objectIDs), WriteConcern.SAFE);
    }
View Full Code Here

        T object = getCachedObject(objectID);
        if (object != null) {
            return object;
        }

        DBObject dbObject = getPrimaryCollection().findOne(new QueryMongoDBObject().forID(objectID));
        if (dbObject == null) {
            return null;
        }

        object = _modelMarshaller.fromDBObject(new MongoDBObject(dbObject));
View Full Code Here

TOP

Related Classes of com.bazaarvoice.commons.data.dao.mongo.dbo.QueryMongoDBObject

Copyright © 2018 www.massapicom. 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.