Search in sources :

Example 1 with ChangesetInfo

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;
}
Also used : User(de.westnordost.osmapi.user.User) ChangesetInfo(de.westnordost.osmapi.changesets.ChangesetInfo)

Example 2 with ChangesetInfo

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;
}
Also used : ChangesetInfo(de.westnordost.osmapi.changesets.ChangesetInfo)

Example 3 with ChangesetInfo

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);
    }
}
Also used : ChangesetInfo(de.westnordost.osmapi.changesets.ChangesetInfo) OpenChangesetInfo(de.westnordost.streetcomplete.data.changesets.OpenChangesetInfo)

Example 4 with ChangesetInfo

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;
}
Also used : ChangesetInfo(de.westnordost.osmapi.changesets.ChangesetInfo)

Example 5 with ChangesetInfo

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;
}
Also used : ChangesetInfo(de.westnordost.osmapi.changesets.ChangesetInfo)

Aggregations

ChangesetInfo (de.westnordost.osmapi.changesets.ChangesetInfo)5 User (de.westnordost.osmapi.user.User)1 OpenChangesetInfo (de.westnordost.streetcomplete.data.changesets.OpenChangesetInfo)1