001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.data.osm; 003 004import java.util.Date; 005import java.util.List; 006 007import org.openstreetmap.josm.data.coor.LatLon; 008import org.openstreetmap.josm.tools.date.DateUtils; 009 010/** 011 * Public user information. 012 * @since 2115 013 */ 014public class UserInfo { 015 /** the user id */ 016 private int id; 017 /** the display name */ 018 private String displayName; 019 /** the date this user was created */ 020 private Date accountCreated; 021 /** the home location */ 022 private LatLon home; 023 /** the zoom level for the home location */ 024 private int homeZoom; 025 /** the profile description */ 026 private String description; 027 /** the list of preferred languages */ 028 private List<String> languages; 029 /** the number of unread messages */ 030 private int unreadMessages; 031 032 /** 033 * Constructs a new {@code UserInfo}. 034 */ 035 public UserInfo() { 036 id = 0; 037 } 038 039 /** 040 * Returns the user identifier. 041 * @return the user identifier 042 */ 043 public int getId() { 044 return id; 045 } 046 047 /** 048 * Sets the user identifier. 049 * @param id the user identifier 050 */ 051 public void setId(int id) { 052 this.id = id; 053 } 054 055 /** 056 * Returns the display name. 057 * @return the display name 058 */ 059 public String getDisplayName() { 060 return displayName; 061 } 062 063 /** 064 * Sets the display name. 065 * @param displayName display name 066 */ 067 public void setDisplayName(String displayName) { 068 this.displayName = displayName; 069 } 070 071 /** 072 * Returns the date at which the account has been created. 073 * @return the user account creation date 074 */ 075 public Date getAccountCreated() { 076 return DateUtils.cloneDate(accountCreated); 077 } 078 079 /** 080 * Sets the date at which the account has been created. 081 * @param accountCreated user account creation date 082 */ 083 public void setAccountCreated(Date accountCreated) { 084 this.accountCreated = DateUtils.cloneDate(accountCreated); 085 } 086 087 /** 088 * Returns the user home coordinates, if set. 089 * @return the user home lat/lon or null 090 */ 091 public LatLon getHome() { 092 return home; 093 } 094 095 /** 096 * Sets the user home coordinates. 097 * @param home user home lat/lon or null 098 */ 099 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}