Class DiffResultProcessor


  • public class DiffResultProcessor
    extends java.lang.Object
    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:
    API 0.6 diff upload response
    • Constructor Detail

      • DiffResultProcessor

        public DiffResultProcessor​(java.util.Collection<? extends OsmPrimitive> 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 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 to NullProgressMonitor.INSTANCE if null
        Throws:
        java.lang.IllegalArgumentException - if diffUploadRequest is null
        XmlParsingException - if the diffUploadRequest can't be parsed successfully
      • postProcess

        protected java.util.Set<OsmPrimitivepostProcess​(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