1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.timehourdetail;
17
18 import java.math.BigDecimal;
19
20 import org.apache.commons.lang.builder.EqualsBuilder;
21 import org.apache.commons.lang.builder.HashCodeBuilder;
22 import org.kuali.kpme.core.util.HrConstants;
23 import org.kuali.kpme.tklm.api.time.timehourdetail.TimeHourDetailContract;
24 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
25
26 public class TimeHourDetail extends PersistableBusinessObjectBase implements TimeHourDetailContract {
27
28 private static final long serialVersionUID = 1L;
29 private String tkTimeHourDetailId;
30 private String tkTimeBlockId;
31 private String earnCode;
32 private BigDecimal hours = HrConstants.BIG_DECIMAL_SCALED_ZERO;
33 private BigDecimal amount = HrConstants.BIG_DECIMAL_SCALED_ZERO;
34
35 public TimeHourDetail() {
36 }
37
38 protected TimeHourDetail(TimeHourDetail t) {
39
40
41 this.tkTimeHourDetailId = t.tkTimeHourDetailId;
42 this.tkTimeBlockId = t.tkTimeBlockId;
43 this.earnCode = t.earnCode;
44 this.hours = t.hours;
45 this.amount = t.amount;
46 }
47
48 public TimeHourDetail copy() {
49 return new TimeHourDetail(this);
50 }
51
52 public String getEarnCode() {
53 return earnCode;
54 }
55
56 public void setEarnCode(String earnCode) {
57 this.earnCode = earnCode;
58 }
59
60 public BigDecimal getHours() {
61 return hours;
62 }
63
64 public void setHours(BigDecimal hours) {
65 if(hours != null){
66 this.hours = hours.setScale(HrConstants.BIG_DECIMAL_SCALE, HrConstants.BIG_DECIMAL_SCALE_ROUNDING);
67 } else {
68 this.hours = hours;
69 }
70 }
71
72 public BigDecimal getAmount() {
73 return amount;
74 }
75
76 public void setAmount(BigDecimal amount) {
77 if(amount != null){
78 this.amount = amount.setScale(HrConstants.BIG_DECIMAL_SCALE, HrConstants.BIG_DECIMAL_SCALE_ROUNDING);
79 } else {
80 this.amount = amount;
81 }
82 }
83
84 public String getTkTimeBlockId() {
85 return tkTimeBlockId;
86 }
87
88 public void setTkTimeBlockId(String tkTimeBlockId) {
89 this.tkTimeBlockId = tkTimeBlockId;
90 }
91 public void setTkTimeHourDetailId(String tkTimeHourDetailId) {
92 this.tkTimeHourDetailId = tkTimeHourDetailId;
93 }
94
95 public String getTkTimeHourDetailId() {
96 return tkTimeHourDetailId;
97 }
98
99 @Override
100 public boolean equals(Object obj) {
101 if (obj == null) {
102 return false;
103 }
104 if (obj == this) {
105 return true;
106 }
107 if (obj.getClass() != getClass()) {
108 return false;
109 }
110 TimeHourDetail timeHourDetail = (TimeHourDetail) obj;
111 return new EqualsBuilder()
112 .append(earnCode, timeHourDetail.earnCode)
113 .append(amount, timeHourDetail.amount)
114 .append(hours, timeHourDetail.hours)
115 .isEquals();
116 }
117
118 @Override
119 public int hashCode() {
120 return new HashCodeBuilder(17, 31)
121 .append(earnCode)
122 .append(amount)
123 .append(hours)
124 .toHashCode();
125 }
126
127 }