public void generateFile(String filename) {
DB db = MongoHelper.mongoMerchantDB();
DBCollection col = db.getCollection(COLLECTION_SYNONYMS);
DBCursor cursor = col.find();
try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(filename, true)))) {
while (cursor.hasNext()) {
DBObject doc = cursor.next();
String word = doc.get(FIELD_KEY_WORLD) != null ? doc.get(FIELD_KEY_WORLD).toString() : null;
String synonyms = doc.get(FIELD_KEY_WORLD) != null
? StringUtils.join((BasicDBList) doc.get(FIELD_KEY_SYNONYMS), ",") : null;
if (word != null && synonyms != null) {
out.println(createLine(word, synonyms));
}
}
} catch (IOException e) {
throw new RuntimeException("IOException: Current db cursor with id: " + cursor.curr().get("_id"), e);
}
}
java类com.mongodb.DBCursor的实例源码
SynonymsGenerator.java 文件源码
项目:geeCommerce-Java-Shop-Software-and-PIM
阅读 24
收藏 0
点赞 0
评论 0
PersistenceBeanBasicSearchTest.java 文件源码
项目:tool.lars
阅读 19
收藏 0
点赞 0
评论 0
/**
* Test that providing a PaginationOptions object results in the correct skip() and limit()
* methods being called on the result cursor.
*/
@Test
public void testRetrieveAllAssetsPaginated(final @Mocked DBCollection collection, final @Injectable DBCursor cursor) {
new Expectations() {
{
collection.find((DBObject) withNotNull(), (DBObject) withNull());
result = cursor;
cursor.skip(20);
cursor.limit(10);
}
};
List<AssetFilter> filters = new ArrayList<>();
filters.add(new AssetFilter("key1", Arrays.asList(new Condition[] { new Condition(Operation.EQUALS, "value1") })));
PaginationOptions pagination = new PaginationOptions(20, 10);
createTestBean().retrieveAllAssets(filters, null, pagination, null);
}
AgentConfigurationRepository.java 文件源码
项目:elastest-instrumentation-manager
阅读 24
收藏 0
点赞 0
评论 0
public boolean existConfiguration(String agentId){
logger.info("Verifying if agent with agentId = " + agentId + " has a configuration stored in DB");
System.out.println("Verifying if agent with agentId = " + agentId + " has a configuration stored in DB");
BasicDBObject query = new BasicDBObject();
query.put("agentId", agentId);
DBCursor cursor = getAgentConfigurationTable().find(query);
if (cursor.hasNext()){
logger.info("Configuration for agent with agentId = " + agentId + " exists");
System.out.println("Configuration for agent with agentId = " + agentId + " exists");
return true;
}
else {
logger.info("Not exists any configuration for an agent with agentId = " + agentId);
System.out.println("Not exists any configuration for an agent with agentId = " + agentId);
return false;
}
}
AgentConfigurationRepository.java 文件源码
项目:elastest-instrumentation-manager
阅读 23
收藏 0
点赞 0
评论 0
public AgentConfigurationDatabase getAgentConfigurationByAgentId(String agentId){
System.out.println("Searching agent cfg in DB with agentId = " + agentId);
logger.info("Searching host in DB with agentId = " + agentId);
BasicDBObject query = new BasicDBObject();
query.put("agentId", agentId);
DBCursor cursor = getAgentConfigurationTable().find(query);
if (cursor.hasNext()){
logger.info("Agent cfg exists in DB with agentId = " + agentId);
return this.toAgentCfgDbObject(cursor.next());
}
else {
logger.info("Agent cfg doesn't exists in DB with agentId = " + agentId);
System.out.println("Agent cfg doesn't exists in DB with agentId = " + agentId);
return null;
}
}
AgentConfigurationRepository.java 文件源码
项目:elastest-instrumentation-manager
阅读 23
收藏 0
点赞 0
评论 0
public List<AgentConfigurationDatabase> findAll(){
ArrayList<AgentConfigurationDatabase> agents = null;
logger.info("Getting all agent cfgs from database...");
DBCursor cur = getAgentConfigurationTable().find();
while (cur.hasNext()) {
if (agents == null) {
agents = new ArrayList<AgentConfigurationDatabase>();
}
agents.add(this.toAgentCfgDbObject(cur.next()));
}
if (agents != null){
logger.info("Retrieved " + agents.size() + " agent configurations from database");
}
else {
logger.info("Retrieved " + 0 + " agent configurations from database");
}
return agents;
}
AgentRepository.java 文件源码
项目:elastest-instrumentation-manager
阅读 23
收藏 0
点赞 0
评论 0
public boolean existHost(String ipAddress){
logger.info("Verifying if host with ipAddress = " + ipAddress + " exists");
System.out.println("Verifying if host with ipAddress = " + ipAddress + " exists");
BasicDBObject query = new BasicDBObject();
query.put("host", ipAddress);
DBCursor cursor = getAgentTable().find(query);
if (cursor.hasNext()){
logger.info("Host with ipAddress = " + ipAddress + " exists");
System.out.println("Host with ipAddress = " + ipAddress + " exists");
return true;
}
else {
logger.info("Not exists any host with ipAddress = " + ipAddress);
System.out.println("Not exists any host with ipAddress = " + ipAddress);
return false;
}
}
AgentRepository.java 文件源码
项目:elastest-instrumentation-manager
阅读 21
收藏 0
点赞 0
评论 0
public AgentFull getAgentByIpAddress(String ipAddress){
logger.info("Searching host in DB with ipAddress = " + ipAddress);
System.out.println("Searching host in DB with ipAddress = " + ipAddress);
AgentFull agent = null;
BasicDBObject query = new BasicDBObject();
query.put("host", ipAddress);
DBCursor cursor = getAgentTable().find(query);
if (cursor.hasNext()){
agent = new AgentFull();
agent.setAgentId((String) cursor.next().get("agentId"));
agent.setHost((String) cursor.curr().get("host"));
agent.setMonitored((boolean) cursor.curr().get("monitored"));
agent.setLogstashIp((String) cursor.curr().get("logstashIp"));
agent.setLogstashPort((String) cursor.curr().get("logstashPort"));
logger.info("Host finded in DB with ipAddress = " + ipAddress + " with ID " + agent.getAgentId());
System.out.println("Host finded in DB with ipAddress = " + ipAddress + " with ID " + agent.getAgentId());
}
else {
logger.error("Host doesn't exists in DB with ipAddress = " + ipAddress);
System.out.println("Host doesn't exists in DB with ipAddress = " + ipAddress);
return null;
}
return agent;
}
AgentRepository.java 文件源码
项目:elastest-instrumentation-manager
阅读 27
收藏 0
点赞 0
评论 0
public AgentFull getAgentByAgentId(String agentId){
System.out.println("Searching host in DB with agentId = " + agentId);
logger.info("Searching host in DB with agentId = " + agentId);
AgentFull agent = null;
BasicDBObject query = new BasicDBObject();
query.put("agentId", agentId);
DBCursor cursor = getAgentTable().find(query);
if (cursor.hasNext()){
agent = new AgentFull();
agent.setAgentId((String) cursor.next().get("agentId"));
agent.setHost((String) cursor.curr().get("host"));
agent.setMonitored((boolean) cursor.curr().get("monitored"));
agent.setLogstashIp((String) cursor.curr().get("logstashIp"));
agent.setLogstashPort((String) cursor.curr().get("logstashPort"));
logger.info("Host finded in DB with agentId = " + agentId + " with ipAddress " + agent.getHost());
System.out.println("Host finded in DB with agentId = " + agentId + " with ipAddress " + agent.getHost());
}
else {
logger.info("Host doesn't exists in DB with agentId = " + agentId);
System.out.println("Host doesn't exists in DB with agentId = " + agentId);
return null;
}
return agent;
}
AgentRepository.java 文件源码
项目:elastest-instrumentation-manager
阅读 23
收藏 0
点赞 0
评论 0
public List<AgentFull> findAll(){
ArrayList<AgentFull> agents = null;
logger.info("Getting all agents from database...");
DBCursor cur = getAgentTable().find();
AgentFull agent = null;
while (cur.hasNext()) {
if (agents == null) {
agents = new ArrayList<AgentFull>();
}
agent = new AgentFull();
agent.setAgentId((String) cur.next().get("agentId"));
agent.setHost((String) cur.curr().get("host") );
agent.setMonitored((boolean) cur.curr().get("monitored"));
agents.add(agent);
}
if (agents != null){
logger.info("Retrieved " + agents.size() + " agents from database");
}
else {
logger.info("Retrieved " + 0 + " agents from database");
}
return agents;
}
AdvancedIntegrationTests.java 文件源码
项目:spring-data-examples
阅读 28
收藏 0
点赞 0
评论 0
/**
* This test demonstrates usage of {@code $comment} {@link Meta} usage. One can also enable profiling using
* {@code --profile=2} when starting {@literal mongod}.
* <p>
* <strong>NOTE</strong>: Requires MongoDB v. 2.6.4+
*/
@Test
public void findByFirstnameUsingMetaAttributes() {
// execute derived finder method just to get the comment in the profile log
repository.findByFirstname(dave.getFirstname());
// execute another finder without meta attributes that should not be picked up
repository.findByLastname(dave.getLastname(), new Sort("firstname"));
DBCursor cursor = operations.getCollection(ApplicationConfiguration.SYSTEM_PROFILE_DB)
.find(new BasicDBObject("query.$comment", AdvancedRepository.META_COMMENT));
while (cursor.hasNext()) {
DBObject dbo = cursor.next();
DBObject query = (DBObject) dbo.get("query");
assertThat(query.containsField("$comment"), is(true));
}
}
OccasionResource.java 文件源码
项目:sample-acmegifts
阅读 20
收藏 0
点赞 0
评论 0
/** Read the occasions that are stored in the database and schedule them to run. */
@PostConstruct
public void afterCreate() {
String method = "afterCreate";
logger.entering(clazz, method);
orchestrator.setOccasionResource(this);
DBCollection occasions = getCollection();
DBCursor cursor = occasions.find();
while (cursor.hasNext()) {
DBObject dbOccasion = cursor.next();
Occasion occasion = new Occasion(dbOccasion);
try {
// TODO: There was a comment here about how we should mark the event as
// popped in the database, which will have different meaning for
// one-time or interval occasions. Need to re-visit this.
orchestrator.scheduleOccasion(occasion);
} catch (Throwable t) {
logger.log(Level.WARNING, "Could not schedule occasion at startup", t);
}
}
logger.exiting(clazz, method);
}
MongoDbConnection.java 文件源码
项目:loom
阅读 30
收藏 0
点赞 0
评论 0
public List<String> getAllIds(final Map<String, Object> conditions) {
DBObject query = new BasicDBObject(conditions);
DBCursor cursor = coll.find(query);
List<String> ids = new ArrayList<String>(cursor.count());
for (DBObject o : cursor) {
ids.add(o.get("_id").toString());
}
return ids;
}
MongoDBCache.java 文件源码
项目:extension-mongodb
阅读 18
收藏 0
点赞 0
评论 0
public CacheEntry getCacheEntry(String key, CacheEntry defaultValue) {
DBCursor cur = null;
DBCollection coll = getCollection();
BasicDBObject query = new BasicDBObject("key", key.toLowerCase());
// be sure to flush
flushInvalid(coll,query);
cur = coll.find(query);
if (cur.count() > 0) {
hits++;
MongoDBCacheDocument doc = new MongoDBCacheDocument((BasicDBObject) cur.next());
doc.addHit();
//update the statistic and persist
save(doc,0);
return new MongoDBCacheEntry(doc);
}
misses++;
return defaultValue;
}
MongoDBCache.java 文件源码
项目:extension-mongodb
阅读 21
收藏 0
点赞 0
评论 0
@Override
public int remove(CacheKeyFilter filter) {
DBCursor cur = qAll_Keys();
int counter = 0;
while (cur.hasNext()) {
DBObject obj = cur.next();
String key = (String) obj.get("key");
if (filter.accept(key)) {
doDelete((BasicDBObject) obj);
counter++;
}
}
return counter;
}
MongoDBCache.java 文件源码
项目:extension-mongodb
阅读 22
收藏 0
点赞 0
评论 0
@Override
public int remove(CacheEntryFilter filter) {
DBCursor cur = qAll();
int counter = 0;
while (cur.hasNext()) {
BasicDBObject obj = (BasicDBObject) cur.next();
MongoDBCacheEntry entry = new MongoDBCacheEntry(new MongoDBCacheDocument(obj));
if (filter.accept(entry)) {
doDelete(obj);
counter++;
}
}
return counter;
}
MongoDBCache.java 文件源码
项目:extension-mongodb
阅读 20
收藏 0
点赞 0
评论 0
@Override
public List<Object> values(CacheKeyFilter filter) {
DBCursor cur = qAll_Keys_Values();
List<Object> result = new ArrayList<Object>();
while (cur.hasNext()) {
BasicDBObject obj = (BasicDBObject) cur.next();
MongoDBCacheDocument doc = new MongoDBCacheDocument(obj);
if (filter.accept(doc.getKey())) {
try {
result.add(MongoDBCacheDocument.getValue(obj));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
return result;
}
MongoDBCache.java 文件源码
项目:extension-mongodb
阅读 21
收藏 0
点赞 0
评论 0
@Override
public List<Object> values(CacheEntryFilter filter) {
DBCursor cur = qAll_Keys_Values();
List<Object> result = new ArrayList<Object>();
while (cur.hasNext()) {
BasicDBObject obj = (BasicDBObject) cur.next();
MongoDBCacheEntry entry = new MongoDBCacheEntry(new MongoDBCacheDocument(obj));
if (filter.accept(entry)) {
try {
result.add(MongoDBCacheDocument.getValue(obj));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
return result;
}
DBCollectionImpl.java 文件源码
项目:extension-mongodb
阅读 20
收藏 0
点赞 0
评论 0
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
DBCursor cursor = coll.find();
Iterator<DBObject> it = cursor.iterator();
DumpTable table = new DumpTable("struct","#339933","#8e714e","#000000");
table.setTitle("DBCollection");
maxlevel--;
DBObject obj;
while(it.hasNext()) {
obj = it.next();
table.appendRow(0,
__toDumpData(toCFML(obj), pageContext,maxlevel,dp)
);
}
return table;
}
EmployeeDao.java 文件源码
项目:JerseyRestBoilerplate
阅读 35
收藏 0
点赞 0
评论 0
public StringBuilder getMongoDBData() {
DBCollection collection = MongoUtil.getCollection("some_db",
"some_collection");
DBCursor cursor = collection.find();
StringBuilder data = new StringBuilder();
long startTime = System.currentTimeMillis();
while (cursor.hasNext()) {
data.append(cursor.next());
}
long endTime = System.currentTimeMillis();
System.out.println("Time taken : " + (endTime - startTime));
return data;
}
AggregateOutTest.java 文件源码
项目:mongodb-aggregate-query-support
阅读 19
收藏 0
点赞 0
评论 0
@Test
public void outMustPlaceRepositoryObjectsInDifferentRepositoryIfOtherQueryAnnotationsArePresent() {
String randomStr = randomAlphabetic(10);
TestAggregateAnnotation2FieldsBean obj1 = new TestAggregateAnnotation2FieldsBean(randomStr);
TestAggregateAnnotation2FieldsBean obj2 = new TestAggregateAnnotation2FieldsBean(randomAlphabetic(20),
nextInt(1, 10000));
TestAggregateAnnotation2FieldsBean obj3 = new TestAggregateAnnotation2FieldsBean(randomStr, nextInt(1, 10000));
testAggregateRepository2.save(obj1);
testAggregateRepository2.save(obj2);
testAggregateRepository2.save(obj3);
String outputRepoName = "tempBroken";
testAggregateRepository2.aggregateQueryWithMatchAndOut(randomStr, outputRepoName);
assertTrue(mongoTemplate.collectionExists(outputRepoName));
List<TestAggregateAnnotation2FieldsBean> copiedObjs = mongoTemplate.findAll(TestAggregateAnnotation2FieldsBean.class,
outputRepoName);
//clear testAggregateAnnotationFieldsBean repo before running this test
assertSame(copiedObjs.size(), 2);
DBCursor dbCursor = mongoTemplate.getCollection("tempBroken").find();
assertTrue(dbCursor.hasNext());
}
MongoDbGridFSIO.java 文件源码
项目:beam
阅读 23
收藏 0
点赞 0
评论 0
@Override
public long getEstimatedSizeBytes(PipelineOptions options) throws Exception {
Mongo mongo = spec.connectionConfiguration().setupMongo();
try {
GridFS gridfs = spec.connectionConfiguration().setupGridFS(mongo);
DBCursor cursor = createCursor(gridfs);
long size = 0;
while (cursor.hasNext()) {
GridFSDBFile file = (GridFSDBFile) cursor.next();
size += file.getLength();
}
return size;
} finally {
mongo.close();
}
}
ModuleFactions.java 文件源码
项目:Sledgehammer
阅读 24
收藏 0
点赞 0
评论 0
/**
* (Private Method)
* <p>
* Loads MongoFaction Objects from the database.
*/
private void loadMongoFactions() {
println("Loading Faction(s)...");
// Create HashMap.
mapMongoFactions = new HashMap<>();
// Initiate collection query.
DBCursor cursor = collectionFactions.find();
// Go through each entry.
while (cursor.hasNext()) {
// Create an object for each entry.
MongoFaction mongoFaction = new MongoFaction(collectionFactions, cursor.next());
// Add to the map with the UUID of the Faction.
mapMongoFactions.put(mongoFaction.getUniqueId(), mongoFaction);
}
// Close the query.
cursor.close();
// Report statistics.
int size = mapMongoFactions.size();
println("Loaded " + (size == 0 ? "no" : size + "") + " Faction" + (size == 1 ? "" : "s") + ".");
}
ModuleFactions.java 文件源码
项目:Sledgehammer
阅读 92
收藏 0
点赞 0
评论 0
/**
* (Private Method)
* <p>
* Loads MongoFactionMember Objects from the database.
*/
private void loadMongoFactionMembers() {
println("Loading Faction Member(s)...");
// Create HashMap.
mapMongoFactionMembers = new HashMap<>();
// Initiate collection query.
DBCursor cursor = collectionFactionMembers.find();
// Go through each entry.
while (cursor.hasNext()) {
// Create an object for each entry.
MongoFactionMember mongoFactionMember = new MongoFactionMember(collectionFactionMembers, cursor.next());
// Add to the map with the UUID of the FactionMember.
mapMongoFactionMembers.put(mongoFactionMember.getPlayerId(), mongoFactionMember);
}
// Close the query.
cursor.close();
// Report statistics.
int size = mapMongoFactionMembers.size();
println("Loaded " + (size == 0 ? "no" : size + "") + " Faction Member" + (size == 1 ? "" : "s") + ".");
}
ModuleFactions.java 文件源码
项目:Sledgehammer
阅读 20
收藏 0
点赞 0
评论 0
/**
* (Private Method)
* <p>
* Loads MongoFactionInvite Objects from the database.
*/
private void loadMongoFactionInvites() {
println("Loading Faction Invite(s)...");
// Create HashMap.
mapMongoFactionInvites = new HashMap<>();
// Initiate collection query.
DBCursor cursor = collectionFactionInvites.find();
// Go through each entry.
while (cursor.hasNext()) {
// Create an object for each entry.
MongoFactionInvite mongoFactionInvite = new MongoFactionInvite(collectionFactionInvites, cursor.next());
// Add to the map with the UUID of the MongoFactionInvite.
mapMongoFactionInvites.put(mongoFactionInvite.getUniqueId(), mongoFactionInvite);
}
// Close the query.
cursor.close();
// Report statistics.
int size = mapMongoFactionInvites.size();
println("Loaded " + (size == 0 ? "no" : size + "") + " Faction Invite" + (size == 1 ? "" : "s") + ".");
}
ModuleChat.java 文件源码
项目:Sledgehammer
阅读 20
收藏 0
点赞 0
评论 0
/**
* @param channelId The Unique ID of the channel.
* @param limit The Integer limit of ChatMessages to load.
* @return Returns a List of ChatMessages for the ChatChannel.
*/
private List<ChatMessage> getChatMessages(UUID channelId, int limit) {
List<ChatMessage> listChatMessages = new LinkedList<>();
// Grab all the messages with the channel_id set to the one provided.
DBObject query = new BasicDBObject("channel_id", channelId);
DBCursor cursor = collectionMessages.find(query);
// Sort the list by timestamp so that the last messages appear first.
cursor.sort(new BasicDBObject("timestamp", -1));
cursor.limit(limit);
if(cursor.size() > 0) {
List<DBObject> listObjects = cursor.toArray();
Collections.reverse(listObjects);
for(DBObject object : listObjects) {
// Create the MongoDocument.
MongoChatMessage mongoChatMessage = new MongoChatMessage(collectionMessages, object);
// Create the container for the document.
ChatMessage chatMessage = new ChatMessage(mongoChatMessage);
// Add this to the list to return.
listChatMessages.add(chatMessage);
}
}
// Close the cursor to release resources.
cursor.close();
// Return the result list of messages for the channel.
return listChatMessages;
}
SledgehammerDatabase.java 文件源码
项目:Sledgehammer
阅读 21
收藏 0
点赞 0
评论 0
public MongoPlayer getMongoPlayer(UUID uniqueId) {
if (uniqueId == null) {
throw new IllegalArgumentException("SledgehammerDatabase: uniqueId given is null!");
}
MongoPlayer player;
player = mapPlayersByUUID.get(uniqueId);
if (player == null) {
DBCursor cursor = collectionPlayers.find(new BasicDBObject("uuid", uniqueId.toString()));
if (cursor.hasNext()) {
player = new MongoPlayer(collectionPlayers, cursor.next());
registerPlayer(player);
}
cursor.close();
}
return player;
}
SledgehammerDatabase.java 文件源码
项目:Sledgehammer
阅读 22
收藏 0
点赞 0
评论 0
public MongoPlayer getMongoPlayer(String username) {
if (username == null || username.isEmpty()) {
throw new IllegalArgumentException("SledgehammerDatabase: Username given is null or empty!");
}
MongoPlayer player;
player = mapPlayersByUsername.get(username);
if (player == null) {
DBCursor cursor = collectionPlayers.find(new BasicDBObject("username", username));
if (cursor.hasNext()) {
player = new MongoPlayer(collectionPlayers, cursor.next());
registerPlayer(player);
}
cursor.close();
}
return player;
}
SledgehammerDatabase.java 文件源码
项目:Sledgehammer
阅读 20
收藏 0
点赞 0
评论 0
public MongoPlayer getMongoPlayer(String username, String password) {
if (username == null || username.isEmpty()) {
throw new IllegalArgumentException("SledgehammerDatabase: Username given is null or empty!");
}
MongoPlayer player;
player = mapPlayersByUsername.get(username);
if (player != null && !player.passwordsMatch(password)) {
player = null;
}
if (player == null) {
DBCursor cursor = collectionPlayers
.find(new BasicDBObject("username", username).append("password", MD5.encrypt(password)));
if (cursor.hasNext()) {
player = new MongoPlayer(collectionPlayers, cursor.next());
registerPlayer(player);
}
cursor.close();
}
return player;
}
SledgehammerDatabase.java 文件源码
项目:Sledgehammer
阅读 18
收藏 0
点赞 0
评论 0
public UUID getPlayerID(String username) {
if (username == null || username.isEmpty()) {
throw new IllegalArgumentException("SledgehammerDatabase: Username is null or empty!");
}
MongoPlayer player = getMongoPlayer(username);
if (player != null) {
return player.getUniqueId();
}
UUID returned = null;
DBCursor cursor = collectionPlayers.find(new BasicDBObject("username", username));
if (cursor.hasNext()) {
DBObject object = cursor.next();
returned = UUID.fromString(object.get("uuid").toString());
}
cursor.close();
return returned;
}
MongoObjectStore.java 文件源码
项目:Elko
阅读 26
收藏 0
点赞 0
评论 0
/**
* Perform a single 'query' operation on the local object store.
*
* @param template Query template indicating what objects are sought.
* @param collection Collection to query.
* @param maxResults Maximum number of result objects to return, or 0 to
* indicate no fixed limit.
*
* @return a list of ObjectDesc objects for objects matching the query.
*/
private List<ObjectDesc> doQuery(JSONObject template,
DBCollection collection, int maxResults) {
List<ObjectDesc> results = new LinkedList<ObjectDesc>();
try {
DBObject query = jsonObjectToDBObject(template);
DBCursor cursor;
if (maxResults > 0) {
cursor = collection.find(query, null, 0, -maxResults);
} else {
cursor = collection.find(query);
}
for (DBObject dbObj : cursor) {
JSONObject jsonObj = dbObjectToJSONObject(dbObj);
String obj = jsonObj.sendableString();
results.add(new ObjectDesc("query", obj, null));
}
} catch (Exception e) {
results.add(new ObjectDesc("query", null, e.getMessage()));
}
return results;
}