cleanup
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / dto / oaipmh / ResumptionToken.java
1 //
2 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
3 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
4 // Any modifications to this file will be lost upon recompilation of the source schema.
5 // Generated on: 2009.11.02 at 12:58:05 PM GMT
6 //
7
8
9 package eu.etaxonomy.cdm.remote.dto.oaipmh;
10
11 import java.io.Serializable;
12 import java.math.BigInteger;
13 import java.util.UUID;
14
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlAttribute;
18 import javax.xml.bind.annotation.XmlSchemaType;
19 import javax.xml.bind.annotation.XmlTransient;
20 import javax.xml.bind.annotation.XmlType;
21 import javax.xml.bind.annotation.XmlValue;
22 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
23 import javax.xml.datatype.XMLGregorianCalendar;
24
25 import org.joda.time.DateTime;
26
27 import eu.etaxonomy.cdm.api.service.pager.Pager;
28 import eu.etaxonomy.cdm.jaxb.DateTimeAdapter;
29
30
31 /**
32 * A resumptionToken may have 3 optional attributes
33 * and can be used in ListSets, ListIdentifiers, ListRecords
34 * responses.
35 *
36 * <p>Java class for resumptionTokenType complex type.
37 *
38 * <p>The following schema fragment specifies the expected content contained within this class.
39 *
40 * <pre>
41 * &lt;complexType name="resumptionTokenType">
42 * &lt;simpleContent>
43 * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
44 * &lt;attribute name="expirationDate" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
45 * &lt;attribute name="completeListSize" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
46 * &lt;attribute name="cursor" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
47 * &lt;/extension>
48 * &lt;/simpleContent>
49 * &lt;/complexType>
50 * </pre>
51 *
52 *
53 */
54 @XmlAccessorType(XmlAccessType.FIELD)
55 @XmlType(name = "resumptionTokenType", propOrder = {
56 "value"
57 })
58 public class ResumptionToken implements Serializable {
59
60 private static final long serialVersionUID = 6381710233899646281L;
61
62 @XmlValue
63 protected String value;
64
65 @XmlAttribute
66 @XmlJavaTypeAdapter(DateTimeAdapter.class)
67 protected DateTime expirationDate;
68
69 @XmlAttribute
70 @XmlSchemaType(name = "positiveInteger")
71 protected BigInteger completeListSize;
72
73 @XmlAttribute
74 @XmlSchemaType(name = "nonNegativeInteger")
75 protected BigInteger cursor;
76
77 @XmlTransient
78 private MetadataPrefix metadataPrefix;
79
80 @XmlTransient
81 private DateTime from;
82
83 @XmlTransient
84 private DateTime until;
85
86 @XmlTransient
87 private SetSpec set;
88
89 public ResumptionToken(Pager results, DateTime from,
90 DateTime until, MetadataPrefix metadataPrefix, SetSpec set) {
91 this.from = from;
92 this.until = until;
93 this.metadataPrefix = metadataPrefix;
94 this.set = set;
95 this.value = UUID.randomUUID().toString();
96 this.completeListSize = BigInteger.valueOf(results.getCount());
97 this.cursor = BigInteger.valueOf(results.getPageSize() * results.getCurrentIndex());
98 }
99
100 public ResumptionToken() { }
101
102 /**
103 * Gets the value of the value property.
104 *
105 * @return
106 * possible object is
107 * {@link String }
108 *
109 */
110 public String getValue() {
111 return value;
112 }
113
114 /**
115 * Sets the value of the value property.
116 *
117 * @param value
118 * allowed object is
119 * {@link String }
120 *
121 */
122 public void setValue(String value) {
123 this.value = value;
124 }
125
126 /**
127 * Gets the value of the expirationDate property.
128 *
129 * @return
130 * possible object is
131 * {@link XMLGregorianCalendar }
132 *
133 */
134 public DateTime getExpirationDate() {
135 return expirationDate;
136 }
137
138 /**
139 * Sets the value of the expirationDate property.
140 *
141 * @param value
142 * allowed object is
143 * {@link XMLGregorianCalendar }
144 *
145 */
146 public void setExpirationDate(DateTime value) {
147 this.expirationDate = value;
148 }
149
150 /**
151 * Gets the value of the completeListSize property.
152 *
153 * @return
154 * possible object is
155 * {@link BigInteger }
156 *
157 */
158 public BigInteger getCompleteListSize() {
159 return completeListSize;
160 }
161
162 /**
163 * Sets the value of the completeListSize property.
164 *
165 * @param value
166 * allowed object is
167 * {@link BigInteger }
168 *
169 */
170 public void setCompleteListSize(BigInteger value) {
171 this.completeListSize = value;
172 }
173
174 /**
175 * Gets the value of the cursor property.
176 *
177 * @return
178 * possible object is
179 * {@link BigInteger }
180 *
181 */
182 public BigInteger getCursor() {
183 return cursor;
184 }
185
186 /**
187 * Sets the value of the cursor property.
188 *
189 * @param value
190 * allowed object is
191 * {@link BigInteger }
192 *
193 */
194 public void setCursor(BigInteger value) {
195 this.cursor = value;
196 }
197
198 public MetadataPrefix getMetadataPrefix() {
199 return metadataPrefix;
200 }
201
202 public DateTime getFrom() {
203 return from;
204 }
205
206 public DateTime getUntil() {
207 return until;
208 }
209
210 public SetSpec getSet() {
211 return set;
212 }
213
214 public void updateResults(Pager results) {
215 this.completeListSize = BigInteger.valueOf(results.getCount());
216 this.cursor = BigInteger.valueOf(results.getPageSize() * results.getCurrentIndex());
217 }
218
219 public static ResumptionToken emptyResumptionToken() {
220 return new ResumptionToken();
221 }
222 }