org.openstreetmap.josm.io
Class DiffResultProcessor

java.lang.Object
  extended by org.openstreetmap.josm.io.DiffResultProcessor

public class DiffResultProcessor
extends java.lang.Object


Nested Class Summary
private static class DiffResultProcessor.DiffResultEntry
           
private  class DiffResultProcessor.Parser
           
 
Field Summary
private  java.util.Map<PrimitiveId,DiffResultProcessor.DiffResultEntry> diffResults
          mapping from old id to new id and version, the result of parsing the diff result replied by the server
private  java.util.Collection<? extends IPrimitive> primitives
          the collection of primitives being uploaded
private  java.util.Set<IPrimitive> processed
          the set of processed primitives *after* the new id, the new version and the new changeset id is set
 
Constructor Summary
DiffResultProcessor(java.util.Collection<? extends IPrimitive> primitives)
          Creates a diff result reader
 
Method Summary
 void parse(java.lang.String diffUploadResponse, ProgressMonitor progressMonitor)
          Parse the response from a diff upload to the OSM API.
protected  java.util.Set<IPrimitive> postProcess(Changeset cs, ProgressMonitor monitor)
          Postprocesses the diff result read and parsed from the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

diffResults

private java.util.Map<PrimitiveId,DiffResultProcessor.DiffResultEntry> diffResults
mapping from old id to new id and version, the result of parsing the diff result replied by the server


processed

private java.util.Set<IPrimitive> processed
the set of processed primitives *after* the new id, the new version and the new changeset id is set


primitives

private java.util.Collection<? extends IPrimitive> primitives
the collection of primitives being uploaded

Constructor Detail

DiffResultProcessor

public DiffResultProcessor(java.util.Collection<? extends IPrimitive> primitives)
Creates a diff result reader

Parameters:
primitives - the collection of primitives which have been uploaded. If null, assumes an empty collection.
Method Detail

parse

public void parse(java.lang.String diffUploadResponse,
                  ProgressMonitor progressMonitor)
           throws OsmDataParsingException
Parse the response from a diff upload to the OSM API.

Parameters:
diffUploadResponse - the response. Must not be null.
progressMonitor - a progress monitor. Defaults to NullProgressMonitor.INSTANCE if null
Throws:
java.lang.IllegalArgumentException - thrown if diffUploadRequest is null
OsmDataParsingException - thrown if the diffUploadRequest can't be parsed successfully

postProcess

protected java.util.Set<IPrimitive> postProcess(Changeset cs,
                                                ProgressMonitor monitor)
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 to NullProgressMonitor.INSTANCE if null
Returns:
the collection of processed primitives


JOSM