001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/authz/QualifierHierarchyData.java $
003: * $Id: QualifierHierarchyData.java 15173 2006-09-24 05:39:49Z ktsao@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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.tool.assessment.data.dao.authz;
021:
022: import java.io.Serializable;
023:
024: /**
025: * DOCUMENTATION PENDING
026: *
027: * @author $author$
028: * @version $Id: QualifierHierarchyData.java 15173 2006-09-24 05:39:49Z ktsao@stanford.edu $
029: */
030: public class QualifierHierarchyData implements Serializable {
031: /** Use serialVersionUID for interoperability. */
032: private final static long serialVersionUID = 9180085666292824370L;
033:
034: // private String childId;
035: // private String parentId;
036: private long childId;
037: private long parentId;
038: private QualifierData child;
039: private QualifierData parent;
040:
041: private Long surrogateKey;
042: private Integer lockId;
043:
044: public QualifierHierarchyData() {
045: }
046:
047: public QualifierHierarchyData(String childId, String parentId) {
048: // this.childId = childId;
049: // this.parentId = parentId;
050: this .childId = (new Long(childId)).longValue();
051: this .parentId = (new Long(parentId)).longValue();
052: }
053:
054: public QualifierHierarchyData(QualifierData child,
055: QualifierData parent) {
056: this .child = child;
057: this .parent = parent;
058: this .childId = child.getQualifierId();
059: this .parentId = parent.getQualifierId();
060: }
061:
062: //public String getChildId()
063: public long getChildId() {
064: return childId;
065: }
066:
067: // public void setChildId(String childId)
068: public void setChildId(long childId) {
069: this .childId = childId;
070: }
071:
072: //public String getParentId()
073: public long getParentId() {
074: return parentId;
075: }
076:
077: //public void setParentId(String parentId)
078: public void setParentId(long parentId) {
079: this .parentId = parentId;
080: }
081:
082: public QualifierData getChild() {
083: return this .child;
084: }
085:
086: public QualifierData getCParent() {
087: return this .parent;
088: }
089:
090: /**
091: * @return Returns the lockId.
092: */
093: public final Integer getLockId() {
094: return lockId;
095: }
096:
097: /**
098: * @param lockId The lockId to set.
099: */
100: public final void setLockId(Integer lockId) {
101: this .lockId = lockId;
102: }
103:
104: /**
105: * @return Returns the surrogateKey.
106: */
107: public final Long getSurrogateKey() {
108: return surrogateKey;
109: }
110:
111: /**
112: * @param surrogateKey The surrogateKey to set.
113: */
114: public final void setSurrogateKey(Long surrogateKey) {
115: this .surrogateKey = surrogateKey;
116: }
117:
118: public boolean equals(Object qualifierHierarchy) {
119: boolean returnValue = false;
120: if (this == qualifierHierarchy)
121: returnValue = true;
122: if (qualifierHierarchy != null
123: && qualifierHierarchy.getClass() == this .getClass()) {
124: QualifierHierarchyData q = (QualifierHierarchyData) qualifierHierarchy;
125: // if ((this.getChildId()).equals(q.getChildId())
126: // && (this.getParentId()).equals(q.getParentId()))
127: if ((this .getChildId()) == (q.getChildId())
128: && (this .getParentId()) == (q.getParentId()))
129: returnValue = true;
130: }
131: return returnValue;
132: }
133:
134: public int hashCode() {
135: //String s = this.childId+":"+(this.parentId).toString();
136: String s = Long.toString(this .childId) + ":"
137: + Long.toString(this.parentId);
138: return (s.hashCode());
139: }
140: }
|