Class ValidationHandler

java.lang.Object
eu.europa.ec.taxud.handler.AbstractHandler
eu.europa.ec.taxud.validation.ValidationHandler

public abstract class ValidationHandler extends AbstractHandler
ValidationHandler is dedicated validation handler for content type. A handler specifies how to validate a message type it can handle.
  • Constructor Details

    • ValidationHandler

      public ValidationHandler()
  • Method Details

    • initContext

      public boolean initContext(ValidationContext context) throws ValidationException
      Generic Init method to initialize the ValidationContext component (such as Validator, Reader).
      Overrides:
      initContext in class AbstractHandler
      Parameters:
      context - Validation context
      Returns:
      boolean Is the handler applicable for input message
      Throws:
      ValidationException - Initialisation exception
    • process

      public String process(ValidationInput input, ValidationContext context) throws ValidationException
      Process a ValidationInput with a specific ValidationContext.
      Parameters:
      input - The input message to validate
      context - The validation context
      Returns:
      the validation result
      Throws:
      ValidationException - Validation exception
    • handleErrors

      public abstract String handleErrors(ValidationContext context)
      Generic method that creates a string representation of the errors
      Parameters:
      context - the validation context containing the errors
      Returns:
      the errors as string
    • getConfig

      public Properties getConfig()
      Return the configuration.
      Returns:
      Properties The handler configuration.
    • initInput

      public abstract ValidationInput initInput(String[] args)
      Creates a ValidationInput according to the arguments provided (i.e. filename of the xml to be validated)
      Parameters:
      args - the arguments provided by the user
      Returns:
      the validation input
    • initContext

      public boolean initContext(ValidationContext context, ValidationRequest validationRequest)
      Initialise ValidationContext based on ValidationRequest of the EVM interfaces. Initialises the context for this validator according the provided arguments.
      Parameters:
      context - The validation context
      validationRequest - the request
      Returns:
      true if the context is initialized
    • additionalAttributesProcess

      protected void additionalAttributesProcess(ValidationContext context, ValidationRequest validationRequest)
      Process the information contains in Additional Attributes of the request.
      Parameters:
      context - the context
      validationRequest - the request
    • getAvailableBusinessRules

      public List<String> getAvailableBusinessRules(ValidationContext context)
      Gets available business rules.
      Parameters:
      context - the context
      Returns:
      the available business rules