[2512] | 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;
|
---|
[11878] | 8 | import org.openstreetmap.josm.tools.date.DateUtils;
|
---|
[2512] | 9 |
|
---|
[11349] | 10 | /**
|
---|
| 11 | * Public user information.
|
---|
| 12 | * @since 2115
|
---|
| 13 | */
|
---|
[2512] | 14 | public class UserInfo {
|
---|
| 15 | /** the user id */
|
---|
[2686] | 16 | private int id;
|
---|
[2512] | 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;
|
---|
[6349] | 29 | /** the number of unread messages */
|
---|
| 30 | private int unreadMessages;
|
---|
[2512] | 31 |
|
---|
[6349] | 32 | /**
|
---|
| 33 | * Constructs a new {@code UserInfo}.
|
---|
| 34 | */
|
---|
[2512] | 35 | public UserInfo() {
|
---|
| 36 | id = 0;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
[11349] | 39 | /**
|
---|
| 40 | * Returns the user identifier.
|
---|
| 41 | * @return the user identifier
|
---|
| 42 | */
|
---|
[2686] | 43 | public int getId() {
|
---|
[2512] | 44 | return id;
|
---|
| 45 | }
|
---|
[8510] | 46 |
|
---|
[11349] | 47 | /**
|
---|
| 48 | * Sets the user identifier.
|
---|
| 49 | * @param id the user identifier
|
---|
| 50 | */
|
---|
[2686] | 51 | public void setId(int id) {
|
---|
[2512] | 52 | this.id = id;
|
---|
| 53 | }
|
---|
[8510] | 54 |
|
---|
[11349] | 55 | /**
|
---|
| 56 | * Returns the display name.
|
---|
| 57 | * @return the display name
|
---|
| 58 | */
|
---|
[2512] | 59 | public String getDisplayName() {
|
---|
| 60 | return displayName;
|
---|
| 61 | }
|
---|
[8510] | 62 |
|
---|
[11349] | 63 | /**
|
---|
| 64 | * Sets the display name.
|
---|
| 65 | * @param displayName display name
|
---|
| 66 | */
|
---|
[2512] | 67 | public void setDisplayName(String displayName) {
|
---|
| 68 | this.displayName = displayName;
|
---|
| 69 | }
|
---|
[8510] | 70 |
|
---|
[11349] | 71 | /**
|
---|
| 72 | * Returns the date at which the account has been created.
|
---|
| 73 | * @return the user account creation date
|
---|
| 74 | */
|
---|
[2512] | 75 | public Date getAccountCreated() {
|
---|
[11878] | 76 | return DateUtils.cloneDate(accountCreated);
|
---|
[2512] | 77 | }
|
---|
[8510] | 78 |
|
---|
[11349] | 79 | /**
|
---|
| 80 | * Sets the date at which the account has been created.
|
---|
| 81 | * @param accountCreated user account creation date
|
---|
| 82 | */
|
---|
[2512] | 83 | public void setAccountCreated(Date accountCreated) {
|
---|
[11878] | 84 | this.accountCreated = DateUtils.cloneDate(accountCreated);
|
---|
[2512] | 85 | }
|
---|
[8510] | 86 |
|
---|
[11349] | 87 | /**
|
---|
| 88 | * Returns the user home coordinates, if set.
|
---|
| 89 | * @return the user home lat/lon or null
|
---|
| 90 | */
|
---|
[2512] | 91 | public LatLon getHome() {
|
---|
| 92 | return home;
|
---|
| 93 | }
|
---|
[8510] | 94 |
|
---|
[11349] | 95 | /**
|
---|
| 96 | * Sets the user home coordinates.
|
---|
| 97 | * @param home user home lat/lon or null
|
---|
| 98 | */
|
---|
[2512] | 99 | public void setHome(LatLon home) {
|
---|
| 100 | this.home = home;
|
---|
| 101 | }
|
---|
[8510] | 102 |
|
---|
[11349] | 103 | /**
|
---|
| 104 | * Returns the public account description.
|
---|
| 105 | * @return the public account description
|
---|
| 106 | */
|
---|
[2512] | 107 | public String getDescription() {
|
---|
| 108 | return description;
|
---|
| 109 | }
|
---|
[8510] | 110 |
|
---|
[11349] | 111 | /**
|
---|
| 112 | * Sets the public account description.
|
---|
| 113 | * @param description public account description
|
---|
| 114 | */
|
---|
[2512] | 115 | public void setDescription(String description) {
|
---|
| 116 | this.description = description;
|
---|
| 117 | }
|
---|
[8510] | 118 |
|
---|
[11349] | 119 | /**
|
---|
| 120 | * Returns the list of preferred languages.
|
---|
| 121 | * @return the list of preferred languages
|
---|
| 122 | */
|
---|
[2512] | 123 | public List<String> getLanguages() {
|
---|
| 124 | return languages;
|
---|
| 125 | }
|
---|
[8510] | 126 |
|
---|
[11349] | 127 | /**
|
---|
| 128 | * Sets the list of preferred languages.
|
---|
| 129 | * @param languages list of preferred languages
|
---|
| 130 | */
|
---|
[2512] | 131 | public void setLanguages(List<String> languages) {
|
---|
| 132 | this.languages = languages;
|
---|
| 133 | }
|
---|
| 134 |
|
---|
[11349] | 135 | /**
|
---|
| 136 | * Returns the user home zoom level.
|
---|
| 137 | * @return the user home zoom level
|
---|
| 138 | */
|
---|
[2512] | 139 | public int getHomeZoom() {
|
---|
| 140 | return homeZoom;
|
---|
| 141 | }
|
---|
| 142 |
|
---|
[11349] | 143 | /**
|
---|
| 144 | * Sets the user home zoom level.
|
---|
| 145 | * @param homeZoom user home zoom level
|
---|
| 146 | */
|
---|
[2512] | 147 | public void setHomeZoom(int homeZoom) {
|
---|
| 148 | this.homeZoom = homeZoom;
|
---|
| 149 | }
|
---|
[6349] | 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 | }
|
---|
[2512] | 168 | }
|
---|