View Javadoc

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