Package org.motechproject.mots.utils
Class ReportingValidationHelper
- java.lang.Object
-
- org.motechproject.mots.utils.ReportingValidationHelper
-
public final class ReportingValidationHelper extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ReportingValidationHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
throwIfFileIsEmpty(org.springframework.web.multipart.MultipartFile file)
ThrowsReportingException
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.
-
-
-
Method Detail
-
throwIfFileIsEmpty
public static void throwIfFileIsEmpty(org.springframework.web.multipart.MultipartFile file)
ThrowsReportingException
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 checkallowedFileTypes
- 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
-
-