@Override public void enterFrame() { wrapped.enterFrame(); }
public ContextBuilder(EvaluationContext evaluationContext) { this.evaluationContext = evaluationContext; evaluationContext.enterFrame(); }
public Object rreturn(Function<EvaluationContext, Object> expression) { try { ctx.enterFrame(); List results = new ArrayList(); ctx.setValue("partial", results); ForIteration[] ictx = initializeContexts(ctx, iterationContexts); while (ForExpressionNode.nextIteration(ctx, ictx)) { Object result = expression.apply(ctx); results.add(result); } return results; } catch (EndpointOfRangeNotOfNumberException e) { // ast error already reported return null; } finally { ctx.exitFrame(); } }
private Object invokeTheFunction(List<String> names, FEELFunction fn, EvaluationContext ctx, Object[] params) { if (names.size() == 1) { Object result = fn.invokeReflectively(ctx, params); return result; } else { try { Object newRoot = ctx.getValue(names.get(0)); ctx.enterFrame(); try { Map<String, Object> asMap = ((Map<String, Object>) newRoot); asMap.forEach(ctx::setValue); } catch (ClassCastException e) { ctx.setRootObject(newRoot); // gracefully handle the less common scenario. } return invokeTheFunction(names.subList(1, names.size()), fn, ctx, params); } finally { ctx.exitFrame(); } } }
public FEELFnResult<Object> invoke(EvaluationContext ctx, Object[] params) { FEELEvent capturedException = null; try { ctx.enterFrame(); for( int i = 0; i < params.length; i++ ) { ctx.setValue( dt.getParameterNames().get( i ), params[i] ); } return dt.evaluate( ctx, params ); } catch ( Exception e ) { String message = "Error invoking decision table '" + getName() + "': " + e.getClass().getSimpleName(); capturedException = new FEELEventBase( Severity.ERROR, message, e); logger.error( message, e ); } finally { ctx.exitFrame(); } return FEELFnResult.ofError( capturedException ); }
private Boolean iterateContexts(EvaluationContext ctx, List<IterationContextCompiled> iterationContexts, Function<EvaluationContext, Object> expression, Quantifier quantifier) { try { ctx.enterFrame(); QEIteration[] ictx = initializeContexts(ctx, iterationContexts); while (QuantifiedExpressionNode.nextIteration(ctx, ictx)) { Boolean result = (Boolean) expression.apply(ctx); if (result != null && result.equals(quantifier.positiveTest())) { return quantifier.positiveTest(); } } return quantifier.defaultValue(); } finally { ctx.exitFrame(); } }
@Override public Object evaluate(EvaluationContext ctx) { try { ctx.enterFrame(); List results = new ArrayList( ); ctx.setValue("partial", results); ForIteration[] ictx = initializeContexts( ctx, iterationContexts); while ( nextIteration( ctx, ictx ) ) { Object result = expression.evaluate( ctx ); results.add( result ); } return results; } catch (EndpointOfRangeNotOfNumberException e) { // ast error already reported return null; } finally { ctx.exitFrame(); } }
@Override public FEELFnResult<Object> invoke(EvaluationContext ctx, Object[] params ) { if( params.length != parameters.size() ) { return FEELFnResult.ofError(new InvalidInputEvent(Severity.ERROR, "Illegal invocation of function", getName(), getName() + "( " + Arrays.asList(params)+" )", getSignature())); } FEELEvent capturedException = null; try { ctx.enterFrame(); for ( int i = 0; i < parameters.size(); i++ ) { ctx.setValue( parameters.get( i ), params[i] ); } Object result = this.body.apply(ctx); return FEELFnResult.ofResult( result ); } catch( Exception e ) { capturedException = new FEELEventBase(Severity.ERROR, "Error invoking function", new RuntimeException("Error invoking function " + getSignature() + ".", e)); } finally { ctx.exitFrame(); } return FEELFnResult.ofError( capturedException ); }
for (Object v : list) { try { ctx.enterFrame();
public FEELFnResult<Object> invoke(EvaluationContext ctx, Object[] params) { if( params.length != parameters.size() ) { return FEELFnResult.ofError(new InvalidInputEvent(Severity.ERROR, "Illegal invocation of function", getName(), getName() + "( " + Arrays.asList(params)+" )", getSignature())); } FEELEvent capturedException = null; try { ctx.enterFrame(); for ( int i = 0; i < parameters.size(); i++ ) { ctx.setValue( parameters.get( i ), params[i] ); } Object[] actualParams = prepareParams( params ); Object result = method.invoke( clazz, actualParams ); return FEELFnResult.ofResult( result ); } catch ( InvocationTargetException e ) { String message = e.getTargetException().getMessage(); capturedException = new FEELEventBase(Severity.ERROR, "Error invoking "+toString()+": "+message, new RuntimeException("Error invoking function " + getSignature() + ".", e)); } catch ( IllegalAccessException e ) { String message = e.getCause().getMessage(); capturedException = new FEELEventBase(Severity.ERROR, "Error invoking "+toString()+": "+message, new RuntimeException("Error invoking function " + getSignature() + ".", e)); } finally { ctx.exitFrame(); } return FEELFnResult.ofError( capturedException ); }
public FEELFnResult<Object> invoke(EvaluationContext ctx, Object[] params ) { if( params.length != parameters.size() ) { return FEELFnResult.ofError(new InvalidInputEvent(Severity.ERROR, "Illegal invocation of function", getName(), getName() + "( " + Arrays.asList(params)+" )", getSignature())); } FEELEvent capturedException = null; try { ctx.enterFrame(); for ( int i = 0; i < parameters.size(); i++ ) { ctx.setValue( parameters.get( i ), params[i] ); } Object result = this.body.evaluate( ctx ); return FEELFnResult.ofResult( result ); } catch( Exception e ) { capturedException = new FEELEventBase(Severity.ERROR, "Error invoking function", new RuntimeException("Error invoking function " + getSignature() + ".", e)); } finally { ctx.exitFrame(); } return FEELFnResult.ofError( capturedException ); }
private void evaluateExpressionInContext(EvaluationContext ctx, List results, Object v) { try { ctx.enterFrame(); // handle it as a predicate // Have the "item" variable set first, so to respect the DMN spec: The expression in square brackets can reference a list // element using the name item, unless the list element is a context that contains the key "item". ctx.setValue( "item", v ); // using Root object logic to avoid having to eagerly inspect all attributes. ctx.setRootObject(v); // a filter would always return a list with all the elements for which the filter is true. // In case any element fails in there or the filter expression returns null, it will only exclude the element, but will continue to process the list. // In case all elements fail, the result will be an empty list. Object r = this.filter.evaluate(new SilentWrappingEvaluationContextImpl(ctx)); // evaluate filter, ignoring errors if( r instanceof Boolean && ((Boolean)r) == Boolean.TRUE ) { results.add( v ); } } finally { ctx.exitFrame(); } }
private Boolean iterateContexts(EvaluationContext ctx, List<IterationContextNode> iterationContexts, BaseNode expression, Quantifier quantifier ) { try { ctx.enterFrame(); QEIteration[] ictx = initializeContexts(ctx, iterationContexts); while ( nextIteration( ctx, ictx ) ) { Boolean result = (Boolean) expression.evaluate( ctx ); if ( result != null && result.equals( quantifier.positiveTest() ) ) { return quantifier.positiveTest(); } } return quantifier.defaultValue(); } finally { ctx.exitFrame(); } }
@Override public Object evaluate(EvaluationContext ctx) { try { ctx.enterFrame(); Map<String, Object> c = new LinkedHashMap<>(); for( ContextEntryNode cen : entries ) { String name = EvalHelper.normalizeVariableName( cen.evaluateName( ctx ) ); Object value = cen.evaluate( ctx ); if( value instanceof CustomFEELFunction ) { // helpful for debugging ((CustomFEELFunction) value).setName( name ); } else if( value instanceof JavaFunction ) { ((JavaFunction) value).setName( name ); } else if ( value instanceof DTInvokerFunction ) { ((DTInvokerFunction) value).setName(name); } ctx.setValue( name, value ); c.put( name, value ); } return c; } finally { ctx.exitFrame(); } }
ctx.enterFrame(); DMNModel dmnModel = dmnRuntime.getModel(namespace, modelName); if (dmnModel == null) {