1 /**
2 * Copyright 2010, CSIRO Australia.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /**
18 *
19 */
20 package au.csiro.pidclient;
21
22 import java.util.List;
23
24 import au.csiro.pidclient.business.AndsPidResponseProperty;
25
26 /**
27 * Represents an ANDS Persistent Identifier service response.
28 *
29 * Copyright 2010, CSIRO Australia All rights reserved.
30 *
31 * @author Robert Bridle on 08/02/2010
32 * @version $Revision: 7131 $ $Date: 2010-06-09 14:25:15 +1000 (Wed, 09 Jun 2010) $
33 */
34 public class AndsPidResponse
35 {
36 /**
37 * A constant that represents the case where no handle is returned.
38 */
39 public static final String NO_HANDLE_FOUND = "No handle found";
40
41 /**
42 * The formatted XML response from the ANDS Persistent Identifier service.
43 */
44 private String xmlResponse;
45
46 /**
47 * Whether an ANDS Persistent Identifier service call was successful.
48 */
49 private boolean success;
50
51 /**
52 * The ANDS Persistent Identifier service call return message.
53 */
54 private String message;
55
56 /**
57 * The handles returned by an ANDS PID service call.
58 */
59 private List<String> handles;
60
61 /**
62 * The properties associated with the handle after the ANDS Persistent Identifier service call.
63 */
64 private List<AndsPidResponseProperty> properties;
65
66 /**
67 *
68 */
69 public AndsPidResponse()
70 {
71 }
72
73 /**
74 * @return the xmlResponse
75 */
76 public String getXmlResponse()
77 {
78 return xmlResponse;
79 }
80
81 /**
82 * @param xmlResponse
83 * the xmlResponse to set
84 */
85 public void setXmlResponse(String xmlResponse)
86 {
87 this.xmlResponse = xmlResponse;
88 }
89
90 /**
91 * @return the web service response message
92 */
93 public String getMessage()
94 {
95 return message;
96 }
97
98 /**
99 * @param message
100 * the web service response message to set
101 */
102 public void setMessage(String message)
103 {
104 this.message = message;
105 }
106
107 /**
108 * @return the success
109 */
110 public boolean isSuccess()
111 {
112 return success;
113 }
114
115 /**
116 * @param success
117 * the success to set
118 */
119 public void setSuccess(boolean success)
120 {
121 this.success = success;
122 }
123
124 /**
125 * @return the handle which an ANDS PID service call mints or modifies, if no handle is found then {@link
126 * #NO_HANDLE_FOUND} is returned.
127 */
128 public String getHandle()
129 {
130 for(String handle : this.getHandles())
131 {
132 // return the first element in this list in proper sequence.
133 return handle;
134 }
135 return AndsPidResponse.NO_HANDLE_FOUND;
136 }
137
138 /**
139 * @return the handles
140 */
141 public List<String> getHandles()
142 {
143 return handles;
144 }
145
146 /**
147 * @param handles the handles to set
148 */
149 public void setHandles(List<String> handles)
150 {
151 this.handles = handles;
152 }
153
154 /**
155 * @return the properties
156 */
157 public List<AndsPidResponseProperty> getProperties()
158 {
159 return properties;
160 }
161
162 /**
163 * @param properties
164 * the properties to set
165 */
166 public void setProperties(List<AndsPidResponseProperty> properties)
167 {
168 this.properties = properties;
169 }
170 }