private boolean handleBindings(final Rewrite event, final EvaluationContextImpl context, ParameterValueStore values) { boolean result = true; ParameterStore store = (ParameterStore) context.get(ParameterStore.class); for (Entry<String, Parameter<?>> entry : store) { Parameter<?> parameter = entry.getValue(); String value = values.retrieve(parameter); if (!ParameterUtils.enqueueSubmission(event, context, parameter, value)) { result = false; break; } } return result; }
private boolean handleBindings(final Rewrite event, final EvaluationContextImpl context, ParameterValueStore values) { boolean result = true; ParameterStore store = (ParameterStore) context.get(ParameterStore.class); for (Entry<String, Parameter<?>> entry : store) { Parameter<?> parameter = entry.getValue(); String value = values.retrieve(parameter); if (!ParameterUtils.enqueueSubmission(event, context, parameter, value)) { result = false; break; } } return result; }
private boolean handleBindings(final Rewrite event, final EvaluationContextImpl context, ParameterValueStore valueStore) { boolean result = true; ParameterStore store = (ParameterStore) context.get(ParameterStore.class); for (Entry<String, Parameter<?>> entry : store) { Parameter<?> parameter = entry.getValue(); String values = valueStore.retrieve(parameter); if (!ParameterUtils.enqueueSubmission(event, context, parameter, values)) { result = false; break; } } return result; }
private boolean handleBindings(final Rewrite event, final EvaluationContextImpl context, ParameterValueStore valueStore) { boolean result = true; ParameterStore store = (ParameterStore) context.get(ParameterStore.class); for (Entry<String, Parameter<?>> entry : store) { Parameter<?> parameter = entry.getValue(); String values = valueStore.retrieve(parameter); if (!ParameterUtils.enqueueSubmission(event, context, parameter, values)) { result = false; break; } } return result; }
/** * Retrieve a single parameter value from the {@link ParameterValueStore}. */ public static String retrieve(EvaluationContext context, String string) { return ((ParameterValueStore) context.get(ParameterValueStore.class)).retrieve(((ParameterStore) context .get(ParameterStore.class)).get(string)); } }
/** * Retrieve a single parameter value from the {@link ParameterValueStore}. */ public static String retrieve(EvaluationContext context, String string) { return ((ParameterValueStore) context.get(ParameterValueStore.class)).retrieve(((ParameterStore) context .get(ParameterStore.class)).get(string)); } }
@Override public boolean submitValue(Parameter<?> parameter, String value) { ParameterValueStore valueStore = DefaultParameterValueStore.getInstance(context); String existingValue = valueStore.retrieve(parameter); if (existingValue == null) { return valueStore.submit(event, context, parameter, value); } else { return valueStore.isValid(event, context, parameter, value); } }
@Override public boolean submitValue(Parameter<?> parameter, String value) { ParameterValueStore valueStore = DefaultParameterValueStore.getInstance(context); String existingValue = valueStore.retrieve(parameter); if (existingValue == null) { return valueStore.submit(event, context, parameter, value); } else { return valueStore.isValid(event, context, parameter, value); } }
@Override public final void perform(GraphRewrite event, EvaluationContext context, T payload) { Map<WindupVertexFrame, ParameterValueStore> stores = ParameterizedGraphCondition .getResultValueStoreMap(context); ParameterValueStore originalValueStore = DefaultParameterValueStore.getInstance(context); ParameterStore parameterStore = DefaultParameterStore.getInstance(context); try { DefaultEvaluationContext tempEvaluationContext = new DefaultEvaluationContext(context); tempEvaluationContext.setState(RewriteState.PERFORMING); ParameterValueStore valueStore = stores.get(originalPayload); for (Entry<String, Parameter<?>> entry : parameterStore) { Parameter<?> parameter = entry.getValue(); String value = valueStore == null ? null : valueStore.retrieve(parameter); ParameterUtils.enqueueSubmission(event, tempEvaluationContext, parameter, value); } context.put(ParameterValueStore.class, valueStore); performParameterized(event, tempEvaluationContext, payload); } finally { context.put(ParameterValueStore.class, originalValueStore); } } }
@Override public final void perform(GraphRewrite event, EvaluationContext context, T payload) { Map<WindupVertexFrame, ParameterValueStore> stores = ParameterizedGraphCondition .getResultValueStoreMap(context); ParameterValueStore originalValueStore = DefaultParameterValueStore.getInstance(context); ParameterStore parameterStore = DefaultParameterStore.getInstance(context); try { DefaultEvaluationContext tempEvaluationContext = new DefaultEvaluationContext(context); tempEvaluationContext.setState(RewriteState.PERFORMING); ParameterValueStore valueStore = stores.get(originalPayload); for (Entry<String, Parameter<?>> entry : parameterStore) { Parameter<?> parameter = entry.getValue(); String value = valueStore == null ? null : valueStore.retrieve(parameter); ParameterUtils.enqueueSubmission(event, tempEvaluationContext, parameter, value); } context.put(ParameterValueStore.class, valueStore); performParameterized(event, tempEvaluationContext, payload); } finally { context.put(ParameterValueStore.class, originalValueStore); } } }
/** * Extract bound values from configured {@link Binding} instances. Return a {@link Map} of the extracted key-value * pairs. Before storing the values in the map, this method applies the supplied {@link Transposition} instance. */ private Map<String, Object> extractBoundValues(final Rewrite event, final EvaluationContext context, Transposition<String> transposition) { Map<String, Object> result = new LinkedHashMap<String, Object>(); for (RegexGroup group : groups) { Parameter<?> parameter = store.get(group.getName()); Object value = null; // TODO TEST ME!!! if (context.getState().isEvaluating()) value = ((ParameterValueStore) context.get(ParameterValueStore.class)).retrieve(parameter); if (value == null || context.getState().isPerforming()) { Object retrieved = ParameterUtils.performRetrieval(event, context, parameter); if (retrieved != null) value = retrieved; } if (value == null) throw new ParameterizationException("The value of required parameter [" + group.getName() + "] was null."); if (transposition != null) value = transposition.transpose(event, context, value.toString()); result.put(group.getName(), value); } return result; }
/** * Extract bound values from configured {@link Binding} instances. Return a {@link Map} of the extracted key-value * pairs. Before storing the values in the map, this method applies the supplied {@link Transposition} instance. */ private Map<String, Object> extractBoundValues(final Rewrite event, final EvaluationContext context, Transposition<String> transposition) { Map<String, Object> result = new LinkedHashMap<String, Object>(); for (RegexGroup group : groups) { Parameter<?> parameter = store.get(group.getName()); Object value = null; // TODO TEST ME!!! if (context.getState().isEvaluating()) value = ((ParameterValueStore) context.get(ParameterValueStore.class)).retrieve(parameter); if (value == null || context.getState().isPerforming()) { Object retrieved = ParameterUtils.performRetrieval(event, context, parameter); if (retrieved != null) value = retrieved; } if (value == null) throw new ParameterizationException("The value of required parameter [" + group.getName() + "] was null."); if (transposition != null) value = transposition.transpose(event, context, value.toString()); result.put(group.getName(), value); } return result; }