Interface ValidationService

All Superinterfaces:
Service

public interface ValidationService
extends Service
Use to register validation "contexts" (e.g. "ZBKS.BookUpdate" or "ZBKS.OrderCancellation"), and to invoke validation rules against those contexts.
  • Method Details

    • registerContext

      void registerContext​(ValidationContext validationContext)
      Registers a Context and associated SubContexts. End users will be allowed to create validation rules against these in the UI.
      Parameters:
      validationContext - describes the context and its SubContexts
    • registerContext

      void registerContext​(ValidationContext validationContext, java.util.List<PlatformELFunction> functions)
      Registers a Context and associated SubContexts. End users will be allowed to create validation rules against these in the UI.
      Parameters:
      validationContext - describes the context and its SubContexts
      functions - additional functions that should be made available to this ValidationContext
    • getContexts

      java.util.Map<java.lang.String,​ValidationContext> getContexts()
      Returns registered Contexts, keyed by context name
    • createValidationPackages

      java.util.List<ValidationPackage> createValidationPackages​(java.util.List<ValidationRule> rules, PlatformUserContext ctx)
      Looks up the associated ValidationRuleIf and ValidationRuleThen records for the given rules to assemble ValidationPackages which can be passed to the compile(ValidationCompilationRequest, PlatformUserContext) or validate(ValidationRequest, PlatformUserContext) methods.

      Inactive rules will be excluded from the packages returned, as will rules where "TestUser" is set and the caller doesn't match the TestUser.

      Parameters:
      rules - ValidationRules
      ctx - caller's context
      Returns:
      ValidationPackages which couple the rules with their ifs/thens
    • compile

      Compiles the rules from the given request and returns any resulting compilation failures. Does not evaluate the rules.
    • validate

      Evaluates the rules from the given request and returns any resulting validation failures.
    • createModelBindings

      java.util.Map<java.lang.String,​java.lang.Object> createModelBindings​(Model m)
      Given a Model, bind all model fields in a Map for evaluation in a Validation context.
    • createModelBindingKeyLabelKeyPairs

      java.util.List<Pair<java.lang.String,​java.lang.String>> createModelBindingKeyLabelKeyPairs​(Model m)
      Given a Model, get a list of pairs of field key to label key (useful in creating a ValidationSubContext for a Model)
    • registerContextsForValidationConfig

      void registerContextsForValidationConfig​(java.util.List<com.onenetwork.platform.data.sql.impl.IDaoRow> validationConfigRows)
      Registers validation contexts for ModelValidationConfigRow entries
      Parameters:
      validationConfigRows - validation configuration rows for which ValidationContext need to be registerd
    • applyValidatedStateToModel

      void applyValidatedStateToModel​(ValidatedModelState validatedState, Model model)
      Apply the supplied ValidatedModelState (computed fields, default values, etc...) to the supplied model.
      Parameters:
      validatedState -
      model -
    • registerPlatformELFunctions

      void registerPlatformELFunctions​(java.util.List<PlatformELFunction> functions)
      Add new global functions to the Platform Exrpression Language by registering them with this method.
      Parameters:
      function -
    • registerPlatformELFunctions

      void registerPlatformELFunctions​(java.util.List<PlatformELFunction> functions, java.lang.String context)
      Add new Platform Expression Language functions for a specific context by registering them with this method. Functions registered this way will only be available to ValidationRules using the passed context.
      Parameters:
      function -
      context -
    • getGlobalPlatformELFunctions

      java.util.List<PlatformELFunction> getGlobalPlatformELFunctions()
      Get a list of all global Platform Expression Language functions. The excludes functions registered for specific contexts and subcontexts.
    • getContextPlatformELFunctions

      java.util.Map<java.lang.String,​java.util.List<PlatformELFunction>> getContextPlatformELFunctions()
      Get a map of context-names to registered Platform Expression Language functions.
      Parameters:
      context -
    • getContextPlatformELFunctions

      java.util.List<PlatformELFunction> getContextPlatformELFunctions​(java.lang.String context)
      Get a list of Platform Expression Language functions registered for the passed context.
      Parameters:
      context -
    • unregisterPlatformELFunctions

      void unregisterPlatformELFunctions​(java.util.List<PlatformELFunction> functions)
      Remove the passed global Platform Expression Language functions from the registry.
      Parameters:
      functions -
    • unregisterPlatformELFunctions

      void unregisterPlatformELFunctions​(java.util.List<PlatformELFunction> functions, java.lang.String context)
      Remove the context-specific Platform Expression Language functions from the registry.
      Parameters:
      functions -
      context -