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); | |
} | |
}; |
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
print(jobs.listJobs()); | |
var job = jobs.getJob('tempFileCleanerTrigger'); | |
job.run(); |
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 node = search.findNode(<nodeRefOfADocumentOrFolder>); | |
var modified = node.properties.modified; | |
policies.disableForNode(node); | |
node.setName("C10"); | |
node.save(); | |
node.reset(); | |
policies.enableForNode(node); | |
var modifiedAfter = node.properties.modified; |
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
print(jmxClient.listSystemProperties()); | |
print('Java version:'+jmxClient.getSystemProperty('java.version')); | |
print(jmx.listAlfProperties()); | |
print('Activiti enabled?'+jmx.getAlfProperty('system.workflow.engine.activiti.enabled')); |
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
jobs.scheduleTemporaryJob({ | |
jobName: 'SimpleAuthorModificationJob', | |
runAs: 'system', | |
cronExpression: '0 0/1 * 1/1 * ? *', | |
script: function(){ | |
batchExecuter.processFolderRecursively({ | |
'root': repository.getCompanyHome(), | |
onNode: function(node) { | |
if (node.isDocument) { | |
node.properties['cm:author'] = 'Alfresco'; |
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
database.query("dataSource", "Select * from alf_node where id=?",2); | |
database.update("dataSource", "Update alf_node set id=? where id=?",2,2); |
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
fileWriter.createFile(); | |
fileWriter.appendLine("Hello"); | |
var logfile = fileWriter.persist( | |
"Test"+java.lang.System.nanoTime(), | |
repository.getCompanyHome(), | |
"text/plain", | |
"cm:content", | |
false); | |
print(logfile.content); |
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 download = downloads.create(repository.getCompanyHome(),true); | |
print(downloads.getStatus(download).getStatus()); |
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
// check if the company home node is a favorite of the current user | |
print(favorites.isFavorite(repository.getCompanyHome())); | |
// get all favorites of the current user with start =0 and limit 20 | |
print(favorites.getFavorites(0,20)); | |
// add the company home node as favorite of the user | |
favorites.add(repository.getCompanyHome()); |
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
print(permissions.getPermissions(repository.getCompanyHome()); | |
print(permissions.hasPermission(repository.getCompanyHome().nodeRef,"Delete")); | |
print(permissions.hasPermission(repository.getCompanyHome().nodeRef,"Delete","abeecher")); | |
permissions.setPermission(repository.getCompanyHome().nodeRef,"Delete","abeecher",true); | |
print(permissions.hasPermission(repository.getCompanyHome().nodeRef,"Delete","abeecher")); | |
permissions.deletePermission(repository.getCompanyHome().nodeRef,"Delete","abeecher"); | |
print(permissions.hasPermission(repository.getCompanyHome().nodeRef,"Delete","abeecher")); |
OlderNewer