View Javadoc

1   /**
2    * Copyright 2005-2013 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.AttributeOverride;
22  import javax.persistence.AttributeOverrides;
23  import javax.persistence.Column;
24  import javax.persistence.MappedSuperclass;
25  
26  import org.hibernate.annotations.Type;
27  
28  /**
29   * This is a description of what this class does - shyu don't forget to fill this in. 
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   *
33   */
34  @MappedSuperclass
35  @AttributeOverrides({
36  	@AttributeOverride(name="edit",column=@Column(name="EDIT_FLAG"))
37  })
38  public class KimDocumentBoActivatableToFromEditableBase  extends KimDocumentBoBase {
39      private static final long serialVersionUID = 9042706897191231673L;
40  	@Type(type="yes_no")
41  	@Column(name="ACTV_IND")
42      protected boolean active = true;
43  	
44  	@Type(type="yes_no")
45  	@Column(name="EDIT_FLAG")
46      protected boolean edit;
47  
48  	
49  	@Column(name="ACTV_FRM_DT")
50  	protected Timestamp activeFromDate;
51  	@Column(name="ACTV_TO_DT")
52  	protected Timestamp activeToDate;
53  
54  	public boolean isActive() {
55  		long now = System.currentTimeMillis();		
56  		return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime());
57  	}
58  
59  	public void setActive(boolean active) {
60  		this.active = active;
61  	}
62  
63  	public boolean isEdit() {
64  		return this.edit;
65  	}
66  
67  	public void setEdit(boolean edit) {
68  		this.edit = edit;
69  	}
70  
71  	/**
72  	 * @return the activeFromDate
73  	 */
74  	public Timestamp getActiveFromDate() {
75  		return this.activeFromDate;
76  	}
77  
78  	/**
79  	 * @param activeFromDate the activeFromDate to set
80  	 */
81  	public void setActiveFromDate(Timestamp activeFromDate) {
82  		this.activeFromDate = activeFromDate;
83  	}
84  
85  	/**
86  	 * @return the activeToDate
87  	 */
88  	public Timestamp getActiveToDate() {
89  		return this.activeToDate;
90  	}
91  
92  	/**
93  	 * @param activeToDate the activeToDate to set
94  	 */
95  	public void setActiveToDate(Timestamp activeToDate) {
96  		this.activeToDate = activeToDate;
97  	}
98  
99  }