Examples of Wavelet


Examples of com.google.wave.api.Wavelet

    assertEquals(expected.getIndex(), actual.getIndex());
    assertEquals(expected.getOldState(),actual.getOldState());
  }

  public void testSerializeAndDeserializeOperationErrorEvent() throws Exception {
    Wavelet wavelet = mock(Wavelet.class);
    EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1",
        "http://wave-active-api.example.com");

    OperationErrorEvent expected = new OperationErrorEvent(wavelet, bundle,
        "foo@google.com", 123l, "op1", "Error!");
View Full Code Here

Examples of com.google.wave.api.Wavelet

   */
  public void writeVoteToResults(String vote) {
    String[] waveIdParts = resultsWaveletId.split(" ");
    String waveId = waveIdParts[0];
    String waveletId = waveIdParts[1];
    Wavelet resultsWavelet = context.getWavelet(waveId, waveletId);
   
    // Append is used rather than set to support concurrent access by pollees
    // voting at the same time.
    resultsWavelet.appendDataDocument(VOTES_DOC,
        recipients + ":" + vote + "\n");
  }
View Full Code Here

Examples of com.google.wave.api.Wavelet

   *     Wave, that contains the request context.
   * @param twitterWave The Twitter Wave that we want to fetch the tweet for.
   */
  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();
View Full Code Here

Examples of com.google.wave.api.Wavelet

    // Deserialize wavelet.
    WaveletData waveletData = context.deserialize(jsonObj.get(WAVELET_TAG), WaveletData.class);
    result.setWaveletData(waveletData);
    Map<String, Blip> blips = new HashMap<String, Blip>();
    Wavelet wavelet = Wavelet.deserialize(operationQueue, blips, waveletData);
    wavelet.setRobotAddress(robotAddress);
    result.setWavelet(wavelet);
    Type blipMapType = new TypeToken<Map<String, BlipData>>(){}.getType();

    // Deserialize blips.
    Map<String, BlipData> blipDatas = context.deserialize(jsonObj.get(BLIPS_TAG), blipMapType);
View Full Code Here

Examples of com.google.wave.api.Wavelet

    button.setName(name);
    blip.append(button);
  }

  private void processComments(final BlipSubmittedEvent event) {
    Wavelet wavelet = event.getWavelet();
    Blip blip = event.getBlip();

    if (blip.getBlipId().equals(wavelet.getRootBlipId())) {
      // This is triggered from root blip, skip comment processing.
      return;
    }

    String user = event.getModifiedBy();
View Full Code Here

Examples of com.google.wave.api.Wavelet

    this.processComments(event);
  }

  @Override
  public void onFormButtonClicked(FormButtonClickedEvent event) {
    Wavelet wavelet = event.getWavelet();
    Blip blip = event.getBlip();
    if (event.getButtonName().equals("createIssue")) {
      String project = wavelet.getDataDocuments().get("issue-tracker-project");
      String title = wavelet.getTitle();
      String content = blip.getContent().replace(title, "");
      int issueId = submitNewIssue(project, event.getModifiedBy(), title, content, wavelet
          .getTags());
      if (issueId > 0) {
        util.persistJdo(new IssueJdoEntry(wavelet.getDomain(), blip, project, issueId));
        // Create a new blip with issue creation info.
        String issueWebLink = projectHostingHelper.getWebIssueEntryUrl(project, issueId);
        wavelet.setTitle(wavelet.getTitle() + " - " + issueWebLink);
        blip.all(ElementType.BUTTON, Restriction.of("name", "createIssue")).delete();
      } else {
        wavelet.reply("\nsubmitNewIssue failed()");
      }
    }
  }
View Full Code Here

Examples of com.google.wave.api.Wavelet

  }

  @Override
  public void onDocumentChanged(DocumentChangedEvent event) {
    Blip blip = event.getBlip();
    Wavelet wavelet = event.getWavelet();

    if (wavelet.getDataDocuments().contains("issue-tracker-project")) {
      return;
    }

    Annotations annotations = event.getBlip().getAnnotations();
    Iterator<Annotation> iterator = annotations.iterator();
    while (iterator.hasNext()) {
      Annotation annotation = iterator.next();
      String name = annotation.getName();
      String value = annotation.getValue();
      if (name.equals(this.HIGHLIGHT_ANNOTATION_NAME) && value.equals("new")) {

        // Check for authsub token first
        String user = event.getModifiedBy();
        UserInfo userInfo = util.getUserInfo(user);
        if (userInfo == null) {
          appendAuthSubGadget(blip, user);
        } else {
          BlipContentRefs blipContentRefs = blip.range(annotation.getRange().getStart(), annotation
              .getRange().getEnd());
          blipContentRefs.annotate(this.HIGHLIGHT_ANNOTATION_NAME, "done");

          Set<String> participants = new HashSet<String>();
          participants.add(event.getModifiedBy());
         
          Wavelet newWavelet = null;         
          try {
            newWavelet = this.newWave(this.getDomain(), participants, "test", event.getBundle().getProxyingFor(), this.getRpcServerUrl());
            newWavelet.setTitle(DEFAULT_ISSUE_TITLE);

            newWavelet.getDataDocuments().set("issue-tracker-project",
                event.getBundle().getProxyingFor());
            newWavelet.getRootBlip().append(new Line());
            newWavelet.getRootBlip().append(blipContentRefs.value());
            newWavelet.getRootBlip().append(new Line());
            newWavelet.getRootBlip().append(new Line());
            this.appendButton(newWavelet.getRootBlip(), "createIssue", "createIssue");

            // Linkify to new wave
            blipContentRefs.annotate("link/wave", this.domain + "!"
                + newWavelet.getWaveId().getId());
         
            this.submit(newWavelet, this.getRpcServerUrl());
          } catch (IOException e) {
            LOG.log(Level.SEVERE, e.getMessage(), e);
          }           
View Full Code Here

Examples of com.google.wave.api.Wavelet

    return gadget;
  }

  public Wavelet createNewWavelet(final Wavelet wavelet, final Set<String> participants,
      final String proxyFor) {
    Wavelet newWavelet = null;
    try {
      newWavelet = this.newWave(wavelet.getDomain(), participants, "new_wave", proxyFor,
          getRpcServerUrl());
      newWavelet.submitWith(wavelet);
    } catch (IOException e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
    }
    return newWavelet;
  }
View Full Code Here

Examples of com.google.wave.api.Wavelet

      LOG.info("robot address = " + robotAddress);
      LOG.info("project name = " + projectName);

      IssueJdoEntry issueJdoEntry = util.getIssueJdoEntry(waveId);

      Wavelet wavelet = robot.fetchWavelet(new WaveId(domain, waveId), new WaveletId(domain,
          waveletId), projectName, robot.getRpcServerUrl());
      LOG.info("fetched wavelet id: " + wavelet.getWaveId().getId());
     
     
      IssueCommentsFeed issueCommentsFeed = projectHostingHelper.getComments(issueJdoEntry
          .getProjectName(), issueJdoEntry.getIssueId(), issueJdoEntry.getLocalCommentsCount() + 1);

      if (issueCommentsFeed.getTotalResults() != issueJdoEntry.getLocalCommentsCount()) {
        // Update local comments count.
        issueJdoEntry.setLocalCommentsCount(issueCommentsFeed.getTotalResults());

        util.persistJdo(issueJdoEntry);

        List<IssueCommentsEntry> comments = issueCommentsFeed.getEntries();
        for (IssueCommentsEntry entry : comments) {
          int commentId = projectHostingHelper.getCommentEntryId(entry.getId(), issueJdoEntry
              .getProjectName(), issueJdoEntry.getIssueId() + "");
          TextContent textContent = (TextContent) entry.getContent();
          String content = null;
          if (textContent != null && textContent.getContent() != null) {
            HtmlTextConstruct htmlConstruct = (HtmlTextConstruct) textContent.getContent();
            content = htmlConstruct.getHtml();
          }
          String author = entry.getAuthors().get(0).getName();

          Blip newBlip = wavelet.reply("\n");
          newBlip.append("Comment #" + commentId + " from " + author);
          newBlip.append("\n\n" + content);
          robot.submit(wavelet, robot.getRpcServerUrl());
        }
      }
View Full Code Here

Examples of com.google.wave.api.Wavelet

  private final String BOT_NAME = "hello-worldy@appspot.com";
  private final String WELCOME = "Hello World!"
 
  @Override
  public void processEvents(RobotMessageBundle robotMessageBundle) {
    Wavelet wavelet = robotMessageBundle.getWavelet();
    for (Event event : robotMessageBundle.getEvents()) {
      Blip currentBlip = event.getBlip();
      switch(event.getType()) {
        case WAVELET_SELF_ADDED:
          wavelet.setTitle(WELCOME);    
          addButton(event.getBlip());
          break;
        case BLIP_SUBMITTED:         
          if (!isRoot(currentBlip, wavelet)) {
            String text = currentBlip.getDocument().getText();
            wavelet.appendBlip().getDocument().append("[echo] " + text);            
          }                  
          break;
        case WAVELET_PARTICIPANTS_CHANGED:
          for (String participant : event.getAddedParticipants()) {           
            if (!participant.equals(BOT_NAME) &&
                !participant.equals(wavelet.getCreator())) {
              wavelet.appendBlip().getDocument().append("Hi " + participant + "!");
            }                       
          }         
          break;           
        case FORM_BUTTON_CLICKED:
          if (event.getButtonName().equals("my_button")) {
            String clicker = event.getModifiedBy();
            wavelet.appendBlip().getDocument().append(clicker + " has clicked the button!");
          }
          FormView formView = currentBlip.getDocument().getFormView();         
          if (formView.getFormElement("my_button") != null) {
           
          }         
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.