source: VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/rest/RestResponse.java @ 215

Last change on this file since 215 was 215, checked in by oschonef, 14 years ago
  • improve error handling
  • improve error messages and reporting
  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1package eu.clarin.cmdi.virtualcollectionregistry.rest;
2
3import java.util.List;
4
5import javax.xml.bind.annotation.XmlAccessType;
6import javax.xml.bind.annotation.XmlAccessorType;
7import javax.xml.bind.annotation.XmlAttribute;
8import javax.xml.bind.annotation.XmlElement;
9import javax.xml.bind.annotation.XmlElements;
10import javax.xml.bind.annotation.XmlRootElement;
11import javax.xml.bind.annotation.XmlElementWrapper;
12import javax.xml.bind.annotation.XmlType;
13
14@XmlRootElement(name = "RegistryResult")
15@XmlAccessorType(XmlAccessType.NONE)
16@XmlType(propOrder = { "id", "info", "errors" })
17public 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
Note: See TracBrowser for help on using the repository browser.