1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
42
43
44 @Column(name="doc_nbr")
45 public String getDocumentNumber() {
46 return documentNumber;
47 }
48
49
50
51
52
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
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 }