Project

General

Profile

« Previous | Next » 

Revision 41783

View differences:

RetrieveURLSJobNode.java
3 3
import javax.annotation.Resource;
4 4
import javax.xml.ws.wsaddressing.W3CEndpointReference;
5 5

  
6
import com.google.common.collect.Iterables;
7
import eu.dnetlib.enabling.resultset.IterableResultSetFactory;
8
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory;
9
import eu.dnetlib.enabling.resultset.client.utils.EPRUtils;
6
import org.springframework.beans.factory.annotation.Autowired;
7
import org.springframework.beans.factory.annotation.Required;
8

  
10 9
import eu.dnetlib.msro.workflows.graph.Arc;
11 10
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
12 11
import eu.dnetlib.msro.workflows.nodes.download.UrlExtractor;
13 12
import eu.dnetlib.msro.workflows.procs.Env;
14
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.beans.factory.annotation.Required;
16 13

  
17 14
// TODO: Auto-generated Javadoc
18 15

  
......
65 62

  
66 63
	@Override
67 64
	protected String execute(final Env env) throws Exception {
68
		final W3CEndpointReference inputEpr = (new EPRUtils()).getEpr(env.getAttribute(inputEprParam, String.class));
69
		Iterable<String> input = resultSetClientFactory.getClient(inputEpr);
70
		Iterable<String> extractedUrls = Iterables.transform(input, new UrlExtractor(xpath, xpathMetadataId, xpathOpenAccess, xpathEmbargoDate));
71
		W3CEndpointReference eprUrls = resultSetFactory.createIterableResultSet(extractedUrls);
65
		final W3CEndpointReference inputEpr = (new EPRUtils()).getEpr(env.getAttribute(this.inputEprParam, String.class));
66
		final Iterable<String> input = this.resultSetClientFactory.getClient(inputEpr);
67

  
68
		final Iterable<String> extractedUrls =
69
				Iterables.transform(input, new UrlExtractor(this.xpath, this.xpathMetadataId, this.xpathOpenAccess, this.xpathEmbargoDate));
70

  
71
		final W3CEndpointReference eprUrls = this.resultSetFactory.createIterableResultSet(extractedUrls);
72 72
		env.setAttribute(getOutputEprParam(), eprUrls.toString());
73 73
		return Arc.DEFAULT_ARC;
74 74
	}
......
79 79
	 * @return the xpath
80 80
	 */
81 81
	public String getXpath() {
82
		return xpath;
82
		return this.xpath;
83 83
	}
84 84

  
85 85
	/**
86 86
	 * Sets the xpath.
87 87
	 *
88
	 * @param xpath the xpath to set
88
	 * @param xpath
89
	 *            the xpath to set
89 90
	 */
90 91
	public void setXpath(final String xpath) {
91 92
		this.xpath = xpath;
......
97 98
	 * @return the xpathMetadataId
98 99
	 */
99 100
	public String getXpathMetadataId() {
100
		return xpathMetadataId;
101
		return this.xpathMetadataId;
101 102
	}
102 103

  
103 104
	/**
104 105
	 * Sets the xpath metadata id.
105 106
	 *
106
	 * @param xpathMetadataId the xpathMetadataId to set
107
	 * @param xpathMetadataId
108
	 *            the xpathMetadataId to set
107 109
	 */
108 110
	@Required
109 111
	public void setXpathMetadataId(final String xpathMetadataId) {
......
116 118
	 * @return the resultSetClientFactory
117 119
	 */
118 120
	public ResultSetClientFactory getResultSetClientFactory() {
119
		return resultSetClientFactory;
121
		return this.resultSetClientFactory;
120 122
	}
121 123

  
122 124
	/**
123 125
	 * Sets the result set client factory.
124 126
	 *
125
	 * @param resultSetClientFactory the resultSetClientFactory to set
127
	 * @param resultSetClientFactory
128
	 *            the resultSetClientFactory to set
126 129
	 */
127 130
	public void setResultSetClientFactory(final ResultSetClientFactory resultSetClientFactory) {
128 131
		this.resultSetClientFactory = resultSetClientFactory;
......
134 137
	 * @return the resultSetFactory
135 138
	 */
136 139
	public IterableResultSetFactory getResultSetFactory() {
137
		return resultSetFactory;
140
		return this.resultSetFactory;
138 141
	}
139 142

  
140 143
	/**
141 144
	 * Sets the result set factory.
142 145
	 *
143
	 * @param resultSetFactory the resultSetFactory to set
146
	 * @param resultSetFactory
147
	 *            the resultSetFactory to set
144 148
	 */
145 149
	public void setResultSetFactory(final IterableResultSetFactory resultSetFactory) {
146 150
		this.resultSetFactory = resultSetFactory;
......
152 156
	 * @return the outputEprParam
153 157
	 */
154 158
	public String getOutputEprParam() {
155
		return outputEprParam;
159
		return this.outputEprParam;
156 160
	}
157 161

  
158 162
	/**
159 163
	 * Sets the output epr param.
160 164
	 *
161
	 * @param outputEprParam the outputEprParam to set
165
	 * @param outputEprParam
166
	 *            the outputEprParam to set
162 167
	 */
163 168
	public void setOutputEprParam(final String outputEprParam) {
164 169
		this.outputEprParam = outputEprParam;
......
170 175
	 * @return the inputEprParam
171 176
	 */
172 177
	public String getInputEprParam() {
173
		return inputEprParam;
178
		return this.inputEprParam;
174 179
	}
175 180

  
176 181
	/**
177 182
	 * Sets the input epr param.
178 183
	 *
179
	 * @param inputEprParam the inputEprParam to set
184
	 * @param inputEprParam
185
	 *            the inputEprParam to set
180 186
	 */
181 187
	public void setInputEprParam(final String inputEprParam) {
182 188
		this.inputEprParam = inputEprParam;
......
188 194
	 * @return the xpath open access
189 195
	 */
190 196
	public String getXpathOpenAccess() {
191
		return xpathOpenAccess;
197
		return this.xpathOpenAccess;
192 198
	}
193 199

  
194 200
	/**
195 201
	 * Sets the xpath open access.
196 202
	 *
197
	 * @param xpathOpenAccess the new xpath open access
203
	 * @param xpathOpenAccess
204
	 *            the new xpath open access
198 205
	 */
199 206
	public void setXpathOpenAccess(final String xpathOpenAccess) {
200 207
		this.xpathOpenAccess = xpathOpenAccess;
......
206 213
	 * @return the xpath embargo date
207 214
	 */
208 215
	public String getXpathEmbargoDate() {
209
		return xpathEmbargoDate;
216
		return this.xpathEmbargoDate;
210 217
	}
211 218

  
212 219
	/**
213 220
	 * Sets the xpath embargo date.
214 221
	 *
215
	 * @param xpathEmbargoDate the new xpath embargo date
222
	 * @param xpathEmbargoDate
223
	 *            the new xpath embargo date
216 224
	 */
217 225
	public void setXpathEmbargoDate(final String xpathEmbargoDate) {
218 226
		this.xpathEmbargoDate = xpathEmbargoDate;

Also available in: Unified diff