| Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 1 | package de.ids_mannheim.korap.user; |
| 2 | |
| Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 3 | import lombok.Getter; |
| 4 | import lombok.Setter; |
| 5 | import org.slf4j.Logger; |
| Michael Hanl | ac113e5 | 2016-01-19 15:49:20 +0100 | [diff] [blame^] | 6 | import org.slf4j.LoggerFactory; |
| Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 7 | |
| 8 | @Getter |
| 9 | @Setter |
| 10 | public class KorAPUser extends User { |
| Michael Hanl | ac113e5 | 2016-01-19 15:49:20 +0100 | [diff] [blame^] | 11 | private static Logger jlog = LoggerFactory.getLogger(KorAPUser.class); |
| Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 12 | private static final long serialVersionUID = -7108308497625884584L; |
| 13 | |
| 14 | //fixme: accountlink to shibboleth account |
| 15 | private String accountLink; |
| 16 | |
| 17 | private String password; |
| 18 | private String URIFragment; |
| 19 | private Long URIExpiration; |
| 20 | |
| 21 | protected KorAPUser(String username) { |
| 22 | super(username, 0); |
| 23 | this.URIFragment = ""; |
| 24 | this.URIExpiration = 0L; |
| 25 | } |
| 26 | |
| 27 | public KorAPUser(Integer id, String username) { |
| 28 | this(username); |
| 29 | this.setId(id); |
| 30 | } |
| 31 | |
| 32 | public KorAPUser() { |
| 33 | super(); |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | protected User clone() { |
| 38 | KorAPUser user = new KorAPUser(this.getUsername()); |
| 39 | user.setUsername(this.getUsername()); |
| 40 | user.setAccountCreation(this.getAccountCreation()); |
| 41 | return user; |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public int hashCode() { |
| 46 | int result = super.hashCode(); |
| 47 | result = 31 * result + (jlog != null ? jlog.hashCode() : 0); |
| 48 | result = 31 * result + (password != null ? password.hashCode() : 0); |
| 49 | result = 31 * result + (URIFragment != null ? |
| 50 | URIFragment.hashCode() : |
| 51 | 0); |
| 52 | result = 31 * result + (URIExpiration != null ? |
| 53 | URIExpiration.hashCode() : |
| 54 | 0); |
| 55 | return result; |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public boolean equals(Object o) { |
| 60 | if (this == o) |
| 61 | return true; |
| 62 | if (!(o instanceof KorAPUser)) |
| 63 | return false; |
| 64 | if (!super.equals(o)) |
| 65 | return false; |
| 66 | |
| 67 | KorAPUser korAPUser = (KorAPUser) o; |
| 68 | if (URIExpiration != korAPUser.URIExpiration) |
| 69 | return false; |
| 70 | if (URIFragment != null ? |
| 71 | !URIFragment.equals(korAPUser.URIFragment) : |
| 72 | korAPUser.URIFragment != null) |
| 73 | return false; |
| 74 | return true; |
| 75 | } |
| 76 | } |