dnet50/modules/dnet-dli-domain/trunk/src/main/java/eu/dnetlib/dli/resolver/model/PID.java @ 49184
1 |
package eu.dnetlib.dli.resolver.model; |
---|---|
2 |
|
3 |
import org.apache.commons.lang3.StringEscapeUtils; |
4 |
|
5 |
/**
|
6 |
* The Class PID.
|
7 |
*/
|
8 |
public class PID { |
9 |
|
10 |
/**
|
11 |
* The id.
|
12 |
*/
|
13 |
private String id; |
14 |
|
15 |
/**
|
16 |
* The type.
|
17 |
*/
|
18 |
private String type; |
19 |
|
20 |
/**
|
21 |
* Instantiates a new pid.
|
22 |
*/
|
23 |
public PID() { |
24 |
|
25 |
}
|
26 |
|
27 |
/**
|
28 |
* Instantiates a new pid.
|
29 |
*
|
30 |
* @param id the id
|
31 |
* @param type the type
|
32 |
*/
|
33 |
public PID(final String id, final String type) { |
34 |
if (id != null) { |
35 |
this.id = id.replace("http://dx.doi.org/", "").toLowerCase(); |
36 |
}
|
37 |
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 |
* @param id the id to set
|
53 |
*/
|
54 |
public void setId(final String id) { |
55 |
if (id != null) { |
56 |
this.id = id.replace("http://dx.doi.org/", "").toLowerCase(); |
57 |
}
|
58 |
;
|
59 |
}
|
60 |
|
61 |
public String getEscapeXMLId() { |
62 |
return StringEscapeUtils.escapeXml11(id); |
63 |
}
|
64 |
|
65 |
/**
|
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 |
* @param type the type to set
|
78 |
*/
|
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 |
|
87 |
@Override
|
88 |
public String toString() { |
89 |
return String.format("\n\t\tPid:%s \n\t\tPidType:%s ", this.id, this.type); |
90 |
}
|
91 |
}
|