View Javadoc

1   /*
2    * Copyright (2005-2009) Schibsted Søk AS
3    * This file is part of SESAT.
4    *
5    *   SESAT is free software: you can redistribute it and/or modify
6    *   it under the terms of the GNU Affero General Public License as published by
7    *   the Free Software Foundation, either version 3 of the License, or
8    *   (at your option) any later version.
9    *
10   *   SESAT is distributed in the hope that it will be useful,
11   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *   GNU Affero General Public License for more details.
14   *
15   *   You should have received a copy of the GNU Affero General Public License
16   *   along with SESAT.  If not, see <http://www.gnu.org/licenses/>.
17   */
18  package no.sesat.search.user;
19  
20  import java.io.Serializable;
21  import java.util.Date;
22  
23  import java.util.Set;
24  
25  
26  /**
27   * A light weight user object used for remote services. Objects of this class is immutable.
28   * Since it's built of only simple Java classes, serialization is no problem.
29   *
30   * @version <tt>$Id: BasicUser.java 23 2009-06-23 16:17:24Z ssmiweve $</tt>
31   */
32  public interface BasicUser extends Serializable {
33  
34      // See Javadoc in implementing class.
35  
36      Long getUserId();
37  
38      String getFirstName();
39  
40      String getLastName();
41  
42      String getFullName();
43  
44      /** @deprecated only delegates to getFullName() **/
45      String getUsername();
46  
47      Date getCreated();
48  
49      Date getLastLogin();
50  
51      String getProperty(String key);
52  
53      Set<String> getPropertyKeys();
54  
55      /**
56       * Returns the login key that should be used for the next login. This is only populated if the user
57       * where fetched by using a login key.
58       *
59       * @return the login key that should be used for the next login
60       */
61      String getNextLoginKey();
62  
63      /**
64       * Set the login key that should be used for the next login. This is only populated if the user
65       * where fetched by using a login key.
66       *
67       * @param nextLoginKey the login key that should be used for the next login
68       */
69      void setNextLoginKey(final String nextLoginKey);
70  
71      /**
72       * Returns the update timestamp for the object. This is populated for login user objects to enable
73       * dirty check for the object.
74       *
75       * @return the update timestamp for the user object
76       */
77      Date getUpdateTimestamp();
78  
79      /**
80       * Set the update timestamp for the object. This is populated for login user objects to enable
81       * dirty check for the object.
82       *
83       * @param updateTimestamp the update timestamp for the user object
84       */
85      void setUpdateTimestamp(final Date updateTimestamp);
86  
87      /**
88       * Returns whether the user object is dirty and needs to be updated or not. The method will only work
89       * for user objects with a populated timestamp.
90       *
91       * @param timestamp the timestamp to check against
92       * @return if the user is dirty or not
93       */
94      boolean isDirty(final Date timestamp);
95  
96  }