001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kim.bo.ui; 017 018import java.sql.Date; 019import java.sql.Timestamp; 020 021import javax.persistence.Column; 022import javax.persistence.MappedSuperclass; 023import javax.persistence.Transient; 024 025/** 026 * This is a description of what this class does - shyu don't forget to fill this in. 027 * 028 * @author Kuali Rice Team (rice.collab@kuali.org) 029 * 030 */ 031@MappedSuperclass 032public class KimDocumentBoActiveToFromBase extends KimDocumentBoBase { 033 private static final long serialVersionUID = 9042706897191231671L; 034 035 @Column(name="ACTV_FRM_DT") 036 protected Timestamp activeFromDate; 037 @Column(name="ACTV_TO_DT") 038 protected Timestamp activeToDate; 039 @Transient 040 protected boolean edit; 041 042 043 /** 044 * @return the edit 045 */ 046 public boolean isEdit() { 047 return this.edit; 048 } 049 050 /** 051 * @param edit the edit to set 052 */ 053 public void setEdit(boolean edit) { 054 this.edit = edit; 055 } 056 057 /** 058 * @return the activeFromDate 059 */ 060 public Timestamp getActiveFromDate() { 061 return this.activeFromDate; 062 } 063 064 /** 065 * @param activeFromDate the activeFromDate to set 066 */ 067 public void setActiveFromDate(Timestamp activeFromDate) { 068 this.activeFromDate = activeFromDate; 069 } 070 071 /** 072 * @return the activeToDate 073 */ 074 public Timestamp getActiveToDate() { 075 return this.activeToDate; 076 } 077 078 /** 079 * @param activeToDate the activeToDate to set 080 */ 081 public void setActiveToDate(Timestamp activeToDate) { 082 this.activeToDate = activeToDate; 083 } 084 085 public boolean isActive() { 086 long now = System.currentTimeMillis(); 087 return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime()); 088 } 089 090}