View Javadoc
1   /**
2    * Copyright 2004-2015 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.kpme.core.bo;
17  
18  import java.sql.Timestamp;
19  import java.util.Date;
20  
21  import org.joda.time.LocalDate;
22  import org.kuali.kpme.core.api.bo.HrBusinessObjectContract;
23  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
24  
25  public abstract class HrBusinessObject extends PersistableBusinessObjectBase implements HrBusinessObjectContract {
26  
27  	private static final long serialVersionUID = -5743717258128864335L;
28  	
29  	private Date effectiveDate;
30  	private boolean active = true;
31  	private Timestamp timestamp;
32  	
33  	public abstract String getId();
34  	
35  	public abstract void setId(String id);
36  	
37  	protected abstract String getUniqueKey();
38  	
39  	public Date getEffectiveDate() {
40  		return effectiveDate;
41  	}
42  
43  	public void setEffectiveDate(Date effectiveDate) {
44  		this.effectiveDate = effectiveDate;
45  	}
46  
47      public Date getRelativeEffectiveDate() {
48          return effectiveDate == null ? LocalDate.now().toDate() : effectiveDate;
49      }
50  
51      public void setRelativeEffectiveDate(Date relativeEffectiveDate) {
52          //do nothing
53      }
54  	
55  	public LocalDate getEffectiveLocalDate() {
56  		return effectiveDate != null ? LocalDate.fromDateFields(effectiveDate) : null;
57  	}
58  	
59  	public void setEffectiveLocalDate(LocalDate effectiveLocalDate) {
60  		this.effectiveDate = effectiveLocalDate != null ? effectiveLocalDate.toDate() : null;
61  	}
62  
63  	public boolean isActive() {
64  		return active;
65  	}
66  
67  	public void setActive(boolean active) {
68  		this.active = active;
69  	}
70  
71  	public void setTimestamp(Timestamp timestamp) {
72  		this.timestamp = timestamp;
73  	}
74  
75  	public Timestamp getTimestamp() {
76  		return timestamp;
77  	}
78  
79  }