![]() |
filechampion4j 0.9.8.3
File validation library for Java
|
Public Member Functions | |
FileValidator (JSONObject configJsonObject) throws IllegalArgumentException | |
ValidationResponse | validateFile (String fileCategory, byte[] originalFile, String fileName, Path outputDir, String mimeString) |
ValidationResponse | validateFile (String fileCategory, Path filePath, String fileName, Path outputDir, String mimeString) |
ValidationResponse | validateFile (String fileCategory, byte[] originalFile, String fileName, String mimeString) |
ValidationResponse | validateFile (String fileCategory, byte[] originalFile, String fileName, Path outputDir) |
ValidationResponse | validateFile (String fileCategory, Path filePath, String fileName, String mimeString) |
ValidationResponse | validateFile (String fileCategory, Path filePath, String fileName, Path outputDir) |
ValidationResponse | validateFile (String fileCategory, byte[] originalFile, String fileName) |
ValidationResponse | validateFile (String fileCategory, Path filePath, String fileName) |
Private Member Functions | |
ValidationResponse | validateFileMain () |
ValidationResponse | doValidations (String originalFilenameClean) |
void | logInfo (StringBuilder message) |
void | logWarn (StringBuilder message) |
void | logSevere (StringBuilder message) |
void | logFine (StringBuilder message) |
void | loadPlugins () |
void | checkPluginsConfig () |
void | checkPluginsExist (JSONObject validationsJsonObject, String categroyKey, String extensionKey) |
void | checkMethodInputs () |
String | executeBeforePlugins (String fileCategory, String fileExtension) |
void | executeAfterPlugins () |
String | executeAfterPluginsProcess (String fileCategory, String fileExtension) |
String | executePlugin (String extensionPlugin, Map< String, StepConfig > stepConfigs, String fileExtension) |
boolean | isBlank (String str) |
Boolean | deleteTempDir (Path tempFilePath) |
String | getFileExtension (String fileName) |
Map< String, String > | calculateChecksum (byte[] fileBytes) |
String | saveFileToOutputDir (String fileCategory, String fileExtension, Path outDir, String fileName, byte[] fileBytes) |
String | setFileAttributes (Path targetFilePath, String changeOwnershipUser, String changePermissionsMode) |
Private Attributes | |
JSONObject | configJsonObject |
PluginsHelper | pluginsHelper |
Map< String, StepConfig > | stepConfigsBefore = new HashMap<>() |
Map< String, StepConfig > | stepConfigsAfter = new HashMap<>() |
Extensions | extensions |
ValidationsHelper | validationsHelper |
StringBuilder | sharedStringBuilder = new StringBuilder() |
String | sharedStepMessage = "Step: " |
String | errorResponse = "File is not valid." |
String | fileCategory |
String | fileName |
Path | filePath |
byte[] | originalFile |
String | mimeString |
Path | outDir |
String | fileExtension |
String | commonFileError = "Error reading file: " |
String | commonLogString |
int | responseMsgCountFail |
StringBuilder | sbresponseAggregationFail |
int | responseMsgCountSuccess |
StringBuilder | sbresponseAggregationSuccess |
List< String > | checksumAlgorithms = new ArrayList<>() |
Static Private Attributes | |
static final Logger | LOG = LogManager.getLogManager().getLogger("") |
static final Logger | LOGGER = Logger.getLogger(FileValidator.class.getName()) |
static final List< String > | supportedAlgorithms = Arrays.asList("MD5", "SHA-1", "SHA-256", "SHA-512") |
This class is used to validate files
Definition at line 29 of file FileValidator.java.
dev.filechampion.filechampion4j.FileValidator.FileValidator | ( | JSONObject | configJsonObject | ) | throws IllegalArgumentException |
This method is used to initiate the class with relevant json configurations
configJsonObject | (JSONObject) - The json object containing the Validations and Plugins configurations for the class. |
IllegalArgumentException | - If the configJsonObject is null or empty, or if the configJsonObject contains errors. |
Definition at line 71 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.checkPluginsConfig(), dev.filechampion.filechampion4j.FileValidator.checksumAlgorithms, dev.filechampion.filechampion4j.FileValidator.configJsonObject, dev.filechampion.filechampion4j.FileValidator.extensions, dev.filechampion.filechampion4j.FileValidator.loadPlugins(), dev.filechampion.filechampion4j.FileValidator.logWarn(), dev.filechampion.filechampion4j.FileValidator.pluginsHelper, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, dev.filechampion.filechampion4j.FileValidator.supportedAlgorithms, and dev.filechampion.filechampion4j.FileValidator.validationsHelper.
|
private |
Calculate the checksum of the file
fileBytes | (byte[]) the file bytes of the file being validated |
Definition at line 792 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.checksumAlgorithms, and dev.filechampion.filechampion4j.CalculateChecksum.getChecksum().
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations().
|
private |
This method is used to check that method inputs are as expected
IllegalArgumentException | - If any of the inputs are null, empty, or does not contain appropiate values |
IOException | - If there is an error reading the file |
Definition at line 515 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.commonFileError, dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.filePath, dev.filechampion.filechampion4j.FileValidator.isBlank(), dev.filechampion.filechampion4j.FileValidator.logWarn(), dev.filechampion.filechampion4j.FileValidator.originalFile, dev.filechampion.filechampion4j.FileValidator.outDir, and dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder.
Referenced by dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Method to check that all extensions defined in config exist in plugins configuration from Validation.json
Definition at line 480 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.checkPluginsExist(), and dev.filechampion.filechampion4j.FileValidator.configJsonObject.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator().
|
private |
Method to check that each extension defined in config exist in plugins configuration
validationsJsonObject | (JSONObject) - the validations.json object |
categroyKey | (String) - the category key |
extensionKey | (String) - the extension key |
Definition at line 500 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.logWarn(), dev.filechampion.filechampion4j.FileValidator.sharedStepMessage, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, dev.filechampion.filechampion4j.FileValidator.stepConfigsAfter, and dev.filechampion.filechampion4j.FileValidator.stepConfigsBefore.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkPluginsConfig().
|
private |
Helper method to delete the temporary directory
tempFilePath | (Path) the path to the temporary file |
Definition at line 761 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.logWarn(), and dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder.
Referenced by dev.filechampion.filechampion4j.FileValidator.executePlugin().
|
private |
Following initial validations and before plugins, this method is used to execute the validations for the file.
originalFilenameClean | (String) a string containing the cleaned file name |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 342 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.calculateChecksum(), dev.filechampion.filechampion4j.FileValidator.errorResponse, dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), dev.filechampion.filechampion4j.FileValidator.extensions, dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileExtension, dev.filechampion.filechampion4j.ValidationsHelper.getValidationResults(), dev.filechampion.filechampion4j.Extensions.getValidationValue(), dev.filechampion.filechampion4j.FileValidator.isBlank(), dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.logInfo(), dev.filechampion.filechampion4j.FileValidator.logWarn(), dev.filechampion.filechampion4j.FileValidator.mimeString, dev.filechampion.filechampion4j.FileValidator.originalFile, dev.filechampion.filechampion4j.FileValidator.outDir, dev.filechampion.filechampion4j.FileValidator.responseMsgCountFail, dev.filechampion.filechampion4j.FileValidator.responseMsgCountSuccess, dev.filechampion.filechampion4j.FileValidator.saveFileToOutputDir(), dev.filechampion.filechampion4j.FileValidator.sbresponseAggregationFail, dev.filechampion.filechampion4j.FileValidator.sbresponseAggregationSuccess, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validationsHelper.
Referenced by dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 599 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.commonLogString, dev.filechampion.filechampion4j.FileValidator.executeAfterPluginsProcess(), dev.filechampion.filechampion4j.FileValidator.extensions, dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileExtension, dev.filechampion.filechampion4j.Extensions.getValidationValue(), dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.logWarn(), dev.filechampion.filechampion4j.FileValidator.responseMsgCountFail, dev.filechampion.filechampion4j.FileValidator.responseMsgCountSuccess, dev.filechampion.filechampion4j.FileValidator.sbresponseAggregationFail, dev.filechampion.filechampion4j.FileValidator.sbresponseAggregationSuccess, and dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations().
|
private |
Execute and check results of plugins configured to run after the validations
fileCategory | (String) the file category of the file being validated |
fileExtension | (String) the file extension of the file being validated |
Definition at line 635 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.executePlugin(), dev.filechampion.filechampion4j.FileValidator.extensions, dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileExtension, dev.filechampion.filechampion4j.Extensions.getValidationValue(), dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.sharedStepMessage, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.stepConfigsAfter.
Referenced by dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins().
|
private |
Execute and check results of plugins configured to run before the validations
fileCategory | (String) the file category of the file being validated |
fileExtension | (String) the file extension of the file being validated |
Definition at line 554 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.executePlugin(), dev.filechampion.filechampion4j.FileValidator.extensions, dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileExtension, dev.filechampion.filechampion4j.Extensions.getValidationValue(), dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.sharedStepMessage, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.stepConfigsBefore.
Referenced by dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Execute a single plugin step
extensionPlugin | (String) a string containing the name of the plugin step to execute |
stepConfigs | (Map<String, StepConfig>) a map containing the configuration for the step to execute |
fileExtension | (String) the file extension of the file being validated |
Definition at line 686 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.deleteTempDir(), dev.filechampion.filechampion4j.FileValidator.fileExtension, dev.filechampion.filechampion4j.FileValidator.isBlank(), dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.logWarn(), dev.filechampion.filechampion4j.FileValidator.originalFile, dev.filechampion.filechampion4j.FileValidator.sharedStepMessage, and dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder.
Referenced by dev.filechampion.filechampion4j.FileValidator.executeAfterPluginsProcess(), and dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins().
|
private |
Parse the file extension from the file name
fileName | (String) the name of the file being validated |
Definition at line 779 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileName.
Referenced by dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
isBlank wrapper method for support of Java 8
str | (String) the string to check if empty or null |
Definition at line 752 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkMethodInputs(), dev.filechampion.filechampion4j.FileValidator.doValidations(), and dev.filechampion.filechampion4j.FileValidator.executePlugin().
|
private |
Method to load the plugins objects into maps
Definition at line 467 of file FileValidator.java.
References dev.filechampion.filechampion4j.PluginsHelper.getPluginConfigs(), dev.filechampion.filechampion4j.PluginsHelper.StepConfig.isRunAfter(), dev.filechampion.filechampion4j.PluginsHelper.StepConfig.isRunBefore(), dev.filechampion.filechampion4j.FileValidator.pluginsHelper, dev.filechampion.filechampion4j.FileValidator.stepConfigsAfter, and dev.filechampion.filechampion4j.FileValidator.stepConfigsBefore.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator().
|
private |
LOGGER.fine wrapper
message | (StringBuilder) - message to log |
Definition at line 458 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.LOGGER.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), dev.filechampion.filechampion4j.FileValidator.executeAfterPluginsProcess(), dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins(), dev.filechampion.filechampion4j.FileValidator.executePlugin(), dev.filechampion.filechampion4j.FileValidator.validateFile(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
LOGGER.info wrapper
message | (String) - message to log |
Definition at line 428 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.LOGGER.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
LOGGER.severe wrapper
message | (String) - message to log |
Definition at line 448 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.LOGGER.
Referenced by dev.filechampion.filechampion4j.FileValidator.saveFileToOutputDir(), and dev.filechampion.filechampion4j.FileValidator.setFileAttributes().
|
private |
LOGGER.warning wrapper
message | (String) - message to log |
Definition at line 438 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.LOGGER.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator(), dev.filechampion.filechampion4j.FileValidator.checkMethodInputs(), dev.filechampion.filechampion4j.FileValidator.checkPluginsExist(), dev.filechampion.filechampion4j.FileValidator.deleteTempDir(), dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), dev.filechampion.filechampion4j.FileValidator.executePlugin(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Helper method to save the file defined file attributes to the output directory and return the path to the saved file
fileCategory | (String) the file category of the file being validated |
fileExtension | (String) the file extension of the file being validated |
outDir | (Path) the path to the output directory |
fileName | (String) the name of the file being validated |
fileBytes | (byte[]) the file bytes of the file being validated |
Definition at line 816 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.extensions, dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileExtension, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.Extensions.getValidationValue(), dev.filechampion.filechampion4j.FileValidator.logSevere(), dev.filechampion.filechampion4j.FileValidator.outDir, dev.filechampion.filechampion4j.FileValidator.setFileAttributes(), and dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations().
|
private |
Helper method to set the file attributes
targetFilePath | (Path) the path to the file |
changeOwnershipUser | (String) the user to change the ownership to |
changePermissionsMode | (String) the permissions to change the file to |
Definition at line 846 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileAclHelper.changeFileAcl(), dev.filechampion.filechampion4j.FileValidator.logSevere(), and dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder.
Referenced by dev.filechampion.filechampion4j.FileValidator.saveFileToOutputDir().
ValidationResponse dev.filechampion.filechampion4j.FileValidator.validateFile | ( | String | fileCategory, |
byte[] | originalFile, | ||
String | fileName | ||
) |
This method is used to validate the file as file bytes, and return the results.
fileCategory | (String) - The category of the file to be validated. This is used to determine which validations to run. |
originalFile | (byte[]) - The file to be validated as a byte array. |
fileName | (String) - The original name of the file to be validated. |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 256 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.originalFile, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
ValidationResponse dev.filechampion.filechampion4j.FileValidator.validateFile | ( | String | fileCategory, |
byte[] | originalFile, | ||
String | fileName, | ||
Path | outputDir | ||
) |
This method is used to validate the file as file bytes, save the file to the output directory if passed validations, and return the results.
fileCategory | (String) - The category of the file to be validated. This is used to determine which validations to run. |
originalFile | (byte[]) - The file to be validated as a byte array. |
fileName | (String) - The original name of the file to be validated. |
outputDir | (Path) - The directory to save the file to if it passes validations. |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 195 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.originalFile, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
ValidationResponse dev.filechampion.filechampion4j.FileValidator.validateFile | ( | String | fileCategory, |
byte[] | originalFile, | ||
String | fileName, | ||
Path | outputDir, | ||
String | mimeString | ||
) |
This method is used to validate the file bytes with existing mime type, typically present in web related file uploads, and save the file to the output directory if passed validations.
fileCategory | (String) - The category of the file to be validated. This is used to determine which validations to run. |
originalFile | (byte[]) - The file to be validated as a byte array. |
fileName | (String) - The original name of the file to be validated. |
outputDir | (Path) - The directory to save the file to if it passes validations. |
mimeString | (String) - The mime type of the file to be validated. |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 125 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.mimeString, dev.filechampion.filechampion4j.FileValidator.originalFile, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
ValidationResponse dev.filechampion.filechampion4j.FileValidator.validateFile | ( | String | fileCategory, |
byte[] | originalFile, | ||
String | fileName, | ||
String | mimeString | ||
) |
This method is used to validate the file as file bytes, with existing mime type, typically present in web related file uploads.
fileCategory | (String) - The category of the file to be validated. This is used to determine which validations to run. |
originalFile | (byte[]) - The file to be validated as a byte array. |
fileName | (String) - The original name of the file to be validated. |
mimeString | (String) - The mime type of the file to be validated. |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 173 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.mimeString, dev.filechampion.filechampion4j.FileValidator.originalFile, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
ValidationResponse dev.filechampion.filechampion4j.FileValidator.validateFile | ( | String | fileCategory, |
Path | filePath, | ||
String | fileName | ||
) |
This method is used to validate the file in target path, and return the results.
fileCategory | (String) - The category of the file to be validated. This is used to determine which validations to run. |
filePath | (Path) - The target file path to be validated as a String. |
fileName | (String) - The original name of the file to be validated. |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 274 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.filePath, dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
ValidationResponse dev.filechampion.filechampion4j.FileValidator.validateFile | ( | String | fileCategory, |
Path | filePath, | ||
String | fileName, | ||
Path | outputDir | ||
) |
This method is used to validate the file in target path, save the file to the output directory if passed validations, and return the results.
fileCategory | (String) - The category of the file to be validated. This is used to determine which validations to run. |
filePath | (Path) - The target file path to be validated as a String. |
fileName | (String) - The original name of the file to be validated. |
outputDir | (Path) - The directory to save the file to if it passes validations. |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 237 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.filePath, dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
ValidationResponse dev.filechampion.filechampion4j.FileValidator.validateFile | ( | String | fileCategory, |
Path | filePath, | ||
String | fileName, | ||
Path | outputDir, | ||
String | mimeString | ||
) |
This method is used to validate the file path with existing mime type, typically present in web related file uploads, and save the file to the output directory if passed validations.
fileCategory | (String) - The category of the file to be validated. This is used to determine which validations to run. |
filePath | (Path) - The target file path to be validated as a String. |
fileName | (String) - The original name of the file to be validated. |
outputDir | (Path) - The directory to save the file to if it passes validations. |
mimeString | (String) - The mime type of the file to be validated. |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 150 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.filePath, dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.mimeString, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
ValidationResponse dev.filechampion.filechampion4j.FileValidator.validateFile | ( | String | fileCategory, |
Path | filePath, | ||
String | fileName, | ||
String | mimeString | ||
) |
This method is used to validate the file path with existing mime type, typically present in web related file uploads.
fileCategory | (String) - The category of the file to be validated. This is used to determine which validations to run. |
filePath | (Path) - The target file path to be validated as a String. |
fileName | (String) - The original name of the file to be validated. |
mimeString | (String) - The mime type of the file to be validated. |
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 215 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.filePath, dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.mimeString, dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder, and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
This method is the internal entry point for the file validation process.
IllegalArgumentException | - If any of the required inputs are null or empty. |
Definition at line 289 of file FileValidator.java.
References dev.filechampion.filechampion4j.FileValidator.checkMethodInputs(), dev.filechampion.filechampion4j.FileValidator.commonLogString, dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.errorResponse, dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins(), dev.filechampion.filechampion4j.FileValidator.extensions, dev.filechampion.filechampion4j.FileValidator.fileCategory, dev.filechampion.filechampion4j.FileValidator.fileExtension, dev.filechampion.filechampion4j.FileValidator.fileName, dev.filechampion.filechampion4j.FileValidator.getFileExtension(), dev.filechampion.filechampion4j.Extensions.getValidationValue(), dev.filechampion.filechampion4j.FileValidator.logFine(), dev.filechampion.filechampion4j.FileValidator.logInfo(), dev.filechampion.filechampion4j.FileValidator.logWarn(), dev.filechampion.filechampion4j.FileValidator.responseMsgCountFail, dev.filechampion.filechampion4j.FileValidator.responseMsgCountSuccess, dev.filechampion.filechampion4j.FileValidator.sbresponseAggregationFail, dev.filechampion.filechampion4j.FileValidator.sbresponseAggregationSuccess, and dev.filechampion.filechampion4j.FileValidator.sharedStringBuilder.
Referenced by dev.filechampion.filechampion4j.FileValidator.validateFile().
|
private |
Definition at line 63 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator(), and dev.filechampion.filechampion4j.FileValidator.calculateChecksum().
|
private |
Definition at line 57 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkMethodInputs().
|
private |
Definition at line 58 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 41 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator(), and dev.filechampion.filechampion4j.FileValidator.checkPluginsConfig().
|
private |
Definition at line 49 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 45 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator(), dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), dev.filechampion.filechampion4j.FileValidator.executeAfterPluginsProcess(), dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins(), dev.filechampion.filechampion4j.FileValidator.saveFileToOutputDir(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 50 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkMethodInputs(), dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), dev.filechampion.filechampion4j.FileValidator.executeAfterPluginsProcess(), dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins(), dev.filechampion.filechampion4j.FileValidator.saveFileToOutputDir(), dev.filechampion.filechampion4j.FileValidator.validateFile(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 56 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), dev.filechampion.filechampion4j.FileValidator.executeAfterPluginsProcess(), dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins(), dev.filechampion.filechampion4j.FileValidator.executePlugin(), dev.filechampion.filechampion4j.FileValidator.saveFileToOutputDir(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 51 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkMethodInputs(), dev.filechampion.filechampion4j.FileValidator.getFileExtension(), dev.filechampion.filechampion4j.FileValidator.saveFileToOutputDir(), dev.filechampion.filechampion4j.FileValidator.validateFile(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 52 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkMethodInputs(), and dev.filechampion.filechampion4j.FileValidator.validateFile().
|
staticprivate |
Initialize logging configuration from logging.properties file in resources folder
Definition at line 33 of file FileValidator.java.
|
staticprivate |
|
private |
Definition at line 54 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), and dev.filechampion.filechampion4j.FileValidator.validateFile().
|
private |
Definition at line 53 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkMethodInputs(), dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executePlugin(), and dev.filechampion.filechampion4j.FileValidator.validateFile().
|
private |
|
private |
Definition at line 42 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator(), and dev.filechampion.filechampion4j.FileValidator.loadPlugins().
|
private |
Definition at line 59 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 61 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 60 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 62 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
Definition at line 48 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkPluginsExist(), dev.filechampion.filechampion4j.FileValidator.executeAfterPluginsProcess(), dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins(), and dev.filechampion.filechampion4j.FileValidator.executePlugin().
|
private |
Definition at line 47 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator(), dev.filechampion.filechampion4j.FileValidator.checkMethodInputs(), dev.filechampion.filechampion4j.FileValidator.checkPluginsExist(), dev.filechampion.filechampion4j.FileValidator.deleteTempDir(), dev.filechampion.filechampion4j.FileValidator.doValidations(), dev.filechampion.filechampion4j.FileValidator.executeAfterPlugins(), dev.filechampion.filechampion4j.FileValidator.executeAfterPluginsProcess(), dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins(), dev.filechampion.filechampion4j.FileValidator.executePlugin(), dev.filechampion.filechampion4j.FileValidator.saveFileToOutputDir(), dev.filechampion.filechampion4j.FileValidator.setFileAttributes(), dev.filechampion.filechampion4j.FileValidator.validateFile(), and dev.filechampion.filechampion4j.FileValidator.validateFileMain().
|
private |
|
private |
Definition at line 43 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.checkPluginsExist(), dev.filechampion.filechampion4j.FileValidator.executeBeforePlugins(), and dev.filechampion.filechampion4j.FileValidator.loadPlugins().
|
staticprivate |
Definition at line 64 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator().
|
private |
Definition at line 46 of file FileValidator.java.
Referenced by dev.filechampion.filechampion4j.FileValidator.FileValidator(), and dev.filechampion.filechampion4j.FileValidator.doValidations().