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
;
30 private boolean fakeCover
;
33 * The title of the story.
37 public String
getTitle() {
42 * The title of the story.
47 public void setTitle(String title
) {
52 * The author of the story.
56 public String
getAuthor() {
61 * The author of the story.
66 public void setAuthor(String author
) {
71 * The story publication date.
75 public String
getDate() {
80 * The story publication date.
85 public void setDate(String date
) {
90 * The tags associated with this story.
94 public List
<String
> getTags() {
99 * The tags associated with this story.
104 public void setTags(List
<String
> tags
) {
109 * The story resume (a.k.a. description).
113 public Chapter
getResume() {
118 * The story resume (a.k.a. description).
123 public void setResume(Chapter resume
) {
124 this.resume
= resume
;
128 * The cover image of the story if any (can be NULL).
132 public BufferedImage
getCover() {
137 * The cover image of the story if any (can be NULL).
142 public void setCover(BufferedImage cover
) {
147 * The subject of the story (or instance, if it is a fanfiction, what is the
148 * original work; if it is a technical text, what is the technical
151 * @return the subject
153 public String
getSubject() {
158 * The subject of the story (for instance, if it is a fanfiction, what is
159 * the original work; if it is a technical text, what is the technical
165 public void setSubject(String subject
) {
166 this.subject
= subject
;
170 * The source of this story (which online library it was downloaded from).
174 public String
getSource() {
179 * The source of this story (which online library it was downloaded from).
184 public void setSource(String source
) {
185 this.source
= source
;
189 * The original URL from which this {@link Story} was imported.
193 public String
getUrl() {
198 * The original URL from which this {@link Story} was imported.
203 public void setUrl(String url
) {
208 * A unique value representing the story (it is often a URL).
212 public String
getUuid() {
217 * A unique value representing the story (it is often a URL).
222 public void setUuid(String uuid
) {
227 * A unique value representing the story in the local library.
231 public String
getLuid() {
236 * A unique value representing the story in the local library.
241 public void setLuid(String luid
) {
246 * The 2-letter code language of this story.
250 public String
getLang() {
255 * The 2-letter code language of this story.
260 public void setLang(String lang
) {
265 * The story publisher (other the same as the source).
267 * @return the publisher
269 public String
getPublisher() {
274 * The story publisher (other the same as the source).
277 * the publisher to set
279 public void setPublisher(String publisher
) {
280 this.publisher
= publisher
;
284 * The output type this {@link Story} is in.
286 * @return the type the type
288 public String
getType() {
293 * The output type this {@link Story} is in.
296 * the new type to set
298 public void setType(String type
) {
303 * Document catering mostly to image files.
305 * @return the imageDocument state
307 public boolean isImageDocument() {
308 return imageDocument
;
312 * Document catering mostly to image files.
314 * @param imageDocument
315 * the imageDocument state to set
317 public void setImageDocument(boolean imageDocument
) {
318 this.imageDocument
= imageDocument
;
322 * The number of words in the related {@link Story}.
324 * @return the number of words
326 public long getWords() {
331 * The number of words in the related {@link Story}.
334 * the number of words to set
336 public void setWords(long words
) {
341 * The (Fanfix) {@link Story} creation date.
343 * @return the creationDate
345 public String
getCreationDate() {
350 * The (Fanfix) {@link Story} creation date.
352 * @param creationDate
353 * the creationDate to set
355 public void setCreationDate(String creationDate
) {
356 this.creationDate
= creationDate
;
360 * The cover in this {@link MetaData} object is "fake", in the sens that it
361 * comes from the actual content images.
363 * @return TRUE for a fake cover
365 public boolean isFakeCover() {
370 * The cover in this {@link MetaData} object is "fake", in the sens that it
371 * comes from the actual content images
374 * TRUE for a fake cover
376 public void setFakeCover(boolean fakeCover
) {
377 this.fakeCover
= fakeCover
;
381 public int compareTo(MetaData o
) {
382 String oUuid
= o
== null ?
null : o
.getUuid();
383 return getUuid().compareTo(oUuid
);
387 public MetaData
clone() {
388 MetaData meta
= null;
390 meta
= (MetaData
) super.clone();
391 } catch (CloneNotSupportedException e
) {
392 // Did the clones rebel?
393 System
.err
.println(e
);
397 meta
.tags
= new ArrayList
<String
>();
398 meta
.tags
.addAll(tags
);
400 if (resume
!= null) {
401 meta
.resume
= new Chapter(resume
.getNumber(), resume
.getName());
402 for (Paragraph para
: resume
) {
403 meta
.resume
.getParagraphs().add(para
);