| 1 | package be.nikiroo.gofetch.data; |
| 2 | |
| 3 | import java.net.URL; |
| 4 | |
| 5 | import be.nikiroo.gofetch.support.BasicSupport; |
| 6 | import be.nikiroo.gofetch.support.BasicSupport.Type; |
| 7 | |
| 8 | /** |
| 9 | * A news story. |
| 10 | * |
| 11 | * @author niki |
| 12 | */ |
| 13 | public class Story { |
| 14 | private Type type; |
| 15 | private String id; |
| 16 | private String title; |
| 17 | private String details; |
| 18 | private String urlInternal; |
| 19 | private String urlExternal; |
| 20 | private String content; |
| 21 | |
| 22 | /** |
| 23 | * Create a news story. |
| 24 | * |
| 25 | * @param type |
| 26 | * the source {@link Type} |
| 27 | * @param id |
| 28 | * the news ID |
| 29 | * @param title |
| 30 | * the news title |
| 31 | * @param details |
| 32 | * some details to add to the title |
| 33 | * @param urlInternal |
| 34 | * the {@link URL} to get this news on the associated news site |
| 35 | * @param urlExternal |
| 36 | * an external {@link URL} that serve as the news' source, if any |
| 37 | * @param content |
| 38 | * the story content |
| 39 | */ |
| 40 | public Story(Type type, String id, String title, String details, |
| 41 | String urlInternal, String urlExternal, String content) { |
| 42 | this.type = type; |
| 43 | this.id = id; |
| 44 | this.title = title; |
| 45 | this.details = details; |
| 46 | this.urlInternal = urlInternal; |
| 47 | this.urlExternal = urlExternal; |
| 48 | this.content = content; |
| 49 | } |
| 50 | |
| 51 | public String getSelector() { |
| 52 | return BasicSupport.getSelector(type) + id; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * @return the id |
| 57 | */ |
| 58 | public String getId() { |
| 59 | return id; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @return the title |
| 64 | */ |
| 65 | public String getTitle() { |
| 66 | return title; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @return the details |
| 71 | */ |
| 72 | public String getDetails() { |
| 73 | return details; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @return the url |
| 78 | */ |
| 79 | public String getUrlInternal() { |
| 80 | return urlInternal; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @return the urlExternal |
| 85 | */ |
| 86 | public String getUrlExternal() { |
| 87 | return urlExternal; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * @return the body |
| 92 | */ |
| 93 | public String getContent() { |
| 94 | return content; |
| 95 | } |
| 96 | } |