Class DocumentsChecker


  • public class DocumentsChecker
    extends Object
    A class that validate if a document file is valid based on the file name. This class relies on the MimetypesFileTypeMap class to load a default MIME types file that maps a mime type to file extensions. Come time to check for the correct mime type, this map will be used to check for the user provided mime type against the mime type defined in the file.
    • Constructor Detail

      • DocumentsChecker

        public DocumentsChecker()
    • Method Detail

      • getPossibleFileExtensions

        public ArrayList<String> getPossibleFileExtensions​(String documentStandardId)
        Given a document standard id, returns a list of possible file extensions associated with that id.
        Parameters:
        documentStandardId - The document standard id as defined by the PDS Information Model document.
        Returns:
        extensionList List of file extensions allowed for that document standard id.
      • isMimeTypeCorrect

        public boolean isMimeTypeCorrect​(String documentRef,
                                         String documentStandardId)
        Given a document file name, check for the mime type matches in the defined default filename.
        Parameters:
        documentRef - The file name of the document
        documentStandardId - The document standard id as defined by the PDS Information Model document.
        Returns:
        true if the mime type matches with was defined, false otherwise.