Coverage Report - edu.sampleu.travel.document.TravelDocument2
 
Classes in this File Line Coverage Branch Coverage Complexity
TravelDocument2
0%
0/24
0%
0/2
1.071
 
 1  
 /*
 2  
  * Copyright 2007-2008 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 edu.sampleu.travel.document;
 17  
 
 18  
 import edu.sampleu.travel.bo.TravelAccount;
 19  
 import org.kuali.rice.kns.document.SessionDocument;
 20  
 import org.kuali.rice.kns.document.TransactionalDocumentBase;
 21  
 
 22  
 import javax.persistence.*;
 23  
 import java.util.ArrayList;
 24  
 import java.util.List;
 25  
 
 26  
 
 27  
 @Entity
 28  
 @Table(name="TRV_DOC_2")
 29  
 public class TravelDocument2 extends TransactionalDocumentBase implements SessionDocument {
 30  
 
 31  
     @Column(name="traveler")
 32  
     private String traveler;
 33  
     @Column(name="org")
 34  
     private String origin;
 35  
     @Column(name="dest")
 36  
     private String destination;
 37  
     @Column(name="request_trav")
 38  
     private String requestType;
 39  
     @Transient
 40  
     private String accountType;
 41  
 
 42  
     @ManyToMany(fetch = FetchType.EAGER)    // Do not use cascade here or it will try to update the TravelAccounts
 43  
     @JoinTable(name="TRAV_DOC_2_ACCOUNTS", 
 44  
                    joinColumns={@JoinColumn(name="fdoc_nbr", referencedColumnName="fdoc_nbr", unique=false)},         // Goes with this class: TravelDocument2
 45  
                    inverseJoinColumns={@JoinColumn(name="acct_num", referencedColumnName="acct_num", unique=false)}   // Goes with that class: TravelAccount
 46  
     )
 47  
     private List<TravelAccount> travelAccounts;
 48  
 
 49  0
     public TravelDocument2() {
 50  0
         travelAccounts = new ArrayList<TravelAccount>();
 51  0
     }
 52  
 
 53  
     public String getDestination() {
 54  0
         return destination;
 55  
     }
 56  
 
 57  
     public void setDestination(String destination) {
 58  0
         this.destination = destination;
 59  0
     }
 60  
 
 61  
     public String getOrigin() {
 62  0
         return origin;
 63  
     }
 64  
 
 65  
     public void setOrigin(String origin) {
 66  0
         this.origin = origin;
 67  0
     }
 68  
 
 69  
     public String getTraveler() {
 70  0
         return traveler;
 71  
     }
 72  
 
 73  
     public void setTraveler(String traveler) {
 74  0
         this.traveler = traveler;
 75  0
     }
 76  
 
 77  
     public List<TravelAccount> getTravelAccounts() {
 78  0
         return travelAccounts;
 79  
     }
 80  
 
 81  
     public void setTravelAccounts(List<TravelAccount> travelAccounts) {
 82  0
         this.travelAccounts = travelAccounts;
 83  0
     }
 84  
 
 85  
     public TravelAccount getTravelAccount(int index) {
 86  0
         while(travelAccounts.size() - 1 < index) {
 87  0
             travelAccounts.add(new TravelAccount());
 88  
         }
 89  0
         return travelAccounts.get(index);
 90  
     }
 91  
 
 92  
     public String getRequestType() {
 93  0
         return requestType;
 94  
     }
 95  
 
 96  
     public void setRequestType(String requestType) {
 97  0
         this.requestType = requestType;
 98  0
     }
 99  
 
 100  
     /**
 101  
      * @param accountType the accountType to set
 102  
      */
 103  
     public void setAccountType(String accountType) {
 104  0
         this.accountType = accountType;
 105  0
     }
 106  
 
 107  
     /**
 108  
      * @return the accountType
 109  
      */
 110  
     public String getAccountType() {
 111  0
         return accountType;
 112  
     }
 113  
 
 114  
 }