| 1 | package be.nikiroo.gofetch.output; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import be.nikiroo.gofetch.data.Comment; |
| 6 | import be.nikiroo.gofetch.data.Story; |
| 7 | import be.nikiroo.gofetch.support.BasicSupport.Type; |
| 8 | |
| 9 | /** |
| 10 | * Base class for output operations. |
| 11 | * |
| 12 | * @author niki |
| 13 | */ |
| 14 | public abstract class Output { |
| 15 | /** |
| 16 | * The type of source, can be NULL for no-type. |
| 17 | */ |
| 18 | protected Type type; |
| 19 | |
| 20 | /** |
| 21 | * Create a new {@link Output} class for the given type (which can be NULL). |
| 22 | * |
| 23 | * @param type |
| 24 | * the type or NULL for no type |
| 25 | */ |
| 26 | public Output(Type type) { |
| 27 | this.type = type; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Get the header to use in the index file. |
| 32 | * |
| 33 | * @return the header |
| 34 | */ |
| 35 | abstract public String getIndexHeader(); |
| 36 | |
| 37 | /** |
| 38 | * Get the footer to use in the index file. |
| 39 | * |
| 40 | * @return the footer |
| 41 | */ |
| 42 | abstract public String getIndexFooter(); |
| 43 | |
| 44 | /** |
| 45 | * Export a story (in resume mode). |
| 46 | * |
| 47 | * @param story |
| 48 | * the story |
| 49 | * |
| 50 | * @return the resume |
| 51 | */ |
| 52 | abstract public String export(Story story); |
| 53 | |
| 54 | /** |
| 55 | * Export a full story with comments. |
| 56 | * |
| 57 | * @param story |
| 58 | * the story |
| 59 | * @param comments |
| 60 | * the comments |
| 61 | * |
| 62 | * @return the story |
| 63 | */ |
| 64 | abstract public String export(Story story, List<Comment> comments); |
| 65 | } |