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 {opened, closed, reopened, commented} 027 028 /** 029 * @param createDate The time at which this comment was added 030 * @param user JOSM User object of the user who created the comment 031 * @param commentText The text left by the user. Is sometimes blank 032 * @param action The action associated with this comment 033 * @param isNew Whether or not this comment is new and needs to be uploaded 034 */ 035 public NoteComment(Date createDate, User user, String commentText, Action action, Boolean isNew) { 036 this.text = commentText; 037 this.user = user; 038 this.commentTimestamp = createDate; 039 this.action = action; 040 this.isNew = isNew; 041 } 042 043 /** @return Plain text of user's comment */ 044 public String getText() { 045 return text; 046 } 047 048 /** @return JOSM's User object for the user who made this comment */ 049 public User getUser() { 050 return user; 051 } 052 053 /** @return The time at which this comment was created */ 054 public Date getCommentTimestamp() { 055 return commentTimestamp; 056 } 057 058 /** @return the action associated with this note */ 059 public Action getNoteAction() { 060 return action; 061 } 062 063 public void setIsNew(Boolean isNew) { 064 this.isNew = isNew; 065 } 066 067 /** @return true if this is a new comment/action and needs to be uploaded to the API */ 068 public Boolean getIsNew() { 069 return isNew; 070 } 071}