001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.data.notes; 003 004import java.util.Date; 005 006import org.openstreetmap.josm.data.osm.User; 007 008/** 009 * Represents a comment made on a note. All notes have at least on comment 010 * which is the comment the note was opened with. Comments are immutable. 011 */ 012public class NoteComment { 013 014 private String text; 015 private User user; 016 private Date commentTimestamp; 017 private Action action; 018 019 //not currently used. I'm planning on using this to keep track of new actions that need to be uploaded 020 private boolean isNew; 021 022 /** 023 * Every comment has an associated action. Some comments are just comments 024 * while others indicate the note being opened, closed or reopened 025 */ 026 public enum Action { 027 opened, 028 closed, 029 reopened, 030 commented 031 } 032 033 /** 034 * @param createDate The time at which this comment was added 035 * @param user JOSM User object of the user who created the comment 036 * @param commentText The text left by the user. Is sometimes blank 037 * @param action The action associated with this comment 038 * @param isNew Whether or not this comment is new and needs to be uploaded 039 */ 040 public NoteComment(Date createDate, User user, String commentText, Action action, boolean isNew) { 041 this.text = commentText; 042 this.user = user; 043 this.commentTimestamp = createDate; 044 this.action = action; 045 this.isNew = isNew; 046 } 047 048 /** @return Plain text of user's comment */ 049 public String getText() { 050 return text; 051 } 052 053 /** @return JOSM's User object for the user who made this comment */ 054 public User getUser() { 055 return user; 056 } 057 058 /** @return The time at which this comment was created */ 059 public Date getCommentTimestamp() { 060 return commentTimestamp; 061 } 062 063 /** @return the action associated with this note */ 064 public Action getNoteAction() { 065 return action; 066 } 067 068 public void setNew(boolean isNew) { 069 this.isNew = isNew; 070 } 071 072 /** @return true if this is a new comment/action and needs to be uploaded to the API */ 073 public boolean isNew() { 074 return isNew; 075 } 076}