Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
Pushed into OneWaveAPI fetchWavelet when WaveletId is unknown.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martín Schonaker committed Jul 30, 2010
1 parent e58b8a8 commit 205f97d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
16 changes: 7 additions & 9 deletions android-gui/src/net/processone/awc/OneWave.java
Expand Up @@ -56,18 +56,16 @@ public SearchResult search(String query, int index, int count) {

public Wavelet fetchWavelet(WaveId waveId) {

// TODO push this method into OneWaveAPI, this class shouldn't have to
// know that conv+root is.
return fetchWavelet(waveId,
new WaveletId("googlewave.com", "conv+root"), null);
}
try {
return waveAPI.fetchWavelet(waveId);
} catch (OneWaveException e) {
Log.e(getClass().getName(), e.getLocalizedMessage(), e);
}

public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId) {
return fetchWavelet(waveId, waveletId, null);
return null;
}

public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId,
String proxyForId) {
public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId) {

try {
return waveAPI.fetchWavelet(waveId, waveletId);
Expand Down
4 changes: 1 addition & 3 deletions android-gui/src/net/processone/awc/WaveList.java
Expand Up @@ -9,7 +9,6 @@
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
Expand All @@ -27,9 +26,8 @@
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemLongClickListener;

import com.commonsware.cwac.endless.EndlessAdapter;
import com.google.wave.api.SearchResult;
import com.google.wave.api.SearchResult.Digest;
Expand Down
10 changes: 8 additions & 2 deletions wave-api/src/main/java/net/processone/wave/api/OneWaveAPI.java
Expand Up @@ -19,7 +19,9 @@
*/
public class OneWaveAPI {

public static final String JSON_MIME_TYPE = "application/json; charset=utf-8";
private static final String DOMAIN = "googlewave.com";

private static final String JSON_MIME_TYPE = "application/json; charset=utf-8";

private OneWaveOAuth oauth;

Expand Down Expand Up @@ -68,6 +70,10 @@ public void send(Wavelet wavelet) throws OneWaveException {
}
}

public Wavelet fetchWavelet(WaveId waveId) throws OneWaveException {
return fetchWavelet(waveId, new WaveletId(DOMAIN, "conv+root"));
}

public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId)
throws OneWaveException {
try {
Expand All @@ -79,7 +85,7 @@ public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId)

public Wavelet newWavelet(Set<String> participants) throws OneWaveException {
try {
return clientWave.newWave("googlewave.com", participants);
return clientWave.newWave(DOMAIN, participants);
} catch (ClientWaveException e) {
throw new OneWaveException(e);
}
Expand Down
12 changes: 8 additions & 4 deletions wave-api/src/test/java/net/processone/wave/api/Main.java
Expand Up @@ -9,7 +9,6 @@

import org.junit.Ignore;
import org.waveprotocol.wave.model.id.WaveId;
import org.waveprotocol.wave.model.id.WaveletId;

import com.google.wave.api.Wavelet;
import com.google.wave.api.SearchResult.Digest;
Expand Down Expand Up @@ -46,8 +45,13 @@ public static void main(String[] args) throws Exception {
participants.add("vidalsantiagomartinez@googlewave.com");
Wavelet wavelet = api.newWavelet(participants);
wavelet.setTitle("Created programmatically");
wavelet.getRootBlip().appendMarkup(
String.format("<h1 style=\"color:blue\">Checkout class <span style=\"color:red\">%s</span>!</h1>", Main.class.getName()));
wavelet
.getRootBlip()
.appendMarkup(
String
.format(
"<h1 style=\"color:blue\">Checkout class <span style=\"color:red\">%s</span>!</h1>",
Main.class.getName()));
api.send(wavelet);

api.stop();
Expand All @@ -68,7 +72,7 @@ public static void fetchAndReply(OneWaveAPI api, String title,
Digest digest = digests.get(0);

Wavelet wavelet = api.fetchWavelet(WaveId.deserialise(digest
.getWaveId()), new WaveletId("googlewave.com", "conv+root"));
.getWaveId()));

wavelet.reply("\n" + message);
api.send(wavelet);
Expand Down

0 comments on commit 205f97d

Please sign in to comment.