use of com.infiniteautomation.mango.util.script.MangoJavaScript in project ma-modules-public by infiniteautomation.
the class EventHandlersRestController method validateScript.
private MangoJavaScriptResultModel validateScript(MangoJavaScriptModel model, String noChangeTranslationKey) {
// Set to potentially return a String
model.setResultDataType(DataType.NUMERIC.name());
MangoJavaScript jsVo = model.toVO();
jsVo.setWrapInFunction(true);
return new MangoJavaScriptResultModel(javaScriptService.testScript(jsVo, noChangeTranslationKey));
}
use of com.infiniteautomation.mango.util.script.MangoJavaScript in project ma-modules-public by infiniteautomation.
the class MangoJavaScriptModel method toVO.
public MangoJavaScript toVO() {
MangoJavaScript vo = new MangoJavaScript();
vo.setWrapInFunction(wrapInFunction);
vo.setContext(convertContext());
vo.setLogLevel(logLevel);
PermissionService service = Common.getBean(PermissionService.class);
vo.setPermissions(new ScriptPermissions(service.explodeLegacyPermissionGroupsToRoles(permissions)));
if (resultDataType != null)
vo.setResultDataType(DataType.fromName(resultDataType));
vo.setScript(script);
vo.setAdditionalContext(additionalContext);
return vo;
}
Aggregations