Interface TaskLoader
-
- All Known Implementing Classes:
MapRouletteConnection
public interface TaskLoaderInterface with various methods required to upload tasks to MapRoulette
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longcreateChallenge(Project project, Challenge challenge)Creates a new challenge with the givenChallenge, if already exists then will attempt to updatelongcreateProject(Project project)Creates a new project with theProject, if already exists then will attempt to updatejava.lang.StringgetConnectionInfo()Retrieve the connection info for this connectionlongpurgeIncompleteTasks(long challengeID)Will purge incomplete tasks from a challengebooleanuploadBatchTasks(long challengeId, java.util.Set<Task> tasks)Uploads tasks as a batch, instead of one at a timebooleanuploadTask(long challengeId, Task task)Uploads a task to MapRoulette
-
-
-
Method Detail
-
createChallenge
long createChallenge(Project project, Challenge challenge) throws java.io.UnsupportedEncodingException, java.net.URISyntaxException
Creates a new challenge with the givenChallenge, if already exists then will attempt to update- Parameters:
project- The parent project object of the challengechallenge- The challenge to create or update- Returns:
- The id for the challenge
- Throws:
java.io.UnsupportedEncodingException- if json data for API payload cannot be encoded correctlyjava.net.URISyntaxException- if the URI for getting/creating/updating project is incorrectly generated
-
createProject
long createProject(Project project) throws java.io.UnsupportedEncodingException, java.net.URISyntaxException
Creates a new project with theProject, if already exists then will attempt to update- Parameters:
project- The project object containing name and description- Returns:
- The id for the project
- Throws:
java.io.UnsupportedEncodingException- if json data for API payload cannot be encoded correctlyjava.net.URISyntaxException- if the URI for getting/creating/updating project is incorrectly generated
-
getConnectionInfo
java.lang.String getConnectionInfo()
Retrieve the connection info for this connection- Returns:
- A string
-
purgeIncompleteTasks
long purgeIncompleteTasks(long challengeID) throws java.io.UnsupportedEncodingException, java.net.URISyntaxExceptionWill purge incomplete tasks from a challenge- Parameters:
challengeID- The challenge ID to purge- Returns:
- The id of the challenge
- Throws:
java.io.UnsupportedEncodingException- if json data for API payload cannot be encoded correctlyjava.net.URISyntaxException- if the URI for getting/creating/updating project is incorrectly generated
-
uploadBatchTasks
boolean uploadBatchTasks(long challengeId, java.util.Set<Task> tasks) throws java.io.UnsupportedEncodingException, java.net.URISyntaxExceptionUploads tasks as a batch, instead of one at a time- Parameters:
challengeId- The id of the parent challengetasks- The list of tasks that should be uploaded for the challenge- Returns:
- The JSON payload used to upload the task
- Throws:
java.io.UnsupportedEncodingException- Exception could be thrown when you try and upload the batch.java.net.URISyntaxException- if the URI cannot be built correctly
-
uploadTask
boolean uploadTask(long challengeId, Task task) throws java.io.UnsupportedEncodingException, java.net.URISyntaxExceptionUploads a task to MapRoulette- Parameters:
challengeId- The id of the parent challengetask- The JSON payload used to upload the task- Returns:
- true if the task was uploaded successfully
- Throws:
java.io.UnsupportedEncodingException- If the JSON is invalid, which it never should bejava.net.URISyntaxException- if the URI cannot be built correctly
-
-