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 | 0 | public KeyValueSort() { |
43 | 0 | keyValue = new ConcreteKeyValue(); |
44 | 0 | } |
45 | |
|
46 | 0 | public KeyValueSort(String key, String value) { |
47 | 0 | keyValue = new ConcreteKeyValue(key, value); |
48 | 0 | } |
49 | |
|
50 | |
public KeyValueSort(String key, String value, Object sortValue, SearchableAttributeValue searchableAttributeValue) { |
51 | 0 | this(key,value); |
52 | 0 | this.sortValue = sortValue; |
53 | 0 | this.searchableAttributeValue = searchableAttributeValue; |
54 | 0 | } |
55 | |
|
56 | |
public KeyValueSort(String key, String value, String userDisplayValue, Object sortValue, SearchableAttributeValue searchableAttributeValue) { |
57 | 0 | this(key,value,sortValue,searchableAttributeValue); |
58 | 0 | this.userDisplayValue = userDisplayValue; |
59 | 0 | } |
60 | |
|
61 | |
public KeyValueSort(KeyValueSort kvs) { |
62 | 0 | this(kvs.getKey(),kvs.getValue(),kvs.getUserDisplayValue(),kvs.getSortValue(),kvs.getSearchableAttributeValue()); |
63 | 0 | } |
64 | |
|
65 | |
public Object getSortValue() { |
66 | 0 | return sortValue; |
67 | |
} |
68 | |
|
69 | |
public void setSortValue(Object sortValue) { |
70 | 0 | this.sortValue = sortValue; |
71 | 0 | this.sortClass = sortValue.getClass(); |
72 | 0 | } |
73 | |
|
74 | |
public Class getSortClass() { |
75 | 0 | return sortClass; |
76 | |
} |
77 | |
|
78 | |
public SearchableAttributeValue getSearchableAttributeValue() { |
79 | 0 | return searchableAttributeValue; |
80 | |
} |
81 | |
|
82 | |
public String getUserDisplayValue() { |
83 | 0 | if (StringUtils.isNotBlank(userDisplayValue)) { |
84 | 0 | return userDisplayValue; |
85 | |
} |
86 | 0 | return getValue(); |
87 | |
} |
88 | |
|
89 | |
@Override |
90 | |
public String getKey() { |
91 | 0 | return keyValue.getKey(); |
92 | |
} |
93 | |
|
94 | |
@Override |
95 | |
public String getValue() { |
96 | 0 | return keyValue.getValue(); |
97 | |
} |
98 | |
|
99 | |
public void setKey(String k) { |
100 | 0 | keyValue.setKey(k); |
101 | 0 | } |
102 | |
|
103 | |
public void setValue(String v) { |
104 | 0 | keyValue.setValue(v); |
105 | 0 | } |
106 | |
|
107 | |
} |