1 23 24 package com.sun.enterprise.config.serverbeans.validation; 25 26 import java.util.Map ; 27 import java.util.HashMap ; 28 29 import com.sun.enterprise.config.ConfigBean; 30 import com.sun.enterprise.config.serverbeans.ElementProperty; 31 32 36 37 38 39 public abstract class ReportHelper { 40 41 final static String ATTR_ERROR_MSG_PREFIX = "AttrValidationError."; 42 final static String ERROR_MSG_PREFIX = "ValidationError."; 43 46 static public void reportAttributeError(ValidationContext valCtx, 47 String msgNameSuffix, String defaultMsg, Object [] values) 48 { 49 valCtx.result.failed( 50 valCtx.smh.getLocalString(ATTR_ERROR_MSG_PREFIX + msgNameSuffix, defaultMsg, values) ); 51 } 52 53 56 static public void reportValidationError(ValidationContext valCtx, 57 String msgNameSuffix, String defaultMsg, Object [] values) 58 { 59 valCtx.result.failed( 60 valCtx.smh.getLocalString(ERROR_MSG_PREFIX + msgNameSuffix, 61 defaultMsg, values) ); 62 } 63 64 static private String getAttributeNameMsgPrefix(ValidationContext valCtx) 65 { 66 if(valCtx.attrName==null) 67 return ""; 68 return valCtx.smh.getLocalString("common.AttributeErrorMsgPrefix", 69 "Attribute {0}: ", new Object [] {valCtx.attrName}); 70 } 71 } 72 | Popular Tags |