1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kim.impl.common.active |
18 | |
|
19 | |
import java.sql.Timestamp |
20 | |
import javax.persistence.Column |
21 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase |
22 | |
|
23 | |
public abstract class ActiveFromToBo extends PersistableBusinessObjectBase { |
24 | |
@Column(name = "ACTV_FRM_DT") |
25 | |
Timestamp activeFromDate |
26 | |
|
27 | |
@Column(name = "ACTV_TO_DT") |
28 | |
Timestamp activeToDate |
29 | |
|
30 | |
boolean isActive() { |
31 | 34 | long asOfDate = System.currentTimeMillis() |
32 | |
|
33 | 34 | return computeActive(asOfDate); |
34 | |
} |
35 | |
|
36 | |
boolean isActive(Timestamp activeAsOfDate) { |
37 | 0 | long asOfDate = System.currentTimeMillis() |
38 | 0 | if (activeAsOfDate != null) { |
39 | 0 | asOfDate = activeAsOfDate.getTime() |
40 | |
} |
41 | |
|
42 | 0 | return computeActive(asOfDate) |
43 | |
} |
44 | |
|
45 | |
private boolean computeActive(Long asOfDate) { |
46 | 34 | return (activeFromDate == null || asOfDate >= activeFromDate.getTime()) && (activeToDate == null || asOfDate < activeToDate.getTime()) |
47 | |
} |
48 | |
} |