Search in sources :

Example 1 with Project

use of org.openstreetmap.atlas.checks.maproulette.data.Project in project atlas-checks by osmlab.

the class MapRouletteClient method upload.

private void upload(final Tuple<String, String> key) {
    final Set<Task> batchList = this.batch.get(key);
    if (batchList != null && batchList.size() > 0) {
        try {
            // retrieve the already created project and challenge
            final Project project = this.projects.get(key.getFirst());
            if (project == null) {
                logger.warn("Failed to upload batch to MapRoulette, Project {} has not been created.", key.getFirst());
            } else {
                final Challenge challenge = this.challenges.get(project.getId()).get(key.getSecond());
                if (challenge == null) {
                    logger.warn("Failed to upload batch to MapRoulette, Challenge {} has not been created.", key.getSecond());
                } else {
                    this.connection.uploadBatchTasks(challenge.getId(), batchList);
                    batchList.clear();
                }
            }
        } catch (final UnsupportedEncodingException e) {
            logger.debug("Failed to upload batch to map roulette [{}]", this.connection.getConnectionInfo());
        } catch (final URISyntaxException e) {
            logger.debug("Failed to upload batch to map roulette", e);
        }
    }
}
Also used : Project(org.openstreetmap.atlas.checks.maproulette.data.Project) Task(org.openstreetmap.atlas.checks.maproulette.data.Task) UnsupportedEncodingException(java.io.UnsupportedEncodingException) URISyntaxException(java.net.URISyntaxException) Challenge(org.openstreetmap.atlas.checks.maproulette.data.Challenge)

Example 2 with Project

use of org.openstreetmap.atlas.checks.maproulette.data.Project in project atlas-checks by osmlab.

the class MapRouletteClient method createProject.

private Project createProject(final String projectName) throws UnsupportedEncodingException, URISyntaxException {
    final Project project = this.projects.getOrDefault(projectName, new Project(projectName));
    if (project.getId() == -1) {
        project.setId(this.connection.createProject(project));
        this.projects.put(projectName, project);
    }
    return project;
}
Also used : Project(org.openstreetmap.atlas.checks.maproulette.data.Project)

Aggregations

Project (org.openstreetmap.atlas.checks.maproulette.data.Project)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 URISyntaxException (java.net.URISyntaxException)1 Challenge (org.openstreetmap.atlas.checks.maproulette.data.Challenge)1 Task (org.openstreetmap.atlas.checks.maproulette.data.Task)1