Package com.mongodb

Examples of com.mongodb.BasicDBList


        return object == null ? null : new MongoStateReader(object);
    }

    @Override
    public List<StateReader> readCollection(final String id) {
        BasicDBList array = (BasicDBList) instance.get(id);
        final List<StateReader> readers = new ArrayList<StateReader>();
        if (array != null) {
            final int size = array.size();
            for (int i = 0; i < size; i++) {
                readers.add(new MongoStateReader((DBObject) array.get(i)));
            }
        }
        return readers;
    }
View Full Code Here


    }

    private void convertToCursorObject(BasicDBObject query, FilterItem item) {
        if (item.isCompoundFilter()) {

            BasicDBList orList = new BasicDBList();

            final FilterItem[] childItems = item.getChildItems();
            for (FilterItem childItem : childItems) {
                BasicDBObject childObject = new BasicDBObject();
                convertToCursorObject(childObject, childItem);
                orList.add(childObject);
            }

            query.put("$or", orList);

        } else {
View Full Code Here

                    }
                }
                return result;
            } else {
                final List list = (List) object;
                final BasicDBList result = new BasicDBList();
                for (final Object obj : list) {
                    final DBObject item = (DBObject) obj;
                    final DBObject cleaned = removeEmptyArrays(item);
                    result.add(cleaned);
                }
                return result;
            }
        } catch (Throwable t) {
            LoggingUtils.getLogger().fine(t.toString());
View Full Code Here

        System.out.println("serialize MONGO OBJECT");

        BeanSerializer instance = new BeanSerializer();

        DBObject mock = new BasicDBObject("test", "THIS IS DBOBJECT");
        BasicDBList list = new BasicDBList();
        list.add(mock);

        MockBean bean = new MockBean();
        bean.setUid("");
        bean.setKey1("value1");
        bean.setList(list);
View Full Code Here

    return ret;
  }

  public DBObject newDBOBbject(PropertyRecord record) {
    DBObject ret = new BasicDBObject();
    BasicDBList propertyArray = new BasicDBList();
    if (record.getId() != null) {
      ret.put("_id", record.getId());
    }
    for (Property<Object> prop : record) {
      DBObject jsonProp = new BasicDBObject();
      jsonProp.put("name", prop.getName());
      jsonProp.put("value", prop.getValue());
      if (prop.getCreatorId() != null) {
        jsonProp.put("creatorId", prop.getCreatorId());
      }
      if (prop.getSourceId() != null) {
        jsonProp.put("sourceId", prop.getSourceId());
      }
      if (prop.getImporterId() != null) {
        jsonProp.put("importerId", prop.getImporterId());
      }
      propertyArray.add(jsonProp);
    }
    ret.put("properties", propertyArray);
    Date creationDate = new Date();
    ret.put("creationDate", creationDate);
    if (record.getCreatorId() != null) {
View Full Code Here

   * @return
   */
  @Override
  public Collection<PropertyRecord> findDublicates(PropertyRecord properties) {
    BasicDBObject query = new BasicDBObject();
    BasicDBList queryParts = new BasicDBList();
    query.put("$or", queryParts);
    for (Property<Object> property : properties) {
      BasicDBObject queryPart = new BasicDBObject();
      queryPart.append("properties.name", property.getName());
      queryPart.append("properties.value", property.getValue());
      if (property.getValue() instanceof String) {
        queryParts.add(queryPart);
      }
    }
    logger.debug("query: " + query);
    DBCursor dbCursor = this.dbCollection.find(query);
    if (dbCursor == null)
View Full Code Here

        this.mongoObject.append(field, value.unwrap());
    }

    @Override
    public void set(final String field, final Object[] values) {
        final BasicDBList list = new BasicDBList();
        Collections.addAll(list, values);
        this.mongoObject.append(field, list);
    }
View Full Code Here

        this.mongoObject.append(field, list);
    }

    @Override
    public void set(final String field, final NoSQLObject<BasicDBObject>[] values) {
        final BasicDBList list = new BasicDBList();
        for (final NoSQLObject<BasicDBObject> value : values) {
            list.add(value.unwrap());
        }
        this.mongoObject.append(field, list);
    }
View Full Code Here

    protected void addThrowableInformation(DBObject bson, final ThrowableInformation throwableInfo)
    {
        if (throwableInfo != null)
        {
            Throwable currentThrowable = throwableInfo.getThrowable();
            List      throwables       = new BasicDBList();
           
            while (currentThrowable != null)
            {
                DBObject throwableBson = bsonifyThrowable(currentThrowable);
               
                if (throwableBson != null)
                {
                    throwables.add(throwableBson);
                }
               
                currentThrowable = currentThrowable.getCause();
            }
           
            if (throwables.size() > 0)
            {
                bson.put("throwables", throwables);
            }
        }
    }
View Full Code Here

     * @param stackTrace The stack trace object to BSONify <i>(may be null)</i>.
     * @return The BSONified equivalent of the stack trace object <i>(may be null)</i>.
     */
    protected DBObject bsonifyStackTrace(final StackTraceElement[] stackTrace)
    {
        BasicDBList result = null;
       
        if (stackTrace != null && stackTrace.length > 0)
        {
            result = new BasicDBList();
           
            for (StackTraceElement element : stackTrace)
            {
                DBObject bson = bsonifyStackTraceElement(element);
               
                if (bson != null)
                {
                    result.add(bson);
                }
            }
        }
       
        return(result);
View Full Code Here

TOP

Related Classes of com.mongodb.BasicDBList

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.