001 /*
002 * SonarQube, open source software quality management tool.
003 * Copyright (C) 2008-2014 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * SonarQube is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * SonarQube is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
019 */
020 package org.sonar.api.database.model;
021
022 import org.apache.commons.lang.builder.ToStringBuilder;
023 import org.apache.commons.lang.builder.ToStringStyle;
024 import org.sonar.api.database.BaseIdentifiable;
025
026 import javax.persistence.Column;
027 import javax.persistence.Entity;
028 import javax.persistence.Table;
029
030 /**
031 * @since 2.2
032 */
033 @Entity
034 @Table(name = "users")
035 public class User extends BaseIdentifiable {
036
037 @Column(name = "login", updatable = true, nullable = true, length = 255)
038 private String login;
039
040 @Column(name = "name", updatable = true, nullable = true, length = 200)
041 private String name;
042
043 @Column(name = "email", updatable = true, nullable = true, length = 100)
044 private String email;
045
046 public String getLogin() {
047 return login;
048 }
049
050 public User setLogin(String login) {
051 this.login = login;
052 return this;
053 }
054
055 public String getName() {
056 return name;
057 }
058
059 public User setName(String name) {
060 this.name = name;
061 return this;
062 }
063
064 public String getEmail() {
065 return email;
066 }
067
068 public User setEmail(String email) {
069 this.email = email;
070 return this;
071 }
072
073 @Override
074 public boolean equals(Object o) {
075 if (this == o) {
076 return true;
077 }
078 if (o == null || getClass() != o.getClass()) {
079 return false;
080 }
081 User user = (User) o;
082 return login.equals(user.login);
083 }
084
085 @Override
086 public int hashCode() {
087 return login.hashCode();
088 }
089
090 @Override
091 public String toString() {
092 return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
093 }
094 }