Interface EventHandler<T extends Containerable>


  • public interface EventHandler<T extends Containerable>
    Set of callback methods used to convey information from the validator to the "working" code. It is used e.g. to connect validator to the code that executes import. It makes validator quite a generic tool. E.g. it can be used as the base of the import in the system and the same validator can be used in tests to check the validity of samples.
    Author:
    Radovan Semancik
    • Method Detail

      • preMarshall

        EventResult preMarshall​(Element objectElement,
                                Node postValidationTree,
                                OperationResult objectResult)
        Call-back called after deserializing to DOM and static schema validation but before unmarshal to JAXB. It can be used for extra DOM-based checks or transformations of the object.
        Parameters:
        objectElement - DOM tree parsed from file
        postValidationTree - post-validation DOM tree
        objectResult - Operation result for this object
        Returns:
        true if the process should continue, false if it should stop
      • postMarshall

        EventResult postMarshall​(T object,
                                 Element objectElement,
                                 OperationResult objectResult)
        Call-back called after the object is unmarshalled. The compliance with static schemas should already be checked. This is the "main" call-back as it is expected that this call-back will do the primary part of work such storing the object to repository during import.
        Parameters:
        object - unmarshalled JAXB object
        objectElement - DOM tree parsed from the fil
        objectResult - Operation result for this object
        Returns:
        true if the process should continue, false if it should stop
      • handleGlobalError

        default void handleGlobalError​(OperationResult currentResult)
        Call-back to handle global errors. This callback will be called with any error that cannot be attributed to any particular object.
        Parameters:
        currentResult - Operation result pointing to the particular error.