1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel.dataobject;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.bo.DataObjectBase;
20 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
21 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
22 import org.kuali.rice.krad.data.provider.annotation.Description;
23 import org.kuali.rice.krad.data.provider.annotation.InheritProperties;
24 import org.kuali.rice.krad.data.provider.annotation.InheritProperty;
25 import org.kuali.rice.krad.data.provider.annotation.Label;
26 import org.kuali.rice.krad.data.provider.annotation.Relationship;
27 import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViewType;
28 import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViews;
29 import org.kuali.rice.krad.data.provider.annotation.UifDisplayHint;
30 import org.kuali.rice.krad.data.provider.annotation.UifDisplayHintType;
31 import org.kuali.rice.krad.data.provider.annotation.UifDisplayHints;
32 import org.kuali.rice.krad.data.provider.annotation.UifValidCharactersConstraintBeanName;
33
34 import javax.persistence.CascadeType;
35 import javax.persistence.Column;
36 import javax.persistence.Convert;
37 import javax.persistence.Entity;
38 import javax.persistence.FetchType;
39 import javax.persistence.GeneratedValue;
40 import javax.persistence.Id;
41 import javax.persistence.JoinColumn;
42 import javax.persistence.ManyToOne;
43 import javax.persistence.Table;
44 import javax.persistence.Temporal;
45 import javax.persistence.TemporalType;
46 import java.io.Serializable;
47 import java.math.BigDecimal;
48 import java.util.Date;
49
50
51
52
53
54
55 @Entity
56 @Table(name = "TRVL_EXP_ITM_T")
57 @UifAutoCreateViews({UifAutoCreateViewType.INQUIRY, UifAutoCreateViewType.LOOKUP})
58 public class TravelExpenseItem extends DataObjectBase implements Serializable {
59
60 private static final long serialVersionUID = -4092206384418712220L;
61
62 @Id @Column(name = "EXP_ITM_ID", length = 10)
63 @GeneratedValue(generator = "TRVL_EXP_ITM_ID_S")
64 @PortableSequenceGenerator(name = "TRVL_EXP_ITM_ID_S")
65 @Label("Id")
66 @Description("Unique identifier for item")
67 @UifValidCharactersConstraintBeanName("AlphaNumericPatternConstraint")
68 private String travelExpenseItemId;
69
70 @Column(name="TRVL_AUTH_DOC_ID", length=40)
71 @Label("Travel Authorization Document Id")
72 @UifDisplayHints({
73 @UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT),
74 @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)})
75 private String travelAuthorizationDocumentId;
76
77 @Relationship(foreignKeyFields="travelAuthorizationDocumentId")
78 @ManyToOne(fetch=FetchType.LAZY, cascade={CascadeType.REFRESH})
79 @JoinColumn(name = "TRVL_AUTH_DOC_ID", referencedColumnName = "TRVL_AUTH_DOC_ID", insertable = false, updatable = false)
80 @InheritProperties({
81 @InheritProperty(name="documentNumber",
82 label=@Label("Travel Authorization Document"),
83 displayHints=@UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA)))})
84 private TravelAuthorizationDocument travelAuthorizationDocument;
85
86 @Column(name = "TRVL_CO_NM")
87 private String travelCompanyName;
88
89 @Column(name = "EXP_TYP_CD", length = 10)
90 @Label("Expense Type")
91 @Description("Type of expense")
92 private String travelExpenseTypeCd;
93
94 @Column(name = "EXP_DESC", length = 10)
95 @Label("Expense Description")
96 @Description("Description of expense")
97 private String expenseDesc;
98
99 @Temporal(TemporalType.TIMESTAMP)
100 @Column(name = "EXP_DT")
101 @Label("Expense Date")
102 @Description("Date of expense")
103 private Date expenseDate;
104
105 @Column(name = "EXP_AMT", length = 10)
106 @Label("Expense Amount")
107 @Description("Amount of expense")
108 private BigDecimal expenseAmount;
109
110 @Column(name = "EXP_REIMB", nullable = false, length = 1)
111 @Convert(converter = BooleanYNConverter.class)
112 @Label("Reimbursable")
113 @Description("Whether expense is reimbursed to traveler")
114 private boolean reimbursable;
115
116 @Column(name = "EXP_TXBL", nullable = false, length = 1)
117 @Convert(converter = BooleanYNConverter.class)
118 @Label("Taxable")
119 @Description("Whether expense is taxed")
120 private boolean taxable;
121
122 public String getTravelExpenseItemId() {
123 return travelExpenseItemId;
124 }
125
126 public void setTravelExpenseItemId(String travelExpenseItemId) {
127 this.travelExpenseItemId = travelExpenseItemId;
128 }
129
130 public String getTravelAuthorizationDocumentId() {
131 if (StringUtils.isBlank(travelAuthorizationDocumentId)
132 && this.travelAuthorizationDocument != null) {
133 return this.travelAuthorizationDocument.getDocumentNumber();
134 }
135
136 return travelAuthorizationDocumentId;
137 }
138
139 public void setTravelAuthorizationDocumentId(String travelAuthorizationDocumentId) {
140 this.travelAuthorizationDocumentId = travelAuthorizationDocumentId;
141 }
142
143 public TravelAuthorizationDocument getTravelAuthorizationDocument() {
144 return travelAuthorizationDocument;
145 }
146
147 public void setTravelAuthorizationDocument(TravelAuthorizationDocument travelAuthorizationDocument) {
148 this.travelAuthorizationDocument = travelAuthorizationDocument;
149 }
150
151 public String getTravelCompanyName() {
152 return travelCompanyName;
153 }
154
155 public void setTravelCompanyName(String travelCompanyName) {
156 this.travelCompanyName = travelCompanyName;
157 }
158
159 public String getTravelExpenseTypeCd() {
160 return travelExpenseTypeCd;
161 }
162
163 public void setTravelExpenseTypeCd(String travelExpenseTypeCd) {
164 this.travelExpenseTypeCd = travelExpenseTypeCd;
165 }
166
167 public String getExpenseDesc() {
168 return expenseDesc;
169 }
170
171 public void setExpenseDesc(String expenseDesc) {
172 this.expenseDesc = expenseDesc;
173 }
174
175 public Date getExpenseDate() {
176 return expenseDate;
177 }
178
179 public void setExpenseDate(Date expenseDate) {
180 this.expenseDate = expenseDate;
181 }
182
183 public BigDecimal getExpenseAmount() {
184 return expenseAmount;
185 }
186
187 public void setExpenseAmount(BigDecimal expenseAmount) {
188 this.expenseAmount = expenseAmount;
189 }
190
191 public boolean isReimbursable() {
192 return reimbursable;
193 }
194
195 public void setReimbursable(boolean reimbursable) {
196 this.reimbursable = reimbursable;
197 }
198
199 public boolean isTaxable() {
200 return taxable;
201 }
202
203 public void setTaxable(boolean taxable) {
204 this.taxable = taxable;
205 }
206 }