use of de.westnordost.osmapi.changesets.ChangesetInfo in project StreetComplete by westnordost.
the class OsmQuestChangesUploadTest method createChangesetForUser.
private static ChangesetInfo createChangesetForUser(long id) {
ChangesetInfo result = new ChangesetInfo();
result.user = new User(id, "Hans Wurst");
return result;
}
use of de.westnordost.osmapi.changesets.ChangesetInfo in project StreetComplete by westnordost.
the class OsmQuestChangesUploadTest method createOpenChangesetForUser.
private static ChangesetInfo createOpenChangesetForUser(long id) {
ChangesetInfo result = createChangesetForUser(id);
result.isOpen = true;
return result;
}
use of de.westnordost.osmapi.changesets.ChangesetInfo in project StreetComplete by westnordost.
the class AOsmQuestChangesUpload method handleConflict.
private boolean handleConflict(long changesetId, OsmQuest quest, Element element, boolean alreadyHandlingElementConflict, boolean alreadyHandlingChangesetConflict, OsmConflictException e) {
/* Conflict can either happen because of the changeset or because of the element(s) uploaded.
Let's find out. */
ChangesetInfo changesetInfo = changesetsDao.get(changesetId);
Long myUserId = prefs.getLong(Prefs.OSM_USER_ID, -1);
// can happen if the user changes his OAuth identity in the settings while having an open changeset
boolean changesetWasOpenedByDifferentUser = myUserId == -1 || changesetInfo.user == null || changesetInfo.user.id != myUserId;
if (!changesetInfo.isOpen || changesetWasOpenedByDifferentUser) {
// safeguard against stack overflow in case of programming error
if (alreadyHandlingChangesetConflict) {
throw new RuntimeException("OSM server continues to report a changeset " + "conflict for changeset id " + changesetId, e);
}
return handleChangesetConflict(quest, element, alreadyHandlingElementConflict);
} else {
// safeguard against stack overflow in case of programming error
if (alreadyHandlingElementConflict) {
throw new RuntimeException("OSM server continues to report an element " + "conflict on uploading the changes for the quest " + getQuestStringForLog(quest) + ". The local version is " + element.getVersion(), e);
}
return handleElementConflict(changesetId, quest, alreadyHandlingChangesetConflict);
}
}
use of de.westnordost.osmapi.changesets.ChangesetInfo in project StreetComplete by westnordost.
the class OsmQuestChangesUploadTest method createClosedChangesetForUser.
private static ChangesetInfo createClosedChangesetForUser(long id) {
ChangesetInfo result = createChangesetForUser(id);
result.isOpen = false;
return result;
}
use of de.westnordost.osmapi.changesets.ChangesetInfo in project StreetComplete by westnordost.
the class QuestStatisticsDaoTest method createChangeset.
private ChangesetInfo createChangeset() {
ChangesetInfo result = new ChangesetInfo();
result.tags = new HashMap<>();
result.tags.put("created_by", ApplicationConstants.USER_AGENT);
return result;
}
Aggregations