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 String
duplicateFileNamesInBatchType
static String
fileNamesAlreadyExistOnWikiType
static String
fileNameTooLongType
static Pattern
forbiddenFileNameChars
static String
inconsistentFileNameAndPathExtensionType
static String
invalidCharactersInFileNameType
static int
maxFileNameLength
static String
missingFileNameExtensionType
protected 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 void
batchIsBeginning()
Called before an edit batch is scrutinized.void
batchIsFinished()
Method called once the edit batch has been read entirelyprotected String
normalizeFileNameSpaces(String filename)
Attempt of a local implementation of the file name normalization that is done in MediaWiki.boolean
prepareDependencies()
Prepare the dependencies(i.e. constraint-related pids and qids) needed by the scrutinizer.void
scrutinize(ItemEdit edit)
Reads the candidate edit and emits warnings in the storevoid
scrutinize(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:EditScrutinizer
Prepare the dependencies(i.e. constraint-related pids and qids) needed by the scrutinizer. Called beforeEditScrutinizer.batchIsBeginning()
.- Specified by:
prepareDependencies
in classEditScrutinizer
- Returns:
- false if any necessary dependency is missing, true otherwise.
-
scrutinize
public void scrutinize(ItemEdit edit)
Description copied from class:EditScrutinizer
Reads the candidate edit and emits warnings in the store- Specified by:
scrutinize
in classEditScrutinizer
- Parameters:
edit
- : theItemEdit
to scrutinize
-
batchIsBeginning
public void batchIsBeginning()
Description copied from class:EditScrutinizer
Called before an edit batch is scrutinized.- Overrides:
batchIsBeginning
in 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:EditScrutinizer
Reads the candidate edit and emits warnings in the store- Specified by:
scrutinize
in classEditScrutinizer
- Parameters:
edit
- : theItemEdit
to scrutinize
-
batchIsFinished
public void batchIsFinished()
Description copied from class:EditScrutinizer
Method called once the edit batch has been read entirely- Overrides:
batchIsFinished
in classEditScrutinizer
-
-