Interface TaskLoader

  • All Known Implementing Classes:
    MapRouletteConnection

    public interface TaskLoader
    Interface with various methods required to upload tasks to MapRoulette
    • Method Detail

      • createChallenge

        long createChallenge​(Project project,
                             Challenge challenge)
                      throws java.io.UnsupportedEncodingException,
                             java.net.URISyntaxException
        Creates a new challenge with the given Challenge, if already exists then will attempt to update
        Parameters:
        project - The parent project object of the challenge
        challenge - 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 correctly
        java.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 the Project, 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 correctly
        java.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
      • uploadBatchTasks

        boolean uploadBatchTasks​(long challengeId,
                                 java.util.Set<Task> tasks)
                          throws java.io.UnsupportedEncodingException,
                                 java.net.URISyntaxException
        Uploads tasks as a batch, instead of one at a time
        Parameters:
        challengeId - The id of the parent challenge
        tasks - 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.URISyntaxException
        Uploads a task to MapRoulette
        Parameters:
        challengeId - The id of the parent challenge
        task - 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 be
        java.net.URISyntaxException - if the URI cannot be built correctly