Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KimCodeBase |
|
| 1.4285714285714286;1.429 |
1 | /* | |
2 | * Copyright 2007-2008 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.kim.bo.reference.impl; | |
17 | ||
18 | import java.util.LinkedHashMap; | |
19 | ||
20 | import javax.persistence.AttributeOverride; | |
21 | import javax.persistence.AttributeOverrides; | |
22 | import javax.persistence.Column; | |
23 | import javax.persistence.MappedSuperclass; | |
24 | ||
25 | import org.apache.commons.lang.StringUtils; | |
26 | import org.kuali.rice.kim.bo.reference.KimCode; | |
27 | import org.kuali.rice.kim.bo.reference.dto.AddressTypeInfo; | |
28 | import org.kuali.rice.kns.bo.KualiCodeBase; | |
29 | ||
30 | /** | |
31 | * This is a description of what this class does - jonathan don't forget to fill this in. | |
32 | * | |
33 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
34 | */ | |
35 | @MappedSuperclass | |
36 | @AttributeOverrides({ | |
37 | @AttributeOverride(name="active",column=@Column(name="ACTV_IND")) | |
38 | }) | |
39 | 0 | public abstract class KimCodeBase extends KualiCodeBase implements KimCode { |
40 | ||
41 | private static final long serialVersionUID = 1660166679188995697L; | |
42 | 0 | @Column(name="DISPLAY_SORT_CD") |
43 | protected String displaySortCode = ""; | |
44 | ||
45 | /** | |
46 | * This overridden method ... | |
47 | * | |
48 | * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper() | |
49 | */ | |
50 | @SuppressWarnings("unchecked") | |
51 | @Override | |
52 | protected LinkedHashMap toStringMapper() { | |
53 | 0 | LinkedHashMap<String, Object> lhm = new LinkedHashMap<String, Object>(); |
54 | 0 | lhm.put("code", getCode()); |
55 | 0 | lhm.put("name", getName()); |
56 | 0 | return lhm; |
57 | } | |
58 | ||
59 | /** | |
60 | * @see org.kuali.core.bo.KualiCode#isActive() | |
61 | */ | |
62 | public boolean isActive() { | |
63 | 0 | return active; |
64 | } | |
65 | ||
66 | /** | |
67 | * @see org.kuali.core.bo.KualiCode#setActive(boolean) | |
68 | */ | |
69 | public void setActive(boolean active) { | |
70 | 0 | this.active = active; |
71 | 0 | } |
72 | ||
73 | /** | |
74 | * Implements equals comparing code to code. | |
75 | * | |
76 | * @see java.lang.Object#equals(java.lang.Object) | |
77 | */ | |
78 | public boolean equals(Object obj) { | |
79 | 0 | if (obj instanceof KualiCodeBase) { |
80 | 0 | return StringUtils.equals(this.getCode(), ((KualiCodeBase) obj).getCode()); |
81 | } | |
82 | 0 | return false; |
83 | } | |
84 | ||
85 | /** | |
86 | * Overriding equals requires writing a hashCode method. | |
87 | * | |
88 | * @see java.lang.Object#hashCode() | |
89 | */ | |
90 | public int hashCode() { | |
91 | 0 | int hashCode = 0; |
92 | ||
93 | 0 | if (getCode() != null) { |
94 | 0 | hashCode = getCode().hashCode(); |
95 | } | |
96 | ||
97 | 0 | return hashCode; |
98 | } | |
99 | ||
100 | /** | |
101 | * @return the displaySortCode | |
102 | */ | |
103 | public String getDisplaySortCode() { | |
104 | 0 | return this.displaySortCode; |
105 | } | |
106 | ||
107 | /** | |
108 | * @param displaySortCode the displaySortCode to set | |
109 | */ | |
110 | public void setDisplaySortCode(String displaySortCode) { | |
111 | 0 | this.displaySortCode = displaySortCode; |
112 | 0 | } |
113 | ||
114 | } |