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 public class ITextHeader
33 {
34 private String title;
35
36 private StringBuilder authors;
37
38 private Date date;
39
40
41
42
43 public ITextHeader()
44 {
45
46 }
47
48
49
50
51
52
53 public final void setTitle( String title1 )
54 {
55 this.title = title1;
56 }
57
58
59
60
61
62
63 public String getTitle()
64 {
65 if ( this.title == null )
66 {
67 return "";
68 }
69
70 return this.title;
71 }
72
73
74
75
76
77
78 public void addAuthor( String author )
79 {
80 if ( this.authors == null )
81 {
82 this.authors = new StringBuilder();
83 }
84 else
85 {
86 this.authors.append( ", " );
87 }
88
89 this.authors.append( author );
90 }
91
92
93
94
95
96
97 public String getAuthors()
98 {
99 if ( ( this.authors == null ) || ( this.authors.length() == 0 ) )
100 {
101 return System.getProperty( "user.name" );
102 }
103
104 return this.authors.toString();
105 }
106
107
108
109
110
111
112 public void setDate( String date1 )
113 {
114 try
115 {
116 this.date = new SimpleDateFormat().parse( date1 );
117 }
118 catch ( ParseException e )
119 {
120 this.date = new Date();
121 }
122 }
123
124
125
126
127
128
129 public String getDate()
130 {
131 if ( this.date == null )
132 {
133 return new Date( System.currentTimeMillis() ).toString();
134 }
135
136 return this.date.toString();
137 }
138 }