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