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