Package com.google.wave.extensions.tweety.controller

Examples of com.google.wave.extensions.tweety.controller.FetchController


  private void fetchTweetsForWave(RobotMessageBundle robotMessageBundle, TwitterWave twitterWave) {
    // Create a wavelet object for this Twitter Wave.
    Wavelet wavelet = robotMessageBundle.getWavelet(twitterWave.getWaveId(),
        twitterWave.getWaveletId());

    FetchController controller = twitterWave.isInSearchMode() ?
        new SearchController(twitterService, wavelet.getRootBlip(),
            twitterWave, robotMessageBundle.getEvents()):
        new TimelineController(twitterService, wavelet.getRootBlip(),
            twitterWave, robotMessageBundle.getEvents());

    try {
      // 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()) {
View Full Code Here


          TextView document = wavelet.getRootBlip().getDocument();
          GadgetView gadgetView = document.getGadgetView();
          for (Gadget gadget : gadgetView.getGadgets()) {
            if ((gadget != null) && ("true".equals(gadget.getField(GADGET_STATE)))) {
              if (twitterService.checkAuthorization(wavelet, loginForm)) {
                FetchController controller =
                    twitterWave.isInSearchMode() ? new SearchController(twitterService, rootBlip,
                        twitterWave, robotMessageBundle.getEvents()) : new TimelineController(
                        twitterService, rootBlip, twitterWave, robotMessageBundle.getEvents());

                // Fetch and append tweets.
                appendTweets(wavelet, controller.fetch());

                // Clear the login form and render the search or update form.
                controller.renderForm();
              }
            }
          }
        }
       
        if (event.getType() == EventType.FORM_BUTTON_CLICKED ||
            event.getType() == EventType.BLIP_SUBMITTED) {
          // Handle the normal flow after logging in.
          FetchController controller =
              twitterWave.isInSearchMode() ? new SearchController(twitterService, rootBlip,
                  twitterWave, robotMessageBundle.getEvents()) : new TimelineController(
                  twitterService, rootBlip, twitterWave, robotMessageBundle.getEvents());

          // Fetch tweets when search or update button is clicked.
          if (controller.isButtonClicked()) {
            appendTweets(wavelet, controller.execute());
          }

          // Handle blip submitted events, that are considered as
          // @replies.
          for (Event blipSubmittedEvent : robotMessageBundle.getBlipSubmittedEvents()) {
View Full Code Here

TOP

Related Classes of com.google.wave.extensions.tweety.controller.FetchController

Copyright © 2018 www.massapicom. 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.