Project

General

Profile

« Previous | Next » 

Revision 44352

fixed bug

View differences:

AbstractPIDResolver.java
4 4
import java.util.HashMap;
5 5
import java.util.Map;
6 6

  
7
import eu.dnetlib.dli.DLIUtils;
8
import eu.dnetlib.resolver.model.CompletionStatus;
9
import eu.dnetlib.resolver.model.ObjectProvenance;
10
import eu.dnetlib.resolver.model.ObjectProvisionMode;
7 11
import eu.dnetlib.resolver.model.ResolvedObject;
8 12
import net.sf.ehcache.Cache;
9 13
import net.sf.ehcache.Element;
......
24 28
 */
25 29
public abstract class AbstractPIDResolver implements PIDResolver {
26 30

  
27
	private static final Log log = LogFactory.getLog(AbstractPIDResolver.class);
28

  
29
	public static Map<String, String> resolvedTypes = new HashMap<String, String>() {
31
	public static final Map<String, String> resolvedTypes = new HashMap<String, String>() {
30 32
		{
31 33
			put("pdb", "http://www.rcsb.org/pdb/explore/explore.do?structureId=%s");
32 34
			put("ncbi-n", "http://www.ncbi.nlm.nih.gov/gquery/?term=%s");
......
54 56
		}
55 57

  
56 58
	};
57

  
59
	private static final Log log = LogFactory.getLog(AbstractPIDResolver.class);
58 60
	private Cache cache;
59 61
	private String name;
60 62
	@Autowired
......
70 72
		}
71 73
	};
72 74

  
75
	public static void setDatasourceProvenace(final ObjectProvenance provenance, final String namespacePrefix) {
76
		try {
77
			provenance.setDatasourceId(DLIUtils.getIdFromDataSourcePrefix(namespacePrefix));
78
			provenance.setDatasource(DLIUtils.getNameFromDataSourcePrefix(namespacePrefix));
79
			provenance.setCompletionStatus(CompletionStatus.complete.toString());
80
			provenance.setProvisionMode(ObjectProvisionMode.resolved.toString());
81
		} catch (Throwable e) {
82
			log.error("Error on assignin datasource ");
83
		}
84
	}
85

  
73 86
	public ResolvedObject retrievePID(final String pid, final String pidType) {
74 87

  
75 88
		if (!canResolvePid(pidType)) return null;

Also available in: Unified diff