Package com.mongodb

Examples of com.mongodb.DBObject.toMap()


    @Override
    public CenterGroup getGroupCenter(String id, String centerId) throws DataAccessException {
        CenterGroup group = null;
        DBObject obj = coll.findOne(new ObjectId(id), null);
        if (obj != null && obj.get(CenterUserKeys.centerId).toString().equals(centerId)) {
            group = factory.createCenterGroup(obj.toMap());
        }
        return group;
    }

    @Override
View Full Code Here



    @Override
    public Center getCenter(String id) {
        DBObject obj = coll.findOne(new ObjectId(id),null);
        return obj != null ? factory.createCenter(obj.toMap()) : null;
    }

    @Override
    public List<Center> getCentersAsList(int page) {
        List<DBObject> objects = coll.find().skip(offset * page).limit(offset).toArray();
 
View Full Code Here

        DBCursor cursor = coll.find(new BasicDBObject(CenterKeys.name, name.toUpperCase()));
        if(cursor.hasNext()) centers = new FastList<Center>();
        while (cursor.hasNext()) {
            DBObject obj = cursor.next();
            if (obj.get(CenterKeys.name).equals(name)) {
                centers.add(factory.createCenter(obj.toMap()));
            }
        }
        return centers != null? centers : Collections.EMPTY_LIST;
    }
View Full Code Here

   *      Mongo Object IDs</a>
   */
  public String fromIdToLong(String id, boolean isUser) {
    DBObject objectIdLong = collectionMap.findOne(new BasicDBObject("element_id", id));
    if (objectIdLong != null) {
      Map<String,Object> idLong = (Map<String,Object>) objectIdLong.toMap();
      Object value = idLong.get("long_value");
      return value == null ? null : value.toString();
    } else {
      objectIdLong = new BasicDBObject();
      String longValue = Long.toString(idCounter++);
View Full Code Here

   * @see <a href="http://www.mongodb.org/display/DOCS/Object%20IDs">
   *      Mongo Object IDs</a>
   */
  public String fromLongToId(long id) {
    DBObject objectIdLong = collectionMap.findOne(new BasicDBObject("long_value", Long.toString(id)));
    Map<String,Object> idLong = (Map<String,Object>) objectIdLong.toMap();
    Object value = idLong.get("element_id");
    return value == null ? null : value.toString();
  }

  /**
 
View Full Code Here

                    }
                }

                boolean equal = true;
                DBObject key = (DBObject)index.get("key");
                if (key.toMap().size() != idxObj.toMap().size())
                {
                    equal = false;
                }
                else
                {
View Full Code Here

        try {
            while (dbCursor.hasNext()) {
                DBObject dbObject = dbCursor.next();
                if (kclass == null) {
                    result.add(dbObject.toMap());
                } else {
                    result.add(staticMethod(kclass, "create", dbObject.toMap()));
                }

            }
View Full Code Here

            while (dbCursor.hasNext()) {
                DBObject dbObject = dbCursor.next();
                if (kclass == null) {
                    result.add(dbObject.toMap());
                } else {
                    result.add(staticMethod(kclass, "create", dbObject.toMap()));
                }

            }
        } finally {
            dbCursor.close();
View Full Code Here

    String json = share.getShare();
    if (null != json) {
      try {
        DBObject dbo = (DBObject) JSON.parse(json);
        if (null != dbo) {
          for (Object entryObj: dbo.toMap().entrySet()) {
            @SuppressWarnings("unchecked")
            Map.Entry<String, Object> entry = (Map.Entry<String, Object>)entryObj;
           
            String masterAlias = entry.getKey();
           
View Full Code Here

    String json = share.getShare();
    if (null != json) {
      try {
        DBObject dbo = (DBObject) JSON.parse(json);
        if (null != dbo) {
          for (Object entryObj: dbo.toMap().entrySet()) {
            @SuppressWarnings("unchecked")
            Map.Entry<String, Object> entry = (Map.Entry<String, Object>)entryObj;
           
            String masterAlias = entry.getKey();
            EntityPojo masterAliasEntity = new EntityPojo();
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.