Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
8   133   1   1.14
0   28   0.88   7
7     1  
1    
 
 
  PERMISResponse       Line # 61 8 1 60% 0.6
 
No Tests
 
1   
2    /*
3    * Copyright (c) 2006, University of Kent
4    * All rights reserved.
5    *
6    * Redistribution and use in source and binary forms, with or without
7    * modification, are permitted provided that the following conditions are met:
8    *
9    * Redistributions of source code must retain the above copyright notice, this
10    * list of conditions and the following disclaimer.
11    *
12    * Redistributions in binary form must reproduce the above copyright notice,
13    * this list of conditions and the following disclaimer in the documentation
14    * and/or other materials provided with the distribution.
15    *
16    * 1. Neither the name of the University of Kent nor the names of its
17    * contributors may be used to endorse or promote products derived from this
18    * software without specific prior written permission.
19    *
20    * 2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23    * PURPOSE ARE DISCLAIMED.
24    *
25    * 3. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32    * POSSIBILITY OF SUCH DAMAGE.
33    *
34    * 4. YOU AGREE THAT THE EXCLUSIONS IN PARAGRAPHS 2 AND 3 ABOVE ARE REASONABLE
35    * IN THE CIRCUMSTANCES. IN PARTICULAR, YOU ACKNOWLEDGE (1) THAT THIS
36    * SOFTWARE HAS BEEN MADE AVAILABLE TO YOU FREE OF CHARGE, (2) THAT THIS
37    * SOFTWARE IS NOT "PRODUCT" QUALITY, BUT HAS BEEN PRODUCED BY A RESEARCH
38    * GROUP WHO DESIRE TO MAKE THIS SOFTWARE FREELY AVAILABLE TO PEOPLE WHO WISH
39    * TO USE IT, AND (3) THAT BECAUSE THIS SOFTWARE IS NOT OF "PRODUCT" QUALITY
40    * IT IS INEVITABLE THAT THERE WILL BE BUGS AND ERRORS, AND POSSIBLY MORE
41    * SERIOUS FAULTS, IN THIS SOFTWARE.
42    *
43    * 5. This license is governed, except to the extent that local laws
44    * necessarily apply, by the laws of England and Wales.
45    *
46    * Author : Gansen Zhao
47    * Email: gz7@kent.ac.uk
48    */
49   
50    package issrg.pba;
51   
52    import issrg.pba.*;
53   
54    /**
55    * This class implements the Response interface, providing a way to create objects
56    * that provide the Response interface. 3 different constructors and one manipulation
57    * function are provided to manipulate/create the objects.
58    *
59    * @author gansen
60    */
 
61    public class PERMISResponse implements Response {
62   
63    private boolean m_bDecision;
64    private Obligations m_obligations;
65   
66    /**
67    * Creates a new default instance of PERMISResponse. The default instance
68    * contains a negative authorisation decision, and an empty set of obligations.
69    */
 
70  0 toggle public PERMISResponse() {
71  0 this(false, null);
72    }
73   
74    /**
75    * Create a new instance of PERMISResponse. The instance contains a positive
76    * authorisation decision, and an empty set of obligations.
77    */
 
78  941 toggle public PERMISResponse(boolean decision) {
79  941 this(decision, null);
80    }
81   
82    /**
83    * Create a new instance of PERMISResponse according the parameters
84    * @param decision specifies what authorisation decision
85    * is in the response; true refers to a positive authorisation decision.
86    * otherwise a negative authorisation decision.
87    * @param obligations is the associated set of Obligations that must be
88    * enforced along with the decision; can be null, if no Obligations
89    * should be enforced.
90    *
91    */
 
92  1058 toggle public PERMISResponse(boolean decision, Obligations obligations){
93  1058 m_bDecision=decision;
94  1058 m_obligations=obligations;
95    }
96   
97    /**
98    * Retrieve the authorisation decision value.
99    * @return true, if access should be granted (subject to enforcing the
100    * associated set of Obligations); false otherwise
101    */
 
102  3174 toggle public boolean isAuthorised() {
103  3174 return m_bDecision;
104    }
105   
106    /**
107    * Set the authorisation decision to the specified value.
108    * @param bDecision is the value that the authorisation decision to be set to. A true value
109    * refers to a positive authorisation decision. otherwise a negative authorisation decision.
110    */
 
111  0 toggle public void setDecision(boolean bDecision) {
112  0 m_bDecision = bDecision;
113    }
114   
115    /**
116    * Retrieve the OBLIGATIONS object that is contained in the instance.
117    * @return an instance to the OBLIGATIONS object. This instance can be null
118    * when there is no OBLIGATIONS object associated with the authorisation decision.
119    */
 
120  794 toggle public Obligations getObligations() {
121  794 return m_obligations;
122    }
123   
124    /**
125    * Set the associated OBLIGATION object to the specified object.
126    * @param obligations This is the object that is to be associated with the authorisation decision, which
127    * contains the information about the obligations to be fulfilled with the enforcement of the authorisation decision.
128    *
129    */
 
130  0 toggle public void setObligations(Obligations obligations) {
131  0 m_obligations = obligations;
132    }
133    }