112113114115116117118119120121122
List<DBObject> objects = new ArrayList<DBObject>(beans.size()); for(Message bean : beans) { if (exists(bean.getGuid())) { throw new DBException("Message with GUID: "+bean.getGuid() + " already exists"); } objects.add(generateDoc(bean)); }
137138139140141142143144
return collection.count(query) > 0; } catch(Exception e) { throw new DBException("Failed to query messagse for guid: "+messageGuid, e); } }
198199200201202203204205206207208
try { Message msg = getMessage(messageId); if (msg == null) { throw new DBException("No such message: "+messageId); } msg.getMetaTags().put(key, value); save(msg); }
220221222223224225226227228229230
try { Message msg = getMessage(messageId); if (msg == null) { throw new DBException("No such message: "+messageId); } msg.getResponderStates().put(responderId, state); save(msg); }
245246247248249250251252
DBObject dbObj = collection.findOne(query); return deserialise(dbObj, Message.class, true); } catch(Exception e) { throw new DBException("Failed to find message with guid: "+guid, e); } }
263264265266267268269270
// long count = collection.find(query).count(); return count; } catch(Exception e) { throw new DBException("Failed to query messages for topic: "+topicGuid, e); } }
294295296297298299300301
} return docs; } catch(Exception e) { throw new DBException("Failed to query messages for topic: "+topicGuid, e); } }
326327328329330331332333
} return docs; } catch(Exception e) { throw new DBException("Failed to list messages", e); } }
388389390391392393394395396397
} return docs; } catch(Exception e) { throw new DBException("Failed to get specified messages for: "+topicId + ", timestamp > "+new Date(afterTimestamp) + ", prefLimit: " + preferredLimit, e); } }
424425426427428429430431432
} return ids; } catch(Exception e) { throw new DBException("Failed to get specified message IDs for: "+topicId + ", timestamp > "+new Date(afterTimestamp), e); } }