Skip to content

Instantly share code, notes, and snippets.

@secondsun
Created March 15, 2013 15:22
Show Gist options
  • Save secondsun/17ce96082eda37dbd10e to your computer and use it in GitHub Desktop.
Save secondsun/17ce96082eda37dbd10e to your computer and use it in GitHub Desktop.
class Post {
Long id;
String title;
Post(Long id, String title) {
this.id = id;
this.title = title;
}
}
class Comment {
Long id;
String body;
}
class Activity {
Pipeline pipeline = new Pipeline(BLOG_SERVER_URL);
Post parent = new Post(1, "Ex Post");
void onCreate() {
PipeConfig commentsConfig = new PipeConfig(Comment.class);
commentsConfig.setParentPath("/post/${id}/");
pipeline.pipe(Comment.class, commentsConfig);
}
void onStart() {
/**
* read(id, parent, callback) will look at the parent path,
* extract property keys (${id}) and then try to load those values
* from the parent object. (parentPost.id)
*/
pipeline.get("comment", this).read(1, parentPost, new ActivityCallback());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment