public class DynamicValidationHelper extends DynamicConversionHelper
| Modifier and Type | Class and Description |
|---|---|
private static class |
DynamicValidationHelper.ValExprCacheKey
Class that keys the JAST tree generated from the validation expression.
|
private static class |
DynamicValidationHelper.WorkArea
Container of context-local data.
|
| Modifier and Type | Field and Description |
|---|---|
private static ExpiryCache<DynamicValidationHelper.ValExprCacheKey,JavaAst> |
cache
Cache for JASTs generated from validation expressions.
|
private static java.lang.String |
DYN_GEN_VAL_EXPR_CLASS
The name of the generated java class.
|
private static ContextLocal<DynamicValidationHelper.WorkArea> |
local
Context-local data.
|
private static CentralLogger |
LOG
Logger.
|
static java.lang.String |
VAL_EXPR_VAR_NAME
Name of the variable which replaces the validated field reference in the validation expression.
|
private static java.util.concurrent.atomic.AtomicLong |
valexpCounter
Counter for converted validation expressions.
|
| Constructor and Description |
|---|
DynamicValidationHelper() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
addToCache(DynamicValidationHelper.ValExprCacheKey cacheKey,
JavaAst javaAst)
Add generated JAST to the cache.
|
private static void |
displayConversionError(java.lang.Exception exc,
java.lang.String operation,
java.lang.String progressCode)
Display conversion error.
|
static void |
initializeCache()
Initializes the cache using CacheManager.
|
private static DynamicValidationHelper.WorkArea |
locate()
Locate the context-local
DynamicValidationHelper.WorkArea instance. |
static JastValidationExpr |
parseValidationExpression(QueryWrapper query,
RecordBuffer validatedBuffer,
java.lang.String validatedProperty,
java.lang.String validateExpression)
Worker for parsing a given validation expression string and returning a
JastValidationExpr instance. |
private static void |
replaceParams(ProgressAst progressAst,
java.lang.String validatedBufferName,
java.lang.String validatedField)
Replace field references in the Progress code AST:
references to the validated field are replaced with a variable which is used as a
parameter when executing validation expression;
reference to buffer's fields other than the currently validated field are replaced with
unknown values, warning is shown;
reference to fields of other buffers raise error.
|
injectVariable, injectVariable, locateBuffer, prepareDynamicTables, prepareTreeprivate static final java.util.concurrent.atomic.AtomicLong valexpCounter
public static final java.lang.String VAL_EXPR_VAR_NAME
private static final java.lang.String DYN_GEN_VAL_EXPR_CLASS
private static final CentralLogger LOG
private static final ContextLocal<DynamicValidationHelper.WorkArea> local
private static ExpiryCache<DynamicValidationHelper.ValExprCacheKey,JavaAst> cache
public static void initializeCache()
public static JastValidationExpr parseValidationExpression(QueryWrapper query, RecordBuffer validatedBuffer, java.lang.String validatedProperty, java.lang.String validateExpression)
JastValidationExpr instance.query - Query which iterates the records in the validated buffer.validatedBuffer - Validated buffer.validatedProperty - Property name of the validated field.validateExpression - Validation expression.JastValidationExpr instance representing the given validation expression.private static void replaceParams(ProgressAst progressAst, java.lang.String validatedBufferName, java.lang.String validatedField)
progressAst - Progress code AST to be modified.validatedBufferName - Fully qualified legacy name of the validated buffer.validatedField - Legacy name of the validated field.private static void addToCache(DynamicValidationHelper.ValExprCacheKey cacheKey, JavaAst javaAst)
cacheKey - Cache key.javaAst - Generate JAST.private static void displayConversionError(java.lang.Exception exc,
java.lang.String operation,
java.lang.String progressCode)
exc - Exception caused by the conversion error.operation - Name of the conversion stage at which the error occurred.progressCode - Progress code being converted.private static DynamicValidationHelper.WorkArea locate()
DynamicValidationHelper.WorkArea instance.