Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LinkcheckFileResult |
|
| 1.7;1,7 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.1 on 2010-11-13 15:27:48, | |
4 | any modifications will be overwritten. | |
5 | ============================================================== | |
6 | */ | |
7 | ||
8 | package org.apache.maven.doxia.linkcheck.model; | |
9 | ||
10 | /** | |
11 | * | |
12 | * An class containing the results of a single check of a | |
13 | * link. | |
14 | * | |
15 | * | |
16 | * @version $Revision$ $Date$ | |
17 | */ | |
18 | 1632 | public class LinkcheckFileResult |
19 | implements java.io.Serializable | |
20 | { | |
21 | ||
22 | //--------------------------/ | |
23 | //- Class/Member Variables -/ | |
24 | //--------------------------/ | |
25 | ||
26 | /** | |
27 | * | |
28 | * The target URL. | |
29 | * | |
30 | */ | |
31 | private String target; | |
32 | ||
33 | /** | |
34 | * | |
35 | * The status. | |
36 | * | |
37 | */ | |
38 | private String status; | |
39 | ||
40 | /** | |
41 | * | |
42 | * The error message. | |
43 | * | |
44 | */ | |
45 | private String errorMessage; | |
46 | ||
47 | ||
48 | //-----------/ | |
49 | //- Methods -/ | |
50 | //-----------/ | |
51 | ||
52 | /** | |
53 | * Method equals. | |
54 | * | |
55 | * @param other | |
56 | * @return boolean | |
57 | */ | |
58 | public boolean equals( Object other ) | |
59 | { | |
60 | 0 | if ( this == other ) |
61 | { | |
62 | 0 | return true; |
63 | } | |
64 | ||
65 | 0 | if ( !( other instanceof LinkcheckFileResult ) ) |
66 | { | |
67 | 0 | return false; |
68 | } | |
69 | ||
70 | 0 | LinkcheckFileResult that = (LinkcheckFileResult) other; |
71 | 0 | boolean result = true; |
72 | ||
73 | 0 | result = result && ( getTarget() == null ? that.getTarget() == null : getTarget().equals( that.getTarget() ) ); |
74 | 0 | result = result && ( getStatus() == null ? that.getStatus() == null : getStatus().equals( that.getStatus() ) ); |
75 | 0 | result = result && ( getErrorMessage() == null ? that.getErrorMessage() == null : getErrorMessage().equals( that.getErrorMessage() ) ); |
76 | ||
77 | 0 | return result; |
78 | } //-- boolean equals( Object ) | |
79 | ||
80 | /** | |
81 | * Get the error message. | |
82 | * | |
83 | * @return String | |
84 | */ | |
85 | public String getErrorMessage() | |
86 | { | |
87 | 3264 | return this.errorMessage; |
88 | } //-- String getErrorMessage() | |
89 | ||
90 | /** | |
91 | * Get the status. | |
92 | * | |
93 | * @return String | |
94 | */ | |
95 | public String getStatus() | |
96 | { | |
97 | 3264 | return this.status; |
98 | } //-- String getStatus() | |
99 | ||
100 | /** | |
101 | * Get the target URL. | |
102 | * | |
103 | * @return String | |
104 | */ | |
105 | public String getTarget() | |
106 | { | |
107 | 3264 | return this.target; |
108 | } //-- String getTarget() | |
109 | ||
110 | /** | |
111 | * Method hashCode. | |
112 | * | |
113 | * @return int | |
114 | */ | |
115 | public int hashCode() | |
116 | { | |
117 | 0 | int result = 17; |
118 | ||
119 | 0 | result = 37 * result + ( target != null ? target.hashCode() : 0 ); |
120 | 0 | result = 37 * result + ( status != null ? status.hashCode() : 0 ); |
121 | 0 | result = 37 * result + ( errorMessage != null ? errorMessage.hashCode() : 0 ); |
122 | ||
123 | 0 | return result; |
124 | } //-- int hashCode() | |
125 | ||
126 | /** | |
127 | * Set the error message. | |
128 | * | |
129 | * @param errorMessage | |
130 | */ | |
131 | public void setErrorMessage( String errorMessage ) | |
132 | { | |
133 | 1632 | this.errorMessage = errorMessage; |
134 | 1632 | } //-- void setErrorMessage( String ) |
135 | ||
136 | /** | |
137 | * Set the status. | |
138 | * | |
139 | * @param status | |
140 | */ | |
141 | public void setStatus( String status ) | |
142 | { | |
143 | 1632 | this.status = status; |
144 | 1632 | } //-- void setStatus( String ) |
145 | ||
146 | /** | |
147 | * Set the target URL. | |
148 | * | |
149 | * @param target | |
150 | */ | |
151 | public void setTarget( String target ) | |
152 | { | |
153 | 1632 | this.target = target; |
154 | 1632 | } //-- void setTarget( String ) |
155 | ||
156 | /** | |
157 | * Method toString. | |
158 | * | |
159 | * @return String | |
160 | */ | |
161 | public java.lang.String toString() | |
162 | { | |
163 | 0 | StringBuffer buf = new StringBuffer( 128 ); |
164 | ||
165 | 0 | buf.append( "target = '" ); |
166 | 0 | buf.append( getTarget() ); |
167 | 0 | buf.append( "'" ); |
168 | 0 | buf.append( "\n" ); |
169 | 0 | buf.append( "status = '" ); |
170 | 0 | buf.append( getStatus() ); |
171 | 0 | buf.append( "'" ); |
172 | 0 | buf.append( "\n" ); |
173 | 0 | buf.append( "errorMessage = '" ); |
174 | 0 | buf.append( getErrorMessage() ); |
175 | 0 | buf.append( "'" ); |
176 | ||
177 | 0 | return buf.toString(); |
178 | } //-- java.lang.String toString() | |
179 | ||
180 | ||
181 | ||
182 | /** The vm line separator. */ | |
183 | 2 | private static final String EOL = System.getProperty( "line.separator" ); |
184 | ||
185 | /** Validation result level: error. */ | |
186 | public static final int ERROR_LEVEL = 1; | |
187 | ||
188 | /** Validation result level: warning. */ | |
189 | public static final int WARNING_LEVEL = 2; | |
190 | ||
191 | /** Validation result level: valid. */ | |
192 | public static final int VALID_LEVEL = 3; | |
193 | ||
194 | /** Validation result level: unknown. */ | |
195 | public static final int UNKNOWN_LEVEL = 4; | |
196 | ||
197 | /** Validation result: error. */ | |
198 | public static final String ERROR = "error"; | |
199 | ||
200 | /** Validation result: warning. */ | |
201 | public static final String WARNING = "warning"; | |
202 | ||
203 | /** Validation result: valid. */ | |
204 | public static final String VALID = "valid"; | |
205 | ||
206 | /** Validation result: unknown. */ | |
207 | public static final String UNKNOWN = "unknown"; | |
208 | ||
209 | /** | |
210 | * Returns the status as an integer. | |
211 | * | |
212 | * @return One of ERROR, WARNING, VALID or UNKNOWN. | |
213 | */ | |
214 | public int getStatusLevel() | |
215 | { | |
216 | 0 | int level = UNKNOWN_LEVEL; |
217 | ||
218 | 0 | if ( VALID.equals( getStatus() ) ) |
219 | { | |
220 | 0 | level = VALID_LEVEL; |
221 | } | |
222 | 0 | else if ( WARNING.equals( getStatus() ) ) |
223 | { | |
224 | 0 | level = WARNING_LEVEL; |
225 | } | |
226 | 0 | else if ( ERROR.equals( getStatus() ) ) |
227 | { | |
228 | 0 | level = ERROR_LEVEL; |
229 | } | |
230 | ||
231 | 0 | return level; |
232 | } | |
233 | ||
234 | ||
235 | } |