Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
7   93   1   1.17
4   24   0.86   6
6     1  
1    
 
 
  AbsoluteValidityPeriod       Line # 43 7 1 76.5% 0.7647059
 
  (1)
 
1    /*
2    * Copyright (c) 2000-2005, University of Salford
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * Redistributions of source code must retain the above copyright notice, this
9    * list of conditions and the following disclaimer.
10    *
11    * Redistributions in binary form must reproduce the above copyright notice,
12    * this list of conditions and the following disclaimer in the documentation
13    * and/or other materials provided with the distribution.
14    *
15    * Neither the name of the University of Salford nor the names of its
16    * contributors may be used to endorse or promote products derived from this
17    * software without specific prior written permission.
18    *
19    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22    * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29    * POSSIBILITY OF SUCH DAMAGE.
30    */
31   
32    package issrg.pba.rbac;
33   
34    /**
35    * This class represents a validity period, specified as two margins in time: the
36    * notBefore and notAfter times. The times are absolute and are input as java.util.Date
37    * objects. The notAfter can be set to time before notBefore, but such a validity
38    * period will mean "invalid time" and cause the credential to be not accepted.
39    *
40    * @author A.Otenko
41    */
42   
 
43    public class AbsoluteValidityPeriod extends DefaultValidityPeriodBehaviour {
44   
45    protected java.util.Date notBefore;
46    protected java.util.Date notAfter;
47   
48    /**
49    * This constructor creates an infinite validity period. This is equivalent
50    * to calling AbsoluteValidityPeriod(null, null);
51    */
 
52  0 toggle public AbsoluteValidityPeriod() {
53  0 this(null, null);
54    }
55   
56    /**
57    * This constructor creates a validity period with the margins specified. If
58    * a margin is null, the period is infinite in that direction.
59    *
60    * @param notBefore is the date and time when the period starts; if null, it
61    * existed forever
62    * @param notAfter is the date and time when the period ends; if null, it lasts
63    * forever
64    */
 
65  2564 toggle public AbsoluteValidityPeriod(java.util.Date notBefore, java.util.Date notAfter){
66  2564 this.notBefore = notBefore;
67  2564 this.notAfter = notAfter;
68    }
69   
70    /**
71    * This method returns the Date of NotBefore, as specified in the constructor.
72    * Can be null, if the validity period exists "since time immemorial"
73    */
 
74  7051 toggle public java.util.Date getNotBefore(){
75  7051 return notBefore;
76    }
77   
78    /**
79    * This method returns the Date of NotAfter, as specified in the constructor.
80    * Can be null, if the validity period lasts forever.
81    */
 
82  8011 toggle public java.util.Date getNotAfter(){
83  8011 return notAfter;
84    }
85   
 
86  0 toggle public Object clone(){
87  0 return new AbsoluteValidityPeriod(notBefore, notAfter);
88    }
89   
 
90  4185 toggle public String toString(){
91  4185 return "("+((notBefore==null)?"-oo":notBefore.toString())+"; "+((notAfter==null)?"+oo":notAfter.toString())+")";
92    }
93    }