001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/msgcntr/trunk/messageforums-hbm/src/java/org/sakaiproject/component/app/messageforums/dao/hibernate/DBMembershipItemImpl.java $
003: * $Id: DBMembershipItemImpl.java 9227 2006-05-15 15:02:42Z cwen@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.component.app.messageforums.dao.hibernate;
021:
022: import org.sakaiproject.api.app.messageforums.DBMembershipItem;
023: import org.sakaiproject.api.app.messageforums.PermissionLevel;
024: import org.sakaiproject.api.app.messageforums.Topic;
025: import org.sakaiproject.api.app.messageforums.OpenForum;
026: import org.sakaiproject.api.app.messageforums.Area;
027:
028: /**
029: * DBMembership Item for storing different types of membership user/group/role
030: *
031: */
032: public class DBMembershipItemImpl extends MutableEntityImpl implements
033: DBMembershipItem, Comparable {
034:
035: private String name;
036: private Integer type;
037: private String permissionLevelName;
038: private PermissionLevel permissionLevel;
039: private Topic topic;
040: private OpenForum forum;
041: private Area area;
042:
043: public DBMembershipItemImpl() {
044:
045: }
046:
047: public String getName() {
048: return name;
049: }
050:
051: public void setName(String name) {
052: this .name = name;
053: }
054:
055: public Integer getType() {
056: return type;
057: }
058:
059: public void setType(Integer type) {
060: this .type = type;
061: }
062:
063: public String getPermissionLevelName() {
064: return permissionLevelName;
065: }
066:
067: public void setPermissionLevelName(String permissionLevelName) {
068: this .permissionLevelName = permissionLevelName;
069: }
070:
071: public PermissionLevel getPermissionLevel() {
072: return permissionLevel;
073: }
074:
075: public void setPermissionLevel(PermissionLevel permissionLevel) {
076: this .permissionLevel = permissionLevel;
077: }
078:
079: public Topic getTopic() {
080: return topic;
081: }
082:
083: public void setTopic(Topic topic) {
084: this .topic = topic;
085: }
086:
087: /**
088: * @see java.lang.Comparable#compareTo(java.lang.Object)
089: */
090: public int compareTo(Object o) {
091: DBMembershipItemImpl item = (DBMembershipItemImpl) o;
092:
093: int typeCompareResult = type.compareTo(item.type);
094:
095: if (typeCompareResult != 0) {
096: return typeCompareResult;
097: } else {
098: return this .name.compareTo(item.name);
099: }
100: }
101:
102: /**
103: * @see java.lang.Object#equals(java.lang.Object)
104: */
105: public boolean equals(Object obj) {
106: if (obj == this ) {
107: return true;
108: }
109:
110: if (!(obj instanceof DBMembershipItemImpl))
111: return false;
112:
113: DBMembershipItemImpl dbmi = (DBMembershipItemImpl) obj;
114:
115: return id == null ? dbmi.id == null : id.equals(dbmi.id);
116: }
117:
118: /**
119: * @see java.lang.Object#hashCode()
120: */
121: public int hashCode() {
122: return id.hashCode();
123: }
124:
125: public Area getArea() {
126: return area;
127: }
128:
129: public void setArea(Area area) {
130: this .area = area;
131: }
132:
133: public OpenForum getForum() {
134: return forum;
135: }
136:
137: public void setForum(OpenForum forum) {
138: this.forum = forum;
139: }
140:
141: }
|