Class SupportedRelativeDateTimeConstantsValidator
java.lang.Object
io.jmix.aitools.dataload.validation.validator.SupportedRelativeDateTimeConstantsValidator
- All Implemented Interfaces:
JpqlResultValidator,org.springframework.core.Ordered
@Component("aitls_SupportedRelativeDateTimeConstantsValidator")
public class SupportedRelativeDateTimeConstantsValidator
extends Object
implements JpqlResultValidator, org.springframework.core.Ordered
Checks that only supported Jmix relative date-time constants (such as
FIRST_DAY_OF_CURRENT_MONTH)
are used, ignoring string literals and standard JPQL temporal keywords.-
Field Summary
FieldsFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetOrder()protected booleanisRelativeDateTimeConstantUsage(String jpql, int start, int end) protected intnextNonWhitespaceIndex(String text, int fromIndex) protected intpreviousNonWhitespaceIndex(String text, int fromIndex) protected StringpreviousWord(String text, int tokenStart) validate(GeneratedJpqlResult result) Validates the given query draft.
-
Field Details
-
RELATIVE_DATE_TIME_CONSTANT_PATTERN
-
SUPPORTED_RELATIVE_DATE_TIME_CONSTANTS
-
JPQL_TEMPORAL_KEYWORDS
-
NON_OPERATION_KEYWORDS
-
OPERATION_KEYWORDS
-
-
Constructor Details
-
SupportedRelativeDateTimeConstantsValidator
public SupportedRelativeDateTimeConstantsValidator()
-
-
Method Details
-
validate
Description copied from interface:JpqlResultValidatorValidates the given query draft.- Specified by:
validatein interfaceJpqlResultValidator- Parameters:
result- generated query draft to validate- Returns:
- issues found, or an empty list if the rule passed
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
isRelativeDateTimeConstantUsage
-
previousNonWhitespaceIndex
-
nextNonWhitespaceIndex
-
previousWord
-