kwin commented on code in PR #414:
URL: 
https://github.com/apache/jackrabbit-filevault/pull/414#discussion_r2768202512


##########
vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/Importer.java:
##########
@@ -1036,8 +1039,132 @@ private void commit(Session session, TxInfo info, 
LinkedList<TxInfo> skipList)
         }
     }
 
+    /**
+     * Restores the coverage filter on the artifact set from the aggregator 
configuration.
+     * This is necessary because the coverage filter metadata is lost during 
the archive→import flow.

Review Comment:
   What is coverage filter metadata? Are you talking about 
https://jackrabbit.apache.org/filevault/config.html#FileVault_Filesystem_Configuration?



##########
vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/Importer.java:
##########
@@ -1036,8 +1039,132 @@ private void commit(Session session, TxInfo info, 
LinkedList<TxInfo> skipList)
         }
     }
 
+    /**
+     * Restores the coverage filter on the artifact set from the aggregator 
configuration.
+     * This is necessary because the coverage filter metadata is lost during 
the archive→import flow.
+     *
+     * The coverage filter determines which child nodes are "covered" by this 
aggregate and should
+     * be removed if not present in the package. Aggregators with partial 
coverage (e.g., folder
+     * aggregates with {@code <exclude isNode="true" />}) should preserve 
child nodes that are
+     * outside their coverage.
+     *
+     * This method only applies the filter when there are child aggregates 
(hints), which indicates

Review Comment:
   The relevant/canonical data to consider here is only the filter.xml (no 
matter the aggregation format).



##########
vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/Importer.java:
##########
@@ -1036,8 +1039,132 @@ private void commit(Session session, TxInfo info, 
LinkedList<TxInfo> skipList)
         }
     }
 
+    /**
+     * Restores the coverage filter on the artifact set from the aggregator 
configuration.
+     * This is necessary because the coverage filter metadata is lost during 
the archive→import flow.
+     *
+     * The coverage filter determines which child nodes are "covered" by this 
aggregate and should
+     * be removed if not present in the package. Aggregators with partial 
coverage (e.g., folder
+     * aggregates with {@code <exclude isNode="true" />}) should preserve 
child nodes that are
+     * outside their coverage.
+     *
+     * This method only applies the filter when there are child aggregates 
(hints), which indicates
+     * that we're dealing with a parent aggregate that has nested content.
+     *
+     * See also JCRVLT-830
+     *
+     * @param session the JCR session
+     * @param info the transaction info for the current import operation
+     * @throws RepositoryException if accessing repository nodes fails
+     */
+    private void restoreCoverageFilterFromConfiguration(Session session, 
TxInfo info) throws RepositoryException {
+        // Only apply when there are child aggregates (hints), indicating 
partial
+        // coverage scenario
+        boolean hasChildAggregates = info.children != null && 
!info.children.isEmpty();
+        if (!hasChildAggregates
+                || info.artifacts == null
+                || info.artifacts.isEmpty()
+                || archive == null
+                || info.path == null
+                || info.path.isEmpty()) {
+            return;
+        }
+
+        try {
+            VaultFsConfig config = archive.getMetaInf().getConfig();
+            if (config == null) {
+                return;
+            }
+
+            // Try to find a matching aggregator
+            // First try with the node itself if it exists, otherwise try 
parent node
+            Node nodeToMatch = null;
+            if (session.nodeExists(info.path)) {
+                nodeToMatch = session.getNode(info.path);
+            } else if (info.parent != null
+                    && info.parent.path != null
+                    && !info.parent.path.isEmpty()
+                    && session.nodeExists(info.parent.path)) {
+                nodeToMatch = session.getNode(info.parent.path);
+            }
+
+            if (nodeToMatch == null) {
+                return;
+            }
+
+            // Find matching aggregator for this node or its parent
+            // Prefer aggregators with explicit match criteria over those with 
empty
+            // matchFilters
+            Aggregator matchedDefaultAggregator = null;

Review Comment:
   aggregator is conceptually a export only thing, and shouldn't have an impact 
on import. The only thing which matters is the filter.xml



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to