04-08-2015 09:01 PM
var newNode = srcNode.copy(srcNode.parent);
newNode.properties.title = "title";
newNode.properties.description = "desc";
newNode.save()
var query = 'PATH:"/app:company_home/app:guest_home/cm:Test//*"';
var sort1 = {
column: "@{http://www.alfresco.org/model/content/1.0}modified",
ascending: true
};
var paging = {
maxItems: 1000,
skipCount: 0
};
var def = {
query: query,
language: "lucene",
sort: [sort1],
page: paging
};
var nodes = search.query(def);
while(nodes.length > 0) {
for(var i=0;i<nodes.length;i++) {
// do sth
}
var prevModified = nodes[nodes.length - 1].properties.modified;
// weird, must add one day, otherwise throws Node does not exist, but this may skip some doc !
prevModified.setDate(prevModified.getDate() + 1);
var fromDate = prevModified.getFullYear() + '-' + (prevModified.getMonth()+1) + '-' + prevModified.getDate();
var dateRange = ' AND (@cm\\:modified:[' + fromDate + ' TO NOW])';
def.query = query + dateRange;
nodes = search.query(def);
}
04-17-2015 10:25 AM
newNode.content = srcNode.content;
newNode.addAspect("cm:titled");
newNode.properties["cm:title"] = "title";
newNode.properties["cm:description"] ="description";
newNode.save();
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.