001/**
002 * Copyright 2005-2016 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 */
016package org.kuali.rice.kcb.bo;
017
018
019import javax.persistence.Column;
020import javax.persistence.Entity;
021import javax.persistence.GeneratedValue;
022import javax.persistence.Id;
023import javax.persistence.Table;
024import javax.persistence.Version;
025
026import org.apache.commons.lang.builder.ToStringBuilder;
027import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
028
029/**
030 * This class represents a recipient preferences in the system.  This is a generic Key/Value structure
031 * that is used by the system to store preferences that the user has set up. This will be 
032 * used by the tickler plugins which will need a generic and dynamic structure for user specific settings.
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 */
035@Entity
036@Table(name="KREN_RECIP_PREFS_T")
037public class RecipientPreference {
038
039        /**
040     * Field names for queries
041     */
042    public static final String RECIPIENT_FIELD = "recipientId";
043    public static final String PROPERTY_FIELD = "property";
044    
045        @Id
046    @GeneratedValue(generator="KREN_RECIP_PREF_S")
047    @PortableSequenceGenerator(name="KREN_RECIP_PREF_S")
048        @Column(name="RECIP_PREFS_ID")
049        private Long id;
050        @Column(name="RECIP_ID", nullable=false)
051        private String recipientId;
052        @Column(name="PROP", nullable=false)
053        private String property;
054        @Column(name="VAL", nullable=true)
055        private String value;
056
057    /**
058     * Lock column for OJB optimistic locking
059     */
060    @Version
061        @Column(name="VER_NBR")
062        private Integer lockVerNbr;
063
064    /**
065     * Gets the id attribute. 
066     * @return Returns the id.
067     */
068    public Long getId() {
069        return id;
070    }
071
072    /**
073     * Sets the id attribute value.
074     * @param id The id to set.
075     */
076    public void setId(Long id) {
077        this.id = id;
078    }
079
080    /**
081     * Gets the property attribute. 
082     * @return Returns the property.
083     */
084    public String getProperty() {
085        return property;
086    }
087
088    /**
089     * Sets the property attribute value.
090     * @param property The property to set.
091     */
092    public void setProperty(String property) {
093        this.property = property;
094    }
095
096    /**
097     * Gets the recipientId attribute. 
098     * @return Returns the recipientId.
099     */
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}