Project

General

Profile

« Previous | Next » 

Revision 42180

Report also for non-OpenAIRE file downloads.

View differences:

modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/workflows/nodes/download/DownloadFromMetadataJobNode.java
14 14
import eu.dnetlib.msro.workflows.util.ProgressProvider;
15 15
import eu.dnetlib.msro.workflows.util.ResultsetProgressProvider;
16 16
import eu.dnetlib.msro.workflows.util.WorkflowsConstants;
17
import org.apache.commons.codec.binary.Base64;
17 18
import org.apache.commons.lang.StringUtils;
19
import org.apache.commons.logging.Log;
20
import org.apache.commons.logging.LogFactory;
18 21
import org.springframework.beans.factory.annotation.Autowired;
19 22

  
20 23
// TODO: Auto-generated Javadoc
......
24 27
 */
25 28
public class DownloadFromMetadataJobNode extends BlackboardJobNode implements ProgressJobNode {
26 29

  
30
	private static final Log log = LogFactory.getLog(DownloadFromMetadataJobNode.class);
31

  
27 32
	protected String regularExpression;
28 33
	/** The inputepr param. */
29 34
	private String inputeprParam;
......
103 108
			@Override
104 109
			protected void populateEnv(final Env env, final Map<String, String> responseParams) {
105 110
				env.setAttribute(WorkflowsConstants.MAIN_LOG_PREFIX + "total", responseParams.get("total"));
111

  
112
				final String base64 = responseParams.get("report");
113
				if (StringUtils.isNotBlank(base64) && Base64.isBase64(base64.getBytes())) {
114
					final String report = new String(Base64.decodeBase64(base64.getBytes()));
115
					log.info("found download report");
116
					log.debug(report);
117
					env.setAttribute(WorkflowsConstants.MAIN_LOG_PREFIX + "report", report);
118
				} else {
119
					log.warn("unable to find or decode download report");
120
				}
106 121
			}
107 122
		};
108 123
	}

Also available in: Unified diff