Project

General

Profile

1
package eu.dnetlib.msro.openaire.ui;
2

    
3
import java.util.ArrayList;
4
import java.util.List;
5
import java.util.Map;
6
import javax.annotation.Resource;
7

    
8
import eu.dnetlib.data.download.rmi.DownloadPlugin;
9
import eu.dnetlib.data.download.rmi.DownloadService;
10
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
11
import eu.dnetlib.msro.workflows.util.ValidNodeValuesFetcher;
12
import org.springframework.beans.factory.annotation.Autowired;
13

    
14
public class DownloadPluginValues extends ValidNodeValuesFetcher {
15

    
16
	/**
17
	 * The download plugin enumerator.
18
	 */
19

    
20
	@Resource
21
	private UniqueServiceLocator serviceLocator;
22

    
23
	@Autowired(required = false)
24
	private List<DownloadPlugin> plugins;
25

    
26
	@Override
27
	protected List<DnetParamValue> obtainValues(final Map<String, String> params) throws Exception {
28

    
29
		List<String> otherPlugins = serviceLocator.getService(DownloadService.class).listPlugins();
30

    
31
		ArrayList<DnetParamValue> output = new ArrayList<ValidNodeValuesFetcher.DnetParamValue>();
32

    
33
		// if (plugins != null) {
34
		// output.addAll(Lists.newArrayList(Iterables.transform(plugins, new Function<DownloadPlugin, DnetParamValue>() {
35
		//
36
		// @Override
37
		// public DnetParamValue apply(final DownloadPlugin input) {
38
		// return new DnetParamValue(input.getPluginName(), input.getPluginName());
39
		// }
40
		// })));
41
		// }
42

    
43
		if (otherPlugins != null) {
44
			for (String pluginName : otherPlugins) {
45
				output.add(new DnetParamValue(pluginName, pluginName));
46
			}
47
		}
48

    
49
		return output;
50
	}
51
}
    (1-1/1)