1 package be
.nikiroo
.fanfix
.data
;
3 import java
.awt
.image
.BufferedImage
;
4 import java
.util
.ArrayList
;
8 * The meta data associated to a {@link Story} object.
12 public class MetaData
implements Cloneable
, Comparable
<MetaData
> {
14 private String author
;
16 private Chapter resume
;
17 private List
<String
> tags
;
18 private BufferedImage cover
;
19 private String subject
;
20 private String source
;
25 private String publisher
;
27 private boolean imageDocument
;
29 private String creationDate
;
32 * The title of the story.
36 public String
getTitle() {
41 * The title of the story.
46 public void setTitle(String title
) {
51 * The author of the story.
55 public String
getAuthor() {
60 * The author of the story.
65 public void setAuthor(String author
) {
70 * The story publication date.
74 public String
getDate() {
79 * The story publication date.
84 public void setDate(String date
) {
89 * The tags associated with this story.
93 public List
<String
> getTags() {
98 * The tags associated with this story.
103 public void setTags(List
<String
> tags
) {
108 * The story resume (a.k.a. description).
112 public Chapter
getResume() {
117 * The story resume (a.k.a. description).
122 public void setResume(Chapter resume
) {
123 this.resume
= resume
;
127 * The cover image of the story if any (can be NULL).
131 public BufferedImage
getCover() {
136 * The cover image of the story if any (can be NULL).
141 public void setCover(BufferedImage cover
) {
146 * The subject of the story (or instance, if it is a fanfiction, what is the
147 * original work; if it is a technical text, what is the technical
150 * @return the subject
152 public String
getSubject() {
157 * The subject of the story (for instance, if it is a fanfiction, what is
158 * the original work; if it is a technical text, what is the technical
164 public void setSubject(String subject
) {
165 this.subject
= subject
;
169 * The source of this story (which online library it was downloaded from).
173 public String
getSource() {
178 * The source of this story (which online library it was downloaded from).
183 public void setSource(String source
) {
184 this.source
= source
;
188 * The original URL from which this {@link Story} was imported.
192 public String
getUrl() {
197 * The original URL from which this {@link Story} was imported.
202 public void setUrl(String url
) {
207 * A unique value representing the story (it is often a URL).
211 public String
getUuid() {
216 * A unique value representing the story (it is often a URL).
221 public void setUuid(String uuid
) {
226 * A unique value representing the story in the local library.
230 public String
getLuid() {
235 * A unique value representing the story in the local library.
240 public void setLuid(String luid
) {
245 * The 2-letter code language of this story.
249 public String
getLang() {
254 * The 2-letter code language of this story.
259 public void setLang(String lang
) {
264 * The story publisher (other the same as the source).
266 * @return the publisher
268 public String
getPublisher() {
273 * The story publisher (other the same as the source).
276 * the publisher to set
278 public void setPublisher(String publisher
) {
279 this.publisher
= publisher
;
283 * The output type this {@link Story} is in.
285 * @return the type the type
287 public String
getType() {
292 * The output type this {@link Story} is in.
295 * the new type to set
297 public void setType(String type
) {
302 * Document catering mostly to image files.
304 * @return the imageDocument state
306 public boolean isImageDocument() {
307 return imageDocument
;
311 * Document catering mostly to image files.
313 * @param imageDocument
314 * the imageDocument state to set
316 public void setImageDocument(boolean imageDocument
) {
317 this.imageDocument
= imageDocument
;
321 * The number of words in the related {@link Story}.
323 * @return the number of words
325 public long getWords() {
330 * The number of words in the related {@link Story}.
333 * the number of words to set
335 public void setWords(long words
) {
340 * The (Fanfix) {@link Story} creation date.
342 * @return the creationDate
344 public String
getCreationDate() {
349 * The (Fanfix) {@link Story} creation date.
351 * @param creationDate
352 * the creationDate to set
354 public void setCreationDate(String creationDate
) {
355 this.creationDate
= creationDate
;
358 public int compareTo(MetaData o
) {
359 String oUuid
= o
== null ?
null : o
.getUuid();
360 return getUuid().compareTo(oUuid
);
364 public MetaData
clone() {
365 MetaData meta
= null;
367 meta
= (MetaData
) super.clone();
368 } catch (CloneNotSupportedException e
) {
369 // Did the clones rebel?
370 System
.err
.println(e
);
374 meta
.tags
= new ArrayList
<String
>();
375 meta
.tags
.addAll(tags
);
377 if (resume
!= null) {
378 meta
.resume
= new Chapter(resume
.getNumber(), resume
.getName());
379 for (Paragraph para
: resume
) {
380 meta
.resume
.getParagraphs().add(para
);