-
-
Save douglascrp/43162ec2f1224fc60198b0842034d185 to your computer and use it in GitHub Desktop.
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 RunAsUtil = { | |
execute: function(workFunction, runAsUser) { | |
Packages.org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(new Packages.org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork() | |
{ | |
doWork: workFunction | |
}, runAsUser); | |
}, | |
doInTransaction: function(workFunction) { | |
var txs = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext().getBean("TransactionService"); | |
var th = txs.getRetryingTransactionHelper(); | |
var callback = new Packages.org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback() { | |
execute: workFunction | |
}; | |
th.doInTransaction(callback, false, true); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment