1 | package eu.clarin.cmdi.virtualcollectionregistry.rest; |
---|
2 | |
---|
3 | import java.util.List; |
---|
4 | |
---|
5 | import javax.xml.bind.annotation.XmlAccessType; |
---|
6 | import javax.xml.bind.annotation.XmlAccessorType; |
---|
7 | import javax.xml.bind.annotation.XmlAttribute; |
---|
8 | import javax.xml.bind.annotation.XmlElement; |
---|
9 | import javax.xml.bind.annotation.XmlElements; |
---|
10 | import javax.xml.bind.annotation.XmlRootElement; |
---|
11 | import javax.xml.bind.annotation.XmlElementWrapper; |
---|
12 | import javax.xml.bind.annotation.XmlType; |
---|
13 | |
---|
14 | @XmlRootElement(name = "RegistryResult") |
---|
15 | @XmlAccessorType(XmlAccessType.NONE) |
---|
16 | @XmlType(propOrder = { "id", "info", "errors" }) |
---|
17 | public class RestResponse { |
---|
18 | private boolean isSuccess; |
---|
19 | private Long id; |
---|
20 | private String info; |
---|
21 | private List<String> errors; |
---|
22 | |
---|
23 | public void setIsSuccess(boolean isSuccess) { |
---|
24 | this.isSuccess = isSuccess; |
---|
25 | } |
---|
26 | |
---|
27 | @XmlAttribute(name = "success") |
---|
28 | public boolean isSuccess() { |
---|
29 | return isSuccess; |
---|
30 | } |
---|
31 | |
---|
32 | public void setId(long id) { |
---|
33 | this.id = new Long(id); |
---|
34 | } |
---|
35 | |
---|
36 | @XmlElement(name = "VirtualCollectionId") |
---|
37 | public Long getId() { |
---|
38 | return id; |
---|
39 | } |
---|
40 | |
---|
41 | public void setInfo(String info) { |
---|
42 | this.info = info; |
---|
43 | } |
---|
44 | |
---|
45 | @XmlElement(name = "Info") |
---|
46 | public String getInfo() { |
---|
47 | return info; |
---|
48 | } |
---|
49 | |
---|
50 | public void setError(List<String> errors) { |
---|
51 | if ((errors != null) && !errors.isEmpty()) { |
---|
52 | this.errors = errors; |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | @XmlElementWrapper(name = "Errors") |
---|
57 | @XmlElements({@XmlElement(name = "Error") }) |
---|
58 | public List<String> getErrors() { |
---|
59 | return errors; |
---|
60 | } |
---|
61 | |
---|
62 | } // class RestResponse |
---|