Last active
December 25, 2015 07:39
-
-
Save jgoldhammer/6941273 to your computer and use it in GitHub Desktop.
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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