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
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 @SuppressWarnings("unused")
62 @XmlAnyElement
63 private final Collection<Element> _futureElements = null;
64
65 public OlePatronLostBarcodeDefinition() {
66 this.olePatronLostBarcodeId = null;
67 this.olePatronId = null;
68 this.invalidOrLostBarcodeNumber = null;
69 this.invalidOrLostBarcodeEffDate = null;
70 this.versionNumber = null;
71
72
73 }
74
75
76 private OlePatronLostBarcodeDefinition(Builder builder) {
77 this.olePatronLostBarcodeId = builder.getOlePatronLostBarcodeId();
78 this.olePatronId = builder.getOlePatronId();
79 this.invalidOrLostBarcodeEffDate = builder.getInvalidOrLostBarcodeEffDate();
80 this.invalidOrLostBarcodeNumber = builder.getInvalidOrLostBarcodeNumber();
81 this.versionNumber = builder.getVersionNumber();
82
83 }
84
85 public String getOlePatronLostBarcodeId() {
86 return this.olePatronLostBarcodeId;
87 }
88
89
90 public String getOlePatronId() {
91 return this.olePatronId;
92 }
93
94
95 public Date getInvalidOrLostBarcodeEffDate() {
96 return this.invalidOrLostBarcodeEffDate;
97 }
98
99 public String getInvalidOrLostBarcodeNumber() {
100 return this.invalidOrLostBarcodeNumber;
101 }
102
103 @Override
104 public Long getVersionNumber() {
105 return this.versionNumber;
106 }
107
108 @Override
109 public String getId() {
110 return this.olePatronLostBarcodeId;
111 }
112
113
114
115
116
117
118
119 public static class Builder
120 implements Serializable, ModelBuilder, OlePatronLostBarcodeContract
121 {
122 private String olePatronLostBarcodeId;
123 private String olePatronId;
124 private Date invalidOrLostBarcodeEffDate;
125 private String invalidOrLostBarcodeNumber;
126 private Long versionNumber;
127
128 private Builder() { }
129
130 public static Builder create() {
131 return new Builder();
132 }
133
134 public static Builder create(OlePatronLostBarcodeContract contract) {
135 if(contract == null) {
136 throw new IllegalArgumentException("contract was null");
137 }
138 Builder builder = create();
139 if (contract.getOlePatronLostBarcodeId() != null) {
140 builder.setOlePatronLostBarcodeId(contract.getOlePatronLostBarcodeId());
141 }
142 if (contract.getOlePatronId() != null) {
143 builder.setOlePatronId(contract.getOlePatronId());
144 }
145 if (contract.getInvalidOrLostBarcodeNumber() != null) {
146 builder.setInvalidOrLostBarcodeNumber(contract.getInvalidOrLostBarcodeNumber());
147 }
148 if (contract.getInvalidOrLostBarcodeEffDate() != null) {
149 builder.setInvalidOrLostBarcodeEffDate(contract.getInvalidOrLostBarcodeEffDate());
150 }
151
152
153 builder.setId(contract.getId());
154 return builder;
155 }
156
157
158 public OlePatronLostBarcodeDefinition build() {
159 return new OlePatronLostBarcodeDefinition(this);
160 }
161
162 public String getOlePatronLostBarcodeId() {
163 return this.olePatronLostBarcodeId;
164 }
165
166 public void setOlePatronLostBarcodeId(String olePatronLostBarcodeId) {
167 this.olePatronLostBarcodeId = olePatronLostBarcodeId;
168 }
169
170 public String getOlePatronId() {
171 return this.olePatronId;
172 }
173
174 public void setOlePatronId(String olePatronId) {
175 this.olePatronId = olePatronId;
176 }
177
178 public Date getInvalidOrLostBarcodeEffDate() {
179 return this.invalidOrLostBarcodeEffDate;
180 }
181
182 public void setInvalidOrLostBarcodeEffDate(Date invalidOrLostBarcodeEffDate) {
183 this.invalidOrLostBarcodeEffDate = invalidOrLostBarcodeEffDate;
184 }
185
186 public String getInvalidOrLostBarcodeNumber() {
187 return this.invalidOrLostBarcodeNumber;
188 }
189
190 public void setInvalidOrLostBarcodeNumber(String invalidOrLostBarcodeNumber) {
191 this.invalidOrLostBarcodeNumber = invalidOrLostBarcodeNumber;
192 }
193
194 @Override
195 public String getId() {
196 return this.olePatronLostBarcodeId;
197 }
198
199
200 public void setId(String id) {
201 if (StringUtils.isWhitespace(id)) {
202 throw new IllegalArgumentException("id is blank");
203 }
204 this.olePatronLostBarcodeId = id;
205 }
206 @Override
207 public Long getVersionNumber() {
208 return this.versionNumber;
209 }
210
211 }
212
213 static class Constants {
214
215 final static String ROOT_ELEMENT_NAME = "olePatronLostBarcode";
216 final static String TYPE_NAME = "OlePatronLostBarcodeType";
217 final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] {CoreConstants.CommonElements.FUTURE_ELEMENTS };
218 }
219
220 static class Elements {
221 final static String OLE_PTRN_LOST_BAR_ID = "olePatronLostBarcodeId";
222 final static String OLE_PTRN_ID = "olePatronId";
223 final static String OLE_PTRN_LOST_BAR_EFF_DT = "invalidOrLostBarcodeEffDate";
224 final static String OLE_PTRN_LOST_BAR_NUM = "invalidOrLostBarcodeNumber";
225
226
227 }
228 public static class Cache {
229 public static final String NAME = KimConstants.Namespaces.KIM_NAMESPACE_2_0 + "/" + Constants.TYPE_NAME;
230 }
231 }