use of de.westnordost.streetcomplete.data.changesets.OpenChangesetInfo in project StreetComplete by westnordost.
the class AOsmQuestChangesUpload method closeOpenChangesets.
public synchronized void closeOpenChangesets() {
long timePassed = System.currentTimeMillis() - openChangesetsDB.getLastQuestSolvedTime();
if (timePassed < OpenChangesetsDao.CLOSE_CHANGESETS_AFTER_INACTIVITY_OF)
return;
for (OpenChangesetInfo info : openChangesetsDB.getAll()) {
try {
osmDao.closeChangeset(info.changesetId);
Log.i(TAG, "Closed changeset #" + info.changesetId + ".");
} catch (OsmConflictException e) {
Log.w(TAG, "Couldn't close changeset #" + info.changesetId + " because it has already been closed.");
} finally {
// done!
openChangesetsDB.delete(info.key);
}
}
}
use of de.westnordost.streetcomplete.data.changesets.OpenChangesetInfo in project StreetComplete by westnordost.
the class AOsmQuestChangesUpload method getChangesetIdOrCreate.
private long getChangesetIdOrCreate(OsmElementQuestType questType, String source) {
String questTypeName = questType.getClass().getSimpleName();
OpenChangesetKey key = new OpenChangesetKey(questTypeName, source);
Long cachedChangesetId = changesetIdsCache.get(key);
if (cachedChangesetId != null)
return cachedChangesetId;
OpenChangesetInfo changesetInfo = openChangesetsDB.get(key);
long result;
if (changesetInfo != null && changesetInfo.changesetId != null) {
result = changesetInfo.changesetId;
} else {
result = createChangeset(questType, source);
}
changesetIdsCache.put(key, result);
return result;
}
Aggregations