/** * Resolves the given variable against the flow variables * in the {@link MuleEvent} held by {@link #evaluationEvent} * * @param variableName the variable name * @return the variable value. Might be {@code null} */ @Override public Object resolveVariable(QName variableName) { MuleEvent event = evaluationEvent.get(); if (event != null) { return event.getFlowVariable(variableName.getLocalPart()); } return null; }
private MuleEvent createMessageCollection(final List<MuleEvent> nonNullResults, final MuleEvent previous, MuleContext muleContext) { MuleMessageCollection coll = new DefaultMessageCollection(muleContext); for (MuleEvent event : nonNullResults) { coll.addMessage(event.getMessage()); } coll.propagateRootId(previous.getMessage()); MuleEvent resultEvent = new DefaultMuleEvent(coll, previous, previous.getSession()); for (String name : previous.getFlowVariableNames()) { resultEvent.setFlowVariable(name, previous.getFlowVariable(name), previous.getFlowVariableDataType(name)); } return OptimizedRequestContext.unsafeSetEvent(resultEvent); } }
if (event.getFlowVariableNames().contains(counterVariableName)) previousCounterVar = event.getFlowVariable(counterVariableName); previousRootMessageVar = event.getFlowVariable(parentMessageProp);
event.setFlowVariable(flowVar, successEvent.getFlowVariable(flowVar), event.getFlowVariableDataType(flowVar));
/** * Returns the new watermark value by evaluating {@link #updateExpression} on the * flowVar of the given name * * @param event the @{link {@link MuleEvent} in which the watermark is being * evaluated * @return a {@link Serializable} value */ @Override protected Object getUpdatedValue(MuleEvent event) { try { return StringUtils.isEmpty(this.updateExpression) ? event.getFlowVariable(this.resolveVariable(event)) : WatermarkUtils.evaluate(this.updateExpression, event); } catch (NotSerializableException e) { throw new IllegalArgumentException(e); } }
/** * Watermark route preparation carries the value from the source event to the * flow event */ @Override public MuleEvent prepareRouting(MuleEvent sourceEvent, MuleEvent event) throws ConfigurationException { if (!event.isSynchronous()) { throw new ConfigurationException(CoreMessages.watermarkRequiresSynchronousProcessing()); } String variableName = this.watermark.resolveVariable(event); event.setFlowVariable(variableName, sourceEvent.getFlowVariable(variableName)); return event; }
/** * {@inheritDoc} */ @Override public final OAuth2Adapter createAdapter(MuleEvent event, String verifier) throws Exception { OAuth2Adapter connector = this.instantiateAdapter(); connector.setOauthVerifier(verifier); connector.setAuthorizationUrl((String) event.getFlowVariable(AUTHORIZATION_URL)); connector.setAccessTokenUrl((String) event.getFlowVariable(ACCESS_TOKEN_URL)); connector.setConsumerKey(this.getDefaultUnauthorizedConnector().getConsumerKey()); connector.setConsumerSecret(this.getDefaultUnauthorizedConnector().getConsumerSecret()); this.setCustomProperties(connector); if (connector instanceof MuleContextAware) { ((MuleContextAware) connector).setMuleContext(muleContext); } if (connector instanceof Initialisable) { ((Initialisable) connector).initialise(); } if (connector instanceof Startable) { ((Startable) connector).start(); } return connector; }