1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.kuali.rice.shareddata.impl.county; |
18 |
|
|
19 |
|
import org.apache.commons.lang.StringUtils; |
20 |
|
import org.kuali.rice.kns.service.BusinessObjectService; |
21 |
|
import org.kuali.rice.shareddata.api.county.County; |
22 |
|
import org.kuali.rice.shareddata.api.county.CountyService; |
23 |
|
|
24 |
|
import java.util.ArrayList; |
25 |
|
import java.util.Collection; |
26 |
|
import java.util.Collections; |
27 |
|
import java.util.HashMap; |
28 |
|
import java.util.List; |
29 |
|
import java.util.Map; |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 45 (45) |
Complexity: 11 |
Complexity Density: 0.39 |
|
31 |
|
public class CountyServiceImpl implements CountyService { |
32 |
|
|
33 |
|
private BusinessObjectService businessObjectService; |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
35 |
0
|
@Override... |
36 |
|
public County getCounty(String countryCode, String stateCode, String code) { |
37 |
0
|
if (StringUtils.isBlank(countryCode)) { |
38 |
0
|
throw new IllegalArgumentException(("countryCode is null")); |
39 |
|
} |
40 |
|
|
41 |
0
|
if (StringUtils.isBlank(code)) { |
42 |
0
|
throw new IllegalArgumentException(("code is null")); |
43 |
|
} |
44 |
|
|
45 |
0
|
if (StringUtils.isBlank(stateCode)) { |
46 |
0
|
throw new IllegalArgumentException(("stateCode is null")); |
47 |
|
} |
48 |
|
|
49 |
0
|
final Map<String, Object> map = new HashMap<String, Object>(); |
50 |
0
|
map.put("countryCode", countryCode); |
51 |
0
|
map.put("stateCode", stateCode); |
52 |
0
|
map.put("code", code); |
53 |
|
|
54 |
0
|
return CountyBo.to(businessObjectService.findByPrimaryKey(CountyBo.class, Collections.unmodifiableMap(map))); |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 6 |
Complexity Density: 0.38 |
|
57 |
0
|
@Override... |
58 |
|
public List<County> findAllCountiesInCountryAndState(String countryCode, String stateCode) { |
59 |
0
|
if (StringUtils.isBlank(countryCode)) { |
60 |
0
|
throw new IllegalArgumentException(("countryCode is null")); |
61 |
|
} |
62 |
|
|
63 |
0
|
if (StringUtils.isBlank(stateCode)) { |
64 |
0
|
throw new IllegalArgumentException(("stateCode is null")); |
65 |
|
} |
66 |
|
|
67 |
0
|
final Map<String, Object> map = new HashMap<String, Object>(); |
68 |
0
|
map.put("countryCode", countryCode); |
69 |
0
|
map.put("stateCode", stateCode); |
70 |
0
|
map.put("active", Boolean.TRUE); |
71 |
|
|
72 |
0
|
final Collection<CountyBo> bos = businessObjectService.findMatching(CountyBo.class, Collections.unmodifiableMap(map)); |
73 |
0
|
if (bos == null) { |
74 |
0
|
return Collections.emptyList(); |
75 |
|
} |
76 |
|
|
77 |
0
|
final List<County> toReturn = new ArrayList<County>(); |
78 |
0
|
for (CountyBo bo : bos) { |
79 |
0
|
if (bo != null && bo.isActive()) { |
80 |
0
|
toReturn.add(CountyBo.to(bo)); |
81 |
|
} |
82 |
|
} |
83 |
|
|
84 |
0
|
return Collections.unmodifiableList(toReturn); |
85 |
|
} |
86 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
0
|
public void setBusinessObjectService(BusinessObjectService businessObjectService) {... |
88 |
0
|
this.businessObjectService = businessObjectService; |
89 |
|
} |
90 |
|
} |