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 houses information pertaining to each recipient for a Notification message.  This 
26   * recipient can be either a user or a group - which is specified by the recipient type.
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  @Entity
30  @Table(name="KREN_RECIP_T")
31  public class NotificationRecipient extends PersistableBusinessObjectBase{
32      @Id
33      @GeneratedValue(generator="KREN_RECIP_S")
34  	@GenericGenerator(name="KREN_RECIP_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
35  			@Parameter(name="sequence_name",value="KREN_RECIP_S"),
36  			@Parameter(name="value_column",value="id")
37  	})
38  	@Column(name="RECIP_ID")
39  	private Long id;
40      @Column(name="NTFCTN_ID", nullable=false)
41  	private Long notificationId;
42      @Column(name="RECIP_TYP_CD", nullable=false)
43  	private String recipientType;
44      @Column(name="PRNCPL_ID", nullable=false)
45  	private String recipientId;
46      
47      // Added for JPA uni-directional one-to-many (not yet supported by JPA)
48      @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.REMOVE})
49      @JoinColumn(name="NTFCTN_ID", insertable=false, updatable=false)
50      private Notification notification;
51      
52      /**
53       * Constructs a NotificationRecipient instance.
54       */
55      public NotificationRecipient() {
56      }
57  
58      /**
59       * Gets the id attribute. 
60       * @return Returns the id.
61       */
62      public Long getId() {
63  	return id;
64      }
65  
66      /**
67       * Sets the id attribute value.
68       * @param id The id to set.
69       */
70      public void setId(Long id) {
71  	this.id = id;
72      }
73  
74      /**
75       * Gets the notificationId attribute. 
76       * @return Returns the notificationId.
77       */
78      public Long getNotificationId() {
79  	return notificationId;
80      }
81  
82      /**
83       * Sets the notificationId attribute value.
84       * @param notificationId The notificationId to set.
85       */
86      public void setNotificationId(Long notificationId) {
87  	this.notificationId = notificationId;
88      }
89  
90      /**
91       * Gets the recipientId attribute. 
92       * @return Returns the recipientId.
93       */
94      public String getRecipientId() {
95  	return recipientId;
96      }
97  
98      /**
99       * Sets the recipientId attribute value.
100      * @param recipientId The recipientId to set.
101      */
102     public void setRecipientId(String recipientId) {
103 	this.recipientId = recipientId;
104     }
105 
106     /**
107      * Gets the recipientType attribute. 
108      * @return Returns the recipientType.
109      */
110     public String getRecipientType() {
111 	return recipientType;
112     }
113 
114     /**
115      * Sets the recipientType attribute value.
116      * @param recipientType The recipientType to set.
117      */
118     public void setRecipientType(String recipientType) {
119 	this.recipientType = recipientType;
120     }
121 }
122