001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kcb.bo;
017    
018    
019    import javax.persistence.Column;
020    import javax.persistence.Entity;
021    import javax.persistence.Id;
022    import javax.persistence.Table;
023    import javax.persistence.Version;
024    
025    import org.apache.commons.lang.builder.ToStringBuilder;
026    
027    /**
028     * This class represents a recipient preferences in the system.  This is a generic Key/Value structure
029     * that is used by the system to store preferences that the user has set up. This will be 
030     * used by the tickler plugins which will need a generic and dynamic structure for user specific settings.
031     * @author Kuali Rice Team (rice.collab@kuali.org)
032     */
033    @Entity
034    @Table(name="KREN_RECIP_PREFS_T")
035    public class RecipientPreference {
036    
037            /**
038         * Field names for queries
039         */
040        public static final String RECIPIENT_FIELD = "recipientId";
041        public static final String PROPERTY_FIELD = "property";
042        
043            @Id
044            @Column(name="RECIP_PREFS_ID")
045            private Long id;
046            @Column(name="RECIP_ID", nullable=false)
047            private String recipientId;
048            @Column(name="PROP", nullable=false)
049            private String property;
050            @Column(name="VAL", nullable=true)
051            private String value;
052    
053        /**
054         * Lock column for OJB optimistic locking
055         */
056        @Version
057            @Column(name="VER_NBR")
058            private Integer lockVerNbr;
059    
060        /**
061         * Gets the id attribute. 
062         * @return Returns the id.
063         */
064        public Long getId() {
065            return id;
066        }
067    
068        /**
069         * Sets the id attribute value.
070         * @param id The id to set.
071         */
072        public void setId(Long id) {
073            this.id = id;
074        }
075    
076        /**
077         * Gets the property attribute. 
078         * @return Returns the property.
079         */
080        public String getProperty() {
081            return property;
082        }
083    
084        /**
085         * Sets the property attribute value.
086         * @param property The property to set.
087         */
088        public void setProperty(String property) {
089            this.property = property;
090        }
091    
092        /**
093         * Gets the recipientId attribute. 
094         * @return Returns the recipientId.
095         */
096        public String getRecipientId() {
097            return recipientId;
098        }
099    
100        /**
101         * Sets the recipientId attribute value.
102         * @param recipientId The recipientId to set.
103         */
104        public void setRecipientId(String recipientId) {
105            this.recipientId = recipientId;
106        }
107    
108        /**
109         * Gets the value attribute. 
110         * @return Returns the value.
111         */
112        public String getValue() {
113            return value;
114        }
115    
116        /**
117         * Sets the value attribute value.
118         * @param value The value to set.
119         */
120        public void setValue(String value) {
121            this.value = value;
122        }
123    
124        /**
125         * Return value of lock column for OJB optimistic locking
126         * @return value of lock column for OJB optimistic locking
127         */
128        public Integer getLockVerNbr() {
129            return lockVerNbr;
130        }
131    
132        /**
133         * Set value of lock column for OJB optimistic locking
134         * @param lockVerNbr value of lock column for OJB optimistic locking
135         */
136        public void setLockVerNbr(Integer lockVerNbr) {
137            this.lockVerNbr = lockVerNbr;
138        }
139    
140        /**
141         * @see java.lang.Object#clone()
142         */
143    //    @Override
144    //    public Object clone() throws CloneNotSupportedException {
145    //        return super.clone();
146    //    }
147    
148        /**
149         * @see java.lang.Object#toString()
150         */
151        @Override
152        public String toString() {
153            return new ToStringBuilder(this)
154                           .append("id", id)
155                           .append("recipientId", recipientId)
156                           .append("property", property)
157                           .append("value", value)
158                           .append("lockVerNbr", lockVerNbr)
159                           .toString();
160        }
161    }