01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/common/api/src/java/org/theospi/portfolio/shared/model/ItemDefinitionMimeType.java $
03: * $Id: ItemDefinitionMimeType.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 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.theospi.portfolio.shared.model;
21:
22: import java.io.Serializable;
23:
24: public class ItemDefinitionMimeType implements Serializable {
25: private String primary;
26: private String secondary;
27: static final long serialVersionUID = -6220810277272518156l;
28:
29: public ItemDefinitionMimeType() {
30: }
31:
32: public ItemDefinitionMimeType(String primary, String secondary) {
33: this .primary = primary;
34: this .secondary = secondary;
35: }
36:
37: public String getSecondary() {
38: return secondary;
39: }
40:
41: public void setSecondary(String secondary) {
42: this .secondary = secondary;
43: }
44:
45: public String getPrimary() {
46: return primary;
47: }
48:
49: public void setPrimary(String primary) {
50: this .primary = primary;
51: }
52:
53: public String getValue() {
54: return this .toString();
55: }
56:
57: public String toString() {
58: StringBuffer buffer = new StringBuffer();
59: buffer.append(getPrimary());
60: if (getSecondary() != null && getSecondary().length() > 0) {
61: buffer.append("/");
62: buffer.append(getSecondary());
63: }
64: return buffer.toString();
65: }
66:
67: public boolean equals(Object o) {
68: if (this == o)
69: return true;
70: if (!(o instanceof ItemDefinitionMimeType))
71: return false;
72:
73: final ItemDefinitionMimeType itemDefinitionMimeType = (ItemDefinitionMimeType) o;
74:
75: if (!primary.equals(itemDefinitionMimeType.primary))
76: return false;
77: if (secondary != null ? !secondary
78: .equals(itemDefinitionMimeType.secondary)
79: : itemDefinitionMimeType.secondary != null)
80: return false;
81:
82: return true;
83: }
84:
85: public int hashCode() {
86: int result;
87: result = primary.hashCode();
88: result = 29 * result
89: + (secondary != null ? secondary.hashCode() : 0);
90: return result;
91: }
92: }
|