Statistics
| Branch: | Tag: | Revision:

root / src / gr / grnet / pithos / web / client / grouptree / User.java @ e6e9f6e6

History | View | Annotate | Download (2.6 kB)

1 d5c6298f Christos Stathis
/*
2 e6e9f6e6 Christos KK Loverdos
 * Copyright 2011-2013 GRNET S.A. All rights reserved.
3 d5c6298f Christos Stathis
 *
4 d5c6298f Christos Stathis
 * Redistribution and use in source and binary forms, with or
5 d5c6298f Christos Stathis
 * without modification, are permitted provided that the following
6 d5c6298f Christos Stathis
 * conditions are met:
7 d5c6298f Christos Stathis
 *
8 d5c6298f Christos Stathis
 *   1. Redistributions of source code must retain the above
9 d5c6298f Christos Stathis
 *      copyright notice, this list of conditions and the following
10 d5c6298f Christos Stathis
 *      disclaimer.
11 d5c6298f Christos Stathis
 *
12 d5c6298f Christos Stathis
 *   2. Redistributions in binary form must reproduce the above
13 d5c6298f Christos Stathis
 *      copyright notice, this list of conditions and the following
14 d5c6298f Christos Stathis
 *      disclaimer in the documentation and/or other materials
15 d5c6298f Christos Stathis
 *      provided with the distribution.
16 d5c6298f Christos Stathis
 *
17 d5c6298f Christos Stathis
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
18 d5c6298f Christos Stathis
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 d5c6298f Christos Stathis
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 d5c6298f Christos Stathis
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
21 d5c6298f Christos Stathis
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 d5c6298f Christos Stathis
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 d5c6298f Christos Stathis
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 d5c6298f Christos Stathis
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 d5c6298f Christos Stathis
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 d5c6298f Christos Stathis
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 d5c6298f Christos Stathis
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 d5c6298f Christos Stathis
 * POSSIBILITY OF SUCH DAMAGE.
29 d5c6298f Christos Stathis
 *
30 d5c6298f Christos Stathis
 * The views and conclusions contained in the software and
31 d5c6298f Christos Stathis
 * documentation are those of the authors and should not be
32 d5c6298f Christos Stathis
 * interpreted as representing official policies, either expressed
33 d5c6298f Christos Stathis
 * or implied, of GRNET S.A.
34 d5c6298f Christos Stathis
 */
35 d5c6298f Christos Stathis
36 4baffab1 Christos Stathis
package gr.grnet.pithos.web.client.grouptree;
37 d5c6298f Christos Stathis
38 d5c6298f Christos Stathis
39 c8f8690d Christos KK Loverdos
public final class User {
40 c8f8690d Christos KK Loverdos
    private final String userID;
41 c8f8690d Christos KK Loverdos
42 c8f8690d Christos KK Loverdos
    private final String group;
43 c8f8690d Christos KK Loverdos
44 c8f8690d Christos KK Loverdos
    public User(String name, String group) {
45 c8f8690d Christos KK Loverdos
        this.userID = name;
46 c8f8690d Christos KK Loverdos
        this.group = group;
47 c8f8690d Christos KK Loverdos
    }
48 c8f8690d Christos KK Loverdos
49 c8f8690d Christos KK Loverdos
    public String getUserID() {
50 c8f8690d Christos KK Loverdos
        return this.userID;
51 c8f8690d Christos KK Loverdos
    }
52 c8f8690d Christos KK Loverdos
53 c8f8690d Christos KK Loverdos
    public String getGroup() {
54 c8f8690d Christos KK Loverdos
        return this.group;
55 d5c6298f Christos Stathis
    }
56 d5c6298f Christos Stathis
57 c8f8690d Christos KK Loverdos
    @Override
58 c8f8690d Christos KK Loverdos
    public boolean equals(Object o) {
59 c8f8690d Christos KK Loverdos
        if(this == o) {
60 c8f8690d Christos KK Loverdos
            return true;
61 c8f8690d Christos KK Loverdos
        }
62 c8f8690d Christos KK Loverdos
        if(o == null || getClass() != o.getClass()) {
63 c8f8690d Christos KK Loverdos
            return false;
64 c8f8690d Christos KK Loverdos
        }
65 c8f8690d Christos KK Loverdos
66 c8f8690d Christos KK Loverdos
        User user = (User) o;
67 c8f8690d Christos KK Loverdos
68 c8f8690d Christos KK Loverdos
        if(group != null ? !group.equals(user.group) : user.group != null) {
69 c8f8690d Christos KK Loverdos
            return false;
70 c8f8690d Christos KK Loverdos
        }
71 c8f8690d Christos KK Loverdos
        if(userID != null ? !userID.equals(user.userID) : user.userID != null) {
72 c8f8690d Christos KK Loverdos
            return false;
73 c8f8690d Christos KK Loverdos
        }
74 c8f8690d Christos KK Loverdos
75 c8f8690d Christos KK Loverdos
        return true;
76 d5c6298f Christos Stathis
    }
77 d5c6298f Christos Stathis
78 c8f8690d Christos KK Loverdos
    @Override
79 c8f8690d Christos KK Loverdos
    public int hashCode() {
80 c8f8690d Christos KK Loverdos
        int result = userID != null ? userID.hashCode() : 0;
81 c8f8690d Christos KK Loverdos
        result = 31 * result + (group != null ? group.hashCode() : 0);
82 c8f8690d Christos KK Loverdos
        return result;
83 c8f8690d Christos KK Loverdos
    }
84 d5c6298f Christos Stathis
}