List of usage examples for com.mongodb DBObject isPartialObject
boolean isPartialObject();
From source file:com.edgytech.umongo.MongoUtils.java
License:Apache License
public static DBObject checkObject(DBObject o, boolean canBeNull, boolean query) { if (o == null) { if (canBeNull) return null; throw new IllegalArgumentException("can't be null"); }/*w ww.j av a 2s . c o m*/ if (o.isPartialObject() && !query) throw new IllegalArgumentException("can't save partial objects"); if (!query) { checkKeys(o); } return o; }
From source file:org.jwebsocket.plugins.quota.storage.StorageQuotaMongo.java
License:Apache License
private IQuotaSingleInstance getSingleInstance(DBObject aObjQuota) { IQuotaSingleInstance lQuota;//from w w w .ja v a 2s .co m if (!aObjQuota.isPartialObject()) { lQuota = QuotaHelper.factorySingleInstance(Long.parseLong(aObjQuota.get("value").toString()), aObjQuota.get("instance").toString(), aObjQuota.get("uuid").toString(), aObjQuota.get("ns").toString(), aObjQuota.get("quotaType").toString(), aObjQuota.get("quotaIdentifier").toString(), aObjQuota.get("instanceType").toString(), aObjQuota.get("actions").toString()); } else { return null; } //Getting child quota. BasicDBObject lObject = new BasicDBObject(); lObject.put("uuidquota", aObjQuota.get("uuid")); DBCursor lDBQuota = mCollectionInstance.find(lObject); while (lDBQuota.hasNext()) { DBObject lObjInstance = lDBQuota.next(); //adding quota Child of this quota. QuotaChildSI lChild = new QuotaChildSI(lObjInstance.get("instance").toString(), aObjQuota.get("uuid").toString(), lObjInstance.get("instanceType").toString()); lChild.setValue(Long.parseLong(lObjInstance.get("value").toString())); lQuota.addChildQuota(lChild); } return lQuota; }