1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.openpermis.editor.policy.presenter; |
11 | |
|
12 | |
import java.util.List; |
13 | |
|
14 | |
import org.openpermis.policy.bean.ActionBean; |
15 | |
import org.openpermis.policy.bean.AuthorityBean; |
16 | |
import org.openpermis.policy.bean.DomainBean; |
17 | |
import org.openpermis.policy.bean.ObligationBean; |
18 | |
import org.openpermis.policy.bean.PolicyBean; |
19 | |
import org.openpermis.policy.bean.TargetBean; |
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
public class PolicyPool |
26 | |
{ |
27 | |
|
28 | |
|
29 | |
private final PolicyPartPool<DomainBean> resourceDomainPool; |
30 | |
|
31 | |
private final PolicyPartPool<DomainBean> subjectDomainPool; |
32 | |
|
33 | |
private final PolicyPartPool<TargetBean> targetPool; |
34 | |
|
35 | |
private final PolicyPartPool<ObligationBean> obligationPool; |
36 | |
|
37 | |
private final PolicyRoleRefPool rolePool; |
38 | |
|
39 | |
private final PolicyPartPool<ActionBean> actionPool; |
40 | |
|
41 | |
private final PolicyPartPool<AuthorityBean> authorityPool; |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
public PolicyPool (PolicyBean policy) { |
51 | 1 | super(); |
52 | 1 | this.resourceDomainPool = |
53 | |
new PolicyPartPool<DomainBean>( |
54 | |
policy, |
55 | |
new PolicyPartPool.PartFinder<DomainBean>() { |
56 | 1 | public List<DomainBean> getParts (PolicyBean policy) { |
57 | 1 | return policy.getResourceDomains(); |
58 | |
} |
59 | |
} |
60 | |
); |
61 | 1 | this.subjectDomainPool = |
62 | |
new PolicyPartPool<DomainBean>( |
63 | |
policy, |
64 | |
new PolicyPartPool.PartFinder<DomainBean>() { |
65 | 1 | public List<DomainBean> getParts (PolicyBean policy) { |
66 | 1 | return policy.getSubjectDomains(); |
67 | |
} |
68 | |
} |
69 | |
); |
70 | 1 | this.targetPool = |
71 | |
new PolicyPartPool<TargetBean>(policy, TargetBean.class); |
72 | 1 | this.obligationPool = |
73 | |
new PolicyPartPool<ObligationBean>(policy, ObligationBean.class); |
74 | 1 | this.rolePool = |
75 | |
new PolicyRoleRefPool(policy); |
76 | 1 | this.actionPool = |
77 | |
new PolicyPartPool<ActionBean>(policy, ActionBean.class); |
78 | 1 | this.authorityPool = |
79 | |
new PolicyPartPool<AuthorityBean>(policy, AuthorityBean.class); |
80 | 1 | } |
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
public PolicyPartPool<DomainBean> getResourceDomainPool () { |
90 | 0 | return this.resourceDomainPool; |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
public PolicyPartPool<DomainBean> getSubjectDomainPool () { |
99 | 0 | return this.subjectDomainPool; |
100 | |
} |
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
public PolicyPartPool<TargetBean> getTargetPool () { |
108 | 0 | return this.targetPool; |
109 | |
} |
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
public PolicyPartPool<ObligationBean> getObligationPool () { |
117 | 0 | return this.obligationPool; |
118 | |
} |
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
public PolicyRoleRefPool getRolePool () { |
126 | 0 | return this.rolePool; |
127 | |
} |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
public PolicyPartPool<ActionBean> getActionPool () { |
135 | 0 | return this.actionPool; |
136 | |
} |
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
public PolicyPartPool<AuthorityBean> getAuthorityPool () { |
144 | 1 | return this.authorityPool; |
145 | |
} |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
public void mergePool (PolicyBean policy, boolean expunge) { |
154 | 0 | this.getResourceDomainPool().mergePool(policy, expunge); |
155 | 0 | this.getSubjectDomainPool().mergePool(policy, expunge); |
156 | 0 | this.getTargetPool().mergePool(policy, expunge); |
157 | 0 | this.getActionPool().mergePool(policy, expunge); |
158 | 0 | this.getRolePool().mergePool(policy, expunge); |
159 | 0 | this.getAuthorityPool().mergePool(policy, expunge); |
160 | 0 | this.getObligationPool().mergePool(policy, expunge); |
161 | 0 | } |
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
public void mergeRolePool (PolicyBean policy, boolean expunge) { |
170 | 0 | this.getRolePool().mergePool(policy, expunge); |
171 | 0 | } |
172 | |
|
173 | |
|
174 | |
} |