source: josm/trunk/src/org/openstreetmap/josm/data/notes/NoteComment.java@ 9600

Last change on this file since 9600 was 9569, checked in by Don-vip, 8 years ago

fix #12393 - Fix parsing note hiding events (patch by ToeBee) + add non-regression unit test

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.notes;
3
4import java.util.Date;
5
6import org.openstreetmap.josm.data.osm.User;
7
8/**
9 * Represents a comment made on a note. All notes have at least on comment
10 * which is the comment the note was opened with. Comments are immutable.
11 */
12public class NoteComment {
13
14 private final String text;
15 private final User user;
16 private final Date commentTimestamp;
17 private final Action action;
18
19 //not currently used. I'm planning on using this to keep track of new actions that need to be uploaded
20 private boolean isNew;
21
22 /**
23 * Every comment has an associated action. Some comments are just comments
24 * while others indicate the note being opened, closed or reopened
25 */
26 public enum Action {
27 opened,
28 closed,
29 reopened,
30 commented,
31 hidden
32 }
33
34 /**
35 * @param createDate The time at which this comment was added
36 * @param user JOSM User object of the user who created the comment
37 * @param commentText The text left by the user. Is sometimes blank
38 * @param action The action associated with this comment
39 * @param isNew Whether or not this comment is new and needs to be uploaded
40 */
41 public NoteComment(Date createDate, User user, String commentText, Action action, boolean isNew) {
42 this.text = commentText;
43 this.user = user;
44 this.commentTimestamp = createDate;
45 this.action = action;
46 this.isNew = isNew;
47 }
48
49 /** @return Plain text of user's comment */
50 public String getText() {
51 return text;
52 }
53
54 /** @return JOSM's User object for the user who made this comment */
55 public User getUser() {
56 return user;
57 }
58
59 /** @return The time at which this comment was created */
60 public Date getCommentTimestamp() {
61 return commentTimestamp;
62 }
63
64 /** @return the action associated with this note */
65 public Action getNoteAction() {
66 return action;
67 }
68
69 public void setNew(boolean isNew) {
70 this.isNew = isNew;
71 }
72
73 /** @return true if this is a new comment/action and needs to be uploaded to the API */
74 public boolean isNew() {
75 return isNew;
76 }
77}
Note: See TracBrowser for help on using the repository browser.