use of org.eclipse.vorto.mapping.engine.functions.IScriptEvaluator in project vorto by eclipse.
the class SpecWithByteArrayConverter method getScriptFunctions.
@Override
public FunctionLibrary getScriptFunctions(IScriptEvalProvider evalProvider) {
FunctionLibrary library = new FunctionLibrary();
IScriptEvaluator evaluator = evalProvider.createEvaluator("button");
evaluator.addScriptFunction(new ScriptClassFunction("convertSensorValue", "function convertSensorValue(value) { return value; }"));
library.addFunctions(evaluator.getFunctions());
return library;
}
use of org.eclipse.vorto.mapping.engine.functions.IScriptEvaluator in project vorto by eclipse.
the class SpecGattConverter method getScriptFunctions.
@Override
public FunctionLibrary getScriptFunctions(IScriptEvalProvider evalProvider) {
FunctionLibrary library = new FunctionLibrary();
IScriptEvaluator evaluator = evalProvider.createEvaluator("button");
evaluator.addScriptFunction(new ScriptClassFunction("convertSensorValue", "function convertSensorValue(value) { return value*0.01; }"));
library.addFunctions(evaluator.getFunctions());
return library;
}
use of org.eclipse.vorto.mapping.engine.functions.IScriptEvaluator in project vorto by eclipse.
the class SpecWithConstraintConfigMapping method getScriptFunctions.
@Override
public FunctionLibrary getScriptFunctions(IScriptEvalProvider evalProvider) {
FunctionLibrary library = new FunctionLibrary();
IScriptEvaluator evaluator = evalProvider.createEvaluator("button");
evaluator.addScriptFunction(new ScriptClassFunction("convertClickType", "function convertClickType(clickType) {if (clickType === 'SINGLE') return 1; else if (clickType === 'DOUBLE') return 2; else return 99;}"));
library.addFunctions(evaluator.getFunctions());
return library;
}
use of org.eclipse.vorto.mapping.engine.functions.IScriptEvaluator in project vorto by eclipse.
the class SpecWithMaliciousFunction method getScriptFunctions.
@Override
public FunctionLibrary getScriptFunctions(IScriptEvalProvider evalProvider) {
FunctionLibrary library = new FunctionLibrary();
IScriptEvaluator evaluator = evalProvider.createEvaluator("button");
evaluator.addScriptFunction(new ScriptClassFunction("convert", "function convert(value) { " + getMaliciousFunctionBody() + "}"));
library.addFunctions(evaluator.getFunctions());
return library;
}
use of org.eclipse.vorto.mapping.engine.functions.IScriptEvaluator in project vorto by eclipse.
the class SpecWithNestedEntityAndCustomFunction method getScriptFunctions.
@Override
public FunctionLibrary getScriptFunctions(IScriptEvalProvider evalProvider) {
FunctionLibrary library = new FunctionLibrary();
IScriptEvaluator evaluator = evalProvider.createEvaluator("button");
evaluator.addScriptFunction(new ScriptClassFunction("convertClickType", "function convertClickType(clickType) {if (clickType === 'SINGLE') return 1; else if (clickType === 'DOUBLE') return 2; else return 99;}"));
library.addFunctions(evaluator.getFunctions());
return library;
}
Aggregations