1 /* 2 * Copyright 2010-2013 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package de.smartics.testdoc.report.export.doc; 17 18 /** 19 * The configuration that tells which report information is to be displayed. 20 * 21 * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a> 22 * @version $Revision:591 $ 23 */ 24 public final class InformationFilter // NOPMD 25 { 26 // ********************************* Fields ********************************* 27 28 // --- constants ------------------------------------------------------------ 29 30 /** 31 * A convenience instance with the default configuration. 32 */ 33 public static final InformationFilter SHOW_DEFAULTS = new InformationFilter( 34 new Builder()); 35 36 // --- members -------------------------------------------------------------- 37 38 /** 39 * The flag that tells whether (<code>true</code>) or not (<code>false</code>) 40 * the index over all indices should be shown. 41 */ 42 private final boolean showIndexOfIndices; 43 44 /** 45 * The flag that tells whether (<code>true</code>) or not (<code>false</code>) 46 * the number column should be shown when enumerating the test cases. 47 */ 48 private final boolean showNumbering; 49 50 /** 51 * The flag that tells whether (<code>true</code>) or not (<code>false</code>) 52 * the test status column should be shown when enumerating the test cases. 53 */ 54 private final boolean showTestStatus; 55 56 /** 57 * The flag that tells whether (<code>true</code>) or not (<code>false</code>) 58 * the categories should be shown when enumerating the test cases. 59 */ 60 private final boolean showCategories; 61 62 /** 63 * The flag that tells whether (<code>true</code>) or not (<code>false</code>) 64 * the test case name should be shown. 65 */ 66 private final boolean showTestCase; 67 68 // ****************************** Initializer ******************************* 69 70 // ****************************** Constructors ****************************** 71 72 /** 73 * Builder pattern. 74 * 75 * @param builder the builder to construct instances of 76 * {@link InformationFilter}. 77 */ 78 private InformationFilter(final Builder builder) 79 { 80 this.showIndexOfIndices = builder.showIndexOfIndices; 81 this.showNumbering = builder.showNumbering; 82 this.showTestStatus = builder.showTestStatus; 83 this.showCategories = builder.showCategories; 84 this.showTestCase = builder.showTestCase; 85 } 86 87 // ****************************** Inner Classes ***************************** 88 89 /** 90 * The builder to construct instances of {@link InformationFilter}. 91 */ 92 public static final class Builder 93 { 94 // ******************************** Fields ******************************** 95 96 // --- constants ---------------------------------------------------------- 97 98 // --- members ------------------------------------------------------------ 99 100 /** 101 * The flag that tells whether (<code>true</code>) or not ( 102 * <code>false</code>) the index over all indices should be shown. 103 */ 104 private boolean showIndexOfIndices = true; 105 106 /** 107 * The flag that tells whether (<code>true</code>) or not ( 108 * <code>false</code>) the number column should be shown when enumerating 109 * the test cases. 110 */ 111 private boolean showNumbering = true; 112 113 /** 114 * The flag that tells whether (<code>true</code>) or not ( 115 * <code>false</code>) the test status column should be shown when 116 * enumerating the test cases. 117 */ 118 private boolean showTestStatus; 119 120 /** 121 * The flag that tells whether (<code>true</code>) or not ( 122 * <code>false</code>) the categories should be shown when enumerating the 123 * test cases. 124 */ 125 private boolean showCategories = true; 126 127 /** 128 * The flag that tells whether (<code>true</code>) or not ( 129 * <code>false</code>) the test case name should be shown. 130 */ 131 private boolean showTestCase = true; 132 133 // ***************************** Initializer ****************************** 134 135 // ***************************** Constructors ***************************** 136 137 // ***************************** Inner Classes **************************** 138 139 // ******************************** Methods ******************************* 140 141 // --- init --------------------------------------------------------------- 142 143 // --- get&set ------------------------------------------------------------ 144 145 /** 146 * Sets the flag that tells whether (<code>true</code>) or not ( 147 * <code>false</code>) the index over all indices should be shown. 148 * 149 * @param showIndexOfIndices the flag that tells whether (<code>true</code>) 150 * or not ( <code>false</code>) the index over all indices should 151 * be shown. 152 */ 153 public void setShowIndexOfIndices(final boolean showIndexOfIndices) 154 { 155 this.showIndexOfIndices = showIndexOfIndices; 156 } 157 158 /** 159 * Sets the flag that tells whether (<code>true</code>) or not ( 160 * <code>false</code>) the number column should be shown when enumerating 161 * the test cases. 162 * 163 * @param showNumbering the flag that tells whether (<code>true</code>) or 164 * not ( <code>false</code>) the number column should be shown when 165 * enumerating the test cases. 166 */ 167 public void setShowNumbering(final boolean showNumbering) 168 { 169 this.showNumbering = showNumbering; 170 } 171 172 /** 173 * Sets the flag that tells whether (<code>true</code>) or not ( 174 * <code>false</code>) the test status column should be shown when 175 * enumerating the test cases. 176 * 177 * @param showTestStatus the flag that tells whether (<code>true</code>) or 178 * not (<code>false</code>) the test status column should be shown 179 * when enumerating the test cases. 180 */ 181 public void setShowTestStatus(final boolean showTestStatus) 182 { 183 this.showTestStatus = showTestStatus; 184 } 185 186 /** 187 * Sets the flag that tells whether (<code>true</code>) or not ( 188 * <code>false</code>) the categories should be shown when enumerating the 189 * test cases. 190 * 191 * @param showCategories the flag that tells whether (<code>true</code>) or 192 * not ( <code>false</code>) the categories should be shown when 193 * enumerating the test cases. 194 */ 195 public void setShowCategories(final boolean showCategories) 196 { 197 this.showCategories = showCategories; 198 } 199 200 /** 201 * Sets the flag that tells whether (<code>true</code>) or not ( 202 * <code>false</code>) the test case name should be shown. 203 * 204 * @param showTestCase the flag that tells whether (<code>true</code>) or 205 * not ( <code>false</code>) the test case name should be shown. 206 */ 207 public void setShowTestCase(final boolean showTestCase) 208 { 209 this.showTestCase = showTestCase; 210 } 211 212 // --- business ----------------------------------------------------------- 213 214 /** 215 * Constructs instances of {@link InformationFilter}. 216 * 217 * @return the requested instance. 218 */ 219 public InformationFilter build() 220 { 221 return new InformationFilter(this); 222 } 223 224 // --- object basics ------------------------------------------------------ 225 } 226 227 // ********************************* Methods ******************************** 228 229 // --- init ----------------------------------------------------------------- 230 231 // --- get&set -------------------------------------------------------------- 232 233 /** 234 * Returns the flag that tells whether (<code>true</code>) or not ( 235 * <code>false</code>) the index over all indices should be shown. 236 * 237 * @return the flag that tells whether (<code>true</code>) or not ( 238 * <code>false</code>) the index over all indices should be shown. 239 */ 240 public boolean isShowIndexOfIndices() 241 { 242 return showIndexOfIndices; 243 } 244 245 /** 246 * Returns the flag that tells whether (<code>true</code>) or not ( 247 * <code>false</code>) the number column should be shown when enumerating the 248 * test cases. 249 * 250 * @return the flag that tells whether (<code>true</code>) or not ( 251 * <code>false</code>) the number column should be shown when 252 * enumerating the test cases. 253 */ 254 public boolean isShowNumbering() 255 { 256 return showNumbering; 257 } 258 259 /** 260 * Returns the flag that tells whether (<code>true</code>) or not ( 261 * <code>false</code>) the test status column should be shown when enumerating 262 * the test cases. 263 * 264 * @return the flag that tells whether (<code>true</code>) or not ( 265 * <code>false</code>) the test status column should be shown when 266 * enumerating the test cases. 267 */ 268 public boolean isShowTestStatus() 269 { 270 return showTestStatus; 271 } 272 273 /** 274 * Returns the flag that tells whether (<code>true</code>) or not ( 275 * <code>false</code>) the categories should be shown when enumerating the 276 * test cases. 277 * 278 * @return the flag that tells whether (<code>true</code>) or not ( 279 * <code>false</code>) the categories should be shown when enumerating 280 * the test cases. 281 */ 282 public boolean isShowCategories() 283 { 284 return showCategories; 285 } 286 287 /** 288 * Returns the flag that tells whether (<code>true</code>) or not ( 289 * <code>false</code>) the test case name should be shown. 290 * 291 * @return the flag that tells whether (<code>true</code>) or not ( 292 * <code>false</code>) the test case name should be shown. 293 */ 294 public boolean isShowTestCase() 295 { 296 return showTestCase; 297 } 298 299 // --- business ------------------------------------------------------------- 300 301 // --- object basics -------------------------------------------------------- 302 303 }