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.krad.bo.PersistableBusinessObjectBase;
21  
22  import javax.persistence.*;
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  
27  
28  
29  
30  
31  
32  
33  @Entity
34  @Table(name = "KREN_CHNL_T")
35  public class NotificationChannel extends PersistableBusinessObjectBase {
36  	@Id
37  	@GeneratedValue(generator="KREN_CHNL_S")
38  	@GenericGenerator(name="KREN_CHNL_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
39  			@Parameter(name="sequence_name",value="KREN_CHNL_S"),
40  			@Parameter(name="value_column",value="id")
41  	})
42  	@Column(name = "CHNL_ID")
43  	private Long id;
44  	@Column(name = "NM", nullable = false)
45  	private String name;
46  	@Column(name = "DESC_TXT", nullable = false)
47  	private String description;
48  	@Column(name = "SUBSCRB_IND", nullable = false)
49  	private boolean subscribable;
50  
51  	
52  	@OneToMany(cascade={CascadeType.REFRESH, CascadeType.DETACH, CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}, 
53  			targetEntity=org.kuali.rice.ken.bo.NotificationRecipientList.class, mappedBy="channel")
54  	@OrderBy ("id ASC")
55  	private List<NotificationRecipientList> recipientLists;
56  	
57  	@ManyToMany(fetch=FetchType.LAZY, cascade={CascadeType.REFRESH, CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST})@JoinTable(name="KREN_CHNL_PRODCR_T", 
58  			joinColumns=@JoinColumn(name="CHNL_ID"), 
59  			inverseJoinColumns=@JoinColumn(name="PRODCR_ID"))
60  	@OrderBy ("id ASC")
61  	private List<NotificationProducer> producers;
62  	
63  	@OneToMany(cascade={CascadeType.REFRESH, CascadeType.DETACH, CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}, 
64  			targetEntity=org.kuali.rice.ken.bo.NotificationChannelReviewer.class, mappedBy="channel")
65  	@OrderBy ("id ASC")
66  	private List<NotificationChannelReviewer> reviewers = new ArrayList<NotificationChannelReviewer>();
67  	
68  	@OneToMany(cascade={CascadeType.REFRESH, CascadeType.DETACH, CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}, 
69  			targetEntity=org.kuali.rice.ken.bo.UserChannelSubscription.class, mappedBy="channel")
70  	@OrderBy ("id ASC")
71  	private List<UserChannelSubscription> subscriptions = new ArrayList<UserChannelSubscription>();
72  
73  
74  	
75  
76  
77  	public NotificationChannel() {
78  		super();
79  		recipientLists = new ArrayList<NotificationRecipientList>();
80  		producers = new ArrayList<NotificationProducer>();
81  	}
82  
83  	
84  
85  
86  
87  
88  	public List<NotificationRecipientList> getRecipientLists() {
89  		return recipientLists;
90  	}
91  
92  	
93  
94  
95  
96  
97  
98  	public void setRecipientLists(List<NotificationRecipientList> recipientLists) {
99  		this.recipientLists = recipientLists;
100 	}
101 
102 	
103 
104 
105 
106 
107 	public void addRecipientList(NotificationRecipientList recipientList) {
108 		this.recipientLists.add(recipientList);
109 	}
110 
111 	
112 
113 
114 
115 
116 	public void removeRecipientList(NotificationRecipientList recipientList) {
117 		this.recipientLists.remove(recipientList);
118 	}
119 
120 	
121 
122 
123 
124 
125 	public String getDescription() {
126 		return description;
127 	}
128 
129 	
130 
131 
132 
133 
134 
135 	public void setDescription(String description) {
136 		this.description = description;
137 	}
138 
139 	
140 
141 
142 
143 
144 	public Long getId() {
145 		return id;
146 	}
147 
148 	
149 
150 
151 
152 
153 
154 	public void setId(Long id) {
155 		this.id = id;
156 	}
157 
158 	
159 
160 
161 
162 
163 	public String getName() {
164 		return name;
165 	}
166 
167 	
168 
169 
170 
171 
172 
173 	public void setName(String name) {
174 		this.name = name;
175 	}
176 
177 	
178 
179 
180 
181 
182 	public boolean isSubscribable() {
183 		return subscribable;
184 	}
185 
186 	
187 
188 
189 
190 
191 
192 	public void setSubscribable(boolean subscribable) {
193 		this.subscribable = subscribable;
194 	}
195 
196 	
197 
198 
199 
200 
201 	public List<NotificationProducer> getProducers() {
202 		return producers;
203 	}
204 
205 	
206 
207 
208 
209 
210 
211 	public void setProducers(List<NotificationProducer> producers) {
212 		this.producers = producers;
213 	}
214 
215 	
216 
217 
218 
219 
220 	public List<NotificationChannelReviewer> getReviewers() {
221 		return reviewers;
222 	}
223 
224 	
225 
226 
227 
228 
229 
230 	public void setReviewers(List<NotificationChannelReviewer> reviewers) {
231 		this.reviewers = reviewers;
232 	}
233 
234 	
235 
236 
237 
238 
239 	public List<UserChannelSubscription> getSubscriptions() {
240 		return subscriptions;
241 	}
242 
243 	
244 
245 
246 
247 
248 
249 	public void setSubscriptions(List<UserChannelSubscription> subscriptions) {
250 		this.subscriptions = subscriptions;
251 	}
252 
253 	
254 
255 
256 
257 
258 	@Override
259 	public boolean equals(Object obj) {
260 		NotificationChannel channelToCompare = (NotificationChannel) obj;
261 		return this.getId().equals(channelToCompare.getId());
262 	}
263 }