Examples of WaveSubmittedTweetsCache


Examples of com.google.wave.extensions.tweety.util.WaveSubmittedTweetsCache

    // Send the tweet to Twitter.
    Tweet tweet = parseTweet(new JSONObject(fetchUrl(UPDATE_URL, queryParameters, true)), false);

    // Keep track of tweet that was originated from Wave.
    new WaveSubmittedTweetsCache().add(waveId, tweet.getId());

    return tweet;
  }
View Full Code Here

Examples of com.google.wave.extensions.tweety.util.WaveSubmittedTweetsCache

    List<Tweet> tweets = new ArrayList<Tweet>();
    JSONArray tweetsAsJson =
        isSearch ? new JSONObject(jsonResponse).getJSONArray(RESULTS) : new JSONArray(jsonResponse);

    // Parse the tweets.
    WaveSubmittedTweetsCache cache = new WaveSubmittedTweetsCache();
    for (int i = 0; i < tweetsAsJson.length(); ++i) {
      if (!tweetsAsJson.isNull(i)) {
        // Parse a single tweet.
        Tweet tweet = parseTweet(tweetsAsJson.getJSONObject(i), isSearch);

        // Add the tweet to the result list if it wasn't submitted from Google
        // Wave.
        if (!cache.contains(waveId, tweet.getId())) {
          tweets.add(tweet);
        }
      }
    }
    return tweets;
View Full Code Here

Examples of com.google.wave.extensions.tweety.util.WaveSubmittedTweetsCache

      // Fetch new tweets from Twitter.
      List<Tweet> newTweets = controller.fetch();
      appendTweets(wavelet, newTweets);

      // Update the latest tweet id, and purge the cache.
      WaveSubmittedTweetsCache cache = new WaveSubmittedTweetsCache();
      if (!newTweets.isEmpty()) {
        twitterWave.setLatestTweetId(newTweets.get(0).getId());
        cache.purge(twitterWave.getWaveId(), twitterWave.getLatestTweetId());
      } else {
        String lastTweetSubmitted = cache.last(twitterWave.getWaveId());
        if (!Util.isEmpty(lastTweetSubmitted) &&
            lastTweetSubmitted.compareTo(twitterWave.getLatestTweetId()) > 0) {
          twitterWave.setLatestTweetId(lastTweetSubmitted);
          cache.purge(twitterWave.getWaveId(), lastTweetSubmitted);
        }
      }
    } catch (IOException e) {
      LOG.warning("There is a problem connecting to Twitter. Cause:" + e.getMessage());
    } catch (JSONException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.