Package com.mongodb

Examples of com.mongodb.BasicDBList


        {
            result = new BasicDBObject();
           
            result.put("fullyQualifiedClassName", className);
           
            List     packageComponents   = new BasicDBList();
            String[] packageAndClassName = className.split("\\.");
           
            packageComponents.addAll(Arrays.asList(packageAndClassName));
            // Requires Java 6
            //packageComponents.addAll(Arrays.asList(Arrays.copyOf(packageAndClassName, packageAndClassName.length - 1)));
           
            if (packageComponents.size() > 0)
            {
                result.put("package",   packageComponents);
            }
           
            result.put("className", packageAndClassName[packageAndClassName.length - 1]);
View Full Code Here


        // verify log entry content
        DBObject entry = collection.findOne();
        assertNotNull(entry);
        assertEquals("WARN", entry.get("level"));
        BasicDBList list = (BasicDBList) entry.get("array");
        assertEquals(2, list.size());
        assertEquals(this.getClass().getSimpleName(), list.get(0));
        assertEquals(msg, list.get(1));
    }
View Full Code Here

        assertEquals("ERROR", entry.get("level"));
        assertEquals("Error entry", entry.get("message"));
       
        // verify throwable presence and content
        assertTrue("Throwable is not present in logged entry", entry.containsField("throwables"));
        BasicDBList throwables = (BasicDBList)entry.get("throwables");
        assertEquals(1, throwables.size());
       
        DBObject throwableEntry = (DBObject)throwables.get("0");
        assertTrue("Throwable message is not present in logged entry", throwableEntry.containsField("message"));
        assertEquals("Here is an exception!", throwableEntry.get("message"));
    }
View Full Code Here

        assertEquals("ERROR", entry.get("level"));
        assertEquals("Error entry", entry.get("message"));
       
        // verify throwable presence and content
        assertTrue("Throwable is not present in logged entry", entry.containsField("throwables"));
        BasicDBList throwables = (BasicDBList)entry.get("throwables");
        assertEquals(2, throwables.size());
       
        DBObject rootEntry = (DBObject)throwables.get("0");                
        assertTrue("Throwable message is not present in logged entry", rootEntry.containsField("message"));
        assertEquals("I'm an innocent bystander.", rootEntry.get("message"));
       
        DBObject chainedEntry = (DBObject)throwables.get("1");                
        assertTrue("Throwable message is not present in logged entry", chainedEntry.containsField("message"));
        assertEquals("I'm the real culprit!", chainedEntry.get("message"));
    }
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

            AggregationOutput aggregationResult = null;

            // Allow body to be a pipeline
            // @see http://docs.mongodb.org/manual/core/aggregation/
            if (query instanceof BasicDBList) {
                BasicDBList queryList = (BasicDBList)query;
                aggregationResult = dbCol.aggregate((DBObject)queryList.get(0), (BasicDBObject[])queryList
                    .subList(1, queryList.size()).toArray(new BasicDBObject[queryList.size() - 1]));
            } else {
                aggregationResult = dbCol.aggregate(query);
            }

            dbIterator = aggregationResult.results();
View Full Code Here

        final DBObject keys = new BasicDBObject(TableColumns.JOBEXECUTIONID, 1);
        keys.put(TableColumns._id, 0);
        final DBCursor cursor = db.getCollection(TableColumns.JOB_EXECUTION).find(
                new BasicDBObject(TableColumns.JOBINSTANCEID, jobExecutionToRestart.getJobInstance().getInstanceId()),
                keys);
        final BasicDBList basicDBList = new BasicDBList();
        while (cursor.hasNext()) {
            final DBObject next = cursor.next();
            basicDBList.add(next.get(TableColumns.JOBEXECUTIONID));
        }
        final DBObject inClause = new BasicDBObject("$in", basicDBList);
        final DBObject query = new BasicDBObject(TableColumns.JOBEXECUTIONID, inClause);
        query.put(TableColumns.STEPNAME, stepName);
        final DBCursor cursor1 = db.getCollection(TableColumns.STEP_EXECUTION).find(query).sort(
View Full Code Here

        final DBObject keys = new BasicDBObject(TableColumns.JOBEXECUTIONID, 1);
        keys.put(TableColumns._id, 0);
        final DBCursor cursor = db.getCollection(TableColumns.JOB_EXECUTION).find(
                new BasicDBObject(TableColumns.JOBINSTANCEID, jobInstanceId),
                keys);
        final BasicDBList basicDBList = new BasicDBList();
        while (cursor.hasNext()) {
            final DBObject next = cursor.next();
            basicDBList.add(next.get(TableColumns.JOBEXECUTIONID));
        }
        final DBObject inClause = new BasicDBObject("$in", basicDBList);
        final DBObject query = new BasicDBObject(TableColumns.JOBEXECUTIONID, inClause);
        query.put(TableColumns.STEPNAME, stepName);
        return db.getCollection(TableColumns.STEP_EXECUTION).find(query).count();
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

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.