Coverage Report - org.kuali.rice.kew.routeheader.DocumentStatusTransition
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentStatusTransition
0%
0/37
0%
0/8
1.429
 
 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.kew.routeheader;
 17  
 
 18  
 import org.bouncycastle.ocsp.OCSPReqGenerator;
 19  
 import org.hibernate.annotations.GenericGenerator;
 20  
 import org.hibernate.annotations.Parameter;
 21  
 import org.joda.time.DateTime;
 22  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
 23  
 
 24  
 import javax.persistence.*;
 25  
 import java.sql.Timestamp;
 26  
 
 27  
 
 28  
 /**
 29  
  * Model bean representing the valid application document statuses for a document type
 30  
  * 
 31  
  * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 32  
  *
 33  
  */
 34  
 @Entity
 35  
 @Table(name="KREW_APP_DOC_STAT_TRAN_T")
 36  
 public class DocumentStatusTransition extends PersistableBusinessObjectBase {
 37  
         private static final long serialVersionUID = -2212481684546954746L;
 38  
 
 39  
         @Id
 40  
         @GeneratedValue(generator="KREW_DOC_HDR_S")
 41  
         @GenericGenerator(name="KREW_DOC_HDR_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
 42  
                         @Parameter(name="sequence_name",value="KREW_DOC_HDR_S"),
 43  
                         @Parameter(name="value_column",value="id")
 44  
         })
 45  
         @Column(name="APP_DOC_STAT_TRAN_ID")
 46  
         private String statusTransitionId;
 47  
         
 48  
         @Column(name="DOC_HDR_ID")
 49  
         private String documentId;
 50  
          
 51  
         @Column(name="APP_DOC_STAT_FROM")
 52  
         private String oldAppDocStatus;
 53  
         
 54  
         @Column(name="APP_DOC_STAT_TO")
 55  
         private String newAppDocStatus;
 56  
         
 57  
         @Column(name="STAT_TRANS_DATE")
 58  
         private java.sql.Timestamp statusTransitionDate;
 59  
         
 60  0
     public DocumentStatusTransition() {
 61  0
     }
 62  
 
 63  0
     public DocumentStatusTransition(String documentId, String oldStatus, String newStatus) {
 64  0
             this.documentId = documentId;
 65  0
             this.oldAppDocStatus = oldStatus;
 66  0
             this.newAppDocStatus = newStatus;
 67  0
             this.statusTransitionDate = new Timestamp(System.currentTimeMillis());
 68  0
     }
 69  
 
 70  
         public String getStatusTransitionId() {
 71  0
                 return this.statusTransitionId;
 72  
         }
 73  
 
 74  
         public void setStatusTransitionId(String statusTransitionId) {
 75  0
                 this.statusTransitionId = statusTransitionId;
 76  0
         }
 77  
 
 78  
         public String getDocumentId() {
 79  0
                 return this.documentId;
 80  
         }
 81  
 
 82  
         public void setDocumentId(String documentId) {
 83  0
                 this.documentId = documentId;
 84  0
         }
 85  
 
 86  
         public String getOldAppDocStatus() {
 87  0
                 return this.oldAppDocStatus;
 88  
         }
 89  
 
 90  
         public void setOldAppDocStatus(String oldAppDocStatus) {
 91  0
                 this.oldAppDocStatus = oldAppDocStatus;
 92  0
         }
 93  
 
 94  
         public String getNewAppDocStatus() {
 95  0
                 return this.newAppDocStatus;
 96  
         }
 97  
 
 98  
         public void setNewAppDocStatus(String newAppDocStatus) {
 99  0
                 this.newAppDocStatus = newAppDocStatus;
 100  0
         }
 101  
 
 102  
         public java.sql.Timestamp getStatusTransitionDate() {
 103  0
                 return this.statusTransitionDate;
 104  
         }
 105  
 
 106  
         public void setStatusTransitionDate(java.sql.Timestamp statusTransitionDate) {
 107  0
                 this.statusTransitionDate = statusTransitionDate;
 108  0
         }
 109  
 
 110  
     public static DocumentStatusTransition from(org.kuali.rice.kew.api.document.DocumentStatusTransition im) {
 111  0
         if (im == null) {
 112  0
             return null;
 113  
         }
 114  0
         DocumentStatusTransition transition = new DocumentStatusTransition(im.getDocumentId(), im.getOldStatus(), im.getNewStatus());
 115  0
         transition.setStatusTransitionId(im.getId());
 116  0
         if (im.getStatusTransitionDate() != null) {
 117  0
             transition.setStatusTransitionDate(new Timestamp(im.getStatusTransitionDate().getMillis()));
 118  
         }
 119  0
         return transition;
 120  
     }
 121  
 
 122  
     public static org.kuali.rice.kew.api.document.DocumentStatusTransition to(DocumentStatusTransition bo) {
 123  0
         if (bo == null) {
 124  0
             return null;
 125  
         }
 126  
 
 127  0
         org.kuali.rice.kew.api.document.DocumentStatusTransition.Builder builder = org.kuali.rice.kew.api.document.DocumentStatusTransition.Builder.create(bo.getDocumentId(), bo.getOldAppDocStatus(), bo.getNewAppDocStatus());
 128  0
         builder.setId(bo.getStatusTransitionId());
 129  0
         if (bo.getStatusTransitionDate() != null) {
 130  0
             builder.setStatusTransitionDate(new DateTime(bo.getStatusTransitionDate().getTime()));
 131  
         }
 132  0
         return builder.build();
 133  
     }
 134  
 }