Example usage for com.mongodb QueryBuilder start

List of usage examples for com.mongodb QueryBuilder start

Introduction

In this page you can find the example usage for com.mongodb QueryBuilder start.

Prototype

public static QueryBuilder start(final String key) 

Source Link

Document

Creates a new query with a document key

Usage

From source file:com.novemberain.quartz.mongodb.MongoDBJobStore.java

License:Open Source License

private void unmarkTriggerGroupsAsPaused(Collection<String> groups) {
    pausedTriggerGroupsCollection.remove(QueryBuilder.start(KEY_GROUP).in(groups).get());
}

From source file:com.novemberain.quartz.mongodb.MongoDBJobStore.java

License:Open Source License

private void unmarkJobGroupsAsPaused(Collection<String> groups) {
    pausedJobGroupsCollection.remove(QueryBuilder.start(KEY_GROUP).in(groups).get());
}

From source file:com.shampan.model.PageModel.java

public ResultEvent addAlbumLikeByReferenceId(String referenceId, String likeInfo) {
    try {/*from  ww  w. j  av a 2s .  co  m*/
        MongoCollection<PageAlbumDAO> mongoCollection = DBConnection.getInstance().getConnection()
                .getCollection(Collections.PAGEALBUMS.toString(), PageAlbumDAO.class);
        String attrReferenceId = PropertyProvider.get("REFERENCE_ID");
        String attrLike = PropertyProvider.get("LIKE");
        BasicDBObject selectQuery = (BasicDBObject) QueryBuilder.start(attrReferenceId).is(referenceId).get();
        Like albumlikeInfo = Like.getLikeInfo(likeInfo);
        if (albumlikeInfo != null) {
            mongoCollection.findOneAndUpdate(selectQuery,
                    new Document("$push", new Document(attrLike, JSON.parse(albumlikeInfo.toString()))));
            this.getResultEvent().setResponseCode(PropertyProvider.get("SUCCESSFUL_OPERATION"));
        }
    } catch (Exception ex) {
        this.getResultEvent().setResponseCode(PropertyProvider.get("ERROR_EXCEPTION"));
    }
    return this.resultEvent;
}

From source file:com.shampan.model.PageModel.java

public List<PageAlbumDAO> getAlbums(String pageId) {
    MongoCollection<PageAlbumDAO> mongoCollection = DBConnection.getInstance().getConnection()
            .getCollection(Collections.PAGEALBUMS.toString(), PageAlbumDAO.class);
    BasicDBObject selectQuery = (BasicDBObject) QueryBuilder.start("pageId").is(pageId).get();
    Document pQuery = new Document();
    pQuery.put("albumId", "$all");
    pQuery.put("title", "$all");
    pQuery.put("totalImg", "$all");
    pQuery.put("defaultImg", "$all");
    MongoCursor<PageAlbumDAO> cursorAlbumList = mongoCollection.find(selectQuery).projection(pQuery).iterator();
    List<PageAlbumDAO> albumList = IteratorUtils.toList(cursorAlbumList);
    return albumList;

}

From source file:com.shampan.model.PageModel.java

public ResultEvent addAlbumCommentByReferenceId(String referenceId, String commentInfo) {
    try {// w  ww  .j  a va 2s  .co  m
        MongoCollection<PagePhotoDAO> mongoCollection = DBConnection.getInstance().getConnection()
                .getCollection(Collections.PAGEALBUMS.toString(), PagePhotoDAO.class);
        BasicDBObject selectQuery = (BasicDBObject) QueryBuilder.start("referenceId").is(referenceId).get();
        Comment photoCommentInfo = Comment.getCommentInfo(commentInfo);
        if (photoCommentInfo != null) {
            photoCommentInfo.setCreatedOn(utility.getCurrentTime());
            mongoCollection.findOneAndUpdate(selectQuery,
                    new Document("$push", new Document("comment", JSON.parse(photoCommentInfo.toString()))));
            this.getResultEvent().setResponseCode(PropertyProvider.get("SUCCESSFUL_OPERATION"));
        }
    } catch (Exception ex) {
        this.getResultEvent().setResponseCode(PropertyProvider.get("ERROR_EXCEPTION"));
    }
    return this.resultEvent;
}

From source file:com.shampan.model.PageModel.java

public ResultEvent addPhotoLikeByReferenceId(String referenceId, String likeInfo) {
    try {// w w w.  j a v  a2 s  .  c o  m
        MongoCollection<PagePhotoDAO> mongoCollection = DBConnection.getInstance().getConnection()
                .getCollection(Collections.PAGEPHOTOS.toString(), PagePhotoDAO.class);
        String attrReferenceId = PropertyProvider.get("REFERENCE_ID");
        String attrLike = PropertyProvider.get("LIKE");
        BasicDBObject selectQuery = (BasicDBObject) QueryBuilder.start(attrReferenceId).is(referenceId).get();
        Like photoLikeInfo = Like.getLikeInfo(likeInfo);
        if (photoLikeInfo != null) {
            mongoCollection.findOneAndUpdate(selectQuery,
                    new Document("$push", new Document(attrLike, JSON.parse(photoLikeInfo.toString()))));
            this.getResultEvent().setResponseCode(PropertyProvider.get("SUCCESSFUL_OPERATION"));
        }
    } catch (Exception ex) {
        this.getResultEvent().setResponseCode(PropertyProvider.get("ERROR_EXCEPTION"));
    }
    return this.resultEvent;
}

From source file:com.shampan.model.PageModel.java

public ResultEvent addPhotoLike(String photoId, String likeInfo) {
    try {/*from   www .  j  ava 2s.c  om*/
        MongoCollection<PagePhotoDAO> mongoCollection = DBConnection.getInstance().getConnection()
                .getCollection(Collections.PAGEPHOTOS.toString(), PagePhotoDAO.class);
        BasicDBObject selectQuery = (BasicDBObject) QueryBuilder.start("photoId").is(photoId).get();
        Like photoLikeInfo = Like.getLikeInfo(likeInfo);
        if (photoLikeInfo != null) {
            mongoCollection.findOneAndUpdate(selectQuery,
                    new Document("$push", new Document("like", JSON.parse(photoLikeInfo.toString()))));
            this.getResultEvent().setResponseCode(PropertyProvider.get("SUCCESSFUL_OPERATION"));
        }
    } catch (Exception ex) {
        this.getResultEvent().setResponseCode(PropertyProvider.get("ERROR_EXCEPTION"));
    }
    return this.resultEvent;
}

From source file:com.shampan.model.PageModel.java

public ResultEvent addMPhotoLike(String userId, String photoId, String likeInfo) {
    try {/*  w  w w  . j  a va 2s.c om*/
        MongoCollection<PagePhotoDAO> mongoCollection = DBConnection.getInstance().getConnection()
                .getCollection(Collections.PAGEPHOTOS.toString(), PagePhotoDAO.class);
        BasicDBObject selectQuery = (BasicDBObject) QueryBuilder.start("photoId").is(photoId).get();
        Like photoLikeInfo = Like.getLikeInfo(likeInfo);
        if (photoLikeInfo != null) {
            mongoCollection.findOneAndUpdate(selectQuery,
                    new Document("$set", new Document("modifiedOn", utility.getCurrentTime())));
            mongoCollection.findOneAndUpdate(selectQuery,
                    new Document("$push", new Document("like", JSON.parse(photoLikeInfo.toString()))));
            UserInfo userInfo = photoLikeInfo.getUserInfo();
            notificationModel.addGeneralNotificationPagePhotoLike(userId, photoId, userInfo.toString());
            this.getResultEvent().setResponseCode(PropertyProvider.get("SUCCESSFUL_OPERATION"));
        }
    } catch (Exception ex) {
        this.getResultEvent().setResponseCode(PropertyProvider.get("ERROR_EXCEPTION"));
    }
    return this.resultEvent;
}

From source file:com.shampan.model.PageModel.java

public ResultEvent addPhotoCommentByReferenceId(String referenceId, String commentInfo) {
    try {//from   w w  w. j  a  v  a2  s .co  m
        MongoCollection<PagePhotoDAO> mongoCollection = DBConnection.getInstance().getConnection()
                .getCollection(Collections.PAGEPHOTOS.toString(), PagePhotoDAO.class);
        BasicDBObject selectQuery = (BasicDBObject) QueryBuilder.start("referenceId").is(referenceId).get();
        Comment photoCommentInfo = Comment.getCommentInfo(commentInfo);
        if (photoCommentInfo != null) {
            photoCommentInfo.setCreatedOn(utility.getCurrentTime());
            mongoCollection.findOneAndUpdate(selectQuery,
                    new Document("$push", new Document("comment", JSON.parse(photoCommentInfo.toString()))));
            this.getResultEvent().setResponseCode(PropertyProvider.get("SUCCESSFUL_OPERATION"));
        }
    } catch (Exception ex) {
        this.getResultEvent().setResponseCode(PropertyProvider.get("ERROR_EXCEPTION"));
    }
    return this.resultEvent;
}

From source file:com.shampan.model.PageModel.java

public ResultEvent addPhotoComment(String photoId, String commentInfo) {
    try {/*  ww w. j  av  a  2s  .  co m*/
        MongoCollection<PagePhotoDAO> mongoCollection = DBConnection.getInstance().getConnection()
                .getCollection(Collections.PAGEPHOTOS.toString(), PagePhotoDAO.class);
        BasicDBObject selectQuery = (BasicDBObject) QueryBuilder.start("photoId").is(photoId).get();
        Comment photoCommentInfo = Comment.getCommentInfo(commentInfo);
        if (photoCommentInfo != null) {
            photoCommentInfo.setCreatedOn(utility.getCurrentTime());
            mongoCollection.findOneAndUpdate(selectQuery,
                    new Document("$push", new Document("comment", JSON.parse(photoCommentInfo.toString()))));
            this.getResultEvent().setResponseCode(PropertyProvider.get("SUCCESSFUL_OPERATION"));
        }
    } catch (Exception ex) {
        this.getResultEvent().setResponseCode(PropertyProvider.get("ERROR_EXCEPTION"));
    }
    return this.resultEvent;
}