1 | |
package org.apache.maven.plugin.trac; |
2 | |
|
3 | |
import java.text.ParseException; |
4 | |
import java.text.SimpleDateFormat; |
5 | |
import java.util.Calendar; |
6 | |
import java.util.Date; |
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
public class TracTicket |
34 | |
{ |
35 | |
private String id; |
36 | |
|
37 | |
private String link; |
38 | |
|
39 | |
private Date timeCreated; |
40 | |
|
41 | |
private Date timeChanged; |
42 | |
|
43 | |
private String type; |
44 | |
|
45 | |
private String summary; |
46 | |
|
47 | |
private String status; |
48 | |
|
49 | |
private String resolution; |
50 | |
|
51 | |
private String milestone; |
52 | |
|
53 | |
private String owner; |
54 | |
|
55 | |
private String priority; |
56 | |
|
57 | |
private String reporter; |
58 | |
|
59 | |
private String component; |
60 | |
|
61 | |
public String getComponent() |
62 | |
{ |
63 | 0 | return component; |
64 | |
} |
65 | |
|
66 | |
public void setComponent( String component ) |
67 | |
{ |
68 | 0 | this.component = component; |
69 | 0 | } |
70 | |
|
71 | |
public String getPriority() |
72 | |
{ |
73 | 0 | return priority; |
74 | |
} |
75 | |
|
76 | |
public void setPriority( String priority ) |
77 | |
{ |
78 | 0 | this.priority = priority; |
79 | 0 | } |
80 | |
|
81 | |
public String getReporter() |
82 | |
{ |
83 | 0 | return reporter; |
84 | |
} |
85 | |
|
86 | |
public void setReporter( String reporter ) |
87 | |
{ |
88 | 0 | this.reporter = reporter; |
89 | 0 | } |
90 | |
|
91 | |
public TracTicket() |
92 | 0 | { |
93 | 0 | } |
94 | |
|
95 | |
public String getId() |
96 | |
{ |
97 | 0 | return id; |
98 | |
} |
99 | |
|
100 | |
public void setId( String id ) |
101 | |
{ |
102 | 0 | this.id = id; |
103 | 0 | } |
104 | |
|
105 | |
public String getMilestone() |
106 | |
{ |
107 | 0 | return milestone; |
108 | |
} |
109 | |
|
110 | |
public void setMilestone( String milestone ) |
111 | |
{ |
112 | 0 | this.milestone = milestone; |
113 | 0 | } |
114 | |
|
115 | |
public String getOwner() |
116 | |
{ |
117 | 0 | return owner; |
118 | |
} |
119 | |
|
120 | |
public void setOwner( String owner ) |
121 | |
{ |
122 | 0 | this.owner = owner; |
123 | 0 | } |
124 | |
|
125 | |
public String getResolution() |
126 | |
{ |
127 | 0 | return resolution; |
128 | |
} |
129 | |
|
130 | |
public void setResolution( String resolution ) |
131 | |
{ |
132 | 0 | this.resolution = resolution; |
133 | 0 | } |
134 | |
|
135 | |
public String getStatus() |
136 | |
{ |
137 | 0 | return status; |
138 | |
} |
139 | |
|
140 | |
public void setStatus( String status ) |
141 | |
{ |
142 | 0 | this.status = status; |
143 | 0 | } |
144 | |
|
145 | |
public String getSummary() |
146 | |
{ |
147 | 0 | return summary; |
148 | |
} |
149 | |
|
150 | |
public void setSummary( String summary ) |
151 | |
{ |
152 | 0 | this.summary = summary; |
153 | 0 | } |
154 | |
|
155 | |
public String getType() |
156 | |
{ |
157 | 0 | return type; |
158 | |
} |
159 | |
|
160 | |
public void setType( String type ) |
161 | |
{ |
162 | 0 | this.type = type; |
163 | 0 | } |
164 | |
|
165 | |
public Date getTimeChanged() |
166 | |
{ |
167 | 0 | return timeChanged; |
168 | |
} |
169 | |
|
170 | |
public void setTimeChanged( String timeChanged ) |
171 | |
{ |
172 | 0 | this.timeChanged = parseDate( timeChanged ); |
173 | 0 | } |
174 | |
|
175 | |
public Date getTimeCreated() |
176 | |
{ |
177 | 0 | return timeCreated; |
178 | |
} |
179 | |
|
180 | |
public void setTimeCreated( String timeCreated ) |
181 | |
{ |
182 | 0 | this.timeCreated = parseDate( timeCreated ); |
183 | 0 | } |
184 | |
|
185 | |
private Date parseDate( String timeCreated ) |
186 | |
throws RuntimeException |
187 | |
{ |
188 | |
try |
189 | |
{ |
190 | 0 | long millis = Long.parseLong( timeCreated ); |
191 | 0 | Calendar cld = Calendar.getInstance(); |
192 | 0 | cld.setTimeInMillis( millis * 1000l ); |
193 | 0 | return cld.getTime(); |
194 | |
} |
195 | 0 | catch ( NumberFormatException e ) |
196 | |
{ |
197 | 0 | SimpleDateFormat format = new SimpleDateFormat( "EEE MMM dd HH:mm:ss z yyyy" ); |
198 | |
try |
199 | |
{ |
200 | 0 | return format.parse( timeCreated ); |
201 | |
} |
202 | 0 | catch ( ParseException e1 ) |
203 | |
{ |
204 | 0 | throw new RuntimeException( "Failed to parse date '" + timeCreated + "' as a date.", e1 ); |
205 | |
} |
206 | |
} |
207 | |
} |
208 | |
|
209 | |
public String getLink() |
210 | |
{ |
211 | 0 | return link; |
212 | |
} |
213 | |
|
214 | |
public void setLink( String link ) |
215 | |
{ |
216 | 0 | this.link = link; |
217 | 0 | } |
218 | |
|
219 | |
} |