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
018import javax.persistence.Column;
019import javax.persistence.Entity;
020import javax.persistence.GeneratedValue;
021import javax.persistence.Id;
022import javax.persistence.Table;
023import javax.persistence.Version;
024
025import org.apache.commons.lang.builder.ToStringBuilder;
026import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
027
028/**
029 * This class represents the enablement of a deliverer for a particular channel for a particular user.
030 * Each RecipientDelivererConfig instance represents a user as having applied a deliverer type configuration
031 * to a channel, such that any messages, targeted at the userId, will also be delivered to the correlating
032 * deliverer type (delivererName) for that user.
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 */
035@Entity
036@Table(name="KREN_RECIP_DELIV_T")
037public class RecipientDelivererConfig {
038    /**
039     * Field names for queries
040     */
041    public static final String RECIPIENT_ID = "recipientId";
042    public static final String CHANNEL = "channel";
043    
044    @Id
045    @GeneratedValue(generator="KREN_RECIP_DELIV_S")
046    @PortableSequenceGenerator(name="KREN_RECIP_DELIV_S")
047        @Column(name="RECIP_DELIV_ID")
048        private Long id;
049    @Column(name="RECIP_ID", nullable=false)
050        private String recipientId;
051    @Column(name="NM", nullable=false)
052        private String delivererName;
053    @Column(name="CHNL", nullable=false)
054        private String channel;
055    /**
056     * Lock column for OJB optimistic locking
057     */
058    @Version
059        @Column(name="VER_NBR")
060        private Integer lockVerNbr;
061
062    /**
063     * Gets the id attribute. 
064     * @return Returns the id.
065     */
066    public Long getId() {
067        return id;
068    }
069
070    /**
071     * Sets the id attribute value.
072     * @param id The id to set.
073     */
074    public void setId(Long id) {
075        this.id = id;
076    }
077    
078    /**
079     * Return value of lock column for OJB optimistic locking
080     * @return value of lock column for OJB optimistic locking
081     */
082    public Integer getLockVerNbr() {
083        return lockVerNbr;
084    }
085
086    /**
087     * Set value of lock column for OJB optimistic locking
088     * @param lockVerNbr value of lock column for OJB optimistic locking
089     */
090    public void setLockVerNbr(Integer lockVerNbr) {
091        this.lockVerNbr = lockVerNbr;
092    }
093
094    /**
095     * Gets the recipientId attribute. 
096     * @return Returns the recipientId.
097     */
098    public String getRecipientId() {
099        return recipientId;
100    }
101
102    /**
103     * Sets the recipientId attribute value.
104     * @param recipientId The userId to set.
105     */
106    public void setRecipientId(String recipientId) {
107        this.recipientId = recipientId;
108    }
109
110    /**
111     * Gets the delivererName attribute. 
112     * @return Returns the name.
113     */
114    public String getDelivererName() {
115        return delivererName;
116    }
117
118    /**
119     * Sets the delivererName attribute value.
120     * @param delivererName The delivererName to set.
121     */
122    public void setDelivererName(String delivererName) {
123        this.delivererName = delivererName;
124    }
125
126    /**
127     * Gets the channels attribute. 
128     * @return Returns the channel.
129     */
130    public String getChannel() {
131        return channel;
132    }
133
134    /**
135     * Sets the channel attribute value.
136     * @param channel The channel to set.
137     */
138    public void setChannel(String channel) {
139        this.channel = channel;
140    }
141    
142    /**
143     * @see java.lang.Object#toString()
144     */
145    @Override
146    public String toString() {
147       return new ToStringBuilder(this).append("id", id)
148                                       .append("recipientId", recipientId)
149                                       .append("delivererName", delivererName)
150                                       .append("channel", channel)
151                                       .toString();
152    }
153}