fix constructor ref to a non existing bean
[aai/sparky-be.git] / sparkybe-onap-service / src / test / java / org / onap / aai / sparky / util / OxmModelAndProcessorHelper.java
1 package org.onap.aai.sparky.util;
2
3 import java.io.IOException;
4 import java.util.HashSet;
5 import java.util.Set;
6
7 import org.onap.aai.setup.Version;
8 import org.onap.aai.sparky.config.SparkyResourceLoader;
9 import org.onap.aai.sparky.config.oxm.CrossEntityReferenceLookup;
10 import org.onap.aai.sparky.config.oxm.GeoEntityLookup;
11 import org.onap.aai.sparky.config.oxm.OxmEntityContainerLookup;
12 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
13 import org.onap.aai.sparky.config.oxm.OxmModelLoader;
14 import org.onap.aai.sparky.config.oxm.OxmModelProcessor;
15 import org.onap.aai.sparky.config.oxm.SearchableEntityLookup;
16 import org.onap.aai.sparky.config.oxm.SuggestionEntityLookup;
17 import org.onap.aai.sparky.search.filters.config.FiltersConfig;
18 import org.springframework.core.io.DefaultResourceLoader;
19
20 public class OxmModelAndProcessorHelper {
21
22         public static Version API_VERSION_OVERRIDE = Version.V11;
23
24         private OxmModelLoader modelLoader;
25         private Set<OxmModelProcessor> processors;
26
27         private CrossEntityReferenceLookup crossEntityReferenceLookup;
28         private GeoEntityLookup geoEntityLookup;
29         private OxmEntityLookup oxmEntityLookup;
30         private SearchableEntityLookup searchableEntityLookup;
31         private SuggestionEntityLookup suggestionEntityLookup;
32         private OxmEntityContainerLookup oxmEntityContainerLookup;
33         private FiltersConfig filtersConfig;
34
35         private static OxmModelAndProcessorHelper instance = null;
36
37         private OxmModelAndProcessorHelper() throws IOException {
38
39           SparkyResourceLoader resourceLoader = new SparkyResourceLoader();
40           resourceLoader.setResourceLoader(new DefaultResourceLoader());
41           
42                 this.filtersConfig = new FiltersConfig();
43                 this.filtersConfig.initializeFiltersDetailsConfig(resourceLoader.getResourceAsFile(SparkyTestConstants.FILTERS_JSON_FILE, false));
44                 this.filtersConfig.initializeFiltersForViewsConfig(resourceLoader.getResourceAsFile(SparkyTestConstants.VIEWS_JSON_FILE, false));
45
46                 this.crossEntityReferenceLookup = new CrossEntityReferenceLookup();
47                 this.geoEntityLookup = new GeoEntityLookup();
48                 this.oxmEntityLookup = new OxmEntityLookup();
49                 this.searchableEntityLookup = new SearchableEntityLookup();
50                 this.suggestionEntityLookup = new SuggestionEntityLookup(filtersConfig);
51                 this.oxmEntityContainerLookup = new OxmEntityContainerLookup();
52
53                 this.processors = new HashSet<OxmModelProcessor>();
54                 processors.add(crossEntityReferenceLookup);
55                 processors.add(geoEntityLookup);
56                 processors.add(oxmEntityLookup);
57                 processors.add(searchableEntityLookup);
58                 processors.add(suggestionEntityLookup);
59                 processors.add(oxmEntityContainerLookup);
60                 this.modelLoader = new OxmModelLoader(API_VERSION_OVERRIDE, processors, null);
61                 
62         }
63
64         public static OxmModelAndProcessorHelper getInstance() throws IOException {
65                 if (instance == null) {
66                         instance = new OxmModelAndProcessorHelper();
67                 }
68                 return instance;
69         }
70
71         public OxmModelLoader getModelLoader() {
72                 return modelLoader;
73         }
74
75         public void setModelLoader(OxmModelLoader modelLoader) {
76                 this.modelLoader = modelLoader;
77         }
78
79         public Set<OxmModelProcessor> getProcessors() {
80                 return processors;
81         }
82
83         public void setProcessors(Set<OxmModelProcessor> processors) {
84                 this.processors = processors;
85         }
86
87         public CrossEntityReferenceLookup getCrossEntityReferenceLookup() {
88                 return crossEntityReferenceLookup;
89         }
90
91         public void setCrossEntityReferenceLookup(CrossEntityReferenceLookup crossEntityReferenceLookup) {
92                 this.crossEntityReferenceLookup = crossEntityReferenceLookup;
93         }
94
95         public GeoEntityLookup getGeoEntityLookup() {
96                 return geoEntityLookup;
97         }
98
99         public void setGeoEntityLookup(GeoEntityLookup geoEntityLookup) {
100                 this.geoEntityLookup = geoEntityLookup;
101         }
102
103         public OxmEntityLookup getOxmEntityLookup() {
104                 return oxmEntityLookup;
105         }
106
107         public void setOxmEntityLookup(OxmEntityLookup oxmEntityLookup) {
108                 this.oxmEntityLookup = oxmEntityLookup;
109         }
110
111         public SearchableEntityLookup getSearchableEntityLookup() {
112                 return searchableEntityLookup;
113         }
114
115         public void setSearchableEntityLookup(SearchableEntityLookup searchableEntityLookup) {
116                 this.searchableEntityLookup = searchableEntityLookup;
117         }
118
119         public SuggestionEntityLookup getSuggestionEntityLookup() {
120                 return suggestionEntityLookup;
121         }
122
123         public void setSuggestionEntityLookup(SuggestionEntityLookup suggestionEntityLookup) {
124                 this.suggestionEntityLookup = suggestionEntityLookup;
125         }
126
127         public FiltersConfig getFiltersConfig() {
128                 return filtersConfig;
129         }
130
131         public void setFiltersConfig(FiltersConfig filtersConfig) {
132                 this.filtersConfig = filtersConfig;
133         }
134
135         public OxmEntityContainerLookup getOxmEntityContainerLookup() {
136                 return oxmEntityContainerLookup;
137         }
138
139         public void setOxmEntityContainerLookup(OxmEntityContainerLookup oxmEntityContainerLookup) {
140                 this.oxmEntityContainerLookup = oxmEntityContainerLookup;
141         }
142
143 }