Is there a way to define reusable functions that can be invoked by multiple rule objects?
I find myself repeatedly copying and pasting common code into pretty much all my rule scripts see below example.
It would be nice to have a shared facility to define these common functions and then be able to include or refer to them as needed.
For example:
/**
* Log an info message
* @param methodCtx - the "method" where the exception was caught
* @param infoMsg -the info message
*/
function logInfo(methodCtx, infoMsg){
logError("", methodCtx, infoMsg);
}
/**
* Log an exception
* @param thrown - the exception
* @param methodCtx -the "method" where the exception was caught
* @param errMsg - error message
*/
function logError(thrown, methodCtx, errMsg){
try {
VegasClient.createLogEntry(RULE_DESCR, methodCtx, errMsg, thrown.toString(), securityContext.getLogonId());
} catch (ignoredEx) {}
}