1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.lookup.valuefinder; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import org.apache.commons.lang.StringUtils; |
22 | |
import org.kuali.rice.core.util.KeyLabelPair; |
23 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
24 | |
import org.kuali.rice.kew.web.KeyValue; |
25 | |
import org.kuali.rice.kns.lookup.keyvalues.KeyValuesBase; |
26 | |
import org.kuali.rice.kns.util.GlobalVariables; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | public class SavedSearchValuesFinder extends KeyValuesBase { |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
public List getKeyValues() { |
40 | 0 | List<KeyLabelPair> savedSearchValues = new ArrayList<KeyLabelPair>(); |
41 | 0 | savedSearchValues.add(new KeyLabelPair("", "Searches")); |
42 | 0 | savedSearchValues.add(new KeyLabelPair("*ignore*", "-----")); |
43 | 0 | savedSearchValues.add(new KeyLabelPair("*ignore*", "-Named Searches")); |
44 | 0 | List<KeyValue> namedSearches = KEWServiceLocator.getDocumentSearchService().getNamedSearches(GlobalVariables.getUserSession().getPrincipalId()); |
45 | 0 | for (KeyValue keyValue : namedSearches) { |
46 | 0 | String label = StringUtils.abbreviate(keyValue.getValue(), 75); |
47 | 0 | KeyLabelPair keyLabel = new KeyLabelPair(keyValue.getKey(),label); |
48 | 0 | savedSearchValues.add(keyLabel); |
49 | 0 | } |
50 | 0 | savedSearchValues.add(new KeyLabelPair("*ignore*", "-----")); |
51 | 0 | savedSearchValues.add(new KeyLabelPair("*ignore*", "-Recent Searches")); |
52 | 0 | List<KeyValue> mostRecentSearches = KEWServiceLocator.getDocumentSearchService().getMostRecentSearches(GlobalVariables.getUserSession().getPrincipalId()); |
53 | 0 | for (KeyValue keyValue : mostRecentSearches) { |
54 | 0 | String label = StringUtils.abbreviate(keyValue.getValue(), 75); |
55 | 0 | KeyLabelPair keyLabel = new KeyLabelPair(keyValue.getKey(),label); |
56 | 0 | savedSearchValues.add(keyLabel); |
57 | 0 | } |
58 | 0 | return savedSearchValues; |
59 | |
} |
60 | |
|
61 | |
} |