Package org.maproulette.client.batch
Class BatchUploader
- java.lang.Object
-
- org.maproulette.client.batch.BatchUploader
-
public class BatchUploader extends java.lang.ObjectA BatchUploader that will add tasks to a batch and then upload them to MapRoulette
-
-
Constructor Summary
Constructors Constructor Description BatchUploader(MapRouletteConfiguration configuration)Default constructor that will build the default project configuration when initialized.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tuple<java.lang.Long,java.lang.Long>addTask(Challenge challenge, Task task)This will add tasks to the batch, it will use the default project found in the configurationTuple<java.lang.Long,java.lang.Long>addTasks(Challenge challenge, java.util.List<Task> tasks)Adds a set of tasks to the batchvoidflush(long identifier)Flushes a single project batchvoidflushAll()Flushes all project batches
-
-
-
Constructor Detail
-
BatchUploader
public BatchUploader(MapRouletteConfiguration configuration)
Default constructor that will build the default project configuration when initialized.- Parameters:
configuration- The configuration to connect to MapRoulette
-
-
Method Detail
-
addTasks
public Tuple<java.lang.Long,java.lang.Long> addTasks(Challenge challenge, java.util.List<Task> tasks) throws MapRouletteException
Adds a set of tasks to the batch- Parameters:
challenge- The challenge to add the tasks undertasks- The tasks to add to the batch- Returns:
- A tuple containing the identifiers first for the project that the task was created in, and then the challenge.
- Throws:
MapRouletteException- If there are any failures while adding tasks to the batch. This will only occur if you add more tasks than the match batch size and it automatically tries to flush the tasks to the maproulette server
-
addTask
public Tuple<java.lang.Long,java.lang.Long> addTask(Challenge challenge, Task task) throws MapRouletteException
This will add tasks to the batch, it will use the default project found in the configuration- Parameters:
challenge- The Challenge you are adding the task too. The project will be either based on the parent identifier in the challenge object or the default project in the configuration.task- The task to add to the batch.- Returns:
- A tuple containing the identifiers first for the project that the task was created in, and then the challenge.
- Throws:
MapRouletteException- if there are any failures adding the task to the batch
-
flush
public void flush(long identifier) throws MapRouletteExceptionFlushes a single project batch- Parameters:
identifier- The identifier of the project that you want to flush- Throws:
MapRouletteException- Any exceptions that occur while flushing the project
-
flushAll
public void flushAll()
Flushes all project batches
-
-