@Test public void testGetBlobs() throws Exception { DocumentModel doc = new DocumentModelImpl("/", "doc", "ComplexDoc"); Blob blob1 = createBlob("file1.txt"); doc.setPropertyValue("file:content", (Serializable) blob1); Blob blob2 = createBlob("file2.txt"); Blob blob3 = createBlob("file3.txt"); List<Map<String, Object>> listBlobs = Arrays.asList( Collections.singletonMap("content", blob2), Collections.singletonMap("content", blob3)); doc.setPropertyValue("cmpf:aList", (Serializable) listBlobs); Blob blob4 = createBlob("file4.txt"); Blob blob5 = createBlob("file5.txt"); List<Map<String, Object>> vignettes = Arrays.asList( Collections.singletonMap("content", blob4), Collections.singletonMap("content", blob5)); doc.setPropertyValue("cmpf:attachedFile", (Serializable) Collections.singletonMap("vignettes", vignettes)); BlobsExtractor extractor = new BlobsExtractor(); List<Blob> blobs = extractor.getBlobs(doc); assertEquals(5, blobs.size()); assertTrue(blobs.contains(blob1)); assertTrue(blobs.contains(blob2)); assertTrue(blobs.contains(blob3)); assertTrue(blobs.contains(blob4)); assertTrue(blobs.contains(blob5)); }
public List<Blob> getBlobs(DocumentModel doc) { List<Blob> blobs = new ArrayList<>(); for (Property property : getBlobsProperties(doc)) { blobs.add((Blob) property.getValue()); } return blobs; }
BlobsExtractor { public List<Blob> getBlobs(DocumentModel doc) { List<Blob> blobs = new ArrayList<>(); for (Property property : getBlobsProperties(doc)) { blobs.add((Blob) property.getValue()); } return blobs; } }
BlobsExtractor { public List<Blob> getBlobs(DocumentModel doc) { List<Blob> blobs = new ArrayList<>(); for (Property property : getBlobsProperties(doc)) { blobs.add((Blob) property.getValue()); } return blobs; }  }
BlobsExtractor { public List<Blob> getBlobs(DocumentModel doc) { List<Blob> blobs = new ArrayList<>(); for (Property property : getBlobsProperties(doc)) { blobs.add((Blob) property.getValue()); } return blobs; }  void setExtractorProperties(Set<String> includedPaths, Set<String> excludedPaths, boolean allBlobs); List<Blob> getBlobs(DocumentModel doc); List<Property> getBlobsProperties(DocumentModel doc); List<String> getBlobPaths(DocumentType documentType); }
BlobsExtractor { public List<Blob> getBlobs(DocumentModel doc) { List<Blob> blobs = new ArrayList<>(); for (Property property : getBlobsProperties(doc)) { blobs.add((Blob) property.getValue()); } return blobs; }  void setExtractorProperties(Set<String> includedPaths, Set<String> excludedPaths, boolean allBlobs); List<Blob> getBlobs(DocumentModel doc); List<Property> getBlobsProperties(DocumentModel doc); List<String> getBlobPaths(DocumentType documentType);  }