| 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 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.service.KEWServiceLocator; |
| 22 | |
import org.kuali.rice.krad.keyvalues.KeyValuesBase; |
| 23 | |
import org.kuali.rice.krad.util.GlobalVariables; |
| 24 | |
|
| 25 | |
import java.util.ArrayList; |
| 26 | |
import java.util.List; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | 0 | public class SavedSearchValuesFinder extends KeyValuesBase { |
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
@Override |
| 40 | |
public List<KeyValue> getKeyValues() { |
| 41 | 0 | List<KeyValue> savedSearchValues = new ArrayList<KeyValue>(); |
| 42 | 0 | savedSearchValues.add(new ConcreteKeyValue("", "Searches")); |
| 43 | 0 | savedSearchValues.add(new ConcreteKeyValue("*ignore*", "-----")); |
| 44 | 0 | savedSearchValues.add(new ConcreteKeyValue("*ignore*", "-Named Searches")); |
| 45 | 0 | List<KeyValue> namedSearches = KEWServiceLocator.getDocumentSearchService().getNamedSearches(GlobalVariables.getUserSession().getPrincipalId()); |
| 46 | 0 | for (KeyValue keyValue : namedSearches) { |
| 47 | 0 | String label = StringUtils.abbreviate(keyValue.getValue(), 75); |
| 48 | 0 | KeyValue keyLabel = new ConcreteKeyValue(keyValue.getKey(),label); |
| 49 | 0 | savedSearchValues.add(keyLabel); |
| 50 | 0 | } |
| 51 | 0 | savedSearchValues.add(new ConcreteKeyValue("*ignore*", "-----")); |
| 52 | 0 | savedSearchValues.add(new ConcreteKeyValue("*ignore*", "-Recent Searches")); |
| 53 | 0 | List<KeyValue> mostRecentSearches = KEWServiceLocator.getDocumentSearchService().getMostRecentSearches(GlobalVariables.getUserSession().getPrincipalId()); |
| 54 | 0 | for (KeyValue keyValue : mostRecentSearches) { |
| 55 | 0 | String label = StringUtils.abbreviate(keyValue.getValue(), 75); |
| 56 | 0 | KeyValue keyLabel = new ConcreteKeyValue(keyValue.getKey(),label); |
| 57 | 0 | savedSearchValues.add(keyLabel); |
| 58 | 0 | } |
| 59 | 0 | return savedSearchValues; |
| 60 | |
} |
| 61 | |
|
| 62 | |
} |