001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/portal/api/src/java/org/theospi/portfolio/portal/model/ToolCategory.java $
003: * $Id: ToolCategory.java 21907 2007-02-24 08:16:07Z john.ellis@rsmart.com $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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.theospi.portfolio.portal.model;
021:
022: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
023:
024: import java.util.Map;
025: import java.util.Hashtable;
026:
027: /**
028: * Created by IntelliJ IDEA.
029: * User: John Ellis
030: * Date: Feb 11, 2006
031: * Time: 8:24:08 AM
032: * To change this template use File | Settings | File Templates.
033: */
034: public class ToolCategory extends IdentifiableObject implements
035: Comparable, Cloneable {
036:
037: public static final String UNCATEGORIZED_KEY = "org.theospi.portfolio.portal.model.ToolCategory.uncategorized";
038:
039: public static final ToolCategory UNCATEGORIZED = new ToolCategory(
040: UNCATEGORIZED_KEY);
041:
042: private String key;
043: private String description;
044: private int order;
045: private String homePagePath;
046: private Map pages;
047: private Map tools;
048:
049: public ToolCategory() {
050: pages = new Hashtable();
051: }
052:
053: public ToolCategory(ToolCategory copy) {
054: this .key = copy.key;
055: this .order = copy.order;
056: this .homePagePath = copy.homePagePath;
057: this .tools = copy.tools;
058: }
059:
060: protected ToolCategory(String key) {
061: this .key = key;
062: }
063:
064: public String getKey() {
065: return key;
066: }
067:
068: public void setKey(String key) {
069: this .key = key;
070: }
071:
072: public int getOrder() {
073: return order;
074: }
075:
076: public void setOrder(int order) {
077: this .order = order;
078: }
079:
080: public int compareTo(Object o) {
081: Integer order = new Integer(getOrder());
082: Integer other = new Integer(((ToolCategory) o).getOrder());
083: if (other.equals(order)
084: && !getKey().equals(((ToolCategory) o).getKey())) {
085: return getKey().equals(UNCATEGORIZED_KEY) ? 1 : -1;
086: }
087: return order.compareTo(other);
088: }
089:
090: public Map getTools() {
091: return tools;
092: }
093:
094: public void setTools(Map tools) {
095: this .tools = tools;
096: }
097:
098: public Object clone() throws CloneNotSupportedException {
099: return super .clone();
100: }
101:
102: public String getHomePagePath() {
103: return homePagePath;
104: }
105:
106: public void setHomePagePath(String homePagePath) {
107: this .homePagePath = homePagePath;
108: }
109:
110: public boolean equals(Object o) {
111: if (this == o) {
112: return true;
113: }
114: if (o == null || getClass() != o.getClass()) {
115: return false;
116: }
117:
118: final ToolCategory that = (ToolCategory) o;
119:
120: if (order != that.order) {
121: return false;
122: }
123: if (key != null ? !key.equals(that.key) : that.key != null) {
124: return false;
125: }
126:
127: return true;
128: }
129:
130: public int hashCode() {
131: int result;
132: result = (key != null ? key.hashCode() : 0);
133: result = 29 * result + order;
134: return result;
135: }
136:
137: public Map getPages() {
138: return pages;
139: }
140:
141: public void setPages(Map pages) {
142: this .pages = pages;
143: }
144:
145: public String getDescription() {
146: return description;
147: }
148:
149: public void setDescription(String description) {
150: this.description = description;
151: }
152:
153: }
|