Class ValidationUtils


  • public final class ValidationUtils
    extends Object
    ValidationUtils provides validation helper methods.
    • Method Detail

      • isValidJSON

        public static boolean isValidJSON​(@NonNull
                                          @NonNull String json)
        Validates if the JSON is valid.
      • isValidJSONFile

        public static boolean isValidJSONFile​(byte[] json)
        Validates if the contents of file are valid JSON.
      • isValidOrgId

        public static boolean isValidOrgId​(String orgID)
        Validates if an orgID is valid.
      • isValidScanTimeOut

        public static boolean isValidScanTimeOut​(Integer scanTimeOut)
        Validates if scanTimeOut Config is valid.
      • isValidFailureConfig

        public static ValidationResponse isValidFailureConfig​(Boolean ignoreAssetViolation,
                                                              List<AssetViolationConfig> assetViolationConfigs)
        Validates if failureConfig is valid.

        Following are conditions for a string to be a valid failureConfig: 1. It must contain atleast one Severity. 2. It must contain each Severity at most once

        Parameters:
        ignoreAssetViolation - build step config that determines if violations should be ignored
        assetViolationConfigs - threshold configs based on severity.
      • checkPermissions

        public static void checkPermissions​(Item item)
        Ensures the executing user has the permissions to be running this step.