Coverage Report - org.kuali.rice.ksb.messaging.PersistedMessage
 
Classes in this File Line Coverage Branch Coverage Complexity
PersistedMessage
0%
0/54
0%
0/4
1.091
 
 1  
 /*
 2  
  * Copyright 2005-2008 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in
 6  
  * compliance with the License. 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 distributed under the License is distributed on an "AS
 11  
  * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
 12  
  * language governing permissions and limitations under the License.
 13  
  */
 14  
 package org.kuali.rice.ksb.messaging;
 15  
 
 16  
 import java.io.Serializable;
 17  
 import java.sql.Timestamp;
 18  
 
 19  
 import javax.persistence.Column;
 20  
 import javax.persistence.Entity;
 21  
 import javax.persistence.Id;
 22  
 import javax.persistence.NamedQueries;
 23  
 import javax.persistence.NamedQuery;
 24  
 import javax.persistence.PrePersist;
 25  
 import javax.persistence.Table;
 26  
 import javax.persistence.Transient;
 27  
 import javax.persistence.Version;
 28  
 
 29  
 import org.kuali.rice.core.jpa.annotations.Sequence;
 30  
 import org.kuali.rice.core.util.OrmUtils;
 31  
 import org.kuali.rice.ksb.service.KSBServiceLocator;
 32  
 
 33  
 /**
 34  
  * A message which has been persisted to the data store.
 35  
  *
 36  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 37  
  */
 38  
 @Entity
 39  
 @Table(name="KRSB_MSG_QUE_T")
 40  
 @Sequence(name="KRSB_MSG_QUE_S", property="routeQueueId")
 41  
 @NamedQueries({
 42  
   @NamedQuery(name="PersistedMessage.FindAll", query="select pm from PersistedMessage pm"),
 43  
   @NamedQuery(name="PersistedMessage.FindByServiceName", query="select pm from PersistedMessage pm where pm.serviceName = :serviceName and pm.methodName = :methodName"),
 44  
   @NamedQuery(name="PersistedMessage.GetNextDocuments", query="select pm from PersistedMessage pm where pm.serviceNamespace = :serviceNamespace and pm.queueStatus <> :queueStatus and pm.ipNumber = :ipNumber order by queuePriority asc, routeQueueId asc, queueDate asc")
 45  
 })
 46  
 public class PersistedMessage implements Serializable {
 47  
 
 48  
         private static final long serialVersionUID = -7047766894738304195L;
 49  
 
 50  
         @Id
 51  
         @Column(name="MSG_QUE_ID")
 52  
         private Long routeQueueId;
 53  
         @Column(name="PRIO")
 54  
         private Integer queuePriority;
 55  
         @Column(name="STAT_CD")
 56  
         private String queueStatus;
 57  
         @Column(name="DT")
 58  
         private Timestamp queueDate;
 59  
         @Column(name="EXP_DT")
 60  
         private Timestamp expirationDate;
 61  
         @Column(name="RTRY_CNT")
 62  
         private Integer retryCount;
 63  
         @Version
 64  
         @Column(name="VER_NBR")
 65  
         private Integer lockVerNbr;
 66  
     @Column(name="IP_NBR")
 67  
         private String ipNumber;
 68  
     @Column(name="SVC_NM")
 69  
         private String serviceName;
 70  
     @Column(name="SVC_NMSPC")
 71  
         private String serviceNamespace;
 72  
     @Column(name="SVC_MTHD_NM")
 73  
         private String methodName;
 74  
     @Transient
 75  
     private AsynchronousCall methodCall;
 76  
     @Transient
 77  
     private PersistedMessagePayload payload;
 78  
     @Column(name="APP_VAL_ONE")
 79  
         private String value1;
 80  
     @Column(name="APP_VAL_TWO")
 81  
         private String value2;
 82  
     
 83  0
     public PersistedMessage() {
 84  
         // default constructor
 85  0
     }
 86  
     
 87  
     @PrePersist
 88  
     public void beforeInsert(){
 89  0
         OrmUtils.populateAutoIncValue(this, KSBServiceLocator.getMessageEntityManagerFactory().createEntityManager());
 90  0
     }
 91  
     
 92  
         public String getServiceNamespace() {
 93  0
                 return this.serviceNamespace;
 94  
         }
 95  
 
 96  
         public void setServiceNamespace(String ServiceNamespace) {
 97  0
                 this.serviceNamespace = ServiceNamespace;
 98  0
         }
 99  
 
 100  
     public String getIpNumber() {
 101  0
         return this.ipNumber;
 102  
     }
 103  
     
 104  
     public void setIpNumber(String ipNumber) {
 105  0
         this.ipNumber = ipNumber;
 106  0
     }
 107  
     
 108  
         public Timestamp getQueueDate() {
 109  0
                 return this.queueDate;
 110  
         }
 111  
 
 112  
         public Integer getQueuePriority() {
 113  0
                 return this.queuePriority;
 114  
         }
 115  
 
 116  
         public String getQueueStatus() {
 117  0
                 return this.queueStatus;
 118  
         }
 119  
 
 120  
         public Integer getRetryCount() {
 121  0
                 return this.retryCount;
 122  
         }
 123  
 
 124  
 
 125  
         public void setQueueDate(Timestamp timestamp) {
 126  0
             this.queueDate = timestamp;
 127  0
         }
 128  
 
 129  
         public void setQueuePriority(Integer integer) {
 130  0
             this.queuePriority = integer;
 131  0
         }
 132  
 
 133  
         public void setQueueStatus(String string) {
 134  0
             this.queueStatus = string;
 135  0
         }
 136  
 
 137  
         public void setRetryCount(Integer integer) {
 138  0
             this.retryCount = integer;
 139  0
         }
 140  
 
 141  
 
 142  
     public Integer getLockVerNbr() {
 143  0
         return this.lockVerNbr;
 144  
     }
 145  
     
 146  
     public void setLockVerNbr(Integer lockVerNbr) {
 147  0
         this.lockVerNbr = lockVerNbr;
 148  0
     }
 149  
     
 150  
     public Long getRouteQueueId() {
 151  0
         return this.routeQueueId;
 152  
     }
 153  
     
 154  
     public void setRouteQueueId(Long queueSequence) {
 155  0
         this.routeQueueId = queueSequence;
 156  0
     }
 157  
     
 158  
         public String getServiceName() {
 159  0
                 return this.serviceName;
 160  
         }
 161  
 
 162  
         public void setServiceName(String serviceName) {
 163  0
                 this.serviceName = serviceName;
 164  0
         }
 165  
 
 166  
     public String toString() {
 167  0
         return "[RouteQueue: " + ", routeQueueId=" + this.routeQueueId + ", ipNumber=" + this.ipNumber 
 168  
                 + "serviceNamespace=" + this.serviceNamespace + ", serviceName=" + this.serviceName + ", methodName=" + methodName 
 169  
                 + ", queueStatus=" + this.queueStatus + ", queuePriority=" + this.queuePriority
 170  
                 + ", queueDate=" + this.queueDate + "]";
 171  
     }
 172  
 
 173  
         public AsynchronousCall getMethodCall() {
 174  0
                 return this.methodCall;
 175  
         }
 176  
 
 177  
         public void setMethodCall(AsynchronousCall methodCall) {
 178  0
                 this.methodCall = methodCall;
 179  0
         }
 180  
 
 181  
         public String getMethodName() {
 182  0
                 return this.methodName;
 183  
         }
 184  
 
 185  
         public void setMethodName(String methodName) {
 186  0
                 this.methodName = methodName;
 187  0
         }
 188  
 
 189  
         public Timestamp getExpirationDate() {
 190  0
                 return this.expirationDate;
 191  
         }
 192  
 
 193  
         public void setExpirationDate(Timestamp expirationDate) {
 194  0
                 this.expirationDate = expirationDate;
 195  0
         }
 196  
 
 197  
     public PersistedMessagePayload getPayload() {
 198  0
         if (this.payload == null) {
 199  0
             if (this.getRouteQueueId() == null) {
 200  0
                 return null;
 201  0
 }            this.payload = KSBServiceLocator.getRouteQueueService().findByPersistedMessageByRouteQueueId(this.getRouteQueueId()); 
 202  
         }
 203  0
         return this.payload;
 204  
     }
 205  
 
 206  
     public void setPayload(PersistedMessagePayload payload) {
 207  0
         this.payload = payload;
 208  0
     }
 209  
 
 210  
     public String getValue1() {
 211  0
         return this.value1;
 212  
     }
 213  
 
 214  
     public void setValue1(String value1) {
 215  0
         this.value1 = value1;
 216  0
     }
 217  
 
 218  
     public String getValue2() {
 219  0
         return this.value2;
 220  
     }
 221  
 
 222  
     public void setValue2(String value2) {
 223  0
         this.value2 = value2;
 224  0
     }
 225  
 
 226  
 }