1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.web;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.core.api.util.ConcreteKeyValue;
20 import org.kuali.rice.core.api.util.KeyValue;
21 import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
22
23
24
25
26
27
28
29
30
31 public class KeyValueSort implements KeyValue {
32
33 private static final long serialVersionUID = 3575440091286391804L;
34
35 private String userDisplayValue;
36 private Object sortValue;
37 private Class sortClass;
38 private SearchableAttributeValue searchableAttributeValue;
39 private final ConcreteKeyValue keyValue;
40
41
42 public KeyValueSort() {
43 keyValue = new ConcreteKeyValue();
44 }
45
46 public KeyValueSort(String key, String value) {
47 keyValue = new ConcreteKeyValue(key, value);
48 }
49
50 public KeyValueSort(String key, String value, Object sortValue, SearchableAttributeValue searchableAttributeValue) {
51 this(key,value);
52 this.sortValue = sortValue;
53 this.searchableAttributeValue = searchableAttributeValue;
54 }
55
56 public KeyValueSort(String key, String value, String userDisplayValue, Object sortValue, SearchableAttributeValue searchableAttributeValue) {
57 this(key,value,sortValue,searchableAttributeValue);
58 this.userDisplayValue = userDisplayValue;
59 }
60
61 public KeyValueSort(KeyValueSort kvs) {
62 this(kvs.getKey(),kvs.getValue(),kvs.getUserDisplayValue(),kvs.getSortValue(),kvs.getSearchableAttributeValue());
63 }
64
65 public Object getSortValue() {
66 return sortValue;
67 }
68
69 public void setSortValue(Object sortValue) {
70 this.sortValue = sortValue;
71 this.sortClass = sortValue.getClass();
72 }
73
74 public Class getSortClass() {
75 return sortClass;
76 }
77
78 public SearchableAttributeValue getSearchableAttributeValue() {
79 return searchableAttributeValue;
80 }
81
82 public String getUserDisplayValue() {
83 if (StringUtils.isNotBlank(userDisplayValue)) {
84 return userDisplayValue;
85 }
86 return getValue();
87 }
88
89 @Override
90 public String getKey() {
91 return keyValue.getKey();
92 }
93
94 @Override
95 public String getValue() {
96 return keyValue.getValue();
97 }
98
99 public void setKey(String k) {
100 keyValue.setKey(k);
101 }
102
103 public void setValue(String v) {
104 keyValue.setValue(v);
105 }
106
107 }