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