T - the type for the flagged identifierspublic abstract class BaseCheck<T> extends java.lang.Object implements Check, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PARAMETER_ACCEPT_PIERS |
static java.lang.String |
PARAMETER_BLACKLIST_COUNTRIES |
static java.lang.String |
PARAMETER_CHALLENGE |
static java.lang.String |
PARAMETER_FLAG |
static java.lang.String |
PARAMETER_WHITELIST_COUNTRIES |
static java.lang.String |
PARAMETER_WHITELIST_TAGS |
| Constructor and Description |
|---|
BaseCheck(org.openstreetmap.atlas.utilities.configuration.Configuration configuration)
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acceptPier()
If the check wants to accept piers as part of it's evaluation then it will need to override
this function and return
true. |
java.util.Optional<CheckFlag> |
check(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
The check for the atlas object
|
java.util.function.Predicate<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> |
checkObjectFilter() |
void |
clear()
Clears all flagged feature identifiers for this check.
|
protected void |
clearFlaggedIdentifiers() |
protected java.lang.String |
configurationKey(java.lang.Class type,
java.lang.String key) |
protected java.lang.String |
configurationKey(java.lang.String key)
Configuration Keys in the Integrity Framework are based on the check simple classname.
|
protected <U> U |
configurationValue(org.openstreetmap.atlas.utilities.configuration.Configuration configuration,
java.lang.String key,
U defaultValue) |
protected <U,V> V |
configurationValue(org.openstreetmap.atlas.utilities.configuration.Configuration configuration,
java.lang.String key,
U defaultValue,
java.util.function.Function<U,V> transform) |
protected CheckFlag |
createFlag(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object,
java.lang.String instruction) |
protected CheckFlag |
createFlag(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object,
java.lang.String instruction,
java.util.List<org.openstreetmap.atlas.geography.Location> points) |
protected CheckFlag |
createFlag(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects,
java.lang.String instruction) |
protected CheckFlag |
createFlag(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects,
java.lang.String instruction,
java.util.List<org.openstreetmap.atlas.geography.Location> points) |
protected abstract java.util.Optional<CheckFlag> |
flag(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object) |
java.lang.Iterable<CheckFlag> |
flags(org.openstreetmap.atlas.geography.atlas.Atlas atlas)
|
java.util.List<java.lang.String> |
getBlacklistCountries() |
Challenge |
getChallenge()
Gets a challenge object for the specific check
|
java.lang.String |
getCheckName()
Gets the name of this check
|
java.util.List<java.lang.String> |
getCountries()
Gets the whitelisted countries for this check.
|
protected java.util.List<java.lang.String> |
getFallbackInstructions()
Method to implement for inheriting checks to return the default set of instruction formats
that will be the last resort in
getLocalizedInstruction(int, Object[]) |
protected java.util.Set<T> |
getFlaggedIdentifiers() |
java.util.Locale |
getLocale() |
java.lang.String |
getLocalizedInstruction(int index,
java.lang.Object... objects)
Uses the default of configured locale to grab the localized instruction format from the
configuration.
|
protected java.lang.String |
getTaskIdentifier(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object) |
protected java.lang.String |
getTaskIdentifier(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects)
The task identifier is ordered to maintain identifier uniqueness.
|
protected java.lang.String |
getUniqueObjectIdentifier(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
Similar to
getUniqueOSMIdentifier(AtlasObject) except instead of using the
OSM identifier we use the Atlas identifier |
protected java.lang.String |
getUniqueOSMIdentifier(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
Generates a unique identifier given an
AtlasObject. |
protected boolean |
isFlagged(T identifier) |
void |
logStatus()
Helper for debugging.
|
protected void |
markAsFlagged(T identifier) |
boolean |
validCheckForCountry(java.lang.String country)
The country check will first check the country whitelist and if the country is contained in
the whitelist it is allowed, after that the country is checked it against blacklist and if
contained in the blacklist will not be allowed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfinder, validCheckForObjectpublic static final java.lang.String PARAMETER_ACCEPT_PIERS
public static final java.lang.String PARAMETER_BLACKLIST_COUNTRIES
public static final java.lang.String PARAMETER_CHALLENGE
public static final java.lang.String PARAMETER_FLAG
public static final java.lang.String PARAMETER_WHITELIST_COUNTRIES
public static final java.lang.String PARAMETER_WHITELIST_TAGS
public BaseCheck(org.openstreetmap.atlas.utilities.configuration.Configuration configuration)
configuration - Configuration required to construct any Checkpublic java.util.Optional<CheckFlag> check(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
Checkpublic final java.util.function.Predicate<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> checkObjectFilter()
public void clear()
public java.lang.Iterable<CheckFlag> flags(org.openstreetmap.atlas.geography.atlas.Atlas atlas)
CheckCheckFlags from this check, given AtlasEntitys and
Relations. ComplexEntitys can be added as well, using the appropriate
Finder.public java.util.List<java.lang.String> getBlacklistCountries()
public Challenge getChallenge()
CheckgetChallenge in interface CheckChallengepublic final java.lang.String getCheckName()
CheckgetCheckName in interface CheckString namepublic java.util.List<java.lang.String> getCountries()
public java.util.Locale getLocale()
public final java.lang.String getLocalizedInstruction(int index,
java.lang.Object... objects)
IndexOutOfBoundsException will be
thrown if the instruction index is out of the Fallback Instructions. The instruction format
will then be formatted using the provided objects and returned.index - The index of the desired instruction format.objects - The objects to be used in constructing the instructionDEFAULT_LOCALE language
instruction, or the fallback instruction. In that order if the previous isn't present
in the configuration.public void logStatus()
Checkpublic boolean validCheckForCountry(java.lang.String country)
validCheckForCountry in interface Checkcountry - country ISO3 code to checktrue if valid check for country, otherwise falseprotected boolean acceptPier()
true. By default piers are skipped.true if we want to check pier edges, false if we want to skip themprotected void clearFlaggedIdentifiers()
protected final java.lang.String configurationKey(java.lang.Class type,
java.lang.String key)
protected final java.lang.String configurationKey(java.lang.String key)
key - key part for a specific configuration item defined for this classprotected <U> U configurationValue(org.openstreetmap.atlas.utilities.configuration.Configuration configuration,
java.lang.String key,
U defaultValue)
protected <U,V> V configurationValue(org.openstreetmap.atlas.utilities.configuration.Configuration configuration,
java.lang.String key,
U defaultValue,
java.util.function.Function<U,V> transform)
protected CheckFlag createFlag(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object, java.lang.String instruction)
protected CheckFlag createFlag(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object, java.lang.String instruction, java.util.List<org.openstreetmap.atlas.geography.Location> points)
protected CheckFlag createFlag(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects, java.lang.String instruction)
protected CheckFlag createFlag(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects, java.lang.String instruction, java.util.List<org.openstreetmap.atlas.geography.Location> points)
protected abstract java.util.Optional<CheckFlag> flag(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
protected java.util.List<java.lang.String> getFallbackInstructions()
getLocalizedInstruction(int, Object[])protected java.util.Set<T> getFlaggedIdentifiers()
protected java.lang.String getTaskIdentifier(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
protected java.lang.String getTaskIdentifier(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects)
objects - set of AtlasObjects comprising this taskprotected java.lang.String getUniqueObjectIdentifier(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
getUniqueOSMIdentifier(AtlasObject) except instead of using the
OSM identifier we use the Atlas identifierobject - AtlasObject to generate unique identifier forprotected java.lang.String getUniqueOSMIdentifier(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
AtlasObject. OSM/Atlas objects with different
types can share the identifier (way 12345 - node 12345). This method makes sure we generate a
truly unique identifier, based on the OSM identifier, among different types for an
AtlasObject. If the AtlasObject is an instanceof AtlasEntity then it will simply use
the type for the first part of the identifier, otherwise it will use the simple class name.object - AtlasObject to generate unique identifier forprotected final boolean isFlagged(T identifier)
protected final void markAsFlagged(T identifier)