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