1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm;
|
---|
3 |
|
---|
4 | import java.util.Date;
|
---|
5 | import java.util.List;
|
---|
6 |
|
---|
7 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
8 | import org.openstreetmap.josm.tools.date.DateUtils;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Public user information.
|
---|
12 | * @since 2115
|
---|
13 | */
|
---|
14 | public class UserInfo {
|
---|
15 | /** the user id */
|
---|
16 | private int id;
|
---|
17 | /** the display name */
|
---|
18 | private String displayName;
|
---|
19 | /** the date this user was created */
|
---|
20 | private Date accountCreated;
|
---|
21 | /** the home location */
|
---|
22 | private LatLon home;
|
---|
23 | /** the zoom level for the home location */
|
---|
24 | private int homeZoom;
|
---|
25 | /** the profile description */
|
---|
26 | private String description;
|
---|
27 | /** the list of preferred languages */
|
---|
28 | private List<String> languages;
|
---|
29 | /** the number of unread messages */
|
---|
30 | private int unreadMessages;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Constructs a new {@code UserInfo}.
|
---|
34 | */
|
---|
35 | public UserInfo() {
|
---|
36 | id = 0;
|
---|
37 | }
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Returns the user identifier.
|
---|
41 | * @return the user identifier
|
---|
42 | */
|
---|
43 | public int getId() {
|
---|
44 | return id;
|
---|
45 | }
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Sets the user identifier.
|
---|
49 | * @param id the user identifier
|
---|
50 | */
|
---|
51 | public void setId(int id) {
|
---|
52 | this.id = id;
|
---|
53 | }
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Returns the display name.
|
---|
57 | * @return the display name
|
---|
58 | */
|
---|
59 | public String getDisplayName() {
|
---|
60 | return displayName;
|
---|
61 | }
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Sets the display name.
|
---|
65 | * @param displayName display name
|
---|
66 | */
|
---|
67 | public void setDisplayName(String displayName) {
|
---|
68 | this.displayName = displayName;
|
---|
69 | }
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * Returns the date at which the account has been created.
|
---|
73 | * @return the user account creation date
|
---|
74 | */
|
---|
75 | public Date getAccountCreated() {
|
---|
76 | return DateUtils.cloneDate(accountCreated);
|
---|
77 | }
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Sets the date at which the account has been created.
|
---|
81 | * @param accountCreated user account creation date
|
---|
82 | */
|
---|
83 | public void setAccountCreated(Date accountCreated) {
|
---|
84 | this.accountCreated = DateUtils.cloneDate(accountCreated);
|
---|
85 | }
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Returns the user home coordinates, if set.
|
---|
89 | * @return the user home lat/lon or null
|
---|
90 | */
|
---|
91 | public LatLon getHome() {
|
---|
92 | return home;
|
---|
93 | }
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Sets the user home coordinates.
|
---|
97 | * @param home user home lat/lon or null
|
---|
98 | */
|
---|
99 | public void setHome(LatLon home) {
|
---|
100 | this.home = home;
|
---|
101 | }
|
---|
102 |
|
---|
103 | /**
|
---|
104 | * Returns the public account description.
|
---|
105 | * @return the public account description
|
---|
106 | */
|
---|
107 | public String getDescription() {
|
---|
108 | return description;
|
---|
109 | }
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * Sets the public account description.
|
---|
113 | * @param description public account description
|
---|
114 | */
|
---|
115 | public void setDescription(String description) {
|
---|
116 | this.description = description;
|
---|
117 | }
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Returns the list of preferred languages.
|
---|
121 | * @return the list of preferred languages
|
---|
122 | */
|
---|
123 | public List<String> getLanguages() {
|
---|
124 | return languages;
|
---|
125 | }
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * Sets the list of preferred languages.
|
---|
129 | * @param languages list of preferred languages
|
---|
130 | */
|
---|
131 | public void setLanguages(List<String> languages) {
|
---|
132 | this.languages = languages;
|
---|
133 | }
|
---|
134 |
|
---|
135 | /**
|
---|
136 | * Returns the user home zoom level.
|
---|
137 | * @return the user home zoom level
|
---|
138 | */
|
---|
139 | public int getHomeZoom() {
|
---|
140 | return homeZoom;
|
---|
141 | }
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * Sets the user home zoom level.
|
---|
145 | * @param homeZoom user home zoom level
|
---|
146 | */
|
---|
147 | public void setHomeZoom(int homeZoom) {
|
---|
148 | this.homeZoom = homeZoom;
|
---|
149 | }
|
---|
150 |
|
---|
151 | /**
|
---|
152 | * Replies the number of unread messages
|
---|
153 | * @return the number of unread messages
|
---|
154 | * @since 6349
|
---|
155 | */
|
---|
156 | public final int getUnreadMessages() {
|
---|
157 | return unreadMessages;
|
---|
158 | }
|
---|
159 |
|
---|
160 | /**
|
---|
161 | * Sets the number of unread messages
|
---|
162 | * @param unreadMessages the number of unread messages
|
---|
163 | * @since 6349
|
---|
164 | */
|
---|
165 | public final void setUnreadMessages(int unreadMessages) {
|
---|
166 | this.unreadMessages = unreadMessages;
|
---|
167 | }
|
---|
168 | }
|
---|