use of com.googlecode.aviator.runtime.type.AviatorString in project jcasbin by casbin.
the class KeyGet2Func method call.
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3) {
String key1 = FunctionUtils.getStringValue(arg1, env);
String key2 = FunctionUtils.getStringValue(arg2, env);
String pathVar = FunctionUtils.getStringValue(arg3, env);
return new AviatorString(BuiltInFunctions.keyGet2Func(key1, key2, pathVar));
}
use of com.googlecode.aviator.runtime.type.AviatorString in project jcasbin by casbin.
the class KeyGetFunc method call.
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {
String key1 = FunctionUtils.getStringValue(arg1, env);
String key2 = FunctionUtils.getStringValue(arg2, env);
return new AviatorString(BuiltInFunctions.keyGetFunc(key1, key2));
}
use of com.googlecode.aviator.runtime.type.AviatorString in project rebuild by getrebuild.
the class RequestFunctuin method call.
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {
String requestUrl = arg1.getValue(env).toString();
String res = null;
try {
res = OkHttpUtils.get(requestUrl);
} catch (IOException ex) {
log.error("Request fail : {}", requestUrl, ex);
}
return res == null ? arg2 : new AviatorString(res);
}
use of com.googlecode.aviator.runtime.type.AviatorString in project rebuild by getrebuild.
the class CurrentBizunitFunction method call.
@Override
public AviatorObject call(Map<String, Object> env) {
ID user = UserContextHolder.getUser();
ID bizunit = (ID) Application.getUserStore().getUser(user).getOwningBizUnit().getIdentity();
return new AviatorString(bizunit.toLiteral());
}
use of com.googlecode.aviator.runtime.type.AviatorString in project graphql-calculator by graphql-calculator.
the class FindOne method call.
@Override
public AviatorObject call(Map<String, Object> env, AviatorObject listElement, AviatorObject elementFieldName, AviatorObject envKey) {
String elementKey = ((AviatorString) elementFieldName).getLexeme(Collections.emptyMap());
String envLexeme = ((AviatorString) envKey).getLexeme(Collections.emptyMap());
Object targetValue = env.get(envLexeme);
List<Map> listValue = (List) listElement.getValue(Collections.emptyMap());
Map result = listValue.stream().filter(map -> Objects.equals(map.get(elementKey), targetValue)).findFirst().orElse(null);
return AviatorRuntimeJavaType.valueOf(result);
}
Aggregations