- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Dictionary d =
new Hashtable()
Bundle bundle;bundle.getHeaders()
new Properties()
- Smart code suggestions by Codota
}
@Override public long totalExtractorCount() { final DBObject query = new BasicDBObject(InputImpl.EMBEDDED_EXTRACTORS, new BasicDBObject("$exists", true)); long extractorsCount = 0; try (DBCursor inputs = dbCollection.find(query, new BasicDBObject(InputImpl.EMBEDDED_EXTRACTORS, 1))) { for (DBObject input : inputs) { final BasicDBList extractors = (BasicDBList) input.get(InputImpl.EMBEDDED_EXTRACTORS); extractorsCount += extractors.size(); } } return extractorsCount; }
public void shutdown() { client.close(); }
BasicDBObject doc = new BasicDBObject( "name", "Matt" ); collection.insert( doc ); ObjectId id = (ObjectId)doc.get( "_id" );
public BasicDBList getList(String key) { DBCollection coll = getCollection(); DBObject query = new BasicDBObject(); query.put("key", key); DBObject result = coll.findOne(query); return (BasicDBList) result.get("value"); }
@Override public <T extends Persisted> int destroyAll(Class<T> modelClass) { return collection(modelClass).remove(new BasicDBObject()).getN(); }
private MongoQueryRunner(Session session, int workers) throws Exception { super(session, workers); server = new MongoServer(new SyncMemoryBackend()); address = server.bind(); client = new MongoClient(new ServerAddress(address)); }
@Override public DBObject convert(DataPointId id) { DBObject object = new BasicDBObject(FIELDS); object.put("date", id.getDate()); object.put("account", id.getAccount()); return object; } }
protected DBObject findOne(DBObject query, DBObject sort, String collectioName) { return collection(collectioName).findOne(query, new BasicDBObject(), sort); }
@Override public void doRun() { LOG.debug("Starting alarm callbacks migration"); final DBObject selection = QueryBuilder.start("id").exists(true).get(); final DBObject modifications = new BasicDBObject("$unset", new BasicDBObject("id", "")); this.dbCollection.updateMulti(selection, modifications); LOG.debug("Done with alarm callbacks migration"); }
public MongoClientURI getMongoClientURI() { final MongoClientOptions.Builder mongoClientOptionsBuilder = MongoClientOptions.builder() .connectionsPerHost(getMaxConnections()) .threadsAllowedToBlockForConnectionMultiplier(getThreadsAllowedToBlockMultiplier()); return new MongoClientURI(uri, mongoClientOptionsBuilder); }
/** * 创建ServerAddress对象 * * @param host 主机域名或者IP(如果为空默认127.0.0.1) * @param port 端口(如果为空默认为) * @return ServerAddress */ private ServerAddress createServerAddress(String host, int port) { return new ServerAddress(host, port); }
/** * 获得DB * * @param dbName DB * @return DB */ public MongoDatabase getDb(String dbName) { return mongo.getDatabase(dbName); }
public boolean getBoolean(String key) { DBCollection coll = getCollection(); DBObject query = new BasicDBObject(); query.put("key", key); DBObject result = coll.findOne(query); if (result == null) { return false; } if (result.get("value").equals(true)) { return true; } return false; }
protected int destroyAll(String collectionName) { return collection(collectionName).remove(new BasicDBObject()).getN(); }
/** * 创建ServerAddress对象 * * @param host 主机域名或者IP(如果为空默认127.0.0.1) * @param port 端口(如果为空默认为) * @return ServerAddress */ private ServerAddress createServerAddress(String host, int port) { return new ServerAddress(host, port); }
/** * 获得DB * * @param dbName DB * @return DB */ public MongoDatabase getDb(String dbName) { return mongo.getDatabase(dbName); }
/** * Closes all resources associated with this instance. */ public void close() { client.close(); }