View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.module.tem.businessobject;
20  
21  import java.sql.Date;
22  import java.util.LinkedHashMap;
23  
24  import javax.persistence.Column;
25  import javax.persistence.Entity;
26  import javax.persistence.Table;
27  
28  import org.kuali.kfs.module.tem.TemPropertyConstants;
29  import org.kuali.kfs.sys.context.SpringContext;
30  import org.kuali.rice.core.api.datetime.DateTimeService;
31  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
32  import org.kuali.rice.core.api.util.type.KualiDecimal;
33  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
34  
35  @Entity
36  @Table(name="TEM_PER_DIEM_MIE_BREAK_DOWN_T")
37  public class PerDiemMealIncidentalBreakDown extends PersistableBusinessObjectBase implements MutableInactivatable {
38  
39      private KualiDecimal mealsAndIncidentals;
40  
41      private KualiDecimal breakfast;
42      private KualiDecimal lunch;
43      private KualiDecimal dinner;
44      private KualiDecimal incidentals;
45  
46      private Date lastUpdateDate;
47  
48      private Boolean active = Boolean.TRUE;
49  
50  
51      @Column(name="MEALS_INC",precision=19,scale=2,nullable=false)
52      public KualiDecimal getMealsAndIncidentals() {
53          return mealsAndIncidentals;
54      }
55  
56      public void setMealsAndIncidentals(KualiDecimal mealsAndIncidentals) {
57          this.mealsAndIncidentals = mealsAndIncidentals;
58      }
59  
60      @Column(name="BKFST",nullable=false)
61      public KualiDecimal getBreakfast() {
62          return breakfast;
63      }
64  
65  
66      public void setBreakfast(KualiDecimal breakfast) {
67          this.breakfast = breakfast;
68      }
69  
70  
71      @Column(name="LUNCH",nullable=false)
72      public KualiDecimal getLunch() {
73          return lunch;
74      }
75  
76  
77      public void setLunch(KualiDecimal lunch) {
78          this.lunch = lunch;
79      }
80  
81      @Column(name="DIN",nullable=false)
82      public KualiDecimal getDinner() {
83          return dinner;
84      }
85  
86  
87      public void setDinner(KualiDecimal dinner) {
88          this.dinner = dinner;
89      }
90  
91      @Column(name="INC",precision=19,scale=2,nullable=false)
92      public KualiDecimal getIncidentals() {
93          return incidentals;
94      }
95  
96      public void setIncidentals(KualiDecimal incidentals) {
97          this.incidentals = incidentals;
98      }
99  
100     @Override
101     @Column(name="ACTV_IND",nullable=false,length=1)
102     public boolean isActive() {
103         return active;
104     }
105 
106     @Override
107     public void setActive(boolean active) {
108         this.active = active;
109     }
110 
111     /**
112      * Gets the lastUpdateDate attribute.
113      * @return Returns the lastUpdateDate.
114      */
115     @Column(name="LAST_UPD_DT")
116     public Date getLastUpdateDate() {
117         return lastUpdateDate;
118     }
119 
120     /**
121      * Sets the lastUpdateDate attribute value.
122      * @param lastUpdateDate The lastUpdateDate to set.
123      */
124     public void setLastUpdateDate(Date lastUpdateDate) {
125         this.lastUpdateDate = lastUpdateDate;
126     }
127 
128     @Override
129     protected void prePersist() {
130         super.prePersist();
131 
132         lastUpdateDate = getDateTimeService().getCurrentSqlDate();
133     }
134 
135     @Override
136     protected void preUpdate() {
137         super.preUpdate();
138 
139         lastUpdateDate = getDateTimeService().getCurrentSqlDate();
140     }
141 
142     @SuppressWarnings("rawtypes")
143     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
144         LinkedHashMap map = new LinkedHashMap();
145 
146         map.put(TemPropertyConstants.MEALS_AND_INCIDENTALS, this.mealsAndIncidentals);
147         map.put(TemPropertyConstants.BREAKFAST, this.breakfast);
148         map.put(TemPropertyConstants.LUNCH, this.lunch);
149         map.put(TemPropertyConstants.DINNER, this.dinner);
150         map.put(TemPropertyConstants.INCIDENTALS, this.incidentals);
151 
152         return map;
153     }
154 
155     public DateTimeService getDateTimeService(){
156         return SpringContext.getBean(DateTimeService.class);
157     }
158 }