X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fgofetch%2Fdata%2FStory.java;h=a2ad7d3b9e3a3660d18c951c6c3904b49a91c6b6;hb=72f39832a7b425003c1d717afcfb5a9cf7d3405b;hp=aa5aecc25501d9a90377d1006d6bb180a257c045;hpb=737852686d8897331706ed4b902dbd9d5038cb53;p=gofetch.git diff --git a/src/be/nikiroo/gofetch/data/Story.java b/src/be/nikiroo/gofetch/data/Story.java index aa5aecc..a2ad7d3 100644 --- a/src/be/nikiroo/gofetch/data/Story.java +++ b/src/be/nikiroo/gofetch/data/Story.java @@ -1,6 +1,7 @@ package be.nikiroo.gofetch.data; import java.net.URL; +import java.util.List; import be.nikiroo.gofetch.support.BasicSupport; import be.nikiroo.gofetch.support.BasicSupport.Type; @@ -19,6 +20,9 @@ public class Story { private String urlExternal; private String content; + private String fullContent; + private List comments; + /** * Create a news story. * @@ -46,6 +50,9 @@ public class Story { this.urlInternal = urlInternal; this.urlExternal = urlExternal; this.content = content; + + // Defaults fullContent to content + this.fullContent = content; } public String getSelector() { @@ -93,4 +100,55 @@ public class Story { public String getContent() { return content; } + + /** + * @return the fullContent + */ + public String getFullContent() { + return fullContent; + } + + /** + * @param fullContent + * the fullContent to set + */ + public void setFullContent(String fullContent) { + this.fullContent = fullContent; + } + + /** + * @return the comments + */ + public List getComments() { + return comments; + } + + /** + * @param comments + * the comments to set + */ + public void setComments(List comments) { + this.comments = comments; + } + + /** + * Find a comment or sub-comment by its id. + * + * @param id + * the id to look for F + * @return this if it has the given id, or a child of this if the child have + * the given id, or NULL if not + */ + public Comment getCommentById(String id) { + if (id != null && comments != null) { + for (Comment comment : comments) { + Comment found = comment.getById(id); + if (found != null) { + return found; + } + } + } + + return null; + } } \ No newline at end of file