Example usage for com.mongodb BasicDBObjectBuilder start

List of usage examples for com.mongodb BasicDBObjectBuilder start

Introduction

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

Prototype

public static BasicDBObjectBuilder start() 

Source Link

Document

Creates a builder intialized with an empty document.

Usage

From source file:converter.DriveConverter.java

public static DBObject toDBObject(Drive d) {

    BasicDBObjectBuilder builder = BasicDBObjectBuilder.start().append("name", d.getName())
            .append("lat", d.getLatitude()).append("long", d.getLongitude()).append("time", d.getTime())
            .append("distance", d.getDistance());

    //        if (a.getId() != null) {
    //            builder = builder.append("_id", new ObjectId(a.getId()));
    //        }//from w w w  . j  av  a2 s .  c  om
    return builder.get();
}

From source file:converter.KindergartenConverter.java

public static DBObject toDBObject(Kindergarten k) {

    BasicDBObjectBuilder builder = BasicDBObjectBuilder.start()
            .append("walk", WalkConverter.toDBObject(k.getWalk()))
            .append("drive", DriveConverter.toDBObject(k.getDrive()));

    return builder.get();
}

From source file:converter.OfferConverter.java

public static DBObject toDBObject(Offer of) {

    BasicDBObjectBuilder builder = BasicDBObjectBuilder.start().append("address", of.getAddress())
            .append("lat", of.getLatitude()).append("long", of.getLongitude()).append("type", of.getType())
            .append("price", of.getPrice()).append("link", of.getLink()).append("rooms", of.getRooms())
            .append("floor", of.getFloor()).append("m2", of.getM2());

    if (of.getId() != null) {
        builder = builder.append("_id", new ObjectId(of.getId()));
    }/*from  www.j  a va 2  s .  c  o  m*/
    return builder.get();
}

From source file:converter.PollutionConverter.java

public static DBObject toDBObject(Pollution p) {

    BasicDBObjectBuilder builder = BasicDBObjectBuilder.start().append("name", p.getName())
            .append("rate", p.getRate()).append("lat", p.getLatitude()).append("long", p.getLongitude())
            .append("distance", p.getDistance());

    return builder.get();
}

From source file:converter.SquareConverter.java

public static DBObject toDBObject(Square s) {

    BasicDBObjectBuilder builder = BasicDBObjectBuilder.start().append("lat", s.getLatitude())
            .append("long", s.getLongitude()).append("atm", AtmConverter.toDBObject(s.getNearestAtm()))
            .append("supermarket", SupermarketConverter.toDBObject(s.getNearestSupermarket()))
            .append("doctor", DoctorConverter.toDBObject(s.getNearestDoctor()))
            .append("kindergarten", KindergartenConverter.toDBObject(s.getNearestKindergarten()))
            .append("pollution", PollutionConverter.toDBObject(s.getPollution()));

    if (s.getId() != null)
        builder = builder.append("_id", new ObjectId(s.getId()));
    return builder.get();
}

From source file:converter.SupermarketConverter.java

public static DBObject toDBObject(Supermarket s) {

    BasicDBObjectBuilder builder = BasicDBObjectBuilder.start()
            .append("walk", WalkConverter.toDBObject(s.getWalk()))
            .append("drive", DriveConverter.toDBObject(s.getDrive()));

    return builder.get();

}

From source file:converter.WalkConverter.java

public static DBObject toDBObject(Walk w) {

    BasicDBObjectBuilder builder = BasicDBObjectBuilder.start().append("name", w.getName())
            .append("lat", w.getLatitude()).append("long", w.getLongitude()).append("time", w.getTime());

    //        if (a.getId() != null) {
    //            builder = builder.append("_id", new ObjectId(a.getId()));
    //        }/*from   w  w w .  j  a  v a  2s .  c  o  m*/
    return builder.get();
}

From source file:dao.MongoDBOfferDao.java

public Offer readOffer(String id) {
    DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(id)).get();
    DBObject data = this.col.findOne(query);
    return OfferConverter.toOffer(data);
}

From source file:dao.MongoDBSquareDao.java

public void updateSquare(Square p) {
    DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(p.getId())).get();
    this.col.update(query, SquareConverter.toDBObject(p));
}

From source file:dao.MongoDBSquareDao.java

public void deleteSquare(Square p) {
    DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(p.getId())).get();
    this.col.remove(query);
}