Class ParserContext
java.lang.Object
com.aquima.interactions.communication.impl.evaluator.parser.ParserContext
Parser context for parsing web services. The current implementation provides attribute validation functionality only.
Note that instances of this class are not intended to be re-used.
- Since:
- 9.3
- Author:
- A.Pragt
-
Constructor Summary
ConstructorsConstructorDescriptionParserContext
(boolean validated, boolean isRestDomainSchema, ISystemMessagesHandler messageHandler) ParserContext
(boolean validated, ISystemMessagesHandler messageHandler) ParserContext
(ISystemMessagesHandler messageHandler) -
Method Summary
Modifier and TypeMethodDescriptioncreateMessage
(String propertyName, String errorMessageKey) Creates a ParseMessage based on the value of the parameter errormessageKey.createMessage
(String propertyName, String errorMessageKey, String... parameters) Creates a ParseMessage based on the value of the parameter errormessageKey.boolean
Returns an indicator whether validation messages are present.protected void
setBodyTree
(SchemaEntity root) protected void
REST: Throws an validation exception based on the validation messages generated while parsing a REST request.protected void
REST: Throws an validation exception based on the validation messages generated while parsing a REST response.protected void
SOAP: Throws an validation exception based on the validation messages.void
validate
(SchemaArgument argument) void
validate
(SchemaAttribute attribute) void
validate
(SchemaFragment fragment) void
validate
(SchemaHeader header) void
validate
(SchemaRelation relation) void
validate
(String attribute, IFieldValidationDefinition[] validations, InstanceContext ctx) Validates an attribute with use of the specified field validations.
-
Constructor Details
-
ParserContext
-
ParserContext
-
ParserContext
public ParserContext(boolean validated, boolean isRestDomainSchema, ISystemMessagesHandler messageHandler)
-
-
Method Details
-
hasMessages
public boolean hasMessages()Returns an indicator whether validation messages are present.- Returns:
- Message indicator.
-
validate
public void validate(String attribute, IFieldValidationDefinition[] validations, InstanceContext ctx) Validates an attribute with use of the specified field validations.- Parameters:
attribute
- The attribute to validate, not null, not empty.validations
- The validations to use, not null.ctx
- The instance context to use, not null.
-
validate
-
validate
-
validate
-
validate
-
validate
-
createMessage
Creates a ParseMessage based on the value of the parameter errormessageKey. If this message is not defined, this method uses the key-value as the actual errormessage.- Parameters:
propertyName
- the property name to create the message forerrorMessageKey
- The key of the error message- Returns:
- ParseMessage A ParseMessage
-
createMessage
public ParseMessage createMessage(String propertyName, String errorMessageKey, String... parameters) Creates a ParseMessage based on the value of the parameter errormessageKey. If this message is not defined, this method uses the key-value as the actual errormessage.- Parameters:
propertyName
- the property name to create the message forerrorMessageKey
- The key of the error messageparameters
- The parameters to add to the error message's placeholders- Returns:
- ParseMessage A ParseMessage
-
setBodyTree
-
throwRestRequestException
protected void throwRestRequestException() throws FieldValidationException, StructuredFieldValidationExceptionREST: Throws an validation exception based on the validation messages generated while parsing a REST request. This method does not throw an exception when no validation messages are present (when the validate method has not been executed, or when no validation messages were registered during the validation).- Throws:
FieldValidationException
- when there are validation messages and basic validation is usedStructuredFieldValidationException
- when there are validation messages and structured validation is used
-
throwRestResponseException
REST: Throws an validation exception based on the validation messages generated while parsing a REST response. This method does not throw an exception when no validation messages are present (when the validate method has not been executed, or when no validation messages were registered during the validation).- Throws:
ContractParseException
- when there are validation messages and isLegacyRestResponseValidation toggle is onFieldValidationException
- when there are validation messages otherwise
-
throwSoapException
SOAP: Throws an validation exception based on the validation messages. This method does not throw an exception when no validation messages are present (when the validate method has not been executed, or when no validation messages were registered during the validation).- Throws:
FieldValidationException
- when there are validation messages
-