| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| KimDocumentBoActiveToFromBase |
|
| 1.4285714285714286;1.429 |
| 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 | /** | |
| 26 | * This is a description of what this class does - shyu don't forget to fill this in. | |
| 27 | * | |
| 28 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 29 | * | |
| 30 | */ | |
| 31 | @MappedSuperclass | |
| 32 | 0 | public class KimDocumentBoActiveToFromBase extends KimDocumentBoBase { |
| 33 | private static final long serialVersionUID = 9042706897191231671L; | |
| 34 | ||
| 35 | @Column(name="ACTV_FRM_DT") | |
| 36 | protected Timestamp activeFromDate; | |
| 37 | @Column(name="ACTV_TO_DT") | |
| 38 | protected Timestamp activeToDate; | |
| 39 | @Transient | |
| 40 | protected boolean edit; | |
| 41 | ||
| 42 | ||
| 43 | /** | |
| 44 | * @return the edit | |
| 45 | */ | |
| 46 | public boolean isEdit() { | |
| 47 | 0 | return this.edit; |
| 48 | } | |
| 49 | ||
| 50 | /** | |
| 51 | * @param edit the edit to set | |
| 52 | */ | |
| 53 | public void setEdit(boolean edit) { | |
| 54 | 0 | this.edit = edit; |
| 55 | 0 | } |
| 56 | ||
| 57 | /** | |
| 58 | * @return the activeFromDate | |
| 59 | */ | |
| 60 | public Timestamp getActiveFromDate() { | |
| 61 | 0 | return this.activeFromDate; |
| 62 | } | |
| 63 | ||
| 64 | /** | |
| 65 | * @param activeFromDate the activeFromDate to set | |
| 66 | */ | |
| 67 | public void setActiveFromDate(Timestamp activeFromDate) { | |
| 68 | 0 | this.activeFromDate = activeFromDate; |
| 69 | 0 | } |
| 70 | ||
| 71 | /** | |
| 72 | * @return the activeToDate | |
| 73 | */ | |
| 74 | public Timestamp getActiveToDate() { | |
| 75 | 0 | return this.activeToDate; |
| 76 | } | |
| 77 | ||
| 78 | /** | |
| 79 | * @param activeToDate the activeToDate to set | |
| 80 | */ | |
| 81 | public void setActiveToDate(Timestamp activeToDate) { | |
| 82 | 0 | this.activeToDate = activeToDate; |
| 83 | 0 | } |
| 84 | ||
| 85 | public boolean isActive() { | |
| 86 | 0 | long now = System.currentTimeMillis(); |
| 87 | 0 | return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime()); |
| 88 | } | |
| 89 | ||
| 90 | } |