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