Revision 50268
Added by Michele Artini about 6 years ago
RepoApisEntryPointController.java | ||
---|---|---|
13 | 13 |
import org.dom4j.Document; |
14 | 14 |
import org.dom4j.Node; |
15 | 15 |
import org.dom4j.io.SAXReader; |
16 |
import org.springframework.beans.factory.annotation.Autowired; |
|
16 | 17 |
import org.springframework.beans.factory.annotation.Required; |
17 | 18 |
import org.springframework.ui.ModelMap; |
18 | 19 |
|
... | ... | |
21 | 22 |
import com.google.common.collect.Sets; |
22 | 23 |
import com.google.gson.Gson; |
23 | 24 |
|
24 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerService; |
|
25 |
import eu.dnetlib.enabling.datasources.common.Api; |
|
26 |
import eu.dnetlib.enabling.datasources.common.Datasource; |
|
27 |
import eu.dnetlib.enabling.datasources.common.LocalDatasourceManager; |
|
25 | 28 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
26 | 29 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
27 | 30 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
... | ... | |
41 | 44 |
private String validatorAddress; |
42 | 45 |
private String validatorServiceAddress; |
43 | 46 |
|
47 |
@Autowired |
|
48 |
private LocalDatasourceManager<Datasource<?, ?>, Api<?>> dsManager; |
|
49 |
|
|
44 | 50 |
public class RepoHIWorkflow implements Comparable<RepoHIWorkflow> { |
45 | 51 |
|
46 |
private String id; |
|
47 |
private String name; |
|
48 |
private Set<String> ifaceTypes; |
|
49 |
private Set<String> compliances; |
|
52 |
private final String id;
|
|
53 |
private final String name;
|
|
54 |
private final Set<String> ifaceTypes;
|
|
55 |
private final Set<String> compliances;
|
|
50 | 56 |
private List<Pair<String, String>> fields; |
51 | 57 |
|
52 | 58 |
/** |
... | ... | |
123 | 129 |
final Set<String> ifcTypes = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(type)); |
124 | 130 |
final Set<String> compliances = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(compliance)); |
125 | 131 |
|
126 |
final List<Pair<String, String>> fields = new ArrayList<Pair<String, String>>();
|
|
132 |
final List<Pair<String, String>> fields = new ArrayList<>(); |
|
127 | 133 |
for (final Object o : doc.selectNodes(".//FIELD")) { |
128 | 134 |
final Node currentNode = (Node) o; |
129 | 135 |
final String key = currentNode.valueOf("@name"); |
130 | 136 |
final String value = currentNode.getText(); |
131 |
fields.add(new Pair<String, String>(key, value));
|
|
137 |
fields.add(new Pair<>(key, value)); |
|
132 | 138 |
} |
133 | 139 |
return new RepoHIWorkflow(id, name, ifcTypes, compliances, fields); |
134 | 140 |
} catch (final Exception e) { |
... | ... | |
156 | 162 |
final Gson gson = new Gson(); |
157 | 163 |
map.addAttribute("availableRepohiWfs", gson.toJson(listRepoHIWorkflows())); |
158 | 164 |
map.addAttribute("compatibilityLevels", gson.toJson(repoUIUtils.fetchVocabularyTerms(getCompatibilityLevelsVocabulary()))); |
159 |
map.addAttribute("browseFields", gson.toJson(serviceLocator.getService(DatasourceManagerService.class).listBrowsableFields()));
|
|
165 |
map.addAttribute("browseFields", gson.toJson(dsManager.listBrowsableFields()));
|
|
160 | 166 |
map.addAttribute("validatorAddress", getValidatorAddress()); |
161 | 167 |
map.addAttribute("validatorServiceAddress", getValidatorServiceAddress()); |
162 | 168 |
} |
Also available in: Unified diff
some fix (maven versions, properties, appContexts)