Class Note
- java.lang.Object
-
- org.openstreetmap.josm.data.notes.Note
-
public class Note extends java.lang.Object
A map note. It always has at least one comment since a comment is required to create a note on osm.org.- Since:
- 7451
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Note.State
Note state
-
Field Summary
Fields Modifier and Type Field Description private java.time.Instant
closedAt
private java.util.List<NoteComment>
comments
private java.time.Instant
createdAt
static java.util.Comparator<Note>
DATE_COMPARATOR
Sorts notes strictly by creation datestatic java.util.Comparator<Note>
DEFAULT_COMPARATOR
Sorts notes in the following order: Open notes Closed notes New notes Within each subgroup it sorts by IDprivate long
id
static java.util.Comparator<Note>
LAST_ACTION_COMPARATOR
Sorts notes by the last modified dateprivate LatLon
latLon
private Note.State
state
static java.util.Comparator<Note>
USER_COMPARATOR
Sorts notes by user, then creation date
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addComment(NoteComment comment)
Adds a comment.boolean
equals(java.lang.Object obj)
java.time.Instant
getClosedAt()
Returns the date at which this note was closed.java.util.List<NoteComment>
getComments()
Returns the list of comments associated with this note.java.time.Instant
getCreatedAt()
Returns the date at which this note was submitted.NoteComment
getFirstComment()
Returns the comment that was submitted by the user when creating the notelong
getId()
Returns the unique OSM ID of this note.NoteComment
getLastComment()
Returns the last comment, ornull
.LatLon
getLatLon()
Returns the geographic location of the note.Note.State
getState()
Returns the open or closed state of this note.private java.lang.String
getUserName()
int
hashCode()
void
setClosedAt(java.time.Instant closedAt)
Sets date at which this note has been closed.void
setCreatedAt(java.time.Instant createdAt)
Sets date at which this note has been created.void
setId(long id)
Sets note id.void
setState(Note.State state)
Sets the note state.java.lang.String
toString()
void
updateWith(Note note)
Copies values from a new note into an existing one.
-
-
-
Field Detail
-
DEFAULT_COMPARATOR
public static final java.util.Comparator<Note> DEFAULT_COMPARATOR
Sorts notes in the following order:- Open notes
- Closed notes
- New notes
-
DATE_COMPARATOR
public static final java.util.Comparator<Note> DATE_COMPARATOR
Sorts notes strictly by creation date
-
USER_COMPARATOR
public static final java.util.Comparator<Note> USER_COMPARATOR
Sorts notes by user, then creation date
-
LAST_ACTION_COMPARATOR
public static final java.util.Comparator<Note> LAST_ACTION_COMPARATOR
Sorts notes by the last modified date
-
id
private long id
-
createdAt
private java.time.Instant createdAt
-
closedAt
private java.time.Instant closedAt
-
state
private Note.State state
-
comments
private java.util.List<NoteComment> comments
-
-
Method Detail
-
getId
public long getId()
Returns the unique OSM ID of this note.- Returns:
- The unique OSM ID of this note
-
setId
public void setId(long id)
Sets note id.- Parameters:
id
- OSM ID of this note
-
getLatLon
public LatLon getLatLon()
Returns the geographic location of the note.- Returns:
- The geographic location of the note
-
getCreatedAt
public java.time.Instant getCreatedAt()
Returns the date at which this note was submitted.- Returns:
- Date that this note was submitted
-
setCreatedAt
public void setCreatedAt(java.time.Instant createdAt)
Sets date at which this note has been created.- Parameters:
createdAt
- date at which this note has been created
-
getClosedAt
public java.time.Instant getClosedAt()
Returns the date at which this note was closed.- Returns:
- Date that this note was closed. Null if it is still open.
-
setClosedAt
public void setClosedAt(java.time.Instant closedAt)
Sets date at which this note has been closed.- Parameters:
closedAt
- date at which this note has been closed
-
getState
public Note.State getState()
Returns the open or closed state of this note.- Returns:
- The open or closed state of this note
-
setState
public void setState(Note.State state)
Sets the note state.- Parameters:
state
- note state (open or closed)
-
getComments
public java.util.List<NoteComment> getComments()
Returns the list of comments associated with this note.- Returns:
- An ordered list of comments associated with this note
-
getLastComment
@Nullable public NoteComment getLastComment()
Returns the last comment, ornull
.- Returns:
- the last comment, or
null
- Since:
- 11821
-
addComment
public void addComment(NoteComment comment)
Adds a comment.- Parameters:
comment
- note comment
-
getFirstComment
@Nullable public NoteComment getFirstComment()
Returns the comment that was submitted by the user when creating the note- Returns:
- First comment object
-
getUserName
@Nullable private java.lang.String getUserName()
-
updateWith
public void updateWith(Note note)
Copies values from a new note into an existing one. Used after a note has been updated on the server and the local copy needs refreshing.- Parameters:
note
- New values to copy
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-