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 = NotificationRecipient.Constants.ROOT_ELEMENT_NAME)
32 @XmlAccessorType(XmlAccessType.NONE)
33 @XmlType(name = NotificationRecipient.Constants.TYPE_NAME, propOrder = {
34 NotificationRecipient.Elements.NOTIFICATION_ID,
35 NotificationRecipient.Elements.RECIPIENT_TYPE,
36 NotificationRecipient.Elements.RECIPIENT_ID,
37 NotificationRecipient.Elements.ID,
38 CoreConstants.CommonElements.VERSION_NUMBER,
39 CoreConstants.CommonElements.OBJECT_ID,
40 CoreConstants.CommonElements.FUTURE_ELEMENTS
41 })
42 public final class NotificationRecipient
43 extends AbstractDataTransferObject
44 implements NotificationRecipientContract
45 {
46
47 @XmlElement(name = Elements.NOTIFICATION_ID, required = false)
48 private final Long notificationId;
49 @XmlElement(name = Elements.RECIPIENT_TYPE, required = false)
50 private final String recipientType;
51 @XmlElement(name = Elements.RECIPIENT_ID, required = false)
52 private final String recipientId;
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 NotificationRecipient() {
68 this.notificationId = null;
69 this.recipientType = null;
70 this.recipientId = null;
71 this.id = null;
72 this.versionNumber = null;
73 this.objectId = null;
74 }
75
76 private NotificationRecipient(Builder builder) {
77 this.notificationId = builder.getNotificationId();
78 this.recipientType = builder.getRecipientType();
79 this.recipientId = builder.getRecipientId();
80 this.id = builder.getId();
81 this.versionNumber = builder.getVersionNumber();
82 this.objectId = builder.getObjectId();
83 }
84
85 @Override
86 public Long getNotificationId() {
87 return this.notificationId;
88 }
89
90 @Override
91 public String getRecipientType() {
92 return this.recipientType;
93 }
94
95 @Override
96 public String getRecipientId() {
97 return this.recipientId;
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, NotificationRecipientContract
122 {
123
124 private Long notificationId;
125 private String recipientType;
126 private String recipientId;
127 private Long id;
128 private Long versionNumber;
129 private String objectId;
130
131 private Builder() {
132
133 }
134
135 public static Builder create() {
136
137 return new Builder();
138 }
139
140 public static Builder create(NotificationRecipientContract contract) {
141 if (contract == null) {
142 throw new IllegalArgumentException("contract was null");
143 }
144
145 Builder builder = create();
146 builder.setNotificationId(contract.getNotificationId());
147 builder.setRecipientType(contract.getRecipientType());
148 builder.setRecipientId(contract.getRecipientId());
149 builder.setId(contract.getId());
150 builder.setVersionNumber(contract.getVersionNumber());
151 builder.setObjectId(contract.getObjectId());
152 return builder;
153 }
154
155 public NotificationRecipient build() {
156 return new NotificationRecipient(this);
157 }
158
159 @Override
160 public Long getNotificationId() {
161 return this.notificationId;
162 }
163
164 @Override
165 public String getRecipientType() {
166 return this.recipientType;
167 }
168
169 @Override
170 public String getRecipientId() {
171 return this.recipientId;
172 }
173
174 @Override
175 public Long getId() {
176 return this.id;
177 }
178
179 @Override
180 public Long getVersionNumber() {
181 return this.versionNumber;
182 }
183
184 @Override
185 public String getObjectId() {
186 return this.objectId;
187 }
188
189 public void setNotificationId(Long notificationId) {
190
191 this.notificationId = notificationId;
192 }
193
194 public void setRecipientType(String recipientType) {
195
196 this.recipientType = recipientType;
197 }
198
199 public void setRecipientId(String recipientId) {
200
201 this.recipientId = recipientId;
202 }
203
204 public void setId(Long id) {
205
206 this.id = id;
207 }
208
209 public void setVersionNumber(Long versionNumber) {
210
211 this.versionNumber = versionNumber;
212 }
213
214 public void setObjectId(String objectId) {
215
216 this.objectId = objectId;
217 }
218
219 }
220
221
222
223
224
225
226 static class Constants {
227
228 final static String ROOT_ELEMENT_NAME = "notificationRecipient";
229 final static String TYPE_NAME = "NotificationRecipientType";
230
231 }
232
233
234
235
236
237
238 static class Elements {
239
240 final static String NOTIFICATION_ID = "notificationId";
241 final static String RECIPIENT_TYPE = "recipientType";
242 final static String RECIPIENT_ID = "recipientId";
243 final static String ID = "id";
244
245 }
246
247 }