Project

General

Profile

« Previous | Next » 

Revision 38899

Added log for debug

View differences:

EuropePMC.java
3 3
import java.util.ArrayList;
4 4
import java.util.List;
5 5

  
6
import org.apache.commons.logging.Log;
7
import org.apache.commons.logging.LogFactory;
8

  
6 9
import com.google.common.base.Function;
7 10
import com.google.common.collect.Iterables;
8 11
import com.google.gson.Gson;
......
16 19
 */
17 20
public class EuropePMC extends AbstractDownloadPlugin implements DownloadPlugin {
18 21

  
22
	private static final Log log = LogFactory.getLog(EuropePMC.class);
23

  
19 24
	/** The base path. */
20 25
	private String basePath;
21 26

  
......
51 56
	public DownloadItem retrieveUrl(final DownloadItem input) {
52 57

  
53 58
		String url = input.getOriginalUrl();
54
		if (url == null || url.trim().length() == 0) { return input; }
59
		if (url == null || url.trim().length() == 0) return input;
55 60
		@SuppressWarnings("unchecked")
56 61
		List<String> urls = new Gson().fromJson(url, ArrayList.class);
57
		if (urls == null || urls.size() == 0) { return input; }
62
		log.debug(String.format("urls is %s", url));
63
		if (urls == null || urls.size() == 0) return input;
58 64
		input.setFileName(input.getIdItemMetadata());
59 65
		Boolean added = false;
60 66
		for (String s : urls) {
61 67
			if (s.startsWith("http")) {
68
				log.debug(String.format("found url starting with http replace original URL with %s", s));
62 69
				input.setOriginalUrl(s);
63 70
			} else if (s.startsWith("PMC")) {
64 71
				String correctUrl = s.replace("PMC", "");
72
				log.debug(String.format("found url starting with PMC %s", correctUrl));
65 73
				added = true;
66 74
				String path = PathRetreiver.getInstance(basePath).getPathForPMCID(Integer.parseInt(correctUrl));
67 75
				if (path != null) {

Also available in: Unified diff