Created
May 13, 2012 17:53
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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