Endpoint provider = findEndpointBean();
Map<String, String> params = getParameters(index, blockSize);
List<TwitterEntry> entries = new ArrayList<TwitterEntry>();
String svcUrl= getServiceUrl();
if(StringUtil.isEmpty(hashTag)){
ClientService svc = createClientService(provider, svcUrl);
HandlerJson json = new HandlerJson();
ArrayList collection = (ArrayList)svc.get(statusUrl, json).getData();
if(collection != null){
int vc = collection.size();
for(int i = 0; i < vc; i++) {
Object o = collection.get(i);
if(o != null){
JsonNavigator nav = new JsonNavigator(o);
TwitterEntry entry = new TwitterEntry();
//entry.setTweetContent(nav.stringValue("text"));
entry.setTitle(nav.stringValue("text"));
entry.setAuthor(nav.get("user").stringValue("name"));
entries.add(entry);
}
}
}
}
else{
//TODO change this to JSON to be consistent
//http://search.twitter.com/search.json?q=%40twitterapi
ClientService svc = createClientService(provider, "search.json");
if(hashTag.indexOf('#') != 0){
hashTag = "#" + hashTag;
}
params.put("q", hashTag);
//TODO - Padraic
HandlerJson json= new HandlerJson();
ArrayList collection = (ArrayList)svc.get(null,params, json).getData();
if(collection != null){
int vc = collection.size();
for(int i = 0; i < vc; i++) {
Object o = collection.get(i);