1 package org.apache.maven.doxia.module.itext;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.text.ParseException;
23 import java.text.SimpleDateFormat;
24
25 import java.util.Date;
26
27
28
29
30
31
32
33 public class ITextHeader
34 {
35 private String title;
36
37 private StringBuilder authors;
38
39 private Date date;
40
41
42
43
44 public ITextHeader()
45 {
46
47 }
48
49
50
51
52
53
54 public final void setTitle( String title1 )
55 {
56 this.title = title1;
57 }
58
59
60
61
62
63
64 public String getTitle()
65 {
66 if ( this.title == null )
67 {
68 return "";
69 }
70
71 return this.title;
72 }
73
74
75
76
77
78
79 public void addAuthor( String author )
80 {
81 if ( this.authors == null )
82 {
83 this.authors = new StringBuilder();
84 }
85 else
86 {
87 this.authors.append( ", " );
88 }
89
90 this.authors.append( author );
91 }
92
93
94
95
96
97
98 public String getAuthors()
99 {
100 if ( ( this.authors == null ) || ( this.authors.length() == 0 ) )
101 {
102 return System.getProperty( "user.name" );
103 }
104
105 return this.authors.toString();
106 }
107
108
109
110
111
112
113 public void setDate( String date1 )
114 {
115 try
116 {
117 this.date = new SimpleDateFormat().parse( date1 );
118 }
119 catch ( ParseException e )
120 {
121 this.date = new Date();
122 }
123 }
124
125
126
127
128
129
130 public String getDate()
131 {
132 if ( this.date == null )
133 {
134 return new Date( System.currentTimeMillis() ).toString();
135 }
136
137 return this.date.toString();
138 }
139 }