PermisAction | Line # 44 | 6 | 1 | 75% |
0.75
|
No Tests | |||
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 the action that can be carried out on a target in the | |
36 | * Permis project. The action has, optionally, a list of arguments. | |
37 | * | |
38 | * @author E Ball | |
39 | * @author A Otenko | |
40 | * @author D Chadwick | |
41 | * @version 0.2 | |
42 | */ | |
43 | ||
44 | public class PermisAction implements issrg.pba.Action{ | |
45 | private String Name; | |
46 | private Argument[] Arguments=new Argument[0]; | |
47 | ||
48 | 0 | protected PermisAction(){} |
49 | ||
50 | /** | |
51 | * This is the constructor for building an action with no arguments. It is | |
52 | * equal to <code>PermisAction(Name, null)</code>. | |
53 | * | |
54 | * @param Name is the name of the action | |
55 | */ | |
56 | 956 | public PermisAction(String Name) { |
57 | 956 | this(Name, null); |
58 | } | |
59 | ||
60 | /** | |
61 | * This is the constructor for building an action with arguments. | |
62 | * | |
63 | * @param Name is the name of the action | |
64 | * @param Arguments is the list of argument values | |
65 | */ | |
66 | 1558 | public PermisAction(String Name, Argument [] Arguments){ |
67 | 1558 | this.Name=Name; |
68 | 1558 | this.Arguments=Arguments; |
69 | } | |
70 | ||
71 | /** | |
72 | * This method returns the name of the action. | |
73 | * | |
74 | * @return String name of the action | |
75 | */ | |
76 | 1245 | public String getActionName(){ |
77 | 1245 | return Name; |
78 | } | |
79 | ||
80 | /** | |
81 | * This method returns the array of arguments that this Action has. | |
82 | * | |
83 | * @return Argument[] containing the values of actual parameters to the | |
84 | * action; | |
85 | * they are in the same order as passed to the constructor; can be null, if | |
86 | * this is an action with no arguments | |
87 | */ | |
88 | 0 | public Argument[] getArguments (){ |
89 | 0 | return Arguments; |
90 | } | |
91 | ||
92 | /** | |
93 | * This method returns the ADI, pertaining to the Action: the array of | |
94 | * parameters to this action. Does the same as <code>getArguments</code> | |
95 | * method, but can be used by objects, operating on abstract actions. | |
96 | * | |
97 | * @return the Object representing an array of parameters to the action; can | |
98 | * be null | |
99 | */ | |
100 | 1118 | public Object getContextualADI(){ |
101 | 1118 | return Arguments; |
102 | } | |
103 | } |
|