1 package org.kuali.ole.patron.api;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.kuali.api.jaxb.DateAdapter;
5 import org.kuali.rice.core.api.CoreConstants;
6 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
7 import org.kuali.rice.core.api.mo.ModelBuilder;
8 import org.kuali.rice.kim.api.KimConstants;
9 import org.kuali.rice.kim.api.identity.address.EntityAddress;
10 import org.w3c.dom.Element;
11
12 import javax.xml.bind.annotation.*;
13 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
14 import java.io.Serializable;
15 import java.util.Collection;
16 import java.util.Date;
17
18
19
20
21
22
23
24
25 @XmlRootElement(name = OlePatronLostBarcodeDefinition.Constants.ROOT_ELEMENT_NAME)
26 @XmlAccessorType(XmlAccessType.NONE)
27 @XmlType(name = OlePatronLostBarcodeDefinition.Constants.TYPE_NAME, propOrder = {
28 OlePatronLostBarcodeDefinition.Elements.OLE_PTRN_LOST_BAR_ID,
29 OlePatronLostBarcodeDefinition.Elements.OLE_PTRN_ID,
30 OlePatronLostBarcodeDefinition.Elements.OLE_PTRN_LOST_BAR_EFF_DT,
31 OlePatronLostBarcodeDefinition.Elements.OLE_PTRN_LOST_BAR_NUM,
32
33
34
35 CoreConstants.CommonElements.VERSION_NUMBER,
36 CoreConstants.CommonElements.OBJECT_ID,
37 CoreConstants.CommonElements.FUTURE_ELEMENTS
38 })
39 public class OlePatronLostBarcodeDefinition extends AbstractDataTransferObject implements OlePatronLostBarcodeContract{
40
41 private static final long serialVersionUID = 1L;
42
43
44
45 @XmlElement(name = Elements.OLE_PTRN_LOST_BAR_ID, required = false)
46 private final String olePatronLostBarcodeId;
47
48 @XmlElement(name = Elements.OLE_PTRN_ID, required = false)
49 private final String olePatronId;
50
51 @XmlElement(name = Elements.OLE_PTRN_LOST_BAR_EFF_DT, required = false)
52 @XmlJavaTypeAdapter(value=DateAdapter.class, type=Date.class)
53 private final Date invalidOrLostBarcodeEffDate;
54
55 @XmlElement(name = Elements.OLE_PTRN_LOST_BAR_NUM, required = false)
56 private final String invalidOrLostBarcodeNumber;
57
58 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
59 private final Long versionNumber;
60
61
62 @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
63 private final String objectId;
64
65
66 @SuppressWarnings("unused")
67 @XmlAnyElement
68 private final Collection<Element> _futureElements = null;
69
70 public OlePatronLostBarcodeDefinition() {
71 this.olePatronLostBarcodeId = null;
72 this.olePatronId = null;
73 this.invalidOrLostBarcodeNumber = null;
74 this.invalidOrLostBarcodeEffDate = null;
75 this.versionNumber = null;
76
77 this.objectId = null;
78 }
79
80
81 private OlePatronLostBarcodeDefinition(Builder builder) {
82 this.olePatronLostBarcodeId = builder.getOlePatronLostBarcodeId();
83 this.olePatronId = builder.getOlePatronId();
84 this.invalidOrLostBarcodeEffDate = builder.getInvalidOrLostBarcodeEffDate();
85 this.invalidOrLostBarcodeNumber = builder.getInvalidOrLostBarcodeNumber();
86 this.versionNumber = builder.getVersionNumber();
87 this.objectId = builder.getObjectId();
88 }
89
90 public String getOlePatronLostBarcodeId() {
91 return this.olePatronLostBarcodeId;
92 }
93
94
95 public String getOlePatronId() {
96 return this.olePatronId;
97 }
98
99
100 public Date getInvalidOrLostBarcodeEffDate() {
101 return this.invalidOrLostBarcodeEffDate;
102 }
103
104 public String getInvalidOrLostBarcodeNumber() {
105 return this.invalidOrLostBarcodeNumber;
106 }
107
108 @Override
109 public String getObjectId() {
110 return this.objectId;
111 }
112
113 @Override
114 public Long getVersionNumber() {
115 return this.versionNumber;
116 }
117
118 @Override
119 public String getId() {
120 return this.olePatronLostBarcodeId;
121 }
122
123
124
125
126
127
128
129 public static class Builder
130 implements Serializable, ModelBuilder, OlePatronLostBarcodeContract
131 {
132 private String olePatronLostBarcodeId;
133 private String olePatronId;
134 private Date invalidOrLostBarcodeEffDate;
135 private String invalidOrLostBarcodeNumber;
136 private Long versionNumber;
137 private String objectId;
138 private Builder() { }
139
140 public static Builder create() {
141 return new Builder();
142 }
143
144 public static Builder create(OlePatronLostBarcodeContract contract) {
145 if(contract == null) {
146 throw new IllegalArgumentException("contract was null");
147 }
148 Builder builder = create();
149 if (contract.getOlePatronLostBarcodeId() != null) {
150 builder.setOlePatronLostBarcodeId(contract.getOlePatronLostBarcodeId());
151 }
152 if (contract.getOlePatronId() != null) {
153 builder.setOlePatronId(contract.getOlePatronId());
154 }
155 if (contract.getInvalidOrLostBarcodeNumber() != null) {
156 builder.setInvalidOrLostBarcodeNumber(contract.getInvalidOrLostBarcodeNumber());
157 }
158 if (contract.getInvalidOrLostBarcodeEffDate() != null) {
159 builder.setInvalidOrLostBarcodeEffDate(contract.getInvalidOrLostBarcodeEffDate());
160 }
161
162 builder.setObjectId(contract.getObjectId());
163 builder.setVersionNumber(contract.getVersionNumber());
164 builder.setId(contract.getId());
165 return builder;
166 }
167
168
169 public OlePatronLostBarcodeDefinition build() {
170 return new OlePatronLostBarcodeDefinition(this);
171 }
172
173 public String getOlePatronLostBarcodeId() {
174 return this.olePatronLostBarcodeId;
175 }
176
177 public void setOlePatronLostBarcodeId(String olePatronLostBarcodeId) {
178 this.olePatronLostBarcodeId = olePatronLostBarcodeId;
179 }
180
181 public String getOlePatronId() {
182 return this.olePatronId;
183 }
184
185 public void setOlePatronId(String olePatronId) {
186 this.olePatronId = olePatronId;
187 }
188
189 public Date getInvalidOrLostBarcodeEffDate() {
190 return this.invalidOrLostBarcodeEffDate;
191 }
192
193 public void setInvalidOrLostBarcodeEffDate(Date invalidOrLostBarcodeEffDate) {
194 this.invalidOrLostBarcodeEffDate = invalidOrLostBarcodeEffDate;
195 }
196
197 public String getInvalidOrLostBarcodeNumber() {
198 return this.invalidOrLostBarcodeNumber;
199 }
200
201 public void setInvalidOrLostBarcodeNumber(String invalidOrLostBarcodeNumber) {
202 this.invalidOrLostBarcodeNumber = invalidOrLostBarcodeNumber;
203 }
204
205 @Override
206 public String getId() {
207 return this.olePatronLostBarcodeId;
208 }
209
210
211 public void setId(String id) {
212 if (StringUtils.isWhitespace(id)) {
213 throw new IllegalArgumentException("id is blank");
214 }
215 this.olePatronLostBarcodeId = id;
216 }
217
218 public Long getVersionNumber() {
219 return this.versionNumber;
220 }
221
222 public void setVersionNumber(Long versionNumber) {
223 this.versionNumber = versionNumber;
224 }
225
226 public String getObjectId() {
227 return objectId;
228 }
229
230 public void setObjectId(String objectId) {
231 this.objectId = objectId;
232 }
233 }
234
235 static class Constants {
236
237 final static String ROOT_ELEMENT_NAME = "olePatronLostBarcode";
238 final static String TYPE_NAME = "OlePatronLostBarcodeType";
239 final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] {CoreConstants.CommonElements.FUTURE_ELEMENTS };
240 }
241
242 static class Elements {
243 final static String OLE_PTRN_LOST_BAR_ID = "olePatronLostBarcodeId";
244 final static String OLE_PTRN_ID = "olePatronId";
245 final static String OLE_PTRN_LOST_BAR_EFF_DT = "invalidOrLostBarcodeEffDate";
246 final static String OLE_PTRN_LOST_BAR_NUM = "invalidOrLostBarcodeNumber";
247
248
249 }
250 public static class Cache {
251 public static final String NAME = KimConstants.Namespaces.KIM_NAMESPACE_2_0 + "/" + Constants.TYPE_NAME;
252 }
253 }