Project

General

Profile

1
package eu.dnetlib.msro.openaireplus.workflows.nodes;
2

    
3
import java.util.List;
4
import java.util.Map;
5

    
6
import com.google.gson.Gson;
7
import com.googlecode.sarasvati.Arc;
8
import com.googlecode.sarasvati.NodeToken;
9
import org.springframework.beans.factory.annotation.Required;
10

    
11
public class PrepareIISMainParamsV2JobNode extends PrepareIISParamsV2 {
12

    
13
	private String xqueryObjectStores;
14

    
15
	private String objectStoreParam = "import_content_objectstores_csv";
16

    
17
	// Enable/Disable inference modules
18

    
19
	@Override
20
	protected String execute(final NodeToken token) throws Exception {
21

    
22
		super.prepare(token);
23

    
24
		token.getEnv().setAttribute(getObjectStoreParam(), getFilteredObjectStoreCSV(getXqueryObjectStores()));
25

    
26
		@SuppressWarnings("unchecked")
27
		final List<Map<String, String>> sets = new Gson().fromJson(token.getEnv().getAttribute("sets"), List.class);
28
		for (Map<String, String> set : sets) {
29
			token.getEnv().setAttribute(set.get("enablingProperty"), set.get("enabled"));
30
		}
31

    
32
		return Arc.DEFAULT_ARC;
33
	}
34

    
35
	public String getXqueryObjectStores() {
36
		return xqueryObjectStores;
37
	}
38

    
39
	@Required
40
	public void setXqueryObjectStores(final String xqueryObjectStores) {
41
		this.xqueryObjectStores = xqueryObjectStores;
42
	}
43

    
44
	public String getObjectStoreParam() {
45
		return objectStoreParam;
46
	}
47

    
48
	public void setObjectStoreParam(final String objectStoreParam) {
49
		this.objectStoreParam = objectStoreParam;
50
	}
51

    
52
}
(11-11/21)