Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DocumentCover |
|
| 2.6333333333333333;2,633 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.4.1 on 2012-04-13 21:33:05, | |
4 | any modifications will be overwritten. | |
5 | ============================================================== | |
6 | */ | |
7 | ||
8 | package org.apache.maven.doxia.document; | |
9 | ||
10 | /** | |
11 | * Contains meta-data information for the document cover page. | |
12 | * | |
13 | * @version $Revision$ $Date$ | |
14 | */ | |
15 | @SuppressWarnings( "all" ) | |
16 | 4 | public class DocumentCover |
17 | implements java.io.Serializable | |
18 | { | |
19 | ||
20 | //--------------------------/ | |
21 | //- Class/Member Variables -/ | |
22 | //--------------------------/ | |
23 | ||
24 | /** | |
25 | * | |
26 | * The title to appear on the cover. | |
27 | * | |
28 | */ | |
29 | private String coverTitle; | |
30 | ||
31 | /** | |
32 | * | |
33 | * a sub-title to appear on the cover. | |
34 | * | |
35 | */ | |
36 | private String coverSubTitle; | |
37 | ||
38 | /** | |
39 | * | |
40 | * The version of the project that appears on the | |
41 | * cover page. | |
42 | * | |
43 | */ | |
44 | private String coverVersion; | |
45 | ||
46 | /** | |
47 | * | |
48 | * The type of the document. This might be used on | |
49 | * the cover page to | |
50 | * specify the type of information contained in the | |
51 | * document | |
52 | * (eg 'User Guide', 'Manual', etc.). | |
53 | * | |
54 | */ | |
55 | private String coverType; | |
56 | ||
57 | /** | |
58 | * | |
59 | * The date to appear on the cover. | |
60 | * Use the ISO 8601 format | |
61 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
62 | * | |
63 | */ | |
64 | private java.util.Date coverDate; | |
65 | ||
66 | /** | |
67 | * | |
68 | * The date as String (recommended format is ISO | |
69 | * 8601) to appear on the cover. | |
70 | * Only used if <code>coverDate</code> is not set. | |
71 | * @since 1.1.1 | |
72 | * . | |
73 | */ | |
74 | private String coverdate; | |
75 | ||
76 | /** | |
77 | * Field authors. | |
78 | */ | |
79 | private java.util.List<DocumentAuthor> authors; | |
80 | ||
81 | /** | |
82 | * | |
83 | * A shortcut for the unique author that appears on | |
84 | * the cover page. | |
85 | * For more authors, you could use the | |
86 | * <authors/> tag. | |
87 | * @since 1.1.1 | |
88 | * . | |
89 | */ | |
90 | private String author; | |
91 | ||
92 | /** | |
93 | * | |
94 | * The name of the project. | |
95 | * | |
96 | */ | |
97 | private String projectName; | |
98 | ||
99 | /** | |
100 | * | |
101 | * The location of an image file that represents | |
102 | * the project logo. | |
103 | * | |
104 | */ | |
105 | private String projectLogo; | |
106 | ||
107 | /** | |
108 | * | |
109 | * The name of the entity that is responsible for | |
110 | * the content of the | |
111 | * document, or a copyright holder. | |
112 | * | |
113 | */ | |
114 | private String companyName; | |
115 | ||
116 | /** | |
117 | * | |
118 | * The location of an image file that represents | |
119 | * the company logo. | |
120 | * | |
121 | */ | |
122 | private String companyLogo; | |
123 | ||
124 | ||
125 | //-----------/ | |
126 | //- Methods -/ | |
127 | //-----------/ | |
128 | ||
129 | /** | |
130 | * Method addAuthor. | |
131 | * | |
132 | * @param documentAuthor | |
133 | */ | |
134 | public void addAuthor( DocumentAuthor documentAuthor ) | |
135 | { | |
136 | 2 | getAuthors().add( documentAuthor ); |
137 | 2 | } //-- void addAuthor( DocumentAuthor ) |
138 | ||
139 | /** | |
140 | * Method equals. | |
141 | * | |
142 | * @param other | |
143 | * @return boolean | |
144 | */ | |
145 | public boolean equals( Object other ) | |
146 | { | |
147 | 2 | if ( this == other ) |
148 | { | |
149 | 0 | return true; |
150 | } | |
151 | ||
152 | 2 | if ( !( other instanceof DocumentCover ) ) |
153 | { | |
154 | 0 | return false; |
155 | } | |
156 | ||
157 | 2 | DocumentCover that = (DocumentCover) other; |
158 | 2 | boolean result = true; |
159 | ||
160 | 2 | result = result && ( getCoverTitle() == null ? that.getCoverTitle() == null : getCoverTitle().equals( that.getCoverTitle() ) ); |
161 | 2 | result = result && ( getCoverSubTitle() == null ? that.getCoverSubTitle() == null : getCoverSubTitle().equals( that.getCoverSubTitle() ) ); |
162 | 2 | result = result && ( getCoverVersion() == null ? that.getCoverVersion() == null : getCoverVersion().equals( that.getCoverVersion() ) ); |
163 | 2 | result = result && ( getCoverType() == null ? that.getCoverType() == null : getCoverType().equals( that.getCoverType() ) ); |
164 | 2 | result = result && ( getCoverDate() == null ? that.getCoverDate() == null : getCoverDate().equals( that.getCoverDate() ) ); |
165 | 2 | result = result && ( getCoverdate() == null ? that.getCoverdate() == null : getCoverdate().equals( that.getCoverdate() ) ); |
166 | 2 | result = result && ( getAuthors() == null ? that.getAuthors() == null : getAuthors().equals( that.getAuthors() ) ); |
167 | 2 | result = result && ( getAuthor() == null ? that.getAuthor() == null : getAuthor().equals( that.getAuthor() ) ); |
168 | 2 | result = result && ( getProjectName() == null ? that.getProjectName() == null : getProjectName().equals( that.getProjectName() ) ); |
169 | 2 | result = result && ( getProjectLogo() == null ? that.getProjectLogo() == null : getProjectLogo().equals( that.getProjectLogo() ) ); |
170 | 2 | result = result && ( getCompanyName() == null ? that.getCompanyName() == null : getCompanyName().equals( that.getCompanyName() ) ); |
171 | 2 | result = result && ( getCompanyLogo() == null ? that.getCompanyLogo() == null : getCompanyLogo().equals( that.getCompanyLogo() ) ); |
172 | ||
173 | 2 | return result; |
174 | } //-- boolean equals( Object ) | |
175 | ||
176 | /** | |
177 | * Get a shortcut for the unique author that appears on the | |
178 | * cover page. | |
179 | * For more authors, you could use the | |
180 | * <authors/> tag. | |
181 | * @since 1.1.1. | |
182 | * | |
183 | * @return String | |
184 | */ | |
185 | public String getAuthor() | |
186 | { | |
187 | 18 | return this.author; |
188 | } //-- String getAuthor() | |
189 | ||
190 | /** | |
191 | * Method getAuthors. | |
192 | * | |
193 | * @return List | |
194 | */ | |
195 | public java.util.List<DocumentAuthor> getAuthors() | |
196 | { | |
197 | 22 | if ( this.authors == null ) |
198 | { | |
199 | 2 | this.authors = new java.util.ArrayList<DocumentAuthor>(); |
200 | } | |
201 | ||
202 | 22 | return this.authors; |
203 | } //-- java.util.List<DocumentAuthor> getAuthors() | |
204 | ||
205 | /** | |
206 | * Get the location of an image file that represents the | |
207 | * company logo. | |
208 | * | |
209 | * @return String | |
210 | */ | |
211 | public String getCompanyLogo() | |
212 | { | |
213 | 18 | return this.companyLogo; |
214 | } //-- String getCompanyLogo() | |
215 | ||
216 | /** | |
217 | * Get the name of the entity that is responsible for the | |
218 | * content of the | |
219 | * document, or a copyright holder. | |
220 | * | |
221 | * @return String | |
222 | */ | |
223 | public String getCompanyName() | |
224 | { | |
225 | 18 | return this.companyName; |
226 | } //-- String getCompanyName() | |
227 | ||
228 | /** | |
229 | * Get the date to appear on the cover. | |
230 | * Use the ISO 8601 format | |
231 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
232 | * | |
233 | * @return Date | |
234 | */ | |
235 | public java.util.Date getCoverDate() | |
236 | { | |
237 | 54 | return this.coverDate; |
238 | } //-- java.util.Date getCoverDate() | |
239 | ||
240 | /** | |
241 | * Get a sub-title to appear on the cover. | |
242 | * | |
243 | * @return String | |
244 | */ | |
245 | public String getCoverSubTitle() | |
246 | { | |
247 | 18 | return this.coverSubTitle; |
248 | } //-- String getCoverSubTitle() | |
249 | ||
250 | /** | |
251 | * Get the title to appear on the cover. | |
252 | * | |
253 | * @return String | |
254 | */ | |
255 | public String getCoverTitle() | |
256 | { | |
257 | 18 | return this.coverTitle; |
258 | } //-- String getCoverTitle() | |
259 | ||
260 | /** | |
261 | * Get the type of the document. This might be used on the | |
262 | * cover page to | |
263 | * specify the type of information contained in the | |
264 | * document | |
265 | * (eg 'User Guide', 'Manual', etc.). | |
266 | * | |
267 | * @return String | |
268 | */ | |
269 | public String getCoverType() | |
270 | { | |
271 | 18 | return this.coverType; |
272 | } //-- String getCoverType() | |
273 | ||
274 | /** | |
275 | * Get the version of the project that appears on the cover | |
276 | * page. | |
277 | * | |
278 | * @return String | |
279 | */ | |
280 | public String getCoverVersion() | |
281 | { | |
282 | 18 | return this.coverVersion; |
283 | } //-- String getCoverVersion() | |
284 | ||
285 | /** | |
286 | * Get the location of an image file that represents the | |
287 | * project logo. | |
288 | * | |
289 | * @return String | |
290 | */ | |
291 | public String getProjectLogo() | |
292 | { | |
293 | 18 | return this.projectLogo; |
294 | } //-- String getProjectLogo() | |
295 | ||
296 | /** | |
297 | * Get the name of the project. | |
298 | * | |
299 | * @return String | |
300 | */ | |
301 | public String getProjectName() | |
302 | { | |
303 | 18 | return this.projectName; |
304 | } //-- String getProjectName() | |
305 | ||
306 | /** | |
307 | * Method hashCode. | |
308 | * | |
309 | * @return int | |
310 | */ | |
311 | public int hashCode() | |
312 | { | |
313 | 4 | int result = 17; |
314 | ||
315 | 4 | result = 37 * result + ( coverTitle != null ? coverTitle.hashCode() : 0 ); |
316 | 4 | result = 37 * result + ( coverSubTitle != null ? coverSubTitle.hashCode() : 0 ); |
317 | 4 | result = 37 * result + ( coverVersion != null ? coverVersion.hashCode() : 0 ); |
318 | 4 | result = 37 * result + ( coverType != null ? coverType.hashCode() : 0 ); |
319 | 4 | result = 37 * result + ( coverDate != null ? coverDate.hashCode() : 0 ); |
320 | 4 | result = 37 * result + ( coverdate != null ? coverdate.hashCode() : 0 ); |
321 | 4 | result = 37 * result + ( authors != null ? authors.hashCode() : 0 ); |
322 | 4 | result = 37 * result + ( author != null ? author.hashCode() : 0 ); |
323 | 4 | result = 37 * result + ( projectName != null ? projectName.hashCode() : 0 ); |
324 | 4 | result = 37 * result + ( projectLogo != null ? projectLogo.hashCode() : 0 ); |
325 | 4 | result = 37 * result + ( companyName != null ? companyName.hashCode() : 0 ); |
326 | 4 | result = 37 * result + ( companyLogo != null ? companyLogo.hashCode() : 0 ); |
327 | ||
328 | 4 | return result; |
329 | } //-- int hashCode() | |
330 | ||
331 | /** | |
332 | * Method removeAuthor. | |
333 | * | |
334 | * @param documentAuthor | |
335 | */ | |
336 | public void removeAuthor( DocumentAuthor documentAuthor ) | |
337 | { | |
338 | 0 | getAuthors().remove( documentAuthor ); |
339 | 0 | } //-- void removeAuthor( DocumentAuthor ) |
340 | ||
341 | /** | |
342 | * Set a shortcut for the unique author that appears on the | |
343 | * cover page. | |
344 | * For more authors, you could use the | |
345 | * <authors/> tag. | |
346 | * @since 1.1.1. | |
347 | * | |
348 | * @param author | |
349 | */ | |
350 | public void setAuthor( String author ) | |
351 | { | |
352 | 4 | this.author = author; |
353 | 4 | } //-- void setAuthor( String ) |
354 | ||
355 | /** | |
356 | * Set the authors that appear on the cover page. | |
357 | * Only used if author is not given. | |
358 | * | |
359 | * @param authors | |
360 | */ | |
361 | public void setAuthors( java.util.List<DocumentAuthor> authors ) | |
362 | { | |
363 | 2 | this.authors = authors; |
364 | 2 | } //-- void setAuthors( java.util.List ) |
365 | ||
366 | /** | |
367 | * Set the location of an image file that represents the | |
368 | * company logo. | |
369 | * | |
370 | * @param companyLogo | |
371 | */ | |
372 | public void setCompanyLogo( String companyLogo ) | |
373 | { | |
374 | 4 | this.companyLogo = companyLogo; |
375 | 4 | } //-- void setCompanyLogo( String ) |
376 | ||
377 | /** | |
378 | * Set the name of the entity that is responsible for the | |
379 | * content of the | |
380 | * document, or a copyright holder. | |
381 | * | |
382 | * @param companyName | |
383 | */ | |
384 | public void setCompanyName( String companyName ) | |
385 | { | |
386 | 4 | this.companyName = companyName; |
387 | 4 | } //-- void setCompanyName( String ) |
388 | ||
389 | /** | |
390 | * Set the date to appear on the cover. | |
391 | * Use the ISO 8601 format | |
392 | * "yyyy-MM-dd'T'HH:mm:ss.SSS" in xml. | |
393 | * | |
394 | * @param coverDate | |
395 | */ | |
396 | public void setCoverDate( java.util.Date coverDate ) | |
397 | { | |
398 | 4 | this.coverDate = coverDate; |
399 | 4 | } //-- void setCoverDate( java.util.Date ) |
400 | ||
401 | /** | |
402 | * Set a sub-title to appear on the cover. | |
403 | * | |
404 | * @param coverSubTitle | |
405 | */ | |
406 | public void setCoverSubTitle( String coverSubTitle ) | |
407 | { | |
408 | 4 | this.coverSubTitle = coverSubTitle; |
409 | 4 | } //-- void setCoverSubTitle( String ) |
410 | ||
411 | /** | |
412 | * Set the title to appear on the cover. | |
413 | * | |
414 | * @param coverTitle | |
415 | */ | |
416 | public void setCoverTitle( String coverTitle ) | |
417 | { | |
418 | 4 | this.coverTitle = coverTitle; |
419 | 4 | } //-- void setCoverTitle( String ) |
420 | ||
421 | /** | |
422 | * Set the type of the document. This might be used on the | |
423 | * cover page to | |
424 | * specify the type of information contained in the | |
425 | * document | |
426 | * (eg 'User Guide', 'Manual', etc.). | |
427 | * | |
428 | * @param coverType | |
429 | */ | |
430 | public void setCoverType( String coverType ) | |
431 | { | |
432 | 4 | this.coverType = coverType; |
433 | 4 | } //-- void setCoverType( String ) |
434 | ||
435 | /** | |
436 | * Set the version of the project that appears on the cover | |
437 | * page. | |
438 | * | |
439 | * @param coverVersion | |
440 | */ | |
441 | public void setCoverVersion( String coverVersion ) | |
442 | { | |
443 | 4 | this.coverVersion = coverVersion; |
444 | 4 | } //-- void setCoverVersion( String ) |
445 | ||
446 | /** | |
447 | * Set the date as String (recommended format is ISO 8601) to | |
448 | * appear on the cover. | |
449 | * Only used if <code>coverDate</code> is not set. | |
450 | * @since 1.1.1. | |
451 | * | |
452 | * @param coverdate | |
453 | */ | |
454 | public void setCoverdate( String coverdate ) | |
455 | { | |
456 | 2 | this.coverdate = coverdate; |
457 | 2 | } //-- void setCoverdate( String ) |
458 | ||
459 | /** | |
460 | * Set the location of an image file that represents the | |
461 | * project logo. | |
462 | * | |
463 | * @param projectLogo | |
464 | */ | |
465 | public void setProjectLogo( String projectLogo ) | |
466 | { | |
467 | 4 | this.projectLogo = projectLogo; |
468 | 4 | } //-- void setProjectLogo( String ) |
469 | ||
470 | /** | |
471 | * Set the name of the project. | |
472 | * | |
473 | * @param projectName | |
474 | */ | |
475 | public void setProjectName( String projectName ) | |
476 | { | |
477 | 4 | this.projectName = projectName; |
478 | 4 | } //-- void setProjectName( String ) |
479 | ||
480 | /** | |
481 | * Method toString. | |
482 | * | |
483 | * @return String | |
484 | */ | |
485 | public java.lang.String toString() | |
486 | { | |
487 | 4 | StringBuilder buf = new StringBuilder( 128 ); |
488 | ||
489 | 4 | buf.append( "coverTitle = '" ); |
490 | 4 | buf.append( getCoverTitle() ); |
491 | 4 | buf.append( "'" ); |
492 | 4 | buf.append( "\n" ); |
493 | 4 | buf.append( "coverSubTitle = '" ); |
494 | 4 | buf.append( getCoverSubTitle() ); |
495 | 4 | buf.append( "'" ); |
496 | 4 | buf.append( "\n" ); |
497 | 4 | buf.append( "coverVersion = '" ); |
498 | 4 | buf.append( getCoverVersion() ); |
499 | 4 | buf.append( "'" ); |
500 | 4 | buf.append( "\n" ); |
501 | 4 | buf.append( "coverType = '" ); |
502 | 4 | buf.append( getCoverType() ); |
503 | 4 | buf.append( "'" ); |
504 | 4 | buf.append( "\n" ); |
505 | 4 | buf.append( "coverDate = '" ); |
506 | 4 | buf.append( getCoverDate() ); |
507 | 4 | buf.append( "'" ); |
508 | 4 | buf.append( "\n" ); |
509 | 4 | buf.append( "coverdate = '" ); |
510 | 4 | buf.append( getCoverdate() ); |
511 | 4 | buf.append( "'" ); |
512 | 4 | buf.append( "\n" ); |
513 | 4 | buf.append( "authors = '" ); |
514 | 4 | buf.append( getAuthors() ); |
515 | 4 | buf.append( "'" ); |
516 | 4 | buf.append( "\n" ); |
517 | 4 | buf.append( "author = '" ); |
518 | 4 | buf.append( getAuthor() ); |
519 | 4 | buf.append( "'" ); |
520 | 4 | buf.append( "\n" ); |
521 | 4 | buf.append( "projectName = '" ); |
522 | 4 | buf.append( getProjectName() ); |
523 | 4 | buf.append( "'" ); |
524 | 4 | buf.append( "\n" ); |
525 | 4 | buf.append( "projectLogo = '" ); |
526 | 4 | buf.append( getProjectLogo() ); |
527 | 4 | buf.append( "'" ); |
528 | 4 | buf.append( "\n" ); |
529 | 4 | buf.append( "companyName = '" ); |
530 | 4 | buf.append( getCompanyName() ); |
531 | 4 | buf.append( "'" ); |
532 | 4 | buf.append( "\n" ); |
533 | 4 | buf.append( "companyLogo = '" ); |
534 | 4 | buf.append( getCompanyLogo() ); |
535 | 4 | buf.append( "'" ); |
536 | ||
537 | 4 | return buf.toString(); |
538 | } //-- java.lang.String toString() | |
539 | ||
540 | ||
541 | ||
542 | /** | |
543 | * @return {@link #getAuthor()} if the unique author name is defined. Otherwise, return all authors full names | |
544 | * comma separated. | |
545 | * @see #getAuthor() | |
546 | * @see #getAuthors() | |
547 | * @since 1.1.1 | |
548 | */ | |
549 | public String getAllAuthorNames() | |
550 | { | |
551 | 0 | StringBuffer sb = new StringBuffer(); |
552 | 0 | if ( getAuthor() != null && getAuthor().trim().length() > 0 ) |
553 | { | |
554 | 0 | return getAuthor().trim(); |
555 | } | |
556 | ||
557 | 0 | if ( getAuthors() != null ) |
558 | { | |
559 | 0 | for ( java.util.Iterator it = getAuthors().iterator(); it.hasNext(); ) |
560 | { | |
561 | 0 | DocumentAuthor author = (DocumentAuthor) it.next(); |
562 | ||
563 | 0 | sb.append( author.getFullName().trim() ); |
564 | ||
565 | 0 | if ( it.hasNext() ) |
566 | { | |
567 | 0 | sb.append( ", " ); |
568 | } | |
569 | 0 | } |
570 | } | |
571 | ||
572 | 0 | return sb.toString(); |
573 | } | |
574 | ||
575 | /** ISO 8601 date format, i.e. <code>yyyy-MM-dd</code> **/ | |
576 | 2 | private static final java.text.DateFormat ISO_8601_FORMAT = new java.text.SimpleDateFormat( "yyyy-MM-dd", java.util.Locale.ENGLISH ); |
577 | ||
578 | /** | |
579 | * Get the date to appear on the cover. | |
580 | * | |
581 | * @return the <code>getCoverDate()</code> if setted, formatted using ISO-8601 English format, otherwise return | |
582 | * the <code>coverdate</code>. | |
583 | * @since 1.1.1 | |
584 | * @see #getCoverDate() | |
585 | */ | |
586 | public String getCoverdate() | |
587 | { | |
588 | 18 | if ( getCoverDate() != null ) |
589 | { | |
590 | 18 | return ISO_8601_FORMAT.format( getCoverDate() ); |
591 | } | |
592 | ||
593 | 0 | return this.coverdate; |
594 | } | |
595 | ||
596 | ||
597 | } |