1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.openpermis.policy.bean.basic; |
11 | |
|
12 | |
import java.net.URI; |
13 | |
import java.util.ArrayList; |
14 | |
import java.util.Collection; |
15 | |
import java.util.List; |
16 | |
|
17 | |
import org.openpermis.policy.AuthorizedRoles; |
18 | |
import org.openpermis.policy.TimeStamp; |
19 | |
import org.openpermis.policy.bean.SerialNumber; |
20 | |
import org.openpermis.policy.bean.TargetAccessRuleBean; |
21 | |
import org.openpermis.policy.bean.TargetAccessRuleBeanCollection; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | 0 | public class BasicTargetAccessRuleCollection |
29 | |
extends BasicAbstractCollection<TargetAccessRuleBean> |
30 | |
implements TargetAccessRuleBeanCollection |
31 | |
{ |
32 | |
|
33 | |
|
34 | |
|
35 | |
private static final long serialVersionUID = -956620427014379243L; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
protected BasicTargetAccessRuleCollection (SerialNumber serialNumber) { |
47 | 266 | super(serialNumber); |
48 | 266 | } |
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
protected BasicTargetAccessRuleCollection ( |
57 | |
SerialNumber serialNumber, |
58 | |
Collection<TargetAccessRuleBean> collection |
59 | |
) { |
60 | 249 | super(serialNumber, collection); |
61 | 248 | } |
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
public List<AuthorizedRoles> findAuthorizedRoleSets ( |
71 | |
URI resourceUri, |
72 | |
String actionName, |
73 | |
List<?> arguments, |
74 | |
TimeStamp timeStamp |
75 | |
) { |
76 | 15 | final List<AuthorizedRoles> result = |
77 | |
new ArrayList<AuthorizedRoles>(); |
78 | 15 | for (TargetAccessRuleBean targetAccessRule : this) { |
79 | 52 | final AuthorizedRoles pair = |
80 | |
targetAccessRule.findAuthorizedRoleSet( |
81 | |
resourceUri, actionName, arguments, timeStamp |
82 | |
); |
83 | 52 | if (pair != null) { |
84 | 13 | result.add(pair); |
85 | |
} |
86 | 52 | } |
87 | 15 | return result; |
88 | |
} |
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
protected boolean isCollectionType (BasicPart part) { |
96 | 935 | return part instanceof TargetAccessRuleBeanCollection; |
97 | |
} |
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
public BasicTargetAccessRuleCollection create (List<TargetAccessRuleBean> list) { |
105 | 0 | return new BasicTargetAccessRuleCollection(getSerialNumber().next(), list); |
106 | |
} |
107 | |
|
108 | |
} |