1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ken.api.notification;
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 import org.kuali.rice.core.api.CoreConstants;
27 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
28 import org.kuali.rice.core.api.mo.ModelBuilder;
29 import org.w3c.dom.Element;
30
31 @XmlRootElement(name = NotificationListRecipient.Constants.ROOT_ELEMENT_NAME)
32 @XmlAccessorType(XmlAccessType.NONE)
33 @XmlType(name = NotificationListRecipient.Constants.TYPE_NAME, propOrder = {
34 NotificationListRecipient.Elements.CHANNEL,
35 NotificationListRecipient.Elements.RECIPIENT_ID,
36 NotificationListRecipient.Elements.RECIPIENT_TYPE,
37 NotificationListRecipient.Elements.ID,
38 CoreConstants.CommonElements.VERSION_NUMBER,
39 CoreConstants.CommonElements.OBJECT_ID,
40 CoreConstants.CommonElements.FUTURE_ELEMENTS
41 })
42 public final class NotificationListRecipient
43 extends AbstractDataTransferObject
44 implements NotificationListRecipientContract
45 {
46
47 @XmlElement(name = Elements.CHANNEL, required = false)
48 private final NotificationChannel channel;
49 @XmlElement(name = Elements.RECIPIENT_ID, required = false)
50 private final String recipientId;
51 @XmlElement(name = Elements.RECIPIENT_TYPE, required = false)
52 private final String recipientType;
53 @XmlElement(name = Elements.ID, required = false)
54 private final Long id;
55 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
56 private final Long versionNumber;
57 @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
58 private final String objectId;
59 @SuppressWarnings("unused")
60 @XmlAnyElement
61 private final Collection<Element> _futureElements = null;
62
63
64
65
66
67 private NotificationListRecipient() {
68 this.channel = null;
69 this.recipientId = null;
70 this.recipientType = null;
71 this.id = null;
72 this.versionNumber = null;
73 this.objectId = null;
74 }
75
76 private NotificationListRecipient(Builder builder) {
77 this.channel = builder.getChannel() == null ? null : builder.getChannel().build();
78 this.recipientId = builder.getRecipientId();
79 this.recipientType = builder.getRecipientType();
80 this.id = builder.getId();
81 this.versionNumber = builder.getVersionNumber();
82 this.objectId = builder.getObjectId();
83 }
84
85 @Override
86 public NotificationChannel getChannel() {
87 return this.channel;
88 }
89
90 @Override
91 public String getRecipientId() {
92 return this.recipientId;
93 }
94
95 @Override
96 public String getRecipientType() {
97 return this.recipientType;
98 }
99
100 @Override
101 public Long getId() {
102 return this.id;
103 }
104
105 @Override
106 public Long getVersionNumber() {
107 return this.versionNumber;
108 }
109
110 @Override
111 public String getObjectId() {
112 return this.objectId;
113 }
114
115
116
117
118
119
120 public final static class Builder
121 implements Serializable, ModelBuilder, NotificationListRecipientContract
122 {
123
124 private NotificationChannel.Builder channel;
125 private String recipientId;
126 private String recipientType;
127 private Long id;
128 private Long versionNumber;
129 private String objectId;
130
131 private Builder() {
132 }
133
134 public static Builder create() {
135 return new Builder();
136 }
137
138 public static Builder create(NotificationListRecipientContract contract) {
139 if (contract == null) {
140 throw new IllegalArgumentException("contract was null");
141 }
142
143 Builder builder = create();
144 builder.setChannel(contract.getChannel() != null ? NotificationChannel.Builder.create(contract.getChannel()) : null);
145 builder.setRecipientId(contract.getRecipientId());
146 builder.setRecipientType(contract.getRecipientType());
147 builder.setId(contract.getId());
148 builder.setVersionNumber(contract.getVersionNumber());
149 builder.setObjectId(contract.getObjectId());
150 return builder;
151 }
152
153 public NotificationListRecipient build() {
154 return new NotificationListRecipient(this);
155 }
156
157 @Override
158 public NotificationChannel.Builder getChannel() {
159 return this.channel;
160 }
161
162 @Override
163 public String getRecipientId() {
164 return this.recipientId;
165 }
166
167 @Override
168 public String getRecipientType() {
169 return this.recipientType;
170 }
171
172 @Override
173 public Long getId() {
174 return this.id;
175 }
176
177 @Override
178 public Long getVersionNumber() {
179 return this.versionNumber;
180 }
181
182 @Override
183 public String getObjectId() {
184 return this.objectId;
185 }
186
187 public void setChannel(NotificationChannel.Builder channel) {
188 this.channel = channel;
189 }
190
191 public void setRecipientId(String recipientId) {
192 this.recipientId = recipientId;
193 }
194
195 public void setRecipientType(String recipientType) {
196 this.recipientType = recipientType;
197 }
198
199 public void setId(Long id) {
200
201 this.id = id;
202 }
203
204 public void setVersionNumber(Long versionNumber) {
205
206 this.versionNumber = versionNumber;
207 }
208
209 public void setObjectId(String objectId) {
210
211 this.objectId = objectId;
212 }
213
214 }
215
216
217
218
219
220
221 static class Constants {
222
223 final static String ROOT_ELEMENT_NAME = "notificationListRecipient";
224 final static String TYPE_NAME = "NotificationListRecipientType";
225
226 }
227
228
229
230
231
232
233 static class Elements {
234
235 final static String CHANNEL = "channel";
236 final static String RECIPIENT_ID = "recipientId";
237 final static String RECIPIENT_TYPE = "recipientType";
238 final static String ID = "id";
239
240 }
241
242 }