Class ReportingValidationHelper


  • public final class ReportingValidationHelper
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void throwIfFileIsEmpty​(org.springframework.web.multipart.MultipartFile file)
      Throws ReportingException if file is empty.
      static void throwIfFileIsNull​(org.springframework.web.multipart.MultipartFile file)
      Throws exception if file is null.
      static void throwIfIncorrectFileType​(org.springframework.web.multipart.MultipartFile file, java.lang.String[] allowedFileTypes)
      Throws exception if file has incorrect type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReportingValidationHelper

        public ReportingValidationHelper()
    • Method Detail

      • throwIfFileIsEmpty

        public static void throwIfFileIsEmpty​(org.springframework.web.multipart.MultipartFile file)
        Throws ReportingException if file is empty.
        Parameters:
        file - The file to check
      • throwIfIncorrectFileType

        public static void throwIfIncorrectFileType​(org.springframework.web.multipart.MultipartFile file,
                                                    java.lang.String[] allowedFileTypes)
        Throws exception if file has incorrect type.
        Parameters:
        file - The file to check
        allowedFileTypes - Allowed file types, e.g. png, jpg
      • throwIfFileIsNull

        public static void throwIfFileIsNull​(org.springframework.web.multipart.MultipartFile file)
        Throws exception if file is null.
        Parameters:
        file - The file to check