Interface IFileValidator

  • All Known Implementing Classes:
    ExtensionFileValidator

    public interface IFileValidator
    Interface to validate a file.

    It's possible make a custom class validator for a file repository. For that, implement this interface, defining the validation behavior on the validate(FileConfig) method.

    To configure the custom validators used by file repositories, define, in the property bag of the file repository's service instance, a property named lumis.portal.file.validation.className, having as its values the custom validator class names.

    Example custom validator class:

     public class FixedSizeValidator implements IFileValidator
     {
       public void validate(FileConfig file) throws FileValidationException, PortalException
       {
         if (file.getFileSize() > 1000000)
           throw new FileValidationException("File size greater than 1000000"); // validation failed
       }
     }
     
    Since:
    6.0.0
    Version:
    $Revision: 17468 $ $Date: 2015-06-30 11:01:30 -0300 (Tue, 30 Jun 2015) $
    See Also:
    IFileManager