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