Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save donatasnicequestion/2689487 to your computer and use it in GitHub Desktop.
Save donatasnicequestion/2689487 to your computer and use it in GitHub Desktop.
Call ADF URL Data control Method Biding In Java And get a The Result
// Put the text as an input parameter value for feelings service
operation.getParamsMap().put("Text", tweet.getMessage());
// Call feeling analyzer method binding
operation.execute();
Object operationResult = operation.getResult();
if (operationResult != null) {
// operationResult is an instance of anonymous inner class
// which (fortunatly) implements an Iterator interface
Iterator result = (Iterator)operationResult;
// Only single result item is expected,contaning a single column
while (result.hasNext()) {
Map map = (Map)result.next();
// Get feeling analyzer response
String feelingJsonString = (String)map.get("Column0");
// Extract a polarity from JSON
Integer feeling = extractPolarityFromJSONString(feelingJsonString);
// Enrich the tweet with it
tweet.setFeeling(feeling);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment