01: /**
02: * $Id: CommunityUser.java,v 1.3 2007/01/26 03:47:54 portalbld Exp $
03: * Copyright 2005 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.community.mc.impl.jdo.pc;
14:
15: /**
16: * JDO PC class to represent a community user.
17: */
18: public class CommunityUser {
19: private int roleId;
20: private String userName;
21: private Community community;
22: private String communityName;
23: private long creationTime;
24:
25: public CommunityUser() {
26: }
27:
28: public CommunityUser(String communityName, int roleId,
29: String userName, long creationTime) {
30: this .communityName = communityName;
31: this .roleId = roleId;
32: this .userName = userName;
33: this .creationTime = creationTime;
34: }
35:
36: public String getCommunityName() {
37: return communityName;
38: }
39:
40: public int getRoleId() {
41: return roleId;
42: }
43:
44: public String getUserName() {
45: return userName;
46: }
47:
48: /*
49: public void setCommunity(Community community) {
50: this.community = community;
51: this.communityName = community.getCommunityName();
52: }
53: */
54: public long getCreationTime() {
55: return creationTime;
56: }
57:
58: public void setCreationTime(long time) {
59: creationTime = time;
60: }
61:
62: public boolean equals(Object obj) {
63: if (obj == this ) {
64: return true;
65: }
66: if (!(obj instanceof CommunityUser)) {
67: return false;
68: }
69: CommunityUser other = (CommunityUser) obj;
70:
71: return getCommunityName().equals(other.getCommunityName())
72: && (getRoleId() == other.getRoleId())
73: && getUserName().equals(other.getUserName());
74: }
75:
76: public int hashCode() {
77: return getCommunityName().hashCode() ^ getRoleId()
78: ^ getUserName().hashCode();
79: }
80:
81: public String toString() {
82: // for debugging only
83: return "{ communityName=" + getCommunityName() + ", roleId="
84: + getRoleId() + ", userName=" + getUserName() + " }";
85: }
86: }
|