View Javadoc
1   /*
2    * The MIT License
3    *
4    * Copyright (c) 2006, The Codehaus
5    *
6    * Permission is hereby granted, free of charge, to any person obtaining a copy of
7    * this software and associated documentation files (the "Software"), to deal in
8    * the Software without restriction, including without limitation the rights to
9    * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10   * of the Software, and to permit persons to whom the Software is furnished to do
11   * so, subject to the following conditions:
12   *
13   * The above copyright notice and this permission notice shall be included in all
14   * copies or substantial portions of the Software.
15   *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22   * SOFTWARE.
23   */
24  
25  package org.codehaus.plexus.maven.plugin.report;
26  
27  import org.codehaus.doxia.sink.Sink;
28  import org.codehaus.plexus.util.StringUtils;
29  import org.jdom.Element;
30  
31  /**
32   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
33   * @version $Id$
34   */
35  public class Requirement
36  {
37      private String role;
38      private String roleHint;
39      private String fieldName;
40  
41      public Requirement( Element requireqment )
42      {
43          role = requireqment.getChildTextTrim( "role" );
44          roleHint = requireqment.getChildTextTrim( "roleHint" );
45          fieldName = requireqment.getChildTextTrim( "fieldName" );
46      }
47  
48      public String getRole()
49      {
50          return role;
51      }
52  
53      public String getRoleHint()
54      {
55          return roleHint;
56      }
57  
58      public String getFieldName()
59      {
60          return fieldName;
61      }
62  
63      public void print( Sink sink )
64      {
65  /*
66          sink.text( "Role: " + role ); sink.lineBreak();
67          if( StringUtils.isNotEmpty( roleHint ) )
68          {
69              sink.text( "Role hint: " + roleHint ); sink.lineBreak();
70          }
71          if( StringUtils.isNotEmpty( fieldName ) )
72          {
73              sink.text( "Field name: " + fieldName ); sink.lineBreak();
74          }
75  */
76          sink.tableRow();
77          sink.tableCell();
78          sink.text( "Role" );
79          sink.tableCell_();
80          sink.tableCell();
81          sink.monospaced();
82          sink.text( role );
83          sink.monospaced_();
84          sink.tableCell_();
85          sink.tableRow_();
86  
87          if( StringUtils.isNotEmpty( roleHint ) )
88          {
89              sink.tableRow();
90              sink.tableCell();
91              sink.text( "Hint" );
92              sink.tableCell_();
93              sink.tableCell();
94              sink.monospaced();
95              sink.text( roleHint );
96              sink.monospaced_();
97              sink.tableCell_();
98              sink.tableRow_();
99          }
100 
101         if( StringUtils.isNotEmpty( fieldName ) )
102         {
103             sink.tableRow();
104             sink.tableCell();
105             sink.text( "Field name" );
106             sink.tableCell_();
107             sink.tableCell();
108             sink.monospaced();
109             sink.text( fieldName );
110             sink.monospaced_();
111             sink.tableCell_();
112             sink.tableRow_();
113         }
114     }
115 }