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