View Javadoc
1   /**
2    * Copyright 2005-2015 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.kcb.bo;
17  
18  
19  import javax.persistence.Column;
20  import javax.persistence.Entity;
21  import javax.persistence.GeneratedValue;
22  import javax.persistence.Id;
23  import javax.persistence.Table;
24  import javax.persistence.Version;
25  
26  import org.apache.commons.lang.builder.ToStringBuilder;
27  import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
28  
29  /**
30   * This class represents a recipient preferences in the system.  This is a generic Key/Value structure
31   * that is used by the system to store preferences that the user has set up. This will be 
32   * used by the tickler plugins which will need a generic and dynamic structure for user specific settings.
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   */
35  @Entity
36  @Table(name="KREN_RECIP_PREFS_T")
37  public class RecipientPreference {
38  
39  	/**
40       * Field names for queries
41       */
42      public static final String RECIPIENT_FIELD = "recipientId";
43      public static final String PROPERTY_FIELD = "property";
44      
45  	@Id
46      @GeneratedValue(generator="KREN_RECIP_PREF_S")
47      @PortableSequenceGenerator(name="KREN_RECIP_PREF_S")
48  	@Column(name="RECIP_PREFS_ID")
49  	private Long id;
50  	@Column(name="RECIP_ID", nullable=false)
51  	private String recipientId;
52  	@Column(name="PROP", nullable=false)
53  	private String property;
54  	@Column(name="VAL", nullable=true)
55  	private String value;
56  
57      /**
58       * Lock column for OJB optimistic locking
59       */
60      @Version
61  	@Column(name="VER_NBR")
62  	private Integer lockVerNbr;
63  
64      /**
65       * Gets the id attribute. 
66       * @return Returns the id.
67       */
68      public Long getId() {
69          return id;
70      }
71  
72      /**
73       * Sets the id attribute value.
74       * @param id The id to set.
75       */
76      public void setId(Long id) {
77          this.id = id;
78      }
79  
80      /**
81       * Gets the property attribute. 
82       * @return Returns the property.
83       */
84      public String getProperty() {
85          return property;
86      }
87  
88      /**
89       * Sets the property attribute value.
90       * @param property The property to set.
91       */
92      public void setProperty(String property) {
93          this.property = property;
94      }
95  
96      /**
97       * Gets the recipientId attribute. 
98       * @return Returns the recipientId.
99       */
100     public String getRecipientId() {
101         return recipientId;
102     }
103 
104     /**
105      * Sets the recipientId attribute value.
106      * @param recipientId The recipientId to set.
107      */
108     public void setRecipientId(String recipientId) {
109         this.recipientId = recipientId;
110     }
111 
112     /**
113      * Gets the value attribute. 
114      * @return Returns the value.
115      */
116     public String getValue() {
117         return value;
118     }
119 
120     /**
121      * Sets the value attribute value.
122      * @param value The value to set.
123      */
124     public void setValue(String value) {
125         this.value = value;
126     }
127 
128     /**
129      * Return value of lock column for OJB optimistic locking
130      * @return value of lock column for OJB optimistic locking
131      */
132     public Integer getLockVerNbr() {
133         return lockVerNbr;
134     }
135 
136     /**
137      * Set value of lock column for OJB optimistic locking
138      * @param lockVerNbr value of lock column for OJB optimistic locking
139      */
140     public void setLockVerNbr(Integer lockVerNbr) {
141         this.lockVerNbr = lockVerNbr;
142     }
143 
144     /**
145      * @see java.lang.Object#clone()
146      */
147 //    @Override
148 //    public Object clone() throws CloneNotSupportedException {
149 //        return super.clone();
150 //    }
151 
152     /**
153      * @see java.lang.Object#toString()
154      */
155     @Override
156     public String toString() {
157         return new ToStringBuilder(this)
158                        .append("id", id)
159                        .append("recipientId", recipientId)
160                        .append("property", property)
161                        .append("value", value)
162                        .append("lockVerNbr", lockVerNbr)
163                        .toString();
164     }
165 }