Package org.openstreetmap.josm.io
Class DiffResultProcessor
java.lang.Object
org.openstreetmap.josm.io.DiffResultProcessor
Helper class to process the OSM API server response to a "diff" upload.
New primitives (uploaded with negative id) will be assigned a positive id, etc. The goal is to have a clean state, just like a fresh download (assuming no concurrent uploads by other users have happened in the meantime).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classprivate final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<PrimitiveId,DiffResultProcessor.DiffResultEntry> mapping from old id to new id and version, the result of parsing the diff result replied by the serverprivate final Collection<? extends OsmPrimitive>the collection of primitives being uploadedprivate final Set<OsmPrimitive>the set of processed primitives *after* the new id, the new version and the new changeset id is set -
Constructor Summary
ConstructorsConstructorDescriptionDiffResultProcessor(Collection<? extends OsmPrimitive> primitives) Creates a diff result reader -
Method Summary
Modifier and TypeMethodDescription(package private) final Map<PrimitiveId,DiffResultProcessor.DiffResultEntry> voidparse(String diffUploadResponse, ProgressMonitor progressMonitor) Parse the response from a diff upload to the OSM API.protected Set<OsmPrimitive>postProcess(Changeset cs, ProgressMonitor monitor) Postprocesses the diff result read and parsed from the server.
-
Field Details
-
diffResults
mapping from old id to new id and version, the result of parsing the diff result replied by the server -
processed
the set of processed primitives *after* the new id, the new version and the new changeset id is set -
primitives
the collection of primitives being uploaded
-
-
Constructor Details
-
DiffResultProcessor
Creates a diff result reader- Parameters:
primitives- the collection of primitives which have been uploaded. If null, assumes an empty collection.
-
-
Method Details
-
parse
public void parse(String diffUploadResponse, ProgressMonitor progressMonitor) throws XmlParsingException Parse the response from a diff upload to the OSM API.- Parameters:
diffUploadResponse- the response. Must not be null.progressMonitor- a progress monitor. Defaults toNullProgressMonitor.INSTANCEif null- Throws:
IllegalArgumentException- if diffUploadRequest is nullXmlParsingException- if the diffUploadRequest can't be parsed successfully
-
postProcess
Postprocesses the diff result read and parsed from the server.Uploaded objects are assigned their new id (if they got assigned a new id by the server), their new version (if the version was incremented), and the id of the changeset to which they were uploaded.
- Parameters:
cs- the current changeset. Ignored if null.monitor- the progress monitor. Set toNullProgressMonitor.INSTANCEif null- Returns:
- the collection of processed primitives
-
getDiffResults
-