View Javadoc

1   /**
2    * Copyright 2005-2014 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.approval.dataobject;
17  
18  import edu.sampleu.travel.approval.TravelAuthorizationDocument;
19  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
20  import org.kuali.rice.krad.util.KRADPropertyConstants;
21  
22  import javax.persistence.Column;
23  import javax.persistence.Entity;
24  import javax.persistence.JoinColumn;
25  import javax.persistence.ManyToOne;
26  import javax.persistence.Table;
27  import java.util.LinkedHashMap;
28  
29  @Entity
30  @Table(name="TRVL_TRANS_MD_DTL_T")
31  public class TransportationModeDetail extends PersistableBusinessObjectBase {
32  
33      private String documentNumber;
34      private String transportationModeCode;
35      private TransportationMode transportationMode;
36      private TravelAuthorizationDocument travelAuthorizationDocument;
37  
38  
39      /**
40       *
41       * This method returns the document number this TransportationModeDetail object is associated with
42       * @return document number
43       */
44      @Column(name="doc_nbr")
45      public String getDocumentNumber() {
46          return documentNumber;
47      }
48  
49      /**
50       *
51       * This method sets the document number this TransportationModeDetail object will be associated with
52       * @param documentNumber
53       */
54      public void setDocumentNumber(String documentNumber) {
55          this.documentNumber = documentNumber;
56      }
57  
58      @Column(name="TRANS_MODE_CD",length=3, nullable=false)
59      public String getTransportationModeCode() {
60          return transportationModeCode;
61      }
62  
63  
64      public void setTransportationModeCode(String transportationModeCode) {
65          this.transportationModeCode = transportationModeCode;
66      }
67  
68      @ManyToOne
69      @JoinColumn(name="TRANS_MODE_CD")
70      public TransportationMode getTransportationMode() {
71          return transportationMode;
72      }
73  
74  
75      public void setTransportationMode(TransportationMode transportationMode) {
76          this.transportationMode = transportationMode;
77      }
78  
79      public TravelAuthorizationDocument getTravelAuthorizationDocument() {
80          return travelAuthorizationDocument;
81      }
82  
83  
84      public void setTravelAuthorizationDocument(TravelAuthorizationDocument travelAuthorizationDocument) {
85          this.travelAuthorizationDocument = travelAuthorizationDocument;
86      }
87  
88  
89      protected LinkedHashMap toStringMapper() {
90          LinkedHashMap m = new LinkedHashMap();
91          m.put(KRADPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
92          m.put("transportationModeCode", this.transportationModeCode);
93          return m;
94      }
95  
96      /**
97       * @see java.lang.Object#equals(java.lang.Object)
98       */
99      @Override
100     public boolean equals(Object obj) {
101         TransportationModeDetail detail = (TransportationModeDetail)obj;
102 
103         if(this.transportationModeCode.equals(detail.getTransportationModeCode()) && this.documentNumber.equals(detail.getDocumentNumber())) {
104             return true;
105         }
106         return false;
107     }
108 
109 }