Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DocumentMeta |
|
| 2.6557377049180326;2,656 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.4.1 on 2012-04-13 21:33:05, | |
4 | any modifications will be overwritten. | |
5 | ============================================================== | |
6 | */ | |
7 | ||
8 | package org.apache.maven.doxia.document; | |
9 | ||
10 | /** | |
11 | * | |
12 | * <p> | |
13 | * Metadata is general information about a document. | |
14 | * </p> | |
15 | * | |
16 | * <p> | |
17 | * The metadata elements used here were mostly inspired | |
18 | * by the | |
19 | * <a href="http://docs.oasis-open.org/office/v1.1/">Open | |
20 | * Document Format Specification v. 1.1</a>, | |
21 | * which in turn borrows heavily upon the metadata | |
22 | * standards developed by the | |
23 | * <a href="http://www.dublincore.org">Dublin Core | |
24 | * Metadata Initiative</a>. | |
25 | * </p> | |
26 | * | |
27 | * | |
28 | * @version $Revision$ $Date$ | |
29 | */ | |
30 | @SuppressWarnings( "all" ) | |
31 | 4 | public class DocumentMeta |
32 | implements java.io.Serializable | |
33 | { | |
34 | ||
35 | //--------------------------/ | |
36 | //- Class/Member Variables -/ | |
37 | //--------------------------/ | |
38 | ||
39 | /** | |
40 | * | |
41 | * The title of the document. | |
42 | * | |
43 | */ | |
44 | private String title; | |
45 | ||
46 | /** | |
47 | * | |
48 | * The unique author of the document, usually as a | |
49 | * String of "firstName lastName". For | |
50 | * more authors, you could use the <authors/> | |
51 | * tag. | |
52 | * | |
53 | */ | |
54 | private String author; | |
55 | ||
56 | /** | |
57 | * Field authors. | |
58 | */ | |
59 | private java.util.List<DocumentAuthor> authors; | |
60 | ||
61 | /** | |
62 | * | |
63 | * The subject of the document. | |
64 | * | |
65 | */ | |
66 | private String subject; | |
67 | ||
68 | /** | |
69 | * | |
70 | * The keywords for the document, usually as a | |
71 | * String of comma separated keywords. | |
72 | * @deprecated use the <keyWords/> tag | |
73 | * instead of. | |
74 | * | |
75 | */ | |
76 | private String keywords; | |
77 | ||
78 | /** | |
79 | * Field keyWords. | |
80 | */ | |
81 | private java.util.List<String> keyWords; | |
82 | ||
83 | /** | |
84 | * | |
85 | * The pagesize of the document. | |
86 | * At least "US", "USLetter" and "A4" should be | |
87 | * supported. | |
88 | * | |
89 | */ | |
90 | private String pageSize; | |
91 | ||
92 | /** | |
93 | * | |
94 | * A string that identifies the application or | |
95 | * tool that was | |
96 | * used to create or last modify the document. | |
97 | * | |
98 | */ | |
99 | private String generator; | |
100 | ||
101 | /** | |
102 | * | |
103 | * A brief description of the document. | |
104 | * | |
105 | */ | |
106 | private String description; | |
107 | ||
108 | /** | |
109 | * | |
110 | * The name of the person who created the document | |
111 | * initially. | |
112 | * | |
113 | */ | |
114 | private String initialCreator; | |
115 | ||
116 | /** | |
117 | * | |
118 | * The name of the person who last modified the | |
119 | * document. | |
120 | * | |
121 | */ | |
122 | private String creator; | |
123 | ||
124 | /** | |
125 | * | |
126 | * The name of the person who last printed the | |
127 | * document. | |
128 | * | |
129 | */ | |
130 | private String printedBy; | |
131 | ||
132 | /** | |
133 | * | |
134 | * The date and time when the document was created | |
135 | * initially. | |
136 | * Use the ISO 8601 format | |
137 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
138 | * | |
139 | */ | |
140 | private java.util.Date creationDate; | |
141 | ||
142 | /** | |
143 | * | |
144 | * The date as String (recommended format is ISO | |
145 | * 8601) when the document was created initially. | |
146 | * Only used if <code>creationDate</code> is not | |
147 | * set. | |
148 | * @since 1.1.1 | |
149 | * . | |
150 | */ | |
151 | private String creationdate; | |
152 | ||
153 | /** | |
154 | * | |
155 | * The date and time when the document was last | |
156 | * modified. | |
157 | * Use the ISO 8601 format | |
158 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
159 | * | |
160 | */ | |
161 | private java.util.Date date; | |
162 | ||
163 | /** | |
164 | * | |
165 | * The date as String (recommended format is ISO | |
166 | * 8601) when the document was last modified. | |
167 | * Only used if <code>date</code> is not set. | |
168 | * @since 1.1.1 | |
169 | * . | |
170 | */ | |
171 | private String modifydate; | |
172 | ||
173 | /** | |
174 | * | |
175 | * The date and time when the document was last | |
176 | * printed. | |
177 | * Use the ISO 8601 format | |
178 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
179 | * | |
180 | */ | |
181 | private java.util.Date printDate; | |
182 | ||
183 | /** | |
184 | * | |
185 | * The date as String (recommended format is ISO | |
186 | * 8601) when the document was last printed. | |
187 | * Only used if <code>printDate</code> is not set. | |
188 | * @since 1.1.1 | |
189 | * . | |
190 | */ | |
191 | private String printdate; | |
192 | ||
193 | /** | |
194 | * | |
195 | * A template that was used to create the document. | |
196 | * | |
197 | */ | |
198 | private DocumentTemplate template; | |
199 | ||
200 | /** | |
201 | * | |
202 | * The hyperlink-behaviour element specifies the | |
203 | * default behavior | |
204 | * for hyperlinks in the document. | |
205 | * | |
206 | */ | |
207 | private DocumentHyperlinkBehaviour hyperlinkBehaviour; | |
208 | ||
209 | /** | |
210 | * | |
211 | * The default language of the document. The | |
212 | * language is represented by | |
213 | * a two or three letter Language Code taken from | |
214 | * the ISO 639 standard, | |
215 | * optionally followed by a hyphen (-) and a | |
216 | * two-letter Country Code | |
217 | * taken from the ISO 3166 standard. | |
218 | * | |
219 | */ | |
220 | 4 | private String language = "en-US"; |
221 | ||
222 | /** | |
223 | * | |
224 | * The number of editing cycles the document has | |
225 | * been through. | |
226 | * | |
227 | */ | |
228 | 4 | private long editingCycles = 0L; |
229 | ||
230 | /** | |
231 | * | |
232 | * The total time spent editing the document. | |
233 | * | |
234 | */ | |
235 | 4 | private long editingDuration = 0L; |
236 | ||
237 | /** | |
238 | * | |
239 | * The statistics of the document, for example, the | |
240 | * page count, | |
241 | * word count, etc. | |
242 | * | |
243 | */ | |
244 | private DocumentStatistic documentStatistic; | |
245 | ||
246 | /** | |
247 | * | |
248 | * whether the content of the document is in some | |
249 | * sense confidential. | |
250 | * | |
251 | */ | |
252 | 4 | private boolean confidential = false; |
253 | ||
254 | /** | |
255 | * | |
256 | * whether the content of the document is in some | |
257 | * sense preliminary. | |
258 | * | |
259 | */ | |
260 | 4 | private boolean draft = false; |
261 | ||
262 | ||
263 | //-----------/ | |
264 | //- Methods -/ | |
265 | //-----------/ | |
266 | ||
267 | /** | |
268 | * Method addAuthor. | |
269 | * | |
270 | * @param documentAuthor | |
271 | */ | |
272 | public void addAuthor( DocumentAuthor documentAuthor ) | |
273 | { | |
274 | 2 | getAuthors().add( documentAuthor ); |
275 | 2 | } //-- void addAuthor( DocumentAuthor ) |
276 | ||
277 | /** | |
278 | * Method addKeyWord. | |
279 | * | |
280 | * @param string | |
281 | */ | |
282 | public void addKeyWord( String string ) | |
283 | { | |
284 | 4 | getKeyWords().add( string ); |
285 | 4 | } //-- void addKeyWord( String ) |
286 | ||
287 | /** | |
288 | * Method equals. | |
289 | * | |
290 | * @param other | |
291 | * @return boolean | |
292 | */ | |
293 | public boolean equals( Object other ) | |
294 | { | |
295 | 2 | if ( this == other ) |
296 | { | |
297 | 0 | return true; |
298 | } | |
299 | ||
300 | 2 | if ( !( other instanceof DocumentMeta ) ) |
301 | { | |
302 | 0 | return false; |
303 | } | |
304 | ||
305 | 2 | DocumentMeta that = (DocumentMeta) other; |
306 | 2 | boolean result = true; |
307 | ||
308 | 2 | result = result && ( getTitle() == null ? that.getTitle() == null : getTitle().equals( that.getTitle() ) ); |
309 | 2 | result = result && ( getAuthor() == null ? that.getAuthor() == null : getAuthor().equals( that.getAuthor() ) ); |
310 | 2 | result = result && ( getAuthors() == null ? that.getAuthors() == null : getAuthors().equals( that.getAuthors() ) ); |
311 | 2 | result = result && ( getSubject() == null ? that.getSubject() == null : getSubject().equals( that.getSubject() ) ); |
312 | 2 | result = result && ( getKeywords() == null ? that.getKeywords() == null : getKeywords().equals( that.getKeywords() ) ); |
313 | 2 | result = result && ( getKeyWords() == null ? that.getKeyWords() == null : getKeyWords().equals( that.getKeyWords() ) ); |
314 | 2 | result = result && ( getPageSize() == null ? that.getPageSize() == null : getPageSize().equals( that.getPageSize() ) ); |
315 | 2 | result = result && ( getGenerator() == null ? that.getGenerator() == null : getGenerator().equals( that.getGenerator() ) ); |
316 | 2 | result = result && ( getDescription() == null ? that.getDescription() == null : getDescription().equals( that.getDescription() ) ); |
317 | 2 | result = result && ( getInitialCreator() == null ? that.getInitialCreator() == null : getInitialCreator().equals( that.getInitialCreator() ) ); |
318 | 2 | result = result && ( getCreator() == null ? that.getCreator() == null : getCreator().equals( that.getCreator() ) ); |
319 | 2 | result = result && ( getPrintedBy() == null ? that.getPrintedBy() == null : getPrintedBy().equals( that.getPrintedBy() ) ); |
320 | 2 | result = result && ( getCreationDate() == null ? that.getCreationDate() == null : getCreationDate().equals( that.getCreationDate() ) ); |
321 | 2 | result = result && ( getCreationdate() == null ? that.getCreationdate() == null : getCreationdate().equals( that.getCreationdate() ) ); |
322 | 2 | result = result && ( getDate() == null ? that.getDate() == null : getDate().equals( that.getDate() ) ); |
323 | 2 | result = result && ( getModifydate() == null ? that.getModifydate() == null : getModifydate().equals( that.getModifydate() ) ); |
324 | 2 | result = result && ( getPrintDate() == null ? that.getPrintDate() == null : getPrintDate().equals( that.getPrintDate() ) ); |
325 | 2 | result = result && ( getPrintdate() == null ? that.getPrintdate() == null : getPrintdate().equals( that.getPrintdate() ) ); |
326 | 2 | result = result && ( getTemplate() == null ? that.getTemplate() == null : getTemplate().equals( that.getTemplate() ) ); |
327 | 2 | result = result && ( getHyperlinkBehaviour() == null ? that.getHyperlinkBehaviour() == null : getHyperlinkBehaviour().equals( that.getHyperlinkBehaviour() ) ); |
328 | 2 | result = result && ( getLanguage() == null ? that.getLanguage() == null : getLanguage().equals( that.getLanguage() ) ); |
329 | 2 | result = result && editingCycles == that.editingCycles; |
330 | 2 | result = result && editingDuration == that.editingDuration; |
331 | 2 | result = result && ( getDocumentStatistic() == null ? that.getDocumentStatistic() == null : getDocumentStatistic().equals( that.getDocumentStatistic() ) ); |
332 | 2 | result = result && confidential == that.confidential; |
333 | 2 | result = result && draft == that.draft; |
334 | ||
335 | 2 | return result; |
336 | } //-- boolean equals( Object ) | |
337 | ||
338 | /** | |
339 | * Get the unique author of the document, usually as a String | |
340 | * of "firstName lastName". For | |
341 | * more authors, you could use the <authors/> | |
342 | * tag. | |
343 | * | |
344 | * @return String | |
345 | */ | |
346 | public String getAuthor() | |
347 | { | |
348 | 18 | return this.author; |
349 | } //-- String getAuthor() | |
350 | ||
351 | /** | |
352 | * Method getAuthors. | |
353 | * | |
354 | * @return List | |
355 | */ | |
356 | public java.util.List<DocumentAuthor> getAuthors() | |
357 | { | |
358 | 22 | if ( this.authors == null ) |
359 | { | |
360 | 2 | this.authors = new java.util.ArrayList<DocumentAuthor>(); |
361 | } | |
362 | ||
363 | 22 | return this.authors; |
364 | } //-- java.util.List<DocumentAuthor> getAuthors() | |
365 | ||
366 | /** | |
367 | * Get the date and time when the document was created | |
368 | * initially. | |
369 | * Use the ISO 8601 format | |
370 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
371 | * | |
372 | * @return Date | |
373 | */ | |
374 | public java.util.Date getCreationDate() | |
375 | { | |
376 | 46 | return this.creationDate; |
377 | } //-- java.util.Date getCreationDate() | |
378 | ||
379 | /** | |
380 | * Get the name of the person who last modified the document. | |
381 | * | |
382 | * @return String | |
383 | */ | |
384 | public String getCreator() | |
385 | { | |
386 | 18 | return this.creator; |
387 | } //-- String getCreator() | |
388 | ||
389 | /** | |
390 | * Get the date and time when the document was last modified. | |
391 | * Use the ISO 8601 format | |
392 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
393 | * | |
394 | * @return Date | |
395 | */ | |
396 | public java.util.Date getDate() | |
397 | { | |
398 | 46 | return this.date; |
399 | } //-- java.util.Date getDate() | |
400 | ||
401 | /** | |
402 | * Get a brief description of the document. | |
403 | * | |
404 | * @return String | |
405 | */ | |
406 | public String getDescription() | |
407 | { | |
408 | 18 | return this.description; |
409 | } //-- String getDescription() | |
410 | ||
411 | /** | |
412 | * Get the statistics of the document, for example, the page | |
413 | * count, | |
414 | * word count, etc. | |
415 | * | |
416 | * @return DocumentStatistic | |
417 | */ | |
418 | public DocumentStatistic getDocumentStatistic() | |
419 | { | |
420 | 18 | return this.documentStatistic; |
421 | } //-- DocumentStatistic getDocumentStatistic() | |
422 | ||
423 | /** | |
424 | * Get the number of editing cycles the document has been | |
425 | * through. | |
426 | * | |
427 | * @return long | |
428 | */ | |
429 | public long getEditingCycles() | |
430 | { | |
431 | 12 | return this.editingCycles; |
432 | } //-- long getEditingCycles() | |
433 | ||
434 | /** | |
435 | * Get the total time spent editing the document. | |
436 | * | |
437 | * @return long | |
438 | */ | |
439 | public long getEditingDuration() | |
440 | { | |
441 | 12 | return this.editingDuration; |
442 | } //-- long getEditingDuration() | |
443 | ||
444 | /** | |
445 | * Get a string that identifies the application or tool that | |
446 | * was | |
447 | * used to create or last modify the document. | |
448 | * | |
449 | * @return String | |
450 | */ | |
451 | public String getGenerator() | |
452 | { | |
453 | 18 | return this.generator; |
454 | } //-- String getGenerator() | |
455 | ||
456 | /** | |
457 | * Get the hyperlink-behaviour element specifies the default | |
458 | * behavior | |
459 | * for hyperlinks in the document. | |
460 | * | |
461 | * @return DocumentHyperlinkBehaviour | |
462 | */ | |
463 | public DocumentHyperlinkBehaviour getHyperlinkBehaviour() | |
464 | { | |
465 | 18 | return this.hyperlinkBehaviour; |
466 | } //-- DocumentHyperlinkBehaviour getHyperlinkBehaviour() | |
467 | ||
468 | /** | |
469 | * Get the name of the person who created the document | |
470 | * initially. | |
471 | * | |
472 | * @return String | |
473 | */ | |
474 | public String getInitialCreator() | |
475 | { | |
476 | 18 | return this.initialCreator; |
477 | } //-- String getInitialCreator() | |
478 | ||
479 | /** | |
480 | * Method getKeyWords. | |
481 | * | |
482 | * @return List | |
483 | */ | |
484 | public java.util.List<String> getKeyWords() | |
485 | { | |
486 | 28 | if ( this.keyWords == null ) |
487 | { | |
488 | 2 | this.keyWords = new java.util.ArrayList<String>(); |
489 | } | |
490 | ||
491 | 28 | return this.keyWords; |
492 | } //-- java.util.List<String> getKeyWords() | |
493 | ||
494 | /** | |
495 | * Get the keywords for the document, usually as a String of | |
496 | * comma separated keywords. | |
497 | * @deprecated use the <keyWords/> tag | |
498 | * instead of. | |
499 | * | |
500 | * @return String | |
501 | */ | |
502 | public String getKeywords() | |
503 | { | |
504 | 14 | return this.keywords; |
505 | } //-- String getKeywords() | |
506 | ||
507 | /** | |
508 | * Get the default language of the document. The language is | |
509 | * represented by | |
510 | * a two or three letter Language Code taken from | |
511 | * the ISO 639 standard, | |
512 | * optionally followed by a hyphen (-) and a | |
513 | * two-letter Country Code | |
514 | * taken from the ISO 3166 standard. | |
515 | * | |
516 | * @return String | |
517 | */ | |
518 | public String getLanguage() | |
519 | { | |
520 | 20 | return this.language; |
521 | } //-- String getLanguage() | |
522 | ||
523 | /** | |
524 | * Get the pagesize of the document. | |
525 | * At least "US", "USLetter" and "A4" should be | |
526 | * supported. | |
527 | * | |
528 | * @return String | |
529 | */ | |
530 | public String getPageSize() | |
531 | { | |
532 | 18 | return this.pageSize; |
533 | } //-- String getPageSize() | |
534 | ||
535 | /** | |
536 | * Get the date and time when the document was last printed. | |
537 | * Use the ISO 8601 format | |
538 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
539 | * | |
540 | * @return Date | |
541 | */ | |
542 | public java.util.Date getPrintDate() | |
543 | { | |
544 | 46 | return this.printDate; |
545 | } //-- java.util.Date getPrintDate() | |
546 | ||
547 | /** | |
548 | * Get the name of the person who last printed the document. | |
549 | * | |
550 | * @return String | |
551 | */ | |
552 | public String getPrintedBy() | |
553 | { | |
554 | 18 | return this.printedBy; |
555 | } //-- String getPrintedBy() | |
556 | ||
557 | /** | |
558 | * Get the subject of the document. | |
559 | * | |
560 | * @return String | |
561 | */ | |
562 | public String getSubject() | |
563 | { | |
564 | 18 | return this.subject; |
565 | } //-- String getSubject() | |
566 | ||
567 | /** | |
568 | * Get a template that was used to create the document. | |
569 | * | |
570 | * @return DocumentTemplate | |
571 | */ | |
572 | public DocumentTemplate getTemplate() | |
573 | { | |
574 | 18 | return this.template; |
575 | } //-- DocumentTemplate getTemplate() | |
576 | ||
577 | /** | |
578 | * Get the title of the document. | |
579 | * | |
580 | * @return String | |
581 | */ | |
582 | public String getTitle() | |
583 | { | |
584 | 18 | return this.title; |
585 | } //-- String getTitle() | |
586 | ||
587 | /** | |
588 | * Method hashCode. | |
589 | * | |
590 | * @return int | |
591 | */ | |
592 | public int hashCode() | |
593 | { | |
594 | 4 | int result = 17; |
595 | ||
596 | 4 | result = 37 * result + ( title != null ? title.hashCode() : 0 ); |
597 | 4 | result = 37 * result + ( author != null ? author.hashCode() : 0 ); |
598 | 4 | result = 37 * result + ( authors != null ? authors.hashCode() : 0 ); |
599 | 4 | result = 37 * result + ( subject != null ? subject.hashCode() : 0 ); |
600 | 4 | result = 37 * result + ( keywords != null ? keywords.hashCode() : 0 ); |
601 | 4 | result = 37 * result + ( keyWords != null ? keyWords.hashCode() : 0 ); |
602 | 4 | result = 37 * result + ( pageSize != null ? pageSize.hashCode() : 0 ); |
603 | 4 | result = 37 * result + ( generator != null ? generator.hashCode() : 0 ); |
604 | 4 | result = 37 * result + ( description != null ? description.hashCode() : 0 ); |
605 | 4 | result = 37 * result + ( initialCreator != null ? initialCreator.hashCode() : 0 ); |
606 | 4 | result = 37 * result + ( creator != null ? creator.hashCode() : 0 ); |
607 | 4 | result = 37 * result + ( printedBy != null ? printedBy.hashCode() : 0 ); |
608 | 4 | result = 37 * result + ( creationDate != null ? creationDate.hashCode() : 0 ); |
609 | 4 | result = 37 * result + ( creationdate != null ? creationdate.hashCode() : 0 ); |
610 | 4 | result = 37 * result + ( date != null ? date.hashCode() : 0 ); |
611 | 4 | result = 37 * result + ( modifydate != null ? modifydate.hashCode() : 0 ); |
612 | 4 | result = 37 * result + ( printDate != null ? printDate.hashCode() : 0 ); |
613 | 4 | result = 37 * result + ( printdate != null ? printdate.hashCode() : 0 ); |
614 | 4 | result = 37 * result + ( template != null ? template.hashCode() : 0 ); |
615 | 4 | result = 37 * result + ( hyperlinkBehaviour != null ? hyperlinkBehaviour.hashCode() : 0 ); |
616 | 4 | result = 37 * result + ( language != null ? language.hashCode() : 0 ); |
617 | 4 | result = 37 * result + (int) ( editingCycles ^ ( editingCycles >>> 32 ) ); |
618 | 4 | result = 37 * result + (int) ( editingDuration ^ ( editingDuration >>> 32 ) ); |
619 | 4 | result = 37 * result + ( documentStatistic != null ? documentStatistic.hashCode() : 0 ); |
620 | 4 | result = 37 * result + ( confidential ? 0 : 1 ); |
621 | 4 | result = 37 * result + ( draft ? 0 : 1 ); |
622 | ||
623 | 4 | return result; |
624 | } //-- int hashCode() | |
625 | ||
626 | /** | |
627 | * Get whether the content of the document is in some sense | |
628 | * confidential. | |
629 | * | |
630 | * @return boolean | |
631 | */ | |
632 | public boolean isConfidential() | |
633 | { | |
634 | 12 | return this.confidential; |
635 | } //-- boolean isConfidential() | |
636 | ||
637 | /** | |
638 | * Get whether the content of the document is in some sense | |
639 | * preliminary. | |
640 | * | |
641 | * @return boolean | |
642 | */ | |
643 | public boolean isDraft() | |
644 | { | |
645 | 12 | return this.draft; |
646 | } //-- boolean isDraft() | |
647 | ||
648 | /** | |
649 | * Method removeAuthor. | |
650 | * | |
651 | * @param documentAuthor | |
652 | */ | |
653 | public void removeAuthor( DocumentAuthor documentAuthor ) | |
654 | { | |
655 | 0 | getAuthors().remove( documentAuthor ); |
656 | 0 | } //-- void removeAuthor( DocumentAuthor ) |
657 | ||
658 | /** | |
659 | * Method removeKeyWord. | |
660 | * | |
661 | * @param string | |
662 | */ | |
663 | public void removeKeyWord( String string ) | |
664 | { | |
665 | 0 | getKeyWords().remove( string ); |
666 | 0 | } //-- void removeKeyWord( String ) |
667 | ||
668 | /** | |
669 | * Set the unique author of the document, usually as a String | |
670 | * of "firstName lastName". For | |
671 | * more authors, you could use the <authors/> | |
672 | * tag. | |
673 | * | |
674 | * @param author | |
675 | */ | |
676 | public void setAuthor( String author ) | |
677 | { | |
678 | 4 | this.author = author; |
679 | 4 | } //-- void setAuthor( String ) |
680 | ||
681 | /** | |
682 | * Set the authors of the document. The names of the entities | |
683 | * that | |
684 | * are primarily responsible for the content of the | |
685 | * document. | |
686 | * | |
687 | * @param authors | |
688 | */ | |
689 | public void setAuthors( java.util.List<DocumentAuthor> authors ) | |
690 | { | |
691 | 2 | this.authors = authors; |
692 | 2 | } //-- void setAuthors( java.util.List ) |
693 | ||
694 | /** | |
695 | * Set whether the content of the document is in some sense | |
696 | * confidential. | |
697 | * | |
698 | * @param confidential | |
699 | */ | |
700 | public void setConfidential( boolean confidential ) | |
701 | { | |
702 | 4 | this.confidential = confidential; |
703 | 4 | } //-- void setConfidential( boolean ) |
704 | ||
705 | /** | |
706 | * Set the date and time when the document was created | |
707 | * initially. | |
708 | * Use the ISO 8601 format | |
709 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
710 | * | |
711 | * @param creationDate | |
712 | */ | |
713 | public void setCreationDate( java.util.Date creationDate ) | |
714 | { | |
715 | 4 | this.creationDate = creationDate; |
716 | 4 | } //-- void setCreationDate( java.util.Date ) |
717 | ||
718 | /** | |
719 | * Set the date as String (recommended format is ISO 8601) when | |
720 | * the document was created initially. | |
721 | * Only used if <code>creationDate</code> is not | |
722 | * set. | |
723 | * @since 1.1.1. | |
724 | * | |
725 | * @param creationdate | |
726 | */ | |
727 | public void setCreationdate( String creationdate ) | |
728 | { | |
729 | 2 | this.creationdate = creationdate; |
730 | 2 | } //-- void setCreationdate( String ) |
731 | ||
732 | /** | |
733 | * Set the name of the person who last modified the document. | |
734 | * | |
735 | * @param creator | |
736 | */ | |
737 | public void setCreator( String creator ) | |
738 | { | |
739 | 4 | this.creator = creator; |
740 | 4 | } //-- void setCreator( String ) |
741 | ||
742 | /** | |
743 | * Set the date and time when the document was last modified. | |
744 | * Use the ISO 8601 format | |
745 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
746 | * | |
747 | * @param date | |
748 | */ | |
749 | public void setDate( java.util.Date date ) | |
750 | { | |
751 | 4 | this.date = date; |
752 | 4 | } //-- void setDate( java.util.Date ) |
753 | ||
754 | /** | |
755 | * Set a brief description of the document. | |
756 | * | |
757 | * @param description | |
758 | */ | |
759 | public void setDescription( String description ) | |
760 | { | |
761 | 4 | this.description = description; |
762 | 4 | } //-- void setDescription( String ) |
763 | ||
764 | /** | |
765 | * Set the statistics of the document, for example, the page | |
766 | * count, | |
767 | * word count, etc. | |
768 | * | |
769 | * @param documentStatistic | |
770 | */ | |
771 | public void setDocumentStatistic( DocumentStatistic documentStatistic ) | |
772 | { | |
773 | 4 | this.documentStatistic = documentStatistic; |
774 | 4 | } //-- void setDocumentStatistic( DocumentStatistic ) |
775 | ||
776 | /** | |
777 | * Set whether the content of the document is in some sense | |
778 | * preliminary. | |
779 | * | |
780 | * @param draft | |
781 | */ | |
782 | public void setDraft( boolean draft ) | |
783 | { | |
784 | 4 | this.draft = draft; |
785 | 4 | } //-- void setDraft( boolean ) |
786 | ||
787 | /** | |
788 | * Set the number of editing cycles the document has been | |
789 | * through. | |
790 | * | |
791 | * @param editingCycles | |
792 | */ | |
793 | public void setEditingCycles( long editingCycles ) | |
794 | { | |
795 | 4 | this.editingCycles = editingCycles; |
796 | 4 | } //-- void setEditingCycles( long ) |
797 | ||
798 | /** | |
799 | * Set the total time spent editing the document. | |
800 | * | |
801 | * @param editingDuration | |
802 | */ | |
803 | public void setEditingDuration( long editingDuration ) | |
804 | { | |
805 | 4 | this.editingDuration = editingDuration; |
806 | 4 | } //-- void setEditingDuration( long ) |
807 | ||
808 | /** | |
809 | * Set a string that identifies the application or tool that | |
810 | * was | |
811 | * used to create or last modify the document. | |
812 | * | |
813 | * @param generator | |
814 | */ | |
815 | public void setGenerator( String generator ) | |
816 | { | |
817 | 4 | this.generator = generator; |
818 | 4 | } //-- void setGenerator( String ) |
819 | ||
820 | /** | |
821 | * Set the hyperlink-behaviour element specifies the default | |
822 | * behavior | |
823 | * for hyperlinks in the document. | |
824 | * | |
825 | * @param hyperlinkBehaviour | |
826 | */ | |
827 | public void setHyperlinkBehaviour( DocumentHyperlinkBehaviour hyperlinkBehaviour ) | |
828 | { | |
829 | 4 | this.hyperlinkBehaviour = hyperlinkBehaviour; |
830 | 4 | } //-- void setHyperlinkBehaviour( DocumentHyperlinkBehaviour ) |
831 | ||
832 | /** | |
833 | * Set the name of the person who created the document | |
834 | * initially. | |
835 | * | |
836 | * @param initialCreator | |
837 | */ | |
838 | public void setInitialCreator( String initialCreator ) | |
839 | { | |
840 | 4 | this.initialCreator = initialCreator; |
841 | 4 | } //-- void setInitialCreator( String ) |
842 | ||
843 | /** | |
844 | * Set a keyword pertaining to the document. The metadata can | |
845 | * contain any | |
846 | * number of keyword elements, each element | |
847 | * specifying one keyword. | |
848 | * | |
849 | * @param keyWords | |
850 | */ | |
851 | public void setKeyWords( java.util.List<String> keyWords ) | |
852 | { | |
853 | 2 | this.keyWords = keyWords; |
854 | 2 | } //-- void setKeyWords( java.util.List ) |
855 | ||
856 | /** | |
857 | * Set the keywords for the document, usually as a String of | |
858 | * comma separated keywords. | |
859 | * @deprecated use the <keyWords/> tag | |
860 | * instead of. | |
861 | * | |
862 | * @param keywords | |
863 | */ | |
864 | public void setKeywords( String keywords ) | |
865 | { | |
866 | 0 | this.keywords = keywords; |
867 | 0 | } //-- void setKeywords( String ) |
868 | ||
869 | /** | |
870 | * Set the default language of the document. The language is | |
871 | * represented by | |
872 | * a two or three letter Language Code taken from | |
873 | * the ISO 639 standard, | |
874 | * optionally followed by a hyphen (-) and a | |
875 | * two-letter Country Code | |
876 | * taken from the ISO 3166 standard. | |
877 | * | |
878 | * @param language | |
879 | */ | |
880 | public void setLanguage( String language ) | |
881 | { | |
882 | 4 | this.language = language; |
883 | 4 | } //-- void setLanguage( String ) |
884 | ||
885 | /** | |
886 | * Set the date as String (recommended format is ISO 8601) when | |
887 | * the document was last modified. | |
888 | * Only used if <code>date</code> is not set. | |
889 | * @since 1.1.1. | |
890 | * | |
891 | * @param modifydate | |
892 | */ | |
893 | public void setModifydate( String modifydate ) | |
894 | { | |
895 | 2 | this.modifydate = modifydate; |
896 | 2 | } //-- void setModifydate( String ) |
897 | ||
898 | /** | |
899 | * Set the pagesize of the document. | |
900 | * At least "US", "USLetter" and "A4" should be | |
901 | * supported. | |
902 | * | |
903 | * @param pageSize | |
904 | */ | |
905 | public void setPageSize( String pageSize ) | |
906 | { | |
907 | 4 | this.pageSize = pageSize; |
908 | 4 | } //-- void setPageSize( String ) |
909 | ||
910 | /** | |
911 | * Set the date and time when the document was last printed. | |
912 | * Use the ISO 8601 format | |
913 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
914 | * | |
915 | * @param printDate | |
916 | */ | |
917 | public void setPrintDate( java.util.Date printDate ) | |
918 | { | |
919 | 4 | this.printDate = printDate; |
920 | 4 | } //-- void setPrintDate( java.util.Date ) |
921 | ||
922 | /** | |
923 | * Set the date as String (recommended format is ISO 8601) when | |
924 | * the document was last printed. | |
925 | * Only used if <code>printDate</code> is not set. | |
926 | * @since 1.1.1. | |
927 | * | |
928 | * @param printdate | |
929 | */ | |
930 | public void setPrintdate( String printdate ) | |
931 | { | |
932 | 2 | this.printdate = printdate; |
933 | 2 | } //-- void setPrintdate( String ) |
934 | ||
935 | /** | |
936 | * Set the name of the person who last printed the document. | |
937 | * | |
938 | * @param printedBy | |
939 | */ | |
940 | public void setPrintedBy( String printedBy ) | |
941 | { | |
942 | 4 | this.printedBy = printedBy; |
943 | 4 | } //-- void setPrintedBy( String ) |
944 | ||
945 | /** | |
946 | * Set the subject of the document. | |
947 | * | |
948 | * @param subject | |
949 | */ | |
950 | public void setSubject( String subject ) | |
951 | { | |
952 | 4 | this.subject = subject; |
953 | 4 | } //-- void setSubject( String ) |
954 | ||
955 | /** | |
956 | * Set a template that was used to create the document. | |
957 | * | |
958 | * @param template | |
959 | */ | |
960 | public void setTemplate( DocumentTemplate template ) | |
961 | { | |
962 | 4 | this.template = template; |
963 | 4 | } //-- void setTemplate( DocumentTemplate ) |
964 | ||
965 | /** | |
966 | * Set the title of the document. | |
967 | * | |
968 | * @param title | |
969 | */ | |
970 | public void setTitle( String title ) | |
971 | { | |
972 | 4 | this.title = title; |
973 | 4 | } //-- void setTitle( String ) |
974 | ||
975 | /** | |
976 | * Method toString. | |
977 | * | |
978 | * @return String | |
979 | */ | |
980 | public java.lang.String toString() | |
981 | { | |
982 | 4 | StringBuilder buf = new StringBuilder( 128 ); |
983 | ||
984 | 4 | buf.append( "title = '" ); |
985 | 4 | buf.append( getTitle() ); |
986 | 4 | buf.append( "'" ); |
987 | 4 | buf.append( "\n" ); |
988 | 4 | buf.append( "author = '" ); |
989 | 4 | buf.append( getAuthor() ); |
990 | 4 | buf.append( "'" ); |
991 | 4 | buf.append( "\n" ); |
992 | 4 | buf.append( "authors = '" ); |
993 | 4 | buf.append( getAuthors() ); |
994 | 4 | buf.append( "'" ); |
995 | 4 | buf.append( "\n" ); |
996 | 4 | buf.append( "subject = '" ); |
997 | 4 | buf.append( getSubject() ); |
998 | 4 | buf.append( "'" ); |
999 | 4 | buf.append( "\n" ); |
1000 | 4 | buf.append( "keywords = '" ); |
1001 | 4 | buf.append( getKeywords() ); |
1002 | 4 | buf.append( "'" ); |
1003 | 4 | buf.append( "\n" ); |
1004 | 4 | buf.append( "keyWords = '" ); |
1005 | 4 | buf.append( getKeyWords() ); |
1006 | 4 | buf.append( "'" ); |
1007 | 4 | buf.append( "\n" ); |
1008 | 4 | buf.append( "pageSize = '" ); |
1009 | 4 | buf.append( getPageSize() ); |
1010 | 4 | buf.append( "'" ); |
1011 | 4 | buf.append( "\n" ); |
1012 | 4 | buf.append( "generator = '" ); |
1013 | 4 | buf.append( getGenerator() ); |
1014 | 4 | buf.append( "'" ); |
1015 | 4 | buf.append( "\n" ); |
1016 | 4 | buf.append( "description = '" ); |
1017 | 4 | buf.append( getDescription() ); |
1018 | 4 | buf.append( "'" ); |
1019 | 4 | buf.append( "\n" ); |
1020 | 4 | buf.append( "initialCreator = '" ); |
1021 | 4 | buf.append( getInitialCreator() ); |
1022 | 4 | buf.append( "'" ); |
1023 | 4 | buf.append( "\n" ); |
1024 | 4 | buf.append( "creator = '" ); |
1025 | 4 | buf.append( getCreator() ); |
1026 | 4 | buf.append( "'" ); |
1027 | 4 | buf.append( "\n" ); |
1028 | 4 | buf.append( "printedBy = '" ); |
1029 | 4 | buf.append( getPrintedBy() ); |
1030 | 4 | buf.append( "'" ); |
1031 | 4 | buf.append( "\n" ); |
1032 | 4 | buf.append( "creationDate = '" ); |
1033 | 4 | buf.append( getCreationDate() ); |
1034 | 4 | buf.append( "'" ); |
1035 | 4 | buf.append( "\n" ); |
1036 | 4 | buf.append( "creationdate = '" ); |
1037 | 4 | buf.append( getCreationdate() ); |
1038 | 4 | buf.append( "'" ); |
1039 | 4 | buf.append( "\n" ); |
1040 | 4 | buf.append( "date = '" ); |
1041 | 4 | buf.append( getDate() ); |
1042 | 4 | buf.append( "'" ); |
1043 | 4 | buf.append( "\n" ); |
1044 | 4 | buf.append( "modifydate = '" ); |
1045 | 4 | buf.append( getModifydate() ); |
1046 | 4 | buf.append( "'" ); |
1047 | 4 | buf.append( "\n" ); |
1048 | 4 | buf.append( "printDate = '" ); |
1049 | 4 | buf.append( getPrintDate() ); |
1050 | 4 | buf.append( "'" ); |
1051 | 4 | buf.append( "\n" ); |
1052 | 4 | buf.append( "printdate = '" ); |
1053 | 4 | buf.append( getPrintdate() ); |
1054 | 4 | buf.append( "'" ); |
1055 | 4 | buf.append( "\n" ); |
1056 | 4 | buf.append( "template = '" ); |
1057 | 4 | buf.append( getTemplate() ); |
1058 | 4 | buf.append( "'" ); |
1059 | 4 | buf.append( "\n" ); |
1060 | 4 | buf.append( "hyperlinkBehaviour = '" ); |
1061 | 4 | buf.append( getHyperlinkBehaviour() ); |
1062 | 4 | buf.append( "'" ); |
1063 | 4 | buf.append( "\n" ); |
1064 | 4 | buf.append( "language = '" ); |
1065 | 4 | buf.append( getLanguage() ); |
1066 | 4 | buf.append( "'" ); |
1067 | 4 | buf.append( "\n" ); |
1068 | 4 | buf.append( "editingCycles = '" ); |
1069 | 4 | buf.append( getEditingCycles() ); |
1070 | 4 | buf.append( "'" ); |
1071 | 4 | buf.append( "\n" ); |
1072 | 4 | buf.append( "editingDuration = '" ); |
1073 | 4 | buf.append( getEditingDuration() ); |
1074 | 4 | buf.append( "'" ); |
1075 | 4 | buf.append( "\n" ); |
1076 | 4 | buf.append( "documentStatistic = '" ); |
1077 | 4 | buf.append( getDocumentStatistic() ); |
1078 | 4 | buf.append( "'" ); |
1079 | 4 | buf.append( "\n" ); |
1080 | 4 | buf.append( "confidential = '" ); |
1081 | 4 | buf.append( isConfidential() ); |
1082 | 4 | buf.append( "'" ); |
1083 | 4 | buf.append( "\n" ); |
1084 | 4 | buf.append( "draft = '" ); |
1085 | 4 | buf.append( isDraft() ); |
1086 | 4 | buf.append( "'" ); |
1087 | ||
1088 | 4 | return buf.toString(); |
1089 | } //-- java.lang.String toString() | |
1090 | ||
1091 | ||
1092 | ||
1093 | /** | |
1094 | * @return a comma separated String of all defined keyWords. | |
1095 | * @see #getKeywords() | |
1096 | * @see #getKeyWords() | |
1097 | * @since 1.1.1 | |
1098 | */ | |
1099 | public String getAllKeyWords() | |
1100 | { | |
1101 | 4 | StringBuffer sb = new StringBuffer(); |
1102 | 4 | boolean hasKeywords = false; |
1103 | 4 | if ( getKeywords() != null && getKeywords().trim().length() > 0 ) |
1104 | { | |
1105 | 0 | java.util.StringTokenizer st = new java.util.StringTokenizer( getKeywords().trim(), "," ); |
1106 | 0 | while ( st.hasMoreTokens() ) |
1107 | { | |
1108 | 0 | String s = st.nextToken(); |
1109 | ||
1110 | 0 | sb.append( s.trim() ); |
1111 | ||
1112 | 0 | if ( st.hasMoreTokens() ) |
1113 | { | |
1114 | 0 | sb.append( ", " ); |
1115 | } | |
1116 | ||
1117 | 0 | hasKeywords = true; |
1118 | 0 | } |
1119 | } | |
1120 | 4 | if ( getKeyWords() != null ) |
1121 | { | |
1122 | 4 | for ( java.util.Iterator it = getKeyWords().iterator(); it.hasNext(); ) |
1123 | { | |
1124 | 8 | String keyword = (String) it.next(); |
1125 | ||
1126 | 8 | if ( hasKeywords ) |
1127 | { | |
1128 | 0 | sb.append( ", " ); |
1129 | 0 | hasKeywords = false; |
1130 | } | |
1131 | ||
1132 | 8 | if ( keyword.trim().length() > 0 ) |
1133 | { | |
1134 | 8 | sb.append( keyword.trim() ); |
1135 | ||
1136 | 8 | if ( it.hasNext() ) |
1137 | { | |
1138 | 4 | sb.append( ", " ); |
1139 | } | |
1140 | } | |
1141 | 8 | } |
1142 | } | |
1143 | ||
1144 | 4 | String ret = sb.toString().trim(); |
1145 | 4 | if ( ret.endsWith( "," ) ) |
1146 | { | |
1147 | 0 | return ret.substring( 0, ret.length() - 1 ); |
1148 | } | |
1149 | ||
1150 | 4 | return ret; |
1151 | } | |
1152 | ||
1153 | /** | |
1154 | * @return {@link #getAuthor()} if the unique author name is defined. Otherwise, return all authors full names | |
1155 | * comma separated. | |
1156 | * @see #getAuthor() | |
1157 | * @see #getAuthors() | |
1158 | * @since 1.1.1 | |
1159 | */ | |
1160 | public String getAllAuthorNames() | |
1161 | { | |
1162 | 0 | StringBuffer sb = new StringBuffer(); |
1163 | 0 | if ( getAuthor() != null && getAuthor().trim().length() > 0 ) |
1164 | { | |
1165 | 0 | return getAuthor().trim(); |
1166 | } | |
1167 | ||
1168 | 0 | if ( getAuthors() != null ) |
1169 | { | |
1170 | 0 | for ( java.util.Iterator it = getAuthors().iterator(); it.hasNext(); ) |
1171 | { | |
1172 | 0 | DocumentAuthor author = (DocumentAuthor) it.next(); |
1173 | ||
1174 | 0 | sb.append( author.getFullName().trim() ); |
1175 | ||
1176 | 0 | if ( it.hasNext() ) |
1177 | { | |
1178 | 0 | sb.append( ", " ); |
1179 | } | |
1180 | 0 | } |
1181 | } | |
1182 | ||
1183 | 0 | return sb.toString(); |
1184 | } | |
1185 | ||
1186 | /** ISO 8601 date format, i.e. <code>yyyy-MM-dd</code> **/ | |
1187 | 2 | private static final java.text.DateFormat ISO_8601_FORMAT = new java.text.SimpleDateFormat( "yyyy-MM-dd", java.util.Locale.ENGLISH ); |
1188 | ||
1189 | /** | |
1190 | * Get the date and time when the document was created initially. | |
1191 | * | |
1192 | * @return the <code>getCreationDate()</code> if setted, formatted using ISO-8601 English format, otherwise return | |
1193 | * the <code>creationdate</code>. | |
1194 | * @since 1.1.1 | |
1195 | * @see #getCreationDate() | |
1196 | */ | |
1197 | public String getCreationdate() | |
1198 | { | |
1199 | 14 | if ( getCreationDate() != null ) |
1200 | { | |
1201 | 14 | return ISO_8601_FORMAT.format( getCreationDate() ); |
1202 | } | |
1203 | ||
1204 | 0 | return this.creationdate; |
1205 | } | |
1206 | ||
1207 | /** | |
1208 | * Get the date and time when the document was last modified. | |
1209 | * | |
1210 | * @return the <code>getDate()</code> if setted, formatted using ISO-8601 English format, otherwise return | |
1211 | * the <code>modifydate</code>. | |
1212 | * @since 1.1.1 | |
1213 | * @see #getDate() | |
1214 | */ | |
1215 | public String getModifydate() | |
1216 | { | |
1217 | 14 | if ( getDate() != null ) |
1218 | { | |
1219 | 14 | return ISO_8601_FORMAT.format( getDate() ); |
1220 | } | |
1221 | ||
1222 | 0 | return this.modifydate; |
1223 | } | |
1224 | ||
1225 | /** | |
1226 | * Get the date and time when the document was last printed. | |
1227 | * | |
1228 | * @return the <code>getPrintDate()</code> if setted, formatted using ISO-8601 English format, otherwise return | |
1229 | * the <code>printdate</code>. | |
1230 | * @since 1.1.1 | |
1231 | * @see #getPrintDate() | |
1232 | */ | |
1233 | public String getPrintdate() | |
1234 | { | |
1235 | 14 | if ( getPrintDate() != null ) |
1236 | { | |
1237 | 14 | return ISO_8601_FORMAT.format( getPrintDate() ); |
1238 | } | |
1239 | ||
1240 | 0 | return this.printdate; |
1241 | } | |
1242 | ||
1243 | ||
1244 | } |