Coverage Report - org.kuali.rice.krad.dto.InactiveableInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
InactiveableInfo
0%
0/15
0%
0/10
1.5
 
 1  
 /*
 2  
  * Copyright 2007-2009 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.krad.dto;
 17  
 
 18  
 import java.util.Date;
 19  
 
 20  0
 public class InactiveableInfo {
 21  
         private static final long serialVersionUID = 1L;
 22  
 
 23  
         protected Date activeFromDate;
 24  
         protected Date activeToDate;
 25  
         protected Date activeAsOfDate;
 26  
 
 27  
         /**
 28  
          * Returns active if the {@link #getActiveAsOfDate()} (current time used if not set) is between
 29  
          * the from and to dates. Null dates are considered to indicate an open range.
 30  
          */
 31  
         public boolean isActive() {
 32  0
                 long asOfDate = System.currentTimeMillis();
 33  0
                 if (activeAsOfDate != null) {
 34  0
                         asOfDate = activeAsOfDate.getTime();
 35  
                 }
 36  
 
 37  0
                 return (activeFromDate == null || asOfDate > activeFromDate.getTime())
 38  
                                 && (activeToDate == null || asOfDate < activeToDate.getTime());
 39  
         }
 40  
 
 41  
         public void setActive(boolean active) {
 42  
                 // do nothing
 43  0
         }
 44  
 
 45  
         public void setActiveFromDate(Date from) {
 46  0
                 this.activeFromDate = from;
 47  0
         }
 48  
 
 49  
         public void setActiveToDate(Date to) {
 50  0
                 this.activeToDate = to;
 51  0
         }
 52  
 
 53  
         public void setActiveAsOfDate(Date activeAsOfDate) {
 54  0
                 this.activeAsOfDate = activeAsOfDate;
 55  0
         }
 56  
 
 57  
         public Date getActiveFromDate() {
 58  0
                 return this.activeFromDate;
 59  
         }
 60  
 
 61  
         public Date getActiveToDate() {
 62  0
                 return this.activeToDate;
 63  
         }
 64  
         
 65  
         public Date getActiveAsOfDate() {
 66  0
                 return this.activeAsOfDate;
 67  
         }
 68  
 
 69  
 }