1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.student.lookup.keyvalues; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import org.kuali.rice.core.util.KeyLabelPair; |
22 | |
import org.kuali.student.common.search.dto.SearchRequest; |
23 | |
import org.kuali.student.common.search.dto.SearchResultCell; |
24 | |
import org.kuali.student.common.search.dto.SearchResultRow; |
25 | |
|
26 | 0 | public class AllOrgsValuesFinder extends StudentKeyValuesBase { |
27 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(AllOrgsValuesFinder.class); |
28 | |
|
29 | |
public List<KeyLabelPair> getKeyValues() { |
30 | 0 | List<KeyLabelPair> departments = new ArrayList<KeyLabelPair>(); |
31 | |
|
32 | 0 | SearchRequest searchRequest = new SearchRequest(); |
33 | 0 | searchRequest.setSearchKey("org.search.generic"); |
34 | |
|
35 | |
try { |
36 | 0 | for (SearchResultRow result : getOrganizationService().search(searchRequest).getRows()) { |
37 | 0 | String orgId = ""; |
38 | 0 | String orgShortName = ""; |
39 | 0 | String orgOptionalLongName = ""; |
40 | 0 | String orgType = ""; |
41 | 0 | for (SearchResultCell resultCell : result.getCells()) { |
42 | 0 | if ("org.resultColumn.orgId".equals(resultCell.getKey())) { |
43 | 0 | orgId = resultCell.getValue(); |
44 | 0 | } else if ("org.resultColumn.orgShortName".equals(resultCell.getKey())) { |
45 | 0 | orgShortName = resultCell.getValue(); |
46 | 0 | } else if ("org.resultColumn.orgOptionalLongName".equals(resultCell.getKey())) { |
47 | 0 | orgOptionalLongName = resultCell.getValue(); |
48 | 0 | } else if ("org.resultColumn.orgType".equals(resultCell.getKey())) { |
49 | 0 | orgType = resultCell.getValue(); |
50 | |
} |
51 | |
} |
52 | 0 | departments.add(buildKeyLabelPair(orgId, orgShortName, orgOptionalLongName, orgType)); |
53 | 0 | } |
54 | |
|
55 | 0 | return departments; |
56 | 0 | } catch (Exception e) { |
57 | 0 | LOG.error("Error building KeyValues List", e); |
58 | 0 | throw new RuntimeException(e); |
59 | |
} |
60 | |
} |
61 | |
|
62 | |
} |