1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kcb.bo;
17
18 import javax.persistence.CascadeType;
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.FetchType;
22 import javax.persistence.GeneratedValue;
23 import javax.persistence.Id;
24 import javax.persistence.JoinColumn;
25 import javax.persistence.OneToOne;
26 import javax.persistence.Table;
27 import javax.persistence.Version;
28
29 import org.apache.commons.lang.builder.ToStringBuilder;
30 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
31
32
33
34
35
36
37
38 @Entity
39 @Table(name="KREN_MSG_DELIV_T")
40 public class MessageDelivery extends BaseLockable {
41 private static final Integer ZERO = Integer.valueOf(0);
42
43
44
45
46 public static final String ID_FIELD = "id";
47 public static final String SYSTEMID_FIELD = "delivererSystemId";
48 public static final String MESSAGEID_FIELD = "message";
49 public static final String DELIVERY_STATUS = "deliveryStatus";
50 public static final String PROCESS_COUNT = "processCount";
51
52 @Id
53 @GeneratedValue(generator="KREN_MSG_DELIV_S")
54 @PortableSequenceGenerator(name="KREN_MSG_DELIV_S")
55 @Column(name="MSG_DELIV_ID")
56 private Long id;
57 @Column(name="TYP_NM", nullable=false)
58 private String delivererTypeName;
59 @Column(name="SYS_ID", nullable=true)
60 private String delivererSystemId;
61 @Column(name="STAT_CD", nullable=true)
62 private String deliveryStatus = MessageDeliveryStatus.UNDELIVERED.name();
63 @Column(name="PROC_CNT", nullable=true)
64 private Integer processCount = ZERO;
65
66
67
68
69 @OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST})
70 @JoinColumn(name="MSG_ID", nullable=false)
71 private Message message;
72
73
74
75
76 @Version
77 @Column(name="VER_NBR")
78 private Integer lockVerNbr;
79
80
81
82
83 public MessageDelivery() {
84 }
85
86
87
88
89
90 public MessageDelivery(MessageDelivery md) {
91 this.id = md.id;
92 this.delivererTypeName = md.delivererTypeName;
93 this.deliveryStatus = md.deliveryStatus;
94 this.delivererSystemId = md.delivererSystemId;
95 this.message = md.message;
96 this.lockVerNbr = md.lockVerNbr;
97 }
98
99
100
101
102
103 public Long getId() {
104 return id;
105 }
106
107
108
109
110
111 public void setId(Long id) {
112 this.id = id;
113 }
114
115
116
117
118
119
120 public Integer getLockVerNbr() {
121 return lockVerNbr;
122 }
123
124
125
126
127
128 public void setLockVerNbr(Integer lockVerNbr) {
129 this.lockVerNbr = lockVerNbr;
130 }
131
132
133
134
135
136 public String getDeliveryStatus() {
137 return deliveryStatus;
138 }
139
140
141
142
143
144
145 public void setDeliveryStatus(MessageDeliveryStatus deliveryStatus) {
146 this.deliveryStatus = deliveryStatus.name();
147 }
148
149
150
151
152
153 public void setDeliveryStatus(String deliveryStatus) {
154
155
156 MessageDeliveryStatus.valueOf(deliveryStatus);
157 this.deliveryStatus = deliveryStatus;
158 }
159
160
161
162
163 public Integer getProcessCount() {
164 return this.processCount;
165 }
166
167
168
169
170
171 public void setProcessCount(Integer processCount) {
172 this.processCount = processCount;
173 }
174
175
176
177
178
179 public String getDelivererTypeName() {
180 return delivererTypeName;
181 }
182
183
184
185
186
187 public void setDelivererTypeName(String delivererTypeName) {
188 this.delivererTypeName = delivererTypeName;
189 }
190
191
192
193
194
195 public String getDelivererSystemId() {
196 return delivererSystemId;
197 }
198
199
200
201
202
203 public void setDelivererSystemId(String delivererSystemId) {
204 this.delivererSystemId = delivererSystemId;
205 }
206
207
208
209
210 public Message getMessage() {
211 return this.message;
212 }
213
214
215
216
217
218 public void setMessage(Message message) {
219 this.message = message;
220 }
221
222
223
224
225 @Override
226 public String toString() {
227 return new ToStringBuilder(this)
228 .append("id", id)
229 .append("deliveryStatus", deliveryStatus)
230 .append("processCount", processCount)
231 .append("delivererTypename", delivererTypeName)
232 .append("delivererSystemId", delivererSystemId)
233 .append("message", message == null ? null : message.getId())
234 .toString();
235 }
236 }