1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.impl.common.history;
17
18 import org.joda.time.DateTime;
19 import org.kuali.rice.core.api.mo.common.active.InactivatableFromToUtils;
20 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
21
22 import javax.persistence.Column;
23 import java.sql.Timestamp;
24
25
26 public abstract class AbstractHistoryBo<T extends PersistableBusinessObjectBase> extends PersistableBusinessObjectBase {
27 protected T bo;
28
29 @Column(name = "ACTV_FRM_DT")
30 private Timestamp activeFromDateValue;
31 @Column(name = "ACTV_TO_DT")
32 private Timestamp activeToDateValue;
33
34 public boolean isActive(Timestamp activeAsOfDate) {
35 return InactivatableFromToUtils.isActive(getActiveFromDate(), getActiveToDate(), new DateTime(
36 activeAsOfDate.getTime()));
37 }
38
39 public boolean isActive(DateTime activeAsOfDate) {
40 return InactivatableFromToUtils.isActive(getActiveFromDate(), getActiveToDate(), activeAsOfDate);
41 }
42
43 public boolean isActive() {
44 return InactivatableFromToUtils.isActive(getActiveFromDate(), getActiveToDate(), null);
45 }
46
47 public DateTime getActiveFromDate() {
48 return this.activeFromDateValue == null ? null : new DateTime(this.activeFromDateValue.getTime());
49 }
50
51 public DateTime getActiveToDate() {
52 return this.activeToDateValue == null ? null : new DateTime(this.activeToDateValue.getTime());
53 }
54
55 public Timestamp getActiveFromDateValue() {
56 return activeFromDateValue;
57 }
58
59 public void setActiveFromDateValue(Timestamp activeFromDateValue) {
60 this.activeFromDateValue = activeFromDateValue;
61 }
62
63 public Timestamp getActiveToDateValue() {
64 return activeToDateValue;
65 }
66
67 public void setActiveToDateValue(Timestamp activeToDateValue) {
68 this.activeToDateValue = activeToDateValue;
69 }
70
71 public T getBo() {
72 return bo;
73 }
74
75 public void setBo(T bo) {
76 this.bo = bo;
77 }
78 }