Skip to content

Instantly share code, notes, and snippets.

@marianogonzalez
Created October 2, 2012 19:53
Show Gist options
  • Save marianogonzalez/3822885 to your computer and use it in GitHub Desktop.
Save marianogonzalez/3822885 to your computer and use it in GitHub Desktop.
<flow name="authorize" doc:name="authorize">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" path="authorize" />
<google-spreadsheets:authorize config-ref="google-spreadsheets" state="#[message.inboundProperties['user']]"/>
<scripting:transformer>
<scripting:script engine="Groovy">
<scripting:text><![CDATA[
org.mule.examples.google.sfdc2google.UserIdMapping mapping = new org.mule.examples.google.sfdc2google.UserIdMapping();
mapping.setUserId(message.getInboundProperty("state"));
mapping.setGoogleId(message.getInvocationProperty("OAuthAccessTokenId"));
message.setPayload(mapping);
return message;]]>
</scripting:text>
</scripting:script>
</scripting:transformer>
<objectstore:store
config-ref="ObjectStore"
key="#[message.inboundProperties['state']]"
value-ref="#[payload]"
overwrite="true"/>
<sfdc:authorize display="PAGE" config-ref="Salesforce" state="#[message.inboundProperties['state']]" />
<objectstore:retrieve config-ref="ObjectStore" key="#[message.inboundProperties['state']]" />
<scripting:transformer>
<scripting:script engine="Groovy">
<scripting:text><![CDATA[
org.mule.examples.google.sfdc2google.UserIdMapping mapping = message.getPayload();
mapping.setSfdcId(message.getInvocationProperty("OAuthAccessTokenId"));
return message;]]>
</scripting:text>
</scripting:script>
</scripting:transformer>
<objectstore:store
config-ref="ObjectStore"
key="#[message.inboundProperties['state']]"
value-ref="#[payload]"
overwrite="true"/>
</flow>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment