예제 #1
0
 private void buildCollectionDetail(MongoDatabase db, TreeItem<DbTreeValue> ti) {
   DbTreeValue indexCategory = new DbTreeValue(db, "Indexes", TreeValueType.CATEGORY);
   indexCategory.setCollectionName(ti.getValue().getDisplayValue());
   ti.getChildren()
       .add(
           new DynamicTreeItem(
               indexCategory,
               new FontAwesomeIconView(FontAwesomeIcon.FOLDER),
               executor,
               popupService,
               this::buildIndexes));
 }
예제 #2
0
  private List<TreeItem<DbTreeValue>> buildIndexes(DbTreeValue value) {
    MongoCollection<Document> collection =
        value.getMongoDatabase().getMongoDb().getCollection(value.getCollectionName());

    return StreamSupport.stream(collection.listIndexes().spliterator(), false)
        .map(
            d -> {
              DbTreeValue val =
                  new DbTreeValue(
                      value.getMongoDatabase(), (String) d.get("name"), TreeValueType.INDEX);
              val.setCollectionName(value.getDisplayValue());
              return new TreeItem<>(val, new FontAwesomeIconView(FontAwesomeIcon.ASTERISK));
            })
        .collect(Collectors.toList());
  }