001    /*
002     * Sonar, open source software quality management tool.
003     * Copyright (C) 2009 SonarSource SA
004     * mailto:contact AT sonarsource DOT com
005     *
006     * Sonar 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     * Sonar 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
017     * License along with Sonar; if not, write to the Free Software
018     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019     */
020    package org.sonar.api.database.model;
021    
022    import org.sonar.api.database.BaseIdentifiable;
023    
024    import javax.persistence.Column;
025    import javax.persistence.Entity;
026    import javax.persistence.Table;
027    
028    /**
029     * @since 2.2
030     */
031    @Entity
032    @Table(name = "users")
033    public class User extends BaseIdentifiable {
034    
035      @Column(name = "login", updatable = true, nullable = true, length = 40)
036      private String login;
037    
038      @Column(name = "name", updatable = true, nullable = true, length = 200)
039      private String name;
040    
041      @Column(name = "email", updatable = true, nullable = true, length = 100)
042      private String email;
043    
044      public String getLogin() {
045        return login;
046      }
047    
048      public User setLogin(String login) {
049        this.login = login;
050        return this;
051      }
052    
053      public String getName() {
054        return name;
055      }
056    
057      public User setName(String name) {
058        this.name = name;
059        return this;
060      }
061    
062      public String getEmail() {
063        return email;
064      }
065    
066      public User setEmail(String email) {
067        this.email = email;
068        return this;
069      }
070    
071      @Override
072      public boolean equals(Object o) {
073        if (this == o) {
074          return true;
075        }
076        if (o == null || getClass() != o.getClass()) {
077          return false;
078        }
079        User user = (User) o;
080        return login.equals(user.login);
081      }
082    
083      @Override
084      public int hashCode() {
085        return login.hashCode();
086      }
087    }