01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/course-management/tags/sakai_2-4-1/cm-impl/hibernate-impl/hibernate/src/java/org/sakaiproject/coursemanagement/impl/SectionCategoryCmImpl.java $
03: * $Id: SectionCategoryCmImpl.java 17958 2006-11-03 23:11:37Z jholtzman@berkeley.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.coursemanagement.impl;
21:
22: import org.apache.commons.lang.builder.EqualsBuilder;
23: import org.apache.commons.lang.builder.HashCodeBuilder;
24: import org.sakaiproject.coursemanagement.api.SectionCategory;
25:
26: public class SectionCategoryCmImpl implements SectionCategory {
27: protected String categoryCode;
28: protected String categoryDescription;
29:
30: public SectionCategoryCmImpl() {
31: }
32:
33: public SectionCategoryCmImpl(String categoryCode,
34: String categoryDescription) {
35: this .categoryCode = categoryCode;
36: this .categoryDescription = categoryDescription;
37: }
38:
39: public String getCategoryCode() {
40: return categoryCode;
41: }
42:
43: public void setCategoryCode(String categoryCode) {
44: this .categoryCode = categoryCode;
45: }
46:
47: public String getCategoryDescription() {
48: return categoryDescription;
49: }
50:
51: public void setCategoryDescription(String categoryDescription) {
52: this .categoryDescription = categoryDescription;
53: }
54:
55: public int hashCode() {
56: return new HashCodeBuilder(17, 37).append(categoryCode).append(
57: categoryDescription).toHashCode();
58: }
59:
60: public boolean equals(Object obj) {
61: SectionCategoryCmImpl other = null;
62: try {
63: other = (SectionCategoryCmImpl) obj;
64: } catch (ClassCastException cce) {
65: return false;
66: }
67:
68: return new EqualsBuilder().append(categoryCode,
69: other.getCategoryCode()).append(categoryDescription,
70: other.getCategoryDescription()).isEquals();
71: }
72:
73: }
|