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.apache.commons.lang.StringUtils; |
22 |
|
import org.kuali.rice.core.util.KeyLabelPair; |
23 |
|
import org.kuali.student.common.search.dto.SearchParam; |
24 |
|
import org.kuali.student.common.search.dto.SearchRequest; |
25 |
|
import org.kuali.student.common.search.dto.SearchResult; |
26 |
|
import org.kuali.student.common.search.dto.SearchResultCell; |
27 |
|
import org.kuali.student.common.search.dto.SearchResultRow; |
28 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 6 |
Complexity Density: 0.26 |
|
29 |
|
public abstract class CocValuesFinder extends StudentKeyValuesBase { |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@param |
37 |
|
@return |
38 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 6 |
Complexity Density: 0.26 |
|
39 |
0
|
public static List<KeyLabelPair> findCocOrgs(String orgType) {... |
40 |
0
|
List<KeyLabelPair> orgEntities = new ArrayList<KeyLabelPair>(); |
41 |
|
|
42 |
0
|
SearchRequest searchRequest = new SearchRequest("org.search.orgQuickViewByRelationTypeOrgTypeRelatedOrgType"); |
43 |
0
|
searchRequest.addParam("org.queryParam.relationType","kuali.org.CurriculumParent"); |
44 |
0
|
searchRequest.addParam("org.queryParam.orgType",orgType); |
45 |
0
|
searchRequest.addParam("org.queryParam.relatedOrgType","kuali.org.COC"); |
46 |
|
|
47 |
0
|
try { |
48 |
0
|
SearchResult results = getOrganizationService().search(searchRequest); |
49 |
|
|
50 |
0
|
for (SearchResultRow result : results.getRows()) { |
51 |
0
|
String orgId = ""; |
52 |
0
|
String orgShortName = ""; |
53 |
0
|
String orgLongName = ""; |
54 |
0
|
for (SearchResultCell resultCell : result.getCells()) { |
55 |
0
|
if ("org.resultColumn.orgId".equals(resultCell.getKey())) { |
56 |
0
|
orgId = resultCell.getValue(); |
57 |
0
|
} else if ("org.resultColumn.orgShortName".equals(resultCell.getKey())) { |
58 |
0
|
orgShortName = resultCell.getValue(); |
59 |
0
|
} else if("org.resultColumn.orgLongName".equals(resultCell.getKey())){ |
60 |
0
|
orgLongName = resultCell.getValue(); |
61 |
|
} |
62 |
|
} |
63 |
0
|
if (StringUtils.isBlank(orgLongName)) { |
64 |
|
|
65 |
0
|
orgEntities.add(buildKeyLabelPair(orgId, orgShortName, null, null)); |
66 |
|
} |
67 |
|
else { |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
0
|
orgEntities.add(new KeyLabelPair(orgId, orgLongName)); |
74 |
|
} |
75 |
|
} |
76 |
|
|
77 |
0
|
return orgEntities; |
78 |
|
} catch (Exception e) { |
79 |
0
|
throw new RuntimeException(e); |
80 |
|
} |
81 |
|
} |
82 |
|
} |