Project

General

Profile

1 44355 claudio.at
package eu.dnetlib.dli.resolver.model;
2 34591 sandro.lab
3 43618 sandro.lab
import org.apache.commons.lang3.StringEscapeUtils;
4 34591 sandro.lab
5
/**
6
 * The Class PID.
7
 */
8 43783 sandro.lab
public class PID {
9 34591 sandro.lab
10 43618 sandro.lab
	/**
11
	 * The id.
12
	 */
13 34591 sandro.lab
	private String id;
14
15 43618 sandro.lab
	/**
16
	 * The type.
17
	 */
18 34591 sandro.lab
	private String type;
19
20
	/**
21
	 * Instantiates a new pid.
22
	 */
23 43783 sandro.lab
	public PID() {
24 34591 sandro.lab
25
	}
26
27
	/**
28
	 * Instantiates a new pid.
29
	 *
30 43618 sandro.lab
	 * @param id   the id
31
	 * @param type the type
32 34591 sandro.lab
	 */
33 43783 sandro.lab
	public PID(final String id, final String type) {
34 35424 sandro.lab
		if (id != null) {
35 38162 sandro.lab
			this.id = id.replace("http://dx.doi.org/", "").toLowerCase();
36 35424 sandro.lab
		}
37 34591 sandro.lab
		this.type = type;
38
	}
39
40
	/**
41
	 * Gets the id.
42
	 *
43
	 * @return the id
44
	 */
45
	public String getId() {
46
		return id;
47
	}
48
49
	/**
50
	 * Sets the id.
51
	 *
52 43618 sandro.lab
	 * @param id the id to set
53 34591 sandro.lab
	 */
54
	public void setId(final String id) {
55 35424 sandro.lab
		if (id != null) {
56 38162 sandro.lab
			this.id = id.replace("http://dx.doi.org/", "").toLowerCase();
57 43618 sandro.lab
		}
58
		;
59 34591 sandro.lab
	}
60
61 43618 sandro.lab
	public String getEscapeXMLId() {
62
		return StringEscapeUtils.escapeXml11(id);
63
	}
64
65 34591 sandro.lab
	/**
66
	 * Gets the type.
67
	 *
68
	 * @return the type
69
	 */
70
	public String getType() {
71
		return type;
72
	}
73
74
	/**
75
	 * Sets the type.
76
	 *
77 43618 sandro.lab
	 * @param type the type to set
78 34591 sandro.lab
	 */
79
	public void setType(final String type) {
80
		if (type != null) {
81
			this.type = type.toUpperCase();
82
		} else {
83
			this.type = type;
84
		}
85
	}
86 35785 sandro.lab
87
	@Override
88
	public String toString() {
89 43618 sandro.lab
		return String.format("\n\t\tPid:%s \n\t\tPidType:%s ", this.id, this.type);
90 35785 sandro.lab
	}
91 34591 sandro.lab
}