1 23 package com.sun.enterprise.config.serverbeans.validation; 24 25 import java.util.*; 26 import com.sun.enterprise.util.LocalStringManagerImpl; 27 28 public class Result { 29 30 public static final int PASSED = 0; 31 public static final int FAILED = 1; 32 public static final int WARNING = 2; 33 public static final int NOT_APPLICABLE = 3; 34 public static final int NOT_RUN = 4; 35 public static final int NOT_IMPLEMENTED = 5; 36 private int status = NOT_RUN; 37 private String componentName; 38 private String operationPrintName; 39 private String assertion; 40 private String testName; 41 private Vector errorDetails = new Vector(); 42 private Vector goodDetails = new Vector(); 43 private Vector warningDetails = new Vector(); 44 private Vector naDetails = new Vector(); 45 boolean debug = false; 47 48 52 public void Result(){ 53 } 54 55 56 61 public void passed(String detail){ 62 setStatus(PASSED); 63 addGoodDetails(detail); 64 } 65 66 71 public void warning(String detail){ 72 setStatus(WARNING); 73 addWarningDetails(detail); 74 } 75 76 81 public void notApplicable(String detail){ 82 setStatus(NOT_APPLICABLE); 83 addNaDetails(detail); 84 } 85 86 91 public void failed(String detail){ 92 setStatus(FAILED); 93 addErrorDetails(detail); 94 } 95 96 101 public Vector getNaDetails(){ 102 return naDetails; 103 } 104 105 110 public Vector getWarningDetails(){ 111 return warningDetails; 112 } 113 114 119 public void addNaDetails(String s){ 120 naDetails.addElement(s); 121 } 122 123 128 public Vector getGoodDetails(){ 129 return goodDetails; 130 } 131 132 137 public void addGoodDetails(String s){ 138 goodDetails.addElement(s); 139 } 140 141 146 public void addWarningDetails(String s){ 147 warningDetails.addElement(s); 148 } 149 150 155 public Vector getErrorDetails(){ 156 return errorDetails; 157 } 158 159 164 public String getErrorDetailsAsString(){ 165 String str = ""; 166 for(int i=0; i<errorDetails.size(); i++) 167 { 168 if(i>0) 169 str += "\n"; 170 str += errorDetails.get(i); 171 } 172 if(errorDetails.size()>0 && 174 operationPrintName!=null && 175 operationPrintName.length()>0) 176 { 177 str += "\n"; 178 str += StringManagerHelper.getLocalStringsManager().getLocalString( 179 "operation_reject_msg","{0} has been rejected.", 180 new Object [] {operationPrintName}); 181 182 } 183 return str; 184 } 185 186 191 public void addErrorDetails(String s){ 192 errorDetails.addElement(s); 193 } 194 195 200 public void addErrorDetails(int index, String s){ 201 errorDetails.add(index, s); 202 } 203 204 209 public int getStatus(){ 210 return status; 211 } 212 213 218 public void setStatus(int s){ 219 status = s; 220 } 221 222 227 public String getAssertion(){ 228 return assertion; 229 } 230 231 236 public void setAssertion(String s){ 237 assertion = s; 238 } 239 240 245 public String getComponentName(){ 246 return componentName; 247 } 248 249 254 public void setComponentName(String s){ 255 componentName = s; 256 } 257 258 263 public String getOperationPrintName(){ 264 return operationPrintName; 265 } 266 267 272 public void setOperationPrintName(String s){ 273 operationPrintName = s; 274 } 275 276 281 public String getTestName(){ 282 return testName; 283 } 284 285 290 public void setTestName(String s){ 291 testName = s; 292 } 293 294 } | Popular Tags |