1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ken.bo;
17
18 import org.kuali.rice.ken.api.notification.NotificationChannelReviewer;
19 import org.kuali.rice.ken.api.notification.NotificationChannelReviewerContract;
20 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
21
22 import javax.persistence.CascadeType;
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.FetchType;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.Id;
28 import javax.persistence.JoinColumn;
29 import javax.persistence.OneToOne;
30 import javax.persistence.Parameter;
31 import javax.persistence.Table;
32
33
34
35
36
37 @Entity
38 @Table(name="KREN_RVWER_T")
39 public class NotificationChannelReviewerBo extends PersistableBusinessObjectBase implements NotificationChannelReviewerContract {
40 @Id
41 @GeneratedValue(generator="KREN_RVWER_S")
42 @Column(name="RVWER_ID")
43 private Long id;
44 @OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH, CascadeType.DETACH })
45 @JoinColumn(name="CHNL_ID")
46 private NotificationChannelBo channel;
47 @Column(name="TYP", nullable=false)
48 private String reviewerType;
49 @Column(name="PRNCPL_ID", nullable=false)
50 private String reviewerId;
51
52
53
54
55
56 public Long getId() {
57 return id;
58 }
59
60
61
62
63
64 public void setId(Long id) {
65 this.id = id;
66 }
67
68
69
70
71
72 public NotificationChannelBo getChannel() {
73 return channel;
74 }
75
76
77
78
79
80 public void setChannel(NotificationChannelBo channel) {
81 this.channel = channel;
82 }
83
84
85
86
87
88
89 public String getReviewerId() {
90 return reviewerId;
91 }
92
93
94
95
96
97 public void setReviewerId(String reviewerId) {
98 this.reviewerId = reviewerId;
99 }
100
101
102
103
104
105 public String getReviewerType() {
106 return reviewerType;
107 }
108
109
110
111
112
113 public void setReviewerType(String reviewerType) {
114 this.reviewerType = reviewerType;
115 }
116
117
118
119
120
121
122 public static NotificationChannelReviewer to(NotificationChannelReviewerBo bo) {
123 if (bo == null) {
124 return null;
125 }
126
127 return NotificationChannelReviewer.Builder.create(bo).build();
128 }
129
130
131
132
133
134
135 public static NotificationChannelReviewerBo from(NotificationChannelReviewer im) {
136 if (im == null) {
137 return null;
138 }
139
140 NotificationChannelReviewerBo bo = new NotificationChannelReviewerBo();
141 bo.setId(im.getId());
142 bo.setVersionNumber(im.getVersionNumber());
143 bo.setObjectId(im.getObjectId());
144
145 bo.setReviewerType(im.getReviewerType());
146 bo.setReviewerId(im.getReviewerId());
147 bo.setChannel(im.getChannel() == null ? null : NotificationChannelBo.from(im.getChannel()));
148
149 return bo;
150 }
151 }