001/** 002 * Copyright 2005-2017 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.Timestamp; 019 020import javax.persistence.Column; 021import javax.persistence.Embeddable; 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 034 private static final long serialVersionUID = 9042706897191231671L; 035 036 @Column(name="ACTV_FRM_DT") 037 protected Timestamp activeFromDate; 038 @Column(name="ACTV_TO_DT") 039 protected Timestamp activeToDate; 040 @Transient 041 protected boolean edit; 042 043 044 /** 045 * @return the edit 046 */ 047 public boolean isEdit() { 048 return this.edit; 049 } 050 051 /** 052 * @param edit the edit to set 053 */ 054 public void setEdit(boolean edit) { 055 this.edit = edit; 056 } 057 058 /** 059 * @return the activeFromDate 060 */ 061 public Timestamp getActiveFromDate() { 062 return this.activeFromDate; 063 } 064 065 /** 066 * @param activeFromDate the activeFromDate to set 067 */ 068 public void setActiveFromDate(Timestamp activeFromDate) { 069 this.activeFromDate = activeFromDate; 070 } 071 072 /** 073 * @return the activeToDate 074 */ 075 public Timestamp getActiveToDate() { 076 return this.activeToDate; 077 } 078 079 /** 080 * @param activeToDate the activeToDate to set 081 */ 082 public void setActiveToDate(Timestamp activeToDate) { 083 this.activeToDate = activeToDate; 084 } 085 086 public boolean isActive() { 087 long now = System.currentTimeMillis(); 088 return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime()); 089 } 090 091}