/* * Juick * Copyright (C) 2008-2011, Ugnich Anton * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package com.juick; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import javax.xml.bind.annotation.*; /** * @author Ugnich Anton */ @XmlRootElement(name = "user", namespace = "http://juick.com/user") @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) public class User { private int uid = 0; private String name = null; private Object Avatar = null; private String FullName = null; private String JID = null; private int MessagesCount = 0; private String AuthHash = null; private boolean Banned = false; public User() { } public User(User u) { setUid(u.getUid()); setName(u.getName()); Avatar = u.Avatar; setFullName(u.getFullName()); setJID(u.getJID()); MessagesCount = u.MessagesCount; setAuthHash(u.getAuthHash()); Banned = u.Banned; } @Override public boolean equals(Object obj) { return obj == this || (obj instanceof User && ((User) obj).getUid() == this.getUid()); } @JsonProperty("uid") @XmlAttribute(name = "uid") public int getUid() { return uid; } public void setUid(int uid) { this.uid = uid; } @JsonProperty("uname") @XmlAttribute(name = "uname") public String getName() { return name; } public void setName(String name) { this.name = name; } @JsonProperty("fullname") @XmlTransient public String getFullName() { return FullName; } public void setFullName(String fullName) { FullName = fullName; } @JsonProperty("jid") public String getJID() { return JID; } public void setJID(String JID) { this.JID = JID; } @XmlTransient @JsonIgnore public String getAuthHash() { return AuthHash; } public void setAuthHash(String authHash) { AuthHash = authHash; } @JsonProperty("unreadCount") @XmlTransient public Integer getUnreadCount() { return MessagesCount; } public void setUnreadCount(Integer count) { MessagesCount = count; } @XmlTransient public boolean isBanned() { return Banned; } public void setBanned(boolean banned) { Banned = banned; } public Object getAvatar() { return Avatar; } public void setAvatar(Object avatar) { Avatar = avatar; } }