private List collectResourceChanges()

in src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java [259:280]


    private List<ResourceChange> collectResourceChanges(final Monitorable monitorable, final ChangeType changeType) {
        List<ResourceChange> changes = new ArrayList<>();
        if (monitorable.status instanceof ContentFileStatus) {
            ContentFile contentFile = ((ContentFileStatus) monitorable.status).contentFile;
            if (changeType == ChangeType.CHANGED) {
                ContentElement content = contentFile.getContent();
                // we cannot easily report the diff of resource changes between two content files
                // so we simulate a removal of the toplevel node and then add all nodes contained in the current content
                // file again.
                changes.add(
                        buildContentResourceChange(ChangeType.REMOVED, this.provider.transformPath(monitorable.path)));
                addContentResourceChanges(
                        changes, ChangeType.ADDED, content, this.provider.transformPath(monitorable.path));
            } else {
                addContentResourceChanges(
                        changes, changeType, contentFile.getContent(), this.provider.transformPath(monitorable.path));
            }
        } else {
            changes.add(buildContentResourceChange(changeType, this.provider.transformPath(monitorable.path)));
        }
        return changes;
    }