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