1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.bo; |
17 | |
|
18 | |
import java.sql.Timestamp; |
19 | |
|
20 | |
import javax.persistence.Column; |
21 | |
import javax.persistence.MappedSuperclass; |
22 | |
import javax.persistence.Transient; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
@MappedSuperclass |
28 | 0 | public abstract class InactivatableFromToImpl extends PersistableBusinessObjectBase implements InactivateableFromTo { |
29 | |
|
30 | |
private static final long serialVersionUID = 1L; |
31 | |
|
32 | |
@Column(name = "ACTV_FRM_DT") |
33 | |
protected Timestamp activeFromDate; |
34 | |
@Column(name = "ACTV_TO_DT") |
35 | |
protected Timestamp activeToDate; |
36 | |
@Transient |
37 | |
protected Timestamp activeAsOfDate; |
38 | |
@Transient |
39 | |
protected boolean current; |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
public boolean isActive() { |
46 | 0 | long asOfDate = System.currentTimeMillis(); |
47 | 0 | if (activeAsOfDate != null) { |
48 | 0 | asOfDate = activeAsOfDate.getTime(); |
49 | |
} |
50 | |
|
51 | 0 | return (activeFromDate == null || asOfDate >= activeFromDate.getTime()) |
52 | |
&& (activeToDate == null || asOfDate < activeToDate.getTime()); |
53 | |
} |
54 | |
|
55 | |
public void setActive(boolean active) { |
56 | |
|
57 | 0 | } |
58 | |
|
59 | |
public void setActiveFromDate(Timestamp from) { |
60 | 0 | this.activeFromDate = from; |
61 | 0 | } |
62 | |
|
63 | |
public void setActiveToDate(Timestamp to) { |
64 | 0 | this.activeToDate = to; |
65 | 0 | } |
66 | |
|
67 | |
public Timestamp getActiveFromDate() { |
68 | 0 | return this.activeFromDate; |
69 | |
} |
70 | |
|
71 | |
public Timestamp getActiveToDate() { |
72 | 0 | return this.activeToDate; |
73 | |
} |
74 | |
|
75 | |
public Timestamp getActiveAsOfDate() { |
76 | 0 | return this.activeAsOfDate; |
77 | |
} |
78 | |
|
79 | |
public void setActiveAsOfDate(Timestamp activeAsOfDate) { |
80 | 0 | this.activeAsOfDate = activeAsOfDate; |
81 | 0 | } |
82 | |
|
83 | |
public boolean isCurrent() { |
84 | 0 | return this.current; |
85 | |
} |
86 | |
|
87 | |
public void setCurrent(boolean current) { |
88 | 0 | this.current = current; |
89 | 0 | } |
90 | |
} |