1 |
|
package org.kuali.student.common.dictionary.service.impl; |
2 |
|
|
3 |
|
import java.util.ArrayList; |
4 |
|
import java.util.HashMap; |
5 |
|
import java.util.List; |
6 |
|
import java.util.Map; |
7 |
|
|
8 |
|
import org.kuali.student.common.dictionary.dto.ObjectStructureDefinition; |
9 |
|
import org.kuali.student.common.dictionary.service.DictionaryService; |
10 |
|
import org.springframework.context.ApplicationContext; |
11 |
|
import org.springframework.context.ConfigurableApplicationContext; |
12 |
|
import org.springframework.context.support.ClassPathXmlApplicationContext; |
13 |
|
import org.springframework.util.StringUtils; |
14 |
|
|
|
|
| 60% |
Uncovered Elements: 10 (25) |
Complexity: 8 |
Complexity Density: 0.47 |
|
15 |
|
public class DictionaryServiceImpl implements DictionaryService{ |
16 |
|
private String[] dictionaryContext; |
17 |
|
private Map<String, ObjectStructureDefinition> objectStructures; |
18 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
19 |
0
|
public DictionaryServiceImpl() {... |
20 |
0
|
super(); |
21 |
|
} |
22 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
23 |
12
|
public DictionaryServiceImpl(String dictionaryContext) {... |
24 |
12
|
super(); |
25 |
12
|
String[] locations = StringUtils.tokenizeToStringArray(dictionaryContext, ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS); |
26 |
12
|
this.dictionaryContext = locations; |
27 |
12
|
init(); |
28 |
|
} |
29 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
30 |
0
|
public DictionaryServiceImpl(String[] dictionaryContext) {... |
31 |
0
|
super(); |
32 |
0
|
this.dictionaryContext = dictionaryContext; |
33 |
0
|
init(); |
34 |
|
} |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
36 |
12
|
@SuppressWarnings("unchecked")... |
37 |
|
public void init() { |
38 |
12
|
ApplicationContext ac = new ClassPathXmlApplicationContext(dictionaryContext); |
39 |
|
|
40 |
12
|
Map<String, ObjectStructureDefinition> beansOfType = (Map<String, ObjectStructureDefinition>) ac.getBeansOfType(ObjectStructureDefinition.class); |
41 |
12
|
objectStructures = new HashMap<String, ObjectStructureDefinition>(); |
42 |
12
|
for (ObjectStructureDefinition objStr : beansOfType.values()){ |
43 |
36
|
objectStructures.put(objStr.getName(), objStr); |
44 |
|
} |
45 |
|
} |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
23
|
@Override... |
48 |
|
public ObjectStructureDefinition getObjectStructure(String objectTypeKey) { |
49 |
23
|
return objectStructures.get(objectTypeKey); |
50 |
|
} |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
4
|
@Override... |
53 |
|
public List<String> getObjectTypes() { |
54 |
4
|
return new ArrayList<String>(objectStructures.keySet()); |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
0
|
public String[] getDictionaryContext() {... |
58 |
0
|
return dictionaryContext; |
59 |
|
} |
60 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
0
|
public void setDictionaryContext(String[] dictionaryContext) {... |
62 |
0
|
this.dictionaryContext = dictionaryContext; |
63 |
|
} |
64 |
|
} |