View Javadoc

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  import java.util.LinkedHashMap;
21  
22  import javax.persistence.Column;
23  import javax.persistence.MappedSuperclass;
24  
25  import org.hibernate.annotations.Type;
26  import org.kuali.rice.kns.bo.Inactivateable;
27  import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
28  
29  /**
30   * This is a description of what this class does - shyu don't forget to fill this in. 
31   * 
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   *
34   */
35  @MappedSuperclass
36  public class KimDocumentBoBase  extends PersistableBusinessObjectBase implements Inactivateable {
37      private static final long serialVersionUID = 9042706897191231670L;
38  	@Column(name="FDOC_NBR")
39      protected String documentNumber;
40  	@Type(type="yes_no")
41  	@Column(name="ACTV_IND")
42      protected boolean active = true;
43  	@Type(type="yes_no")
44  	@Column(name="EDIT_FLAG")
45      protected boolean edit;
46  
47  	
48  	@Column(name="ACTV_FRM_DT")
49  	protected Timestamp activeFromDate;
50  	@Column(name="ACTV_TO_DT")
51  	protected Timestamp activeToDate;
52  
53  	/**
54  	 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
55  	 */
56  	@SuppressWarnings("unchecked")
57  	@Override
58  	protected LinkedHashMap toStringMapper() {
59  		LinkedHashMap m = new LinkedHashMap();
60  		m.put( "documentNumber", documentNumber );
61  		return m;
62  	}
63  
64  	public String getDocumentNumber() {
65  		return this.documentNumber;
66  	}
67  
68  	public void setDocumentNumber(String documentNumber) {
69  		this.documentNumber = documentNumber;
70  	}
71  
72  	public boolean isActive() {
73  		long now = System.currentTimeMillis();		
74  		return (activeFromDate == null || now > activeFromDate.getTime()) && (activeToDate == null || now < activeToDate.getTime());
75  	}
76  
77  	public void setActive(boolean active) {
78  		this.active = active;
79  	}
80  
81  	public boolean isEdit() {
82  		return this.edit;
83  	}
84  
85  	public void setEdit(boolean edit) {
86  		this.edit = edit;
87  	}
88  
89  	/**
90  	 * @return the activeFromDate
91  	 */
92  	public Timestamp getActiveFromDate() {
93  		return this.activeFromDate;
94  	}
95  
96  	/**
97  	 * @param activeFromDate
98  	 *            the activeFromDate to set
99  	 */
100 	public void setActiveFromDate(Timestamp activeFromDate) {
101 		this.activeFromDate = activeFromDate;
102 	}
103 
104 	/**
105 	 * @return the activeToDate
106 	 */
107 	public Timestamp getActiveToDate() {
108 		return this.activeToDate;
109 	}
110 
111 	/**
112 	 * @param activeToDate
113 	 *            the activeToDate to set
114 	 */
115 	public void setActiveToDate(Timestamp activeToDate) {
116 		this.activeToDate = activeToDate;
117 	}
118 
119 }