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