Project

General

Profile

1
package eu.dnetlib.openaire.directindex.objects;
2

    
3
import eu.dnetlib.miscutils.functional.hash.Hashing;
4
import org.apache.commons.lang.StringUtils;
5

    
6
/**
7
 * Created by michele on 02/12/15.
8
 */
9
public class DatasourceEntry {
10

    
11
	private String id;
12
	private String name;
13
	private String prefix;
14

    
15
	public DatasourceEntry() {
16
	}
17

    
18
	public DatasourceEntry(final String id, final String name, final String prefix) {
19
		this.id = id;
20
		this.name = name;
21
		this.prefix = prefix;
22
	}
23

    
24
	public String getId() {
25
		return id;
26
	}
27

    
28
	public void setId(final String id) {
29
		this.id = id;
30
	}
31

    
32
	public String getName() {
33
		return name;
34
	}
35

    
36
	public void setName(final String name) {
37
		this.name = name;
38
	}
39

    
40
	public String getPrefix() {
41
		return prefix;
42
	}
43

    
44
	public void setPrefix(final String prefix) {
45
		this.prefix = prefix;
46
	}
47

    
48
	public String calculateOpenaireId() {
49
		if (StringUtils.isNotBlank(id)) {
50
			final String[] arr = id.split("::");
51
			if (arr.length == 2) {
52
				return String.format("%s::%s", arr[0], Hashing.md5(arr[1]));
53
			}
54
		}
55
		return "";
56
	}
57
}
(1-1/4)