Exemplo n.º 1
0
 private List<BsonDocument> processChunks(
     final BsonArray bsonArray, final List<BsonDocument> documents) {
   for (BsonValue rawDocument : bsonArray.getValues()) {
     if (rawDocument.isDocument()) {
       documents.add(parseHexDocument(rawDocument.asDocument()));
     }
   }
   return documents;
 }
Exemplo n.º 2
0
 private List<BsonDocument> processFiles(
     final BsonArray bsonArray, final List<BsonDocument> documents) {
   for (BsonValue rawDocument : bsonArray.getValues()) {
     if (rawDocument.isDocument()) {
       BsonDocument document = rawDocument.asDocument();
       if (document.get("length").isInt32()) {
         document.put("length", new BsonInt64(document.getInt32("length").getValue()));
       }
       if (document.containsKey("metadata") && document.getDocument("metadata").isEmpty()) {
         document.remove("metadata");
       }
       if (document.containsKey("aliases")
           && document.getArray("aliases").getValues().size() == 0) {
         document.remove("aliases");
       }
       if (document.containsKey("contentType")
           && document.getString("contentType").getValue().length() == 0) {
         document.remove("contentType");
       }
       documents.add(document);
     }
   }
   return documents;
 }