in vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/FolderArtifactHandler.java [110:174]
public ImportInfoImpl accept(@NotNull ImportOptions options, boolean isStrictByDefault, WorkspaceFilter wspFilter, Node parent, String name,
ArtifactSetImpl artifacts)
throws RepositoryException, IOException {
Artifact dir = artifacts.getDirectory();
if (dir == null || artifacts.size() != 1) {
return null;
}
ImportInfoImpl info = new ImportInfoImpl();
if (dir.getRelativePath().length() == 0) {
// special check if artifact addresses itself
return info;
}
if (!parent.hasNode(dir.getRelativePath())) {
final Node node;
if (wspFilter.contains(parent.getPath() + "/" + dir.getRelativePath())) {
node = parent.addNode(dir.getRelativePath(), nodeType);
} else {
node = createIntermediateNode(parent, dir.getRelativePath());
}
info.onCreated(node.getPath());
} else {
// sync nodes
Set<String> hints = new HashSet<>();
String rootPath = parent.getPath();
if (!rootPath.equals("/")) {
rootPath += "/";
}
for (Artifact a: artifacts.values(ArtifactType.HINT)) {
hints.add(rootPath + a.getRelativePath());
}
Node node = parent.getNode(dir.getRelativePath());
if (overwritePrimaryTypesOfFolders
&& wspFilter.contains(node.getPath()) && wspFilter.getImportMode(node.getPath()) == ImportMode.REPLACE && !nodeType.equals(node.getPrimaryNodeType().getName())) {
modifyPrimaryType(node, info);
}
NodeIterator iter = node.getNodes();
while (iter.hasNext()) {
Node child = iter.nextNode();
String path = child.getPath();
if (wspFilter.contains(path) && wspFilter.getImportMode(path) == ImportMode.REPLACE) {
if (!hints.contains(path)) {
// if the child is in the filter, it belongs to
// this aggregate and needs to be removed
if (getAclManagement().isACLNode(child)) {
if (acHandling == AccessControlHandling.OVERWRITE
|| acHandling == AccessControlHandling.CLEAR) {
info.onDeleted(path);
getAclManagement().clearACL(node);
}
} else {
info.onDeleted(path);
child.remove();
}
} else if (acHandling == AccessControlHandling.CLEAR
&& getAclManagement().isACLNode(child)) {
info.onDeleted(path);
getAclManagement().clearACL(node);
}
}
}
}
return info;
}