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);
}
}
}
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;
}
Aggregations