| 1 | package be.nikiroo.gofetch.data; |
| 2 | |
| 3 | import java.net.URL; |
| 4 | import java.util.List; |
| 5 | |
| 6 | import be.nikiroo.gofetch.support.BasicSupport; |
| 7 | import be.nikiroo.gofetch.support.BasicSupport.Type; |
| 8 | |
| 9 | /** |
| 10 | * A news story. |
| 11 | * |
| 12 | * @author niki |
| 13 | */ |
| 14 | public class Story { |
| 15 | private Type type; |
| 16 | private String id; |
| 17 | private String title; |
| 18 | private String details; |
| 19 | private String urlInternal; |
| 20 | private String urlExternal; |
| 21 | private String content; |
| 22 | |
| 23 | private String fullContent; |
| 24 | private List<Comment> comments; |
| 25 | |
| 26 | /** |
| 27 | * Create a news story. |
| 28 | * |
| 29 | * @param type |
| 30 | * the source {@link Type} |
| 31 | * @param id |
| 32 | * the news ID |
| 33 | * @param title |
| 34 | * the news title |
| 35 | * @param details |
| 36 | * some details to add to the title |
| 37 | * @param urlInternal |
| 38 | * the {@link URL} to get this news on the associated news site |
| 39 | * @param urlExternal |
| 40 | * an external {@link URL} that serve as the news' source, if any |
| 41 | * @param content |
| 42 | * the story content |
| 43 | */ |
| 44 | public Story(Type type, String id, String title, String details, |
| 45 | String urlInternal, String urlExternal, String content) { |
| 46 | this.type = type; |
| 47 | this.id = id; |
| 48 | this.title = title; |
| 49 | this.details = details; |
| 50 | this.urlInternal = urlInternal; |
| 51 | this.urlExternal = urlExternal; |
| 52 | this.content = content; |
| 53 | |
| 54 | // Defaults fullContent to content |
| 55 | this.fullContent = content; |
| 56 | } |
| 57 | |
| 58 | public String getSelector() { |
| 59 | return BasicSupport.getSelector(type) + id; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @return the id |
| 64 | */ |
| 65 | public String getId() { |
| 66 | return id; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @return the title |
| 71 | */ |
| 72 | public String getTitle() { |
| 73 | return title; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @return the details |
| 78 | */ |
| 79 | public String getDetails() { |
| 80 | return details; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @return the url |
| 85 | */ |
| 86 | public String getUrlInternal() { |
| 87 | return urlInternal; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * @return the urlExternal |
| 92 | */ |
| 93 | public String getUrlExternal() { |
| 94 | return urlExternal; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * @return the body |
| 99 | */ |
| 100 | public String getContent() { |
| 101 | return content; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * @return the fullContent |
| 106 | */ |
| 107 | public String getFullContent() { |
| 108 | return fullContent; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * @param fullContent |
| 113 | * the fullContent to set |
| 114 | */ |
| 115 | public void setFullContent(String fullContent) { |
| 116 | this.fullContent = fullContent; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * @return the comments |
| 121 | */ |
| 122 | public List<Comment> getComments() { |
| 123 | return comments; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * @param comments |
| 128 | * the comments to set |
| 129 | */ |
| 130 | public void setComments(List<Comment> comments) { |
| 131 | this.comments = comments; |
| 132 | } |
| 133 | } |