Coverage Report - org.kuali.rice.ksb.messaging.PersistedMessagePayload
 
Classes in this File Line Coverage Branch Coverage Complexity
PersistedMessagePayload
0%
0/21
0%
0/2
1.2
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.ksb.messaging;
 17  
 
 18  
 import org.kuali.rice.core.api.util.io.SerializationUtils;
 19  
 import org.kuali.rice.ksb.api.KsbApiServiceLocator;
 20  
 import org.kuali.rice.ksb.api.messaging.AsynchronousCall;
 21  
 
 22  
 import javax.persistence.*;
 23  
 import java.io.Serializable;
 24  
 
 25  
 /**
 26  
  * Holds message payload content.  Needed to proxy the content so we don't have to 
 27  
  * take the hit when grabbing large amounts of persisted messages at time.
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  *
 31  
  */
 32  
 @Entity
 33  
 @Table(name="KRSB_MSG_PYLD_T")
 34  
 public class PersistedMessagePayload implements Serializable {
 35  
     
 36  
     private static final long serialVersionUID = 508778527504899029L;
 37  
     
 38  
     @Id
 39  
         @Column(name="MSG_QUE_ID")
 40  
         private Long routeQueueId;
 41  
     @Lob
 42  
         @Basic(fetch=FetchType.LAZY)
 43  
         @Column(name="MSG_PYLD", length=4000)
 44  
         private String payload;
 45  
     @Transient
 46  
     private AsynchronousCall methodCall;
 47  
     @Transient
 48  
     private PersistedMessageBO message;
 49  
     
 50  0
     public PersistedMessagePayload() {}
 51  
     
 52  0
     public PersistedMessagePayload (AsynchronousCall methodCall, PersistedMessageBO message) {
 53  0
         this.setPayload(SerializationUtils.serializeToBase64(methodCall));
 54  0
         this.methodCall = methodCall;
 55  0
         this.message = message;
 56  0
     }
 57  
     
 58  
     public String getPayload() {
 59  0
         return this.payload;
 60  
     }
 61  
     public void setPayload(String payload) {
 62  0
         this.payload = payload;
 63  0
     }
 64  
     public Long getRouteQueueId() {
 65  0
         return this.routeQueueId;
 66  
     }
 67  
     public void setRouteQueueId(Long routeQueueId) {
 68  0
         this.routeQueueId = routeQueueId;
 69  0
     }
 70  
     public AsynchronousCall getMethodCall() {
 71  0
         if (this.methodCall != null) {
 72  0
             return this.methodCall;
 73  
         } 
 74  0
         this.methodCall = (AsynchronousCall) SerializationUtils.deserializeFromBase64(getPayload());
 75  0
         return this.methodCall;
 76  
     }
 77  
 
 78  
     public PersistedMessageBO getMessage() {
 79  0
         return this.message;
 80  
     }
 81  
 
 82  
     public void setMessage(PersistedMessageBO message) {
 83  0
         this.message = message;
 84  0
     }
 85  
 
 86  
     public void setMethodCall(AsynchronousCall methodCall) {
 87  0
         this.methodCall = methodCall;
 88  0
     }
 89  
     
 90  
 
 91  
 }
 92