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