Class FileNameScrutinizer
- java.lang.Object
-
- org.openrefine.wikibase.qa.scrutinizers.EditScrutinizer
-
- org.openrefine.wikibase.qa.scrutinizers.FileNameScrutinizer
-
public class FileNameScrutinizer extends EditScrutinizer
-
-
Field Summary
Fields Modifier and Type Field Description static StringduplicateFileNamesInBatchTypestatic StringfileNamesAlreadyExistOnWikiTypestatic StringfileNameTooLongTypestatic PatternforbiddenFileNameCharsstatic StringinconsistentFileNameAndPathExtensionTypestatic StringinvalidCharactersInFileNameTypestatic intmaxFileNameLengthstatic StringmissingFileNameExtensionTypeprotected Set<String>seenFileNames-
Fields inherited from class org.openrefine.wikibase.qa.scrutinizers.EditScrutinizer
_fetcher, _store, connection, enableSlowChecks, manifest
-
-
Constructor Summary
Constructors Constructor Description FileNameScrutinizer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbatchIsBeginning()Called before an edit batch is scrutinized.voidbatchIsFinished()Method called once the edit batch has been read entirelyprotected StringnormalizeFileNameSpaces(String filename)Attempt of a local implementation of the file name normalization that is done in MediaWiki.booleanprepareDependencies()Prepare the dependencies(i.e. constraint-related pids and qids) needed by the scrutinizer.voidscrutinize(ItemEdit edit)Reads the candidate edit and emits warnings in the storevoidscrutinize(MediaInfoEdit edit)Reads the candidate edit and emits warnings in the store-
Methods inherited from class org.openrefine.wikibase.qa.scrutinizers.EditScrutinizer
addIssue, addIssue, critical, findValues, getConstraintsRelatedId, important, info, infoNotFacetable, scrutinize, setApiConnection, setEnableSlowChecks, setFetcher, setManifest, setStore, warning
-
-
-
-
Field Detail
-
maxFileNameLength
public static final int maxFileNameLength
- See Also:
- Constant Field Values
-
forbiddenFileNameChars
public static final Pattern forbiddenFileNameChars
-
duplicateFileNamesInBatchType
public static final String duplicateFileNamesInBatchType
- See Also:
- Constant Field Values
-
fileNamesAlreadyExistOnWikiType
public static final String fileNamesAlreadyExistOnWikiType
- See Also:
- Constant Field Values
-
invalidCharactersInFileNameType
public static final String invalidCharactersInFileNameType
- See Also:
- Constant Field Values
-
fileNameTooLongType
public static final String fileNameTooLongType
- See Also:
- Constant Field Values
-
missingFileNameExtensionType
public static final String missingFileNameExtensionType
- See Also:
- Constant Field Values
-
inconsistentFileNameAndPathExtensionType
public static final String inconsistentFileNameAndPathExtensionType
- See Also:
- Constant Field Values
-
-
Method Detail
-
prepareDependencies
public boolean prepareDependencies()
Description copied from class:EditScrutinizerPrepare the dependencies(i.e. constraint-related pids and qids) needed by the scrutinizer. Called beforeEditScrutinizer.batchIsBeginning().- Specified by:
prepareDependenciesin classEditScrutinizer- Returns:
- false if any necessary dependency is missing, true otherwise.
-
scrutinize
public void scrutinize(ItemEdit edit)
Description copied from class:EditScrutinizerReads the candidate edit and emits warnings in the store- Specified by:
scrutinizein classEditScrutinizer- Parameters:
edit- : theItemEditto scrutinize
-
batchIsBeginning
public void batchIsBeginning()
Description copied from class:EditScrutinizerCalled before an edit batch is scrutinized.- Overrides:
batchIsBeginningin classEditScrutinizer
-
normalizeFileNameSpaces
protected String normalizeFileNameSpaces(String filename)
Attempt of a local implementation of the file name normalization that is done in MediaWiki. Assumes a non-empty file name as input. This assumes that some special characters have been replaced already: `:`, `/` and `\`- Returns:
-
scrutinize
public void scrutinize(MediaInfoEdit edit)
Description copied from class:EditScrutinizerReads the candidate edit and emits warnings in the store- Specified by:
scrutinizein classEditScrutinizer- Parameters:
edit- : theItemEditto scrutinize
-
batchIsFinished
public void batchIsFinished()
Description copied from class:EditScrutinizerMethod called once the edit batch has been read entirely- Overrides:
batchIsFinishedin classEditScrutinizer
-
-