Ignore:
Timestamp:
2014-11-04T02:33:20+01:00 (9 years ago)
Author:
Don-vip
Message:

see #10701 - parsing support of changeset discussions

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r7700 r7704  
    22package org.openstreetmap.josm.data.osm;
    33
     4import java.util.ArrayList;
    45import java.util.Collection;
     6import java.util.Collections;
    57import java.util.Date;
    68import java.util.HashMap;
     9import java.util.List;
    710import java.util.Map;
    811
     
    3942    /** the map of tags */
    4043    private Map<String,String> tags;
    41     /** indicates whether this changeset is incomplete. For an
    42      * incomplete changeset we only know its id
    43      */
     44    /** indicates whether this changeset is incomplete. For an incomplete changeset we only know its id */
    4445    private boolean incomplete;
    4546    /** the changeset content */
    4647    private ChangesetDataSet content = null;
     48    /** the changeset discussion */
     49    private List<ChangesetDiscussionComment> discussion = null;
    4750
    4851    /**
     
    328331        this.content = content;
    329332    }
     333
     334    /**
     335     * Replies the list of comments in the changeset discussion, if any.
     336     * @return the list of comments in the changeset discussion. May be empty but never null
     337     * @since 7704
     338     */
     339    public synchronized final List<ChangesetDiscussionComment> getDiscussion() {
     340        if (discussion == null) {
     341            return Collections.emptyList();
     342        }
     343        return new ArrayList<>(discussion);
     344    }
     345
     346    /**
     347     * Adds a comment to the changeset discussion.
     348     * @param comment the comment to add. Ignored if null
     349     * @since 7704
     350     */
     351    public synchronized final void addDiscussionComment(ChangesetDiscussionComment comment) {
     352        if (comment == null) {
     353            return;
     354        }
     355        if (discussion == null) {
     356            discussion = new ArrayList<>();
     357        }
     358        discussion.add(comment);
     359    }
    330360}
Note: See TracChangeset for help on using the changeset viewer.