001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package edu.sampleu.travel.dataobject;
017    
018    import edu.sampleu.travel.options.MileageRateKeyValues;
019    import edu.sampleu.travel.options.TravelDestinationKeyValues;
020    import org.kuali.rice.krad.bo.DataObjectBase;
021    import org.kuali.rice.krad.data.jpa.eclipselink.PortableSequenceGenerator;
022    import org.kuali.rice.krad.data.provider.annotation.Description;
023    import org.kuali.rice.krad.data.provider.annotation.InheritProperties;
024    import org.kuali.rice.krad.data.provider.annotation.InheritProperty;
025    import org.kuali.rice.krad.data.provider.annotation.KeyValuesFinderClass;
026    import org.kuali.rice.krad.data.provider.annotation.Label;
027    import org.kuali.rice.krad.data.provider.annotation.Relationship;
028    import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViewType;
029    import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViews;
030    import org.kuali.rice.krad.data.provider.annotation.UifDisplayHint;
031    import org.kuali.rice.krad.data.provider.annotation.UifDisplayHintType;
032    import org.kuali.rice.krad.data.provider.annotation.UifDisplayHints;
033    import org.kuali.rice.krad.data.provider.annotation.UifValidCharactersConstraintBeanName;
034    
035    import javax.persistence.CascadeType;
036    import javax.persistence.Column;
037    import javax.persistence.Entity;
038    import javax.persistence.FetchType;
039    import javax.persistence.GeneratedValue;
040    import javax.persistence.Id;
041    import javax.persistence.JoinColumn;
042    import javax.persistence.ManyToOne;
043    import javax.persistence.Table;
044    import javax.persistence.Temporal;
045    import javax.persistence.TemporalType;
046    import java.io.Serializable;
047    import java.math.BigDecimal;
048    import java.util.Date;
049    
050    /**
051     * This class provides the per diem expenses.
052     *
053     * @author Kuali Rice Team (rice.collab@kuali.org)
054     */
055    @Entity
056    @Table(name = "TRVL_PD_EXP_T")
057    @UifAutoCreateViews({UifAutoCreateViewType.INQUIRY, UifAutoCreateViewType.LOOKUP})
058    public class TravelPerDiemExpense extends DataObjectBase implements Serializable {
059    
060        private static final long serialVersionUID = 6269893036439679855L;
061    
062        @Id
063        @Column(name = "PD_EXP_ID", length = 10)
064        @GeneratedValue(generator = "TRVL_PD_EXP_ID_S")
065        @PortableSequenceGenerator(name = "TRVL_PD_EXP_ID_S")
066        @Label("Id")
067        @Description("Unique identifier for per diem expense item")
068        @UifValidCharactersConstraintBeanName("AlphaNumericPatternConstraint")
069        private String travelPerDiemExpenseId;
070    
071        @Column(name = "TRVL_AUTH_DOC_ID")
072        private String travelAuthorizationDocumentId;
073    
074        @Column(name="TRVL_DEST_ID", length=40)
075        @Label("Primary Destination")
076        @Description("Primary Destination related to per diem expense")
077        @KeyValuesFinderClass(TravelDestinationKeyValues.class)
078        @UifDisplayHints({
079                @UifDisplayHint(UifDisplayHintType.NONE),
080                @UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT),
081                @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)})
082        private String travelDestinationId;
083    
084        @Relationship(foreignKeyFields="travelDestinationId")
085        @ManyToOne(fetch=FetchType.LAZY, cascade={CascadeType.REFRESH})
086        @JoinColumn(name="TRVL_DEST_ID", insertable=false, updatable=false)
087        @InheritProperties({
088                @InheritProperty(name="travelDestinationId",
089                        label=@Label("Primary Destination"),
090                        displayHints=@UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA)))})
091        @UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA)
092        private TravelDestination travelDestination;
093    
094        @Temporal(TemporalType.TIMESTAMP)
095        @Column(name = "PD_DT")
096        @Label("Date of Use")
097        private Date perDiemDate;
098    
099        @Column(name = "BKFST_VAL")
100        @Label("Breakfast Value")
101        private BigDecimal breakfastValue;
102    
103        @Column(name = "LNCH_VAL")
104        @Label("Lunch Value")
105        private BigDecimal lunchValue;
106    
107        @Column(name = "DNNR_VAL")
108        @Label("Dinner Value")
109        private BigDecimal dinnerValue;
110    
111        @Column(name = "INCD_VAL")
112        @Label("Amount estimated for incidentals")
113        private BigDecimal incidentalsValue;
114    
115        @Column(name="MLG_RT_ID", length=40)
116        @Label("Mileage Rate")
117        @Description("Mileage Rate Code Used")
118        @KeyValuesFinderClass(MileageRateKeyValues.class)
119        @UifDisplayHints({
120                @UifDisplayHint(UifDisplayHintType.NONE),
121                @UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT),
122                @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)})
123        private String mileageRateId;
124    
125        @Relationship(foreignKeyFields="mileageRateId")
126        @ManyToOne(fetch=FetchType.LAZY, cascade={CascadeType.REFRESH})
127        @JoinColumn(name="MLG_RT_ID", insertable=false, updatable=false)
128        @InheritProperties({
129                @InheritProperty(name="mileageRateCd",
130                        label=@Label("Mileage rate"),
131                        displayHints=@UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA)))})
132        private TravelMileageRate mileageRate;
133    
134        @Column(name = "MLG_EST")
135        @Label("Number of estimated miles")
136        private BigDecimal estimatedMileage;
137    
138        public String getTravelPerDiemExpenseId() {
139            return travelPerDiemExpenseId;
140        }
141    
142        public void setTravelPerDiemExpenseId(String travelPerDiemExpenseId) {
143            this.travelPerDiemExpenseId = travelPerDiemExpenseId;
144        }
145    
146        public String getTravelAuthorizationDocumentId() {
147            return travelAuthorizationDocumentId;
148        }
149    
150        public void setTravelAuthorizationDocumentId(String travelAuthorizationDocumentId) {
151            this.travelAuthorizationDocumentId = travelAuthorizationDocumentId;
152        }
153    
154        public Date getPerDiemDate() {
155            return perDiemDate;
156        }
157    
158        public void setPerDiemDate(Date perDiemDate) {
159            this.perDiemDate = perDiemDate;
160        }
161    
162        public BigDecimal getBreakfastValue() {
163            return breakfastValue;
164        }
165    
166        public void setBreakfastValue(BigDecimal breakfastValue) {
167            this.breakfastValue = breakfastValue;
168        }
169    
170        public BigDecimal getLunchValue() {
171            return lunchValue;
172        }
173    
174        public void setLunchValue(BigDecimal lunchValue) {
175            this.lunchValue = lunchValue;
176        }
177    
178        public BigDecimal getDinnerValue() {
179            return dinnerValue;
180        }
181    
182        public void setDinnerValue(BigDecimal dinnerValue) {
183            this.dinnerValue = dinnerValue;
184        }
185    
186        public BigDecimal getIncidentalsValue() {
187            return incidentalsValue;
188        }
189    
190        public void setIncidentalsValue(BigDecimal incidentalsValue) {
191            this.incidentalsValue = incidentalsValue;
192        }
193    
194        public String getTravelDestinationId() {
195            return travelDestinationId;
196        }
197    
198        public void setTravelDestinationId(String travelDestinationId) {
199            this.travelDestinationId = travelDestinationId;
200        }
201    
202        public TravelDestination getTravelDestination() {
203            return travelDestination;
204        }
205    
206        public void setTravelDestination(TravelDestination travelDestination) {
207            this.travelDestination = travelDestination;
208        }
209    
210        public String getMileageRateId() {
211            return mileageRateId;
212        }
213    
214        public void setMileageRateId(String mileageRateId) {
215            this.mileageRateId = mileageRateId;
216        }
217    
218        public TravelMileageRate getMileageRate() {
219            return mileageRate;
220        }
221    
222        public void setMileageRate(TravelMileageRate mileageRate) {
223            this.mileageRate = mileageRate;
224        }
225    
226        public BigDecimal getEstimatedMileage() {
227            return estimatedMileage;
228        }
229    
230        public void setEstimatedMileage(BigDecimal estimatedMileage) {
231            this.estimatedMileage = estimatedMileage;
232        }
233    }