Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A first example to show the possibilities with the simple batch processing extension for alfresco javascript execution. It has the only limitation that the processorfunction must have the name process
var batchName ='MyProcessor';
var numberOfThreads = 4;
var numberOfProcessedItems = 10;
var runAsSystem = true;
var processorFunction = function process(node){
if(node.hasAspect('cm:titled')){
logger.error(node);
}
};
var beforeProcessFunction = function beforeProcess(){
logger.error("beforeProcessorFunction-"+processingNodes.length);
};
var afterProcessFunction = function afterProcess(){
logger.error("afterProcessorFunction-"+processingNodes.length);
};
// run for a lucene search query
var nodes = search.luceneSearch("TEXT: alfresco");
batch.runForNodes(batchName,numberOfThreads,numberOfProcessedItems,nodes, processorFunction, runAsSystem, beforeProcessFunction, afterProcessFunction);
// run for a lucene query
var luceneQuery = 'TEXT:alfresco';
batch.runForQuery(batchName,numberOfThreads,numberOfProcessedItems,luceneQuery, processorFunction, runAsSystem, null, null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment