Package org.cyclos.impl.users
Class AddressLocatingPollingTask
-
- All Implemented Interfaces:
Runnable,PollingTask
@Component public class AddressLocatingPollingTask extends SimplePollingTask
APollingTaskwhich locates addresses which are saved without geolocation
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.utils.tasks.AbstractTask
errorLogService, invokerHandler, loggingHandler
-
Fields inherited from class org.cyclos.impl.AbstractGlobalServerComponent
rawEntityManagerHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description AddressLocatingPollingTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longexecute()Executes the task batch.protected List<Long>findMapEnabledConfigurations()Returns the ids of all configurations with map enabled and a valid server API keyprotected booleangeocode(Long id)Locates a single addressStringgetName()Returns the task nameintgetSleepSeconds()protected booleanisRunInTransaction()Return whether the execute method must be ran in a transaction or not.protected voidmarkAsGeocodeFailed(Long id)Marks a single address as geocoding failedprotected List<Long>nextBatch(List<Long> configurationIds)Returns a list of address ids which are not yet localized-
Methods inherited from class org.cyclos.impl.utils.tasks.SimplePollingTask
doRun
-
Methods inherited from class org.cyclos.impl.utils.tasks.AbstractPollingTask
dateFromDelay, getFirstExecution, getInitialSleepSeconds, getNextExecution, getSecondsUntilNextDay, getSecondsUntilNextHour, getStorage, initialize, isExclusiveInCluster, run
-
Methods inherited from class org.cyclos.impl.utils.tasks.AbstractTask
getLogConfiguration, logName, logTaskError, logTaskSuccess, shouldGenerateErrorLog, toString
-
Methods inherited from class org.cyclos.impl.AbstractGlobalServerComponent
getBaseEntityManagerHandler, getEntityManager
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:PollingTaskReturns the task name- Specified by:
getNamein interfacePollingTask- Specified by:
getNamein classAbstractTask
-
getSleepSeconds
public int getSleepSeconds()
- Overrides:
getSleepSecondsin classAbstractPollingTask
-
execute
protected long execute() throws ThrowableDescription copied from class:SimplePollingTaskExecutes the task batch. This method must be idempotent, which means that subsequent invocations should not cause side effects. For example, a task could expire data up to the current hour. If executed several times within any given hour, only the first execution should change data, while others should not affect anything. Should return the number of affected records- Specified by:
executein classSimplePollingTask- Throws:
Throwable
-
findMapEnabledConfigurations
protected List<Long> findMapEnabledConfigurations()
Returns the ids of all configurations with map enabled and a valid server API key
-
isRunInTransaction
protected boolean isRunInTransaction()
Description copied from class:SimplePollingTaskReturn whether the execute method must be ran in a transaction or not. By default a transaction is opened before execute the method.- Overrides:
isRunInTransactionin classSimplePollingTask
-
geocode
protected boolean geocode(Long id)
Locates a single address
-
markAsGeocodeFailed
protected void markAsGeocodeFailed(Long id)
Marks a single address as geocoding failed
-
-