Project

General

Profile

1
package eu.dnetlib.data.mdstore.plugins.objects;
2

    
3
import javax.xml.bind.annotation.XmlAccessType;
4
import javax.xml.bind.annotation.XmlAccessorType;
5
import javax.xml.bind.annotation.XmlAttribute;
6
import javax.xml.bind.annotation.XmlValue;
7

    
8
@XmlAccessorType(XmlAccessType.FIELD)
9
public class Dataset {
10

    
11
	@XmlAttribute(name = "doi")
12
	private String doi;
13

    
14
	@XmlAttribute(name = "url")
15
	private String url;
16

    
17
	@XmlValue
18
	private String title;
19

    
20
	public Dataset() {}
21

    
22
	public Dataset(final String doi, final String title) {
23
		this.doi = doi;
24
		this.title = title;
25
		setUrl("https://dx.doi.org/" + doi);
26
	}
27

    
28
	public Dataset(final String doi, final String url, final String title) {
29
		this.doi = doi;
30
		this.url = url;
31
		this.title = title;
32
	}
33

    
34
	public String getDoi() {
35
		return doi;
36
	}
37

    
38
	public void setDoi(final String doi) {
39
		this.doi = doi;
40
	}
41

    
42
	public String getUrl() {
43
		return url;
44
	}
45

    
46
	public void setUrl(final String url) {
47
		this.url = url;
48
	}
49

    
50
	public String getTitle() {
51
		return title;
52
	}
53

    
54
	public void setTitle(final String title) {
55
		this.title = title;
56
	}
57

    
58
	@Override
59
	public int hashCode() {
60
		return doi.toLowerCase().hashCode();
61
	}
62

    
63
	@Override
64
	public boolean equals(final Object obj) {
65
		if (this == obj) { return true; }
66
		if (obj == null) { return false; }
67
		return (obj instanceof Dataset) && doi.equalsIgnoreCase(((Dataset) obj).getDoi());
68
	}
69

    
70
}
(4-4/8)