protected void findBlobsProperties(Property property, List<String> split, List<Property> properties) { if (split.isEmpty()) { if (property.getValue() != null) { properties.add(property); } } else { for (Property childProperty : property.getChildren()) { Property childSubProp = childProperty.get(split.get(0)); List<String> subPath = split.subList(1, split.size()); findBlobsProperties(childSubProp, subPath, properties); } } }
/** * Gets the blob properties of the document. * * @param doc the document * @return the list of blob properties */ public List<Property> getBlobsProperties(DocumentModel doc) { List<Property> properties = new ArrayList<>(); for (String path : getBlobPaths(doc.getDocumentType())) { if (!isInterestingPath(path)) { continue; } List<String> split = Arrays.asList(path.split("/[*]/")); if (split.isEmpty()) { throw new IllegalStateException("Path detected not well-formed: " + path); } Property property = doc.getProperty(split.get(0)); List<String> subPath = split.subList(1, split.size()); findBlobsProperties(property, subPath, properties); } return properties; }