Clover Coverage Report - KS Common Impl 1.2-SNAPSHOT
Coverage timestamp: Thu Mar 3 2011 04:48:53 EST
../../../../../../../img/srcFileCovDistChart6.png 30% of files have more coverage
17   64   8   2.12
0   52   0.47   8
8     1  
1    
 
  DictionaryServiceImpl       Line # 15 17 0% 8 10 60% 0.6
 
  (12)
 
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   
 
15    public class DictionaryServiceImpl implements DictionaryService{
16    private String[] dictionaryContext;
17    private Map<String, ObjectStructureDefinition> objectStructures;
18   
 
19  0 toggle public DictionaryServiceImpl() {
20  0 super();
21    }
22   
 
23  12 toggle 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   
 
30  0 toggle public DictionaryServiceImpl(String[] dictionaryContext) {
31  0 super();
32  0 this.dictionaryContext = dictionaryContext;
33  0 init();
34    }
35   
 
36  12 toggle @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   
 
47  23 toggle @Override
48    public ObjectStructureDefinition getObjectStructure(String objectTypeKey) {
49  23 return objectStructures.get(objectTypeKey);
50    }
51   
 
52  4 toggle @Override
53    public List<String> getObjectTypes() {
54  4 return new ArrayList<String>(objectStructures.keySet());
55    }
56   
 
57  0 toggle public String[] getDictionaryContext() {
58  0 return dictionaryContext;
59    }
60   
 
61  0 toggle public void setDictionaryContext(String[] dictionaryContext) {
62  0 this.dictionaryContext = dictionaryContext;
63    }
64    }