AVM: The Alfresco Versioning Machine
Example using the AVM API to process a webproject store - the store name is passed as store on the url arguments:
if (args['store'] == null)
{
logger.log('ERROR: 'store' argument not specified.');
}
else
{
main();
}
function main()
{
var storeRootNode = avm.lookupStoreRoot(args['store']);
if (storeRootNode != null)
{
var path = storeRootNode.path + '/ROOT/admin/index.html';
var node = avm.lookupNode(path);
if (node == null)
{
return 'ERROR: unable to find path: ' + path;
}
var store = avm.lookupStore(args['store']);
if (store == null)
{
return 'ERROR: unable to lookup store: ' + args['store'];
}
var rootNode = store.lookupRoot();
if (rootNode == null)
{
return 'ERROR: unable to find root node for store: ' + store.name;
}
var out = '';
var results = store.luceneSearch('TEXT:tomcat');
for (var i=0; i<results.length; i++ ) {
// do something
}
return out;
}
}
文档更新时间: 2020-02-16 16:54 作者:凌云文档