Coverage Report - org.kuali.rice.kim.impl.common.active.ActiveFromToBo
 
Classes in this File Line Coverage Branch Coverage Complexity
ActiveFromToBo
42%
3/7
42%
6/14
0
 
 1  
 /*
 2  
  * Copyright 2006-2011 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  
 
 17  
 package org.kuali.rice.kim.impl.common.active
 18  
 
 19  
 import java.sql.Timestamp
 20  
 import javax.persistence.Column
 21  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 22  
 
 23  
 public abstract class ActiveFromToBo extends PersistableBusinessObjectBase {
 24  
     @Column(name = "ACTV_FRM_DT")
 25  
         Timestamp activeFromDate
 26  
 
 27  
         @Column(name = "ACTV_TO_DT")
 28  
         Timestamp activeToDate
 29  
 
 30  
     boolean isActive() {
 31  34
         long asOfDate = System.currentTimeMillis()
 32  
 
 33  34
                 return computeActive(asOfDate);
 34  
     }
 35  
 
 36  
     boolean isActive(Timestamp activeAsOfDate) {
 37  0
         long asOfDate = System.currentTimeMillis()
 38  0
                 if (activeAsOfDate != null) {
 39  0
                         asOfDate = activeAsOfDate.getTime()
 40  
                 }
 41  
 
 42  0
                 return computeActive(asOfDate)
 43  
     }
 44  
 
 45  
     private boolean computeActive(Long asOfDate) {
 46  34
           return (activeFromDate == null || asOfDate >= activeFromDate.getTime()) && (activeToDate == null || asOfDate < activeToDate.getTime())
 47  
     }
 48  
 }