Java Code Examples for com.mongodb.BasicDBList#isEmpty()
The following examples show how to use
com.mongodb.BasicDBList#isEmpty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MongoData.java From Mycat2 with GNU General Public License v3.0 | 6 votes |
public void setGrouyBy(DBObject gb) { this.groupby = gb; this.type = true; if (gb instanceof BasicDBList) { BasicDBList basicDBList = (BasicDBList)gb; if(!basicDBList.isEmpty()){ Object gb2 = basicDBList.get(0); if (gb2 instanceof DBObject) { for (String field : ((DBObject) gb2).keySet()) { Object val = ((DBObject) gb2).get(field); setField(field, getObjectToType(val)); } } } } }
Example 2
Source File: Occasion.java From sample-acmegifts with Eclipse Public License 1.0 | 4 votes |
public BasicDBObject toDbo() { String method = "toDbo"; logger.entering(clazz, method); logger.fine("id: " + id); logger.fine("date: " + date); logger.fine("groupId: " + groupId); logger.fine("interval: " + interval); logger.fine("name: " + name); logger.fine("organizerId: " + organizerId); logger.fine("recipientId: " + recipientId); logger.fine("contributions: " + Contribution.listToString(contributions)); // build the db object BasicDBObject dbo = new BasicDBObject(); if (null != id && ObjectId.isValid(id.toString())) { dbo.append(OCCASION_ID_KEY, id); } if (null != date && !date.isEmpty()) { dbo.append(OCCASION_DATE_KEY, date); } if (null != groupId && !groupId.isEmpty()) { dbo.append(OCCASION_GROUP_ID_KEY, groupId); } if (null != interval && !interval.isEmpty()) { dbo.append(OCCASION_INTERVAL_KEY, interval); } if (null != name && !name.isEmpty()) { dbo.append(OCCASION_NAME_KEY, name); } if (null != organizerId && !organizerId.isEmpty()) { dbo.append(OCCASION_ORGANIZER_ID_KEY, organizerId); } if (null != recipientId && !recipientId.isEmpty()) { dbo.append(OCCASION_RECIPIENT_ID_KEY, recipientId); } BasicDBList contributionDbList = Contribution.listToDBList(contributions); if (null != contributionDbList && !contributionDbList.isEmpty()) { dbo.append(OCCASION_CONTRIBUTIONS_KEY, contributionDbList); } logger.exiting(clazz, method, dbo); return dbo; }