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.KeyValue; |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 6 |
Complexity Density: 0.27 |
|
26 |
|
public class AllOrgsValuesFinder extends StudentKeyValuesBase { |
27 |
|
private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(AllOrgsValuesFinder.class); |
28 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 6 |
Complexity Density: 0.27 |
|
29 |
0
|
public List<KeyValue> getKeyValues() {... |
30 |
0
|
List<KeyValue> departments = new ArrayList<KeyValue>(); |
31 |
|
|
32 |
0
|
SearchRequest searchRequest = new SearchRequest(); |
33 |
0
|
searchRequest.setSearchKey("org.search.generic"); |
34 |
|
|
35 |
0
|
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(buildKeyValue(orgId, orgShortName, orgOptionalLongName, orgType)); |
53 |
|
} |
54 |
|
|
55 |
0
|
return departments; |
56 |
|
} catch (Exception e) { |
57 |
0
|
LOG.error("Error building KeyValues List", e); |
58 |
0
|
throw new RuntimeException(e); |
59 |
|
} |
60 |
|
} |
61 |
|
|
62 |
|
} |