001/**
002 * Copyright 2005-2017 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.ken.bo;
017
018import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
019import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
020
021import javax.persistence.*;
022import java.sql.Timestamp;
023
024/**
025 * This class represents and instance of a NotificationMessageDelivery.  A Notification gets delivered to 
026 * recipients, possibly in various ways.  For each delivery type that a recipient gets sent to them, 
027 * they have an instance of this entity.
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 */
030@Entity
031@Table(name="KREN_NTFCTN_MSG_DELIV_T")
032public class NotificationMessageDelivery extends PersistableBusinessObjectBase implements Lockable {
033    @Id
034    @GeneratedValue(generator="KREN_NTFCTN_MSG_DELIV_S")
035    @PortableSequenceGenerator(name="KREN_NTFCTN_MSG_DELIV_S")
036        @Column(name="NTFCTN_MSG_DELIV_ID")
037        private Long id;
038    @Column(name="STAT_CD", nullable=false)
039        private String messageDeliveryStatus;
040    @Column(name="RECIP_ID", nullable=false)
041        private String userRecipientId;
042    @Column(name="SYS_ID", nullable=true)
043        private String deliverySystemId;  // can hold an identifier from the endpoint delivery mechanism system (i.e. workflow id, SMS id, etc)
044        @Column(name="LOCKD_DTTM", nullable=true)
045        private Timestamp lockedDateValue;
046
047    /**
048     * Lock column for OJB optimistic locking
049     */
050//    @Version
051//      @Column(name="VER_NBR")
052//      private Integer lockVerNbr;
053    
054    @OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH, CascadeType.DETACH})
055        @JoinColumn(name="NTFCTN_ID")
056        private NotificationBo notification;
057
058    /**
059     * Constructs a NotificationMessageDelivery instance.
060     */
061    public NotificationMessageDelivery() {
062    }
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    /**
082     * Return value of lock column for OJB optimistic locking
083     * @return value of lock column for OJB optimistic locking
084     */
085    //public Integer getLockVerNbr() {
086    //    return lockVerNbr;
087        //return Integer.valueOf(super.getVersionNumber().intValue());
088    //}
089
090    /**
091     * Set value of lock column for OJB optimistic locking
092     * @param lockVerNbr value of lock column for OJB optimistic locking
093     */
094    //public void setLockVerNbr(Integer lockVerNbr) {
095    //    this.lockVerNbr = lockVerNbr;
096    //  //super.setVersionNumber(lockVerNbr.longValue());
097    //}
098
099    /**
100     * Gets the messageDeliveryStatus attribute. 
101     * @return Returns the messageDeliveryStatus.
102     */
103    public String getMessageDeliveryStatus() {
104        return messageDeliveryStatus;
105    }
106
107    /**
108     * Sets the messageDeliveryStatus attribute value.
109     * @param deliveryStatus The messageDeliveryStatus to set.
110     */
111    public void setMessageDeliveryStatus(String deliveryStatus) {
112        this.messageDeliveryStatus = deliveryStatus;
113    }
114
115    /**
116     * Gets the userRecipientId attribute. 
117     * @return Returns the userRecipientId.
118     */
119    public String getUserRecipientId() {
120        return userRecipientId;
121    }
122
123    /**
124     * Sets the userRecipientId attribute value.
125     * @param userRecipientId The userRecipientId to set.
126     */
127    public void setUserRecipientId(String userRecipientId) {
128        this.userRecipientId = userRecipientId;
129    }
130
131    /**
132     * Gets the lockedDate attribute. 
133     * @return Returns the lockedDate.
134     */
135    public Timestamp getLockedDateValue() {
136        return this.lockedDateValue;
137    }
138    
139    /**
140     * Sets the lockedDate attribute value.
141     * @param lockedDateValue The lockedDate to set.
142     */
143    public void setLockedDateValue(Timestamp lockedDateValue) {
144        this.lockedDateValue = lockedDateValue;
145    }
146
147    /**
148     * Gets the notification attribute. 
149     * @return Returns the notification.
150     */
151    public NotificationBo getNotification() {
152        return notification;
153    }
154
155    /**
156     * Sets the notification attribute value.
157     * @param notification The notification to set.
158     */
159    public void setNotification(NotificationBo notification) {
160        this.notification = notification;
161    }
162
163    /**
164     * Gets the deliverySystemId attribute. 
165     * @return Returns the deliverySystemId.
166     */
167    public String getDeliverySystemId() {
168        return deliverySystemId;
169    }
170
171    /**
172     * Sets the deliverySystemId attribute value.
173     * @param deliverySystemId The deliverySystemId to set.
174     */
175    public void setDeliverySystemId(String deliverySystemId) {
176        this.deliverySystemId = deliverySystemId;
177    }
178}