Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KimDocumentBoActivatableToFromBase |
|
| 1.375;1.375 |
1 | /* | |
2 | * Copyright 2007-2008 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.kim.bo.ui; | |
17 | ||
18 | import java.sql.Date; | |
19 | import java.sql.Timestamp; | |
20 | ||
21 | import javax.persistence.Column; | |
22 | import javax.persistence.MappedSuperclass; | |
23 | import javax.persistence.Transient; | |
24 | ||
25 | import org.hibernate.annotations.Type; | |
26 | ||
27 | /** | |
28 | * This is a description of what this class does - shyu don't forget to fill this in. | |
29 | * | |
30 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
31 | * | |
32 | */ | |
33 | @MappedSuperclass | |
34 | 0 | public class KimDocumentBoActivatableToFromBase extends KimDocumentBoBase { |
35 | private static final long serialVersionUID = 9042706897191231671L; | |
36 | ||
37 | @Column(name="ACTV_FRM_DT") | |
38 | protected Timestamp activeFromDate; | |
39 | @Column(name="ACTV_TO_DT") | |
40 | protected Timestamp activeToDate; | |
41 | ||
42 | 0 | @Type(type="yes_no") |
43 | @Column(name="ACTV_IND") | |
44 | protected boolean active = true; | |
45 | ||
46 | @Transient | |
47 | protected boolean edit; | |
48 | ||
49 | public void setActive(boolean active) { | |
50 | 0 | this.active = active; |
51 | 0 | } |
52 | ||
53 | /** | |
54 | * @return the activeFromDate | |
55 | */ | |
56 | public Timestamp getActiveFromDate() { | |
57 | 0 | return this.activeFromDate; |
58 | } | |
59 | ||
60 | /** | |
61 | * @param activeFromDate the activeFromDate to set | |
62 | */ | |
63 | public void setActiveFromDate(Timestamp activeFromDate) { | |
64 | 0 | this.activeFromDate = activeFromDate; |
65 | 0 | } |
66 | ||
67 | /** | |
68 | * @return the activeToDate | |
69 | */ | |
70 | public Timestamp getActiveToDate() { | |
71 | 0 | return this.activeToDate; |
72 | } | |
73 | ||
74 | /** | |
75 | * @param activeToDate the activeToDate to set | |
76 | */ | |
77 | public void setActiveToDate(Timestamp activeToDate) { | |
78 | 0 | this.activeToDate = activeToDate; |
79 | 0 | } |
80 | ||
81 | public boolean isActive() { | |
82 | 0 | long now = System.currentTimeMillis(); |
83 | 0 | return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime()); |
84 | } | |
85 | ||
86 | /** | |
87 | * @return the edit | |
88 | */ | |
89 | public boolean isEdit() { | |
90 | 0 | return this.edit; |
91 | } | |
92 | ||
93 | /** | |
94 | * @param edit the edit to set | |
95 | */ | |
96 | public void setEdit(boolean edit) { | |
97 | 0 | this.edit = edit; |
98 | 0 | } |
99 | } |