01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.client.security;
19:
20: import java.io.Serializable;
21:
22: /**
23: * Simple structure for a principal.
24: */
25: final public class Principal implements Serializable {
26:
27: private String groupId, id;
28:
29: public Principal() {
30: }
31:
32: public Principal(String groupId, String id) {
33: this .groupId = groupId;
34: this .id = id;
35: }
36:
37: public void setGroupId(String groupId) {
38: this .groupId = groupId;
39: }
40:
41: public String getGroupId() {
42: return groupId;
43: }
44:
45: public void setId(String id) {
46: this .id = id;
47: }
48:
49: public String getId() {
50: return id;
51: }
52:
53: public String getDisplayName() {
54: return groupId + ":" + id;
55: }
56:
57: public boolean equals(Object o) {
58: if (o instanceof Principal) {
59: Principal p = (Principal) o;
60: if (p.getId().equals(id) && p.getGroupId().equals(groupId)) {
61: return true;
62: }
63: }
64: return false;
65: }
66:
67: public int hashCode() {
68: return -1;
69: }
70:
71: }
|