public interface IFileValidator
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
}
}
IFileManager
Modifier and Type | Method and Description |
---|---|
void |
validate(FileConfig file)
Validate the metadata of a file.
|
void validate(FileConfig file) throws FileValidationException, PortalException
file
- The file to be validated.FileValidationException
- If the validation has failed.PortalException
- If any error occurs validating the metadata.LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.