View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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  
24  /**
25   * This class represents an instance of a user's subscription to a specific 
26   * notification channel.
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  @Entity
30  @Table(name="KREN_CHNL_SUBSCRP_T")
31  public class UserChannelSubscription extends PersistableBusinessObjectBase{
32      @Id
33      @GeneratedValue(generator="KREN_CHNL_SUBSCRP_S")
34  	@GenericGenerator(name="KREN_CHNL_SUBSCRP_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
35  			@Parameter(name="sequence_name",value="KREN_CHNL_SUBSCRP_S"),
36  			@Parameter(name="value_column",value="id")
37  	})
38  	@Column(name="CHNL_SUBSCRP_ID")
39  	private Long id;
40      @Column(name="PRNCPL_ID", nullable=false)
41  	private String userId;
42      
43      @OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH, CascadeType.MERGE})
44  	@JoinColumn(name="CHNL_ID")
45  	private NotificationChannel channel;
46      
47      /**
48       * Constructs a UserChannelSubscription instance.
49       */
50      public UserChannelSubscription() {
51      }
52  
53      /**
54       * Gets the channel attribute. 
55       * @return Returns the channel.
56       */
57      public NotificationChannel getChannel() {
58  	return channel;
59      }
60  
61      /**
62       * Sets the channel attribute value.
63       * @param channel The channel to set.
64       */
65      public void setChannel(NotificationChannel channel) {
66  	this.channel = channel;
67      }
68  
69      /**
70       * Gets the id attribute. 
71       * @return Returns the id.
72       */
73      public Long getId() {
74  	return id;
75      }
76  
77      /**
78       * Sets the id attribute value.
79       * @param id The id to set.
80       */
81      public void setId(Long id) {
82  	this.id = id;
83      }
84  
85      /**
86       * Gets the userId attribute. 
87       * @return Returns the userId.
88       */
89      public String getUserId() {
90  	return userId;
91      }
92  
93      /**
94       * Sets the userId attribute value.
95       * @param userId The userId to set.
96       */
97      public void setUserId(String userId) {
98  	this.userId = userId;
99      }
100 }
101