View Javadoc
1   /**
2    * Copyright 2005-2016 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.Timestamp;
19  
20  import javax.persistence.Column;
21  import javax.persistence.Embeddable;
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  public class KimDocumentBoActiveToFromBase extends KimDocumentBoBase {
33  
34      private static final long serialVersionUID = 9042706897191231671L;
35  
36      @Column(name="ACTV_FRM_DT")
37  	protected Timestamp activeFromDate;
38  	@Column(name="ACTV_TO_DT")
39  	protected Timestamp activeToDate;
40  	@Transient
41  	protected boolean edit;
42  
43  
44  	/**
45  	 * @return the edit
46  	 */
47  	public boolean isEdit() {
48  		return this.edit;
49  	}
50  
51  	/**
52  	 * @param edit the edit to set
53  	 */
54  	public void setEdit(boolean edit) {
55  		this.edit = edit;
56  	}
57  
58  	/**
59  	 * @return the activeFromDate
60  	 */
61  	public Timestamp getActiveFromDate() {
62  		return this.activeFromDate;
63  	}
64  
65  	/**
66  	 * @param activeFromDate the activeFromDate to set
67  	 */
68  	public void setActiveFromDate(Timestamp activeFromDate) {
69  		this.activeFromDate = activeFromDate;
70  	}
71  
72  	/**
73  	 * @return the activeToDate
74  	 */
75  	public Timestamp getActiveToDate() {
76  		return this.activeToDate;
77  	}
78  
79  	/**
80  	 * @param activeToDate the activeToDate to set
81  	 */
82  	public void setActiveToDate(Timestamp activeToDate) {
83  		this.activeToDate = activeToDate;
84  	}
85  
86  	public boolean isActive() {
87  		long now = System.currentTimeMillis();		
88  		return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime());
89  	}
90  
91  }