Script - Recursive repository traversal
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.openkm.api.*;
import com.openkm.bean.*;
Logger log = LoggerFactory.getLogger("com.openkm.scripting");
int MAX_DEPTH = Integer.MAX_VALUE;
void nodeTask(String path, int depth) throws Exception {
for (Document doc : OKMDocument.getInstance().getChildren(null, path)) {
log.info("Document: {}", doc.getPath());
}
for (Folder fld : OKMFolder.getInstance().getChildren(null, path)) {
log.info("Folder: {}", fld.getPath());
if (depth < MAX_DEPTH) {
nodeTask(fld.getPath(), depth + 1);
}
}
}
log.info("***** Process BEGIN *****");
nodeTask("/okm:root", 0);
log.info("***** Process END *****");