Project

General

Profile

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

    
3
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
4
import eu.dnetlib.msro.workflows.graph.Arc;
5
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
6
import eu.dnetlib.msro.workflows.procs.Env;
7
import eu.dnetlib.rmi.common.ResultSet;
8
import eu.dnetlib.rmi.data.MDStoreService;
9
import eu.dnetlib.rmi.manager.MSROException;
10
import org.apache.commons.logging.Log;
11
import org.apache.commons.logging.LogFactory;
12
import org.springframework.beans.factory.annotation.Autowired;
13

    
14
public class FetchMDStoreRecordsJobNode extends SimpleJobNode {
15

    
16
	private static final Log log = LogFactory.getLog(FetchMDStoreRecordsJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
17

    
18
	@Autowired
19
	private UniqueServiceLocator serviceLocator;
20

    
21
	private String mdId;
22

    
23
	private String mdFormat;
24

    
25
	private String eprParam;
26

    
27
	@Override
28
	protected String execute(final Env env) throws Exception {
29
		if (getMdId() == null) {
30
			setMdId(env.getAttribute("mdId", String.class));
31
		}
32
		log.info("getting MDRecords from: " + getMdId());
33
		final ResultSet<String> rs = this.serviceLocator.getService(MDStoreService.class, getMdId()).deliverMDRecords(getMdId(), "", "", "");
34
		if (rs == null) { throw new MSROException("unable to read MDRecords from: " + getMdId()); }
35
		env.setAttribute(getEprParam(), rs);
36
		return Arc.DEFAULT_ARC;
37
	}
38

    
39
	public String getMdId() {
40
		return this.mdId;
41
	}
42

    
43
	public void setMdId(final String mdId) {
44
		this.mdId = mdId;
45
	}
46

    
47
	public String getEprParam() {
48
		return this.eprParam;
49
	}
50

    
51
	public void setEprParam(final String eprParam) {
52
		this.eprParam = eprParam;
53
	}
54

    
55
	public String getMdFormat() {
56
		return mdFormat;
57
	}
58

    
59
	public void setMdFormat(final String mdFormat) {
60
		this.mdFormat = mdFormat;
61
	}
62
}
(3-3/8)