Ignore:
Timestamp:
2011-12-28T20:40:46+01:00 (12 years ago)
Author:
Don-vip
Message:

fix #7194 - Reworking of osmChange downloads (Fail to update a way loaded from osmChange that have been deleted after)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java

    r3083 r4734  
    2222 * It can either download the object including or not including its immediate children.
    2323 * The former case is called a "full download".
     24 *
     25 * It can also download a specific version of the object (however, "full" download is not possible
     26 * in that case).
    2427 *
    2528 */
     
    2932    /** true if a full download is required, i.e. a download including the immediate children */
    3033    private boolean full;
     34    /** the specific version number, if required (incompatible with full), or -1 else */
     35    private int version;
    3136
    3237    /**
     
    4146     */
    4247    public OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full) throws IllegalArgumentException {
     48        this(id, type, full, -1);
     49    }
     50
     51    /**
     52     * Creates a new server object reader for a given id and a primitive type.
     53     *
     54     * @param id the object id. > 0 required.
     55     * @param type the type. Must not be null.
     56     * @param version the specific version number, if required; -1, otherwise
     57     * @throws IllegalArgumentException thrown if id <= 0
     58     * @throws IllegalArgumentException thrown if type is null
     59     */
     60    public OsmServerObjectReader(long id, OsmPrimitiveType type, int version) throws IllegalArgumentException {
     61        this(id, type, false, version);
     62    }
     63
     64    protected OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full, int version) throws IllegalArgumentException {
    4365        if (id <= 0)
    4466            throw new IllegalArgumentException(MessageFormat.format("Expected value > 0 for parameter ''{0}'', got {1}", "id", id));
     
    4668        this.id = new SimplePrimitiveId(id, type);
    4769        this.full = full;
     70        this.version = version;
    4871    }
    4972
     
    5881     */
    5982    public OsmServerObjectReader(PrimitiveId id, boolean full) {
     83        this(id, full, -1);
     84    }
     85
     86    /**
     87     * Creates a new server object reader for an object with the given <code>id</code>
     88     *
     89     * @param id the object id. Must not be null. Unique id > 0 required.
     90     * @param version the specific version number, if required; -1, otherwise
     91     * @throws IllegalArgumentException thrown if id is null
     92     * @throws IllegalArgumentException thrown if id.getUniqueId() <= 0
     93     */
     94    public OsmServerObjectReader(PrimitiveId id, int version) {
     95        this(id, false, version);
     96    }
     97
     98    protected OsmServerObjectReader(PrimitiveId id, boolean full, int version) {
    6099        CheckParameterUtil.ensureValidPrimitiveId(id, "id");
    61100        this.id = id;
    62101        this.full = full;
     102        this.version = version;
    63103    }
    64104
     
    87127            if (full && ! id.getType().equals(OsmPrimitiveType.NODE)) {
    88128                sb.append("/full");
     129            } else if (version > 0) {
     130                sb.append("/"+version);
    89131            }
    90132
Note: See TracChangeset for help on using the changeset viewer.