All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.versioneye.persistence.mongodb.PomDao Maven / Gradle / Ivy

Go to download

This is the java implementation of the VersionEye core services. It contains some buisiness logic and utility classes.

There is a newer version: 1.3.7
Show newest version
package com.versioneye.persistence.mongodb;


import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.versioneye.domain.Pom;
import com.versioneye.persistence.IPomDao;

public class PomDao implements IPomDao{

    private static final String POMS = "poms";
    private MongoDB mongoDB;

    private DBCollection getCollection(){
        return mongoDB.getDb().getCollection(POMS);
    }

    public void create(String url) {
        BasicDBObject doc = new BasicDBObject();
        doc.put(Pom.URL, url);
        getCollection().insert(doc);
    }

    public boolean existsAlready(String url) {
        DBCollection poms = getCollection();
        BasicDBObject doc = new BasicDBObject();
        doc.put(Pom.URL, url);
        DBCursor cursor = poms.find(doc);
        return cursor.hasNext();
    }

    public void setMongoDB(MongoDB mongoDB) {
        this.mongoDB = mongoDB;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy