Coverage Report - org.kuali.rice.core.api.mo.common.active.InactivatableFromToImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
InactivatableFromToImpl
0%
0/10
0%
0/10
1.8
 
 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.core.api.mo.common.active;
 18  
 
 19  
 import java.sql.Timestamp;
 20  
 
 21  0
 public abstract class InactivatableFromToImpl implements InactivatableFromTo {
 22  
     protected Timestamp activeFromDate;
 23  
         protected Timestamp activeToDate;
 24  
 
 25  
 
 26  
     @Override
 27  
     public Timestamp getActiveFromDate() {
 28  0
         return activeFromDate;
 29  
     }
 30  
 
 31  
     @Override
 32  
     public Timestamp getActiveToDate() {
 33  0
         return activeToDate;
 34  
     }
 35  
 
 36  
 
 37  
     public boolean isActive() {
 38  0
         long asOfDate = System.currentTimeMillis();
 39  
 
 40  0
                 return computeActive(asOfDate);
 41  
     }
 42  
 
 43  
 
 44  
     public boolean isActive(Timestamp activeAsOfDate) {
 45  0
         long asOfDate = System.currentTimeMillis();
 46  0
                 if (activeAsOfDate != null) {
 47  0
                         asOfDate = activeAsOfDate.getTime();
 48  
                 }
 49  
 
 50  0
                 return computeActive(asOfDate);
 51  
     }
 52  
 
 53  
 
 54  
     private boolean computeActive(Long asOfDate) {
 55  0
           return (activeFromDate == null || asOfDate >= activeFromDate.getTime())
 56  
                                 && (activeToDate == null || asOfDate < activeToDate.getTime());
 57  
     }
 58  
 
 59  
 
 60  
 }