1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.dictionary.service.impl.old; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.HashMap; |
20 | |
import java.util.List; |
21 | |
import java.util.Map; |
22 | |
|
23 | |
import javax.jws.WebService; |
24 | |
|
25 | |
import org.kuali.student.core.dictionary.old.dto.ObjectStructure; |
26 | |
import org.kuali.student.core.dictionary.service.old.DictionaryService; |
27 | |
import org.springframework.context.ApplicationContext; |
28 | |
import org.springframework.context.ConfigurableApplicationContext; |
29 | |
import org.springframework.context.support.ClassPathXmlApplicationContext; |
30 | |
import org.springframework.util.StringUtils; |
31 | |
|
32 | |
@WebService(endpointInterface = "org.kuali.student.core.dictionary.service.DictionaryService", serviceName = "DictionaryService", portName = "DictionaryService", targetNamespace = "http://student.kuali.org/wsdl/dictionary") |
33 | |
@Deprecated |
34 | |
public class DictionaryServiceSpringImpl implements DictionaryService { |
35 | |
|
36 | |
private String[] dictionaryContext; |
37 | |
private Map<String, ObjectStructure> objectStructures; |
38 | |
|
39 | |
public DictionaryServiceSpringImpl() { |
40 | 0 | super(); |
41 | 0 | } |
42 | |
|
43 | |
public DictionaryServiceSpringImpl(String dictionaryContext) { |
44 | 2 | super(); |
45 | 2 | String[] locations = StringUtils.tokenizeToStringArray(dictionaryContext, ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS); |
46 | 2 | this.dictionaryContext = locations; |
47 | 2 | init(); |
48 | 2 | } |
49 | |
|
50 | |
public DictionaryServiceSpringImpl(String[] dictionaryContext) { |
51 | 0 | super(); |
52 | 0 | this.dictionaryContext = dictionaryContext; |
53 | 0 | init(); |
54 | 0 | } |
55 | |
|
56 | |
@SuppressWarnings("unchecked") |
57 | |
public void init() { |
58 | 2 | ApplicationContext ac = new ClassPathXmlApplicationContext(dictionaryContext); |
59 | |
|
60 | 2 | Map<String, ObjectStructure> beansOfType = (Map<String, ObjectStructure>) ac.getBeansOfType(ObjectStructure.class); |
61 | 2 | objectStructures = new HashMap<String, ObjectStructure>(); |
62 | 2 | for (ObjectStructure objStr : beansOfType.values()){ |
63 | |
|
64 | 6 | if(objStr.getId()!=null){ |
65 | 0 | if(objStr.getId().startsWith("object.")){ |
66 | 0 | if(!objStr.getId().startsWith("object.field.")){ |
67 | 0 | objectStructures.put(objStr.getKey(), objStr); |
68 | |
} |
69 | |
}else{ |
70 | 0 | objectStructures.put(objStr.getKey(), objStr); |
71 | |
} |
72 | |
}else{ |
73 | 6 | objectStructures.put(objStr.getKey(), objStr); |
74 | |
} |
75 | |
} |
76 | 2 | } |
77 | |
|
78 | |
@Override |
79 | |
public ObjectStructure getObjectStructure(String objectTypeKey) { |
80 | 2 | return objectStructures.get(objectTypeKey); |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public List<String> getObjectTypes() { |
85 | 1 | return new ArrayList<String>(objectStructures.keySet()); |
86 | |
} |
87 | |
|
88 | |
public String[] getDictionaryContext() { |
89 | 0 | return dictionaryContext; |
90 | |
} |
91 | |
|
92 | |
public void setDictionaryContext(String[] dictionaryContext) { |
93 | 0 | this.dictionaryContext = dictionaryContext; |
94 | 0 | } |
95 | |
|
96 | |
} |