Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PartBeanFactory |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport | |
3 | * (http://www.vbs.admin.ch) | |
4 | * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch) | |
5 | * All rights reserved. | |
6 | * | |
7 | * Licensed under the Open Permis License which accompanies this distribution, | |
8 | * and is available at http://www.openpermis.org/BSDlicenceKent.txt | |
9 | */ | |
10 | package org.openpermis.policy.bean; | |
11 | ||
12 | import java.net.URI; | |
13 | import java.util.Collection; | |
14 | ||
15 | import org.joda.time.DateTimeZone; | |
16 | ||
17 | import org.openpermis.basic.TimePeriodConstraint; | |
18 | import org.openpermis.policy.Action; | |
19 | import org.openpermis.policy.ActionCollection; | |
20 | import org.openpermis.policy.Authority; | |
21 | import org.openpermis.policy.Domain; | |
22 | import org.openpermis.policy.Obligation; | |
23 | import org.openpermis.policy.ObligationCollection; | |
24 | import org.openpermis.policy.ParameterList; | |
25 | import org.openpermis.policy.PartFactory; | |
26 | import org.openpermis.policy.Predicate; | |
27 | import org.openpermis.policy.Role; | |
28 | import org.openpermis.policy.RoleAssignmentRule; | |
29 | import org.openpermis.policy.RoleAssignmentRuleCollection; | |
30 | import org.openpermis.policy.RoleHierarchy; | |
31 | import org.openpermis.policy.RoleHierarchyCollection; | |
32 | import org.openpermis.policy.Target; | |
33 | import org.openpermis.policy.TargetAccessRule; | |
34 | import org.openpermis.policy.TargetAccessRuleCollection; | |
35 | import org.openpermis.policy.TargetCollection; | |
36 | ||
37 | ||
38 | ||
39 | /** | |
40 | * Factory for policy parts. | |
41 | * @since 0.1.0 | |
42 | */ | |
43 | public interface PartBeanFactory | |
44 | extends PartFactory | |
45 | { | |
46 | ||
47 | //---- Methods | |
48 | ||
49 | /** | |
50 | * @since 0.1.0 | |
51 | */ | |
52 | public SerialNumber getSerialNumber (); | |
53 | ||
54 | /** | |
55 | * Creates a new action bean. | |
56 | * @return an {@link ActionBean} instance. | |
57 | * @since 0.1.0 | |
58 | */ | |
59 | public ActionBean createAction (String name, ParameterList parameterList); | |
60 | ||
61 | /** | |
62 | * Creates a action bean collection. | |
63 | * @param collection of {@link ActionBean}'s. | |
64 | * @return a {@link ActionBeanCollection} instance. | |
65 | * @since 0.3.0 | |
66 | */ | |
67 | public ActionBeanCollection createActionCollection (Collection<? extends Action> collection); | |
68 | ||
69 | /** | |
70 | * Creates a new authority bean. | |
71 | * @return an {@link AuthorityBean} instance. | |
72 | * @since 0.1.0 | |
73 | */ | |
74 | public AuthorityBean createAuthority (URI identity); | |
75 | ||
76 | /** | |
77 | * Creates a new domain. | |
78 | * @return a {@link DomainBean} instance. | |
79 | * @since 0.1.0 | |
80 | */ | |
81 | public DomainBean createDomain (URI uri); | |
82 | ||
83 | /** | |
84 | * Creates a new obligation. | |
85 | * @param text the {@link String} describing the obligation. | |
86 | * @return a {@link ObligationBean} instance. | |
87 | * @since 0.3.0 | |
88 | */ | |
89 | public ObligationBean createObligation (String text); | |
90 | ||
91 | /** | |
92 | * Creates a obligation bean collection. | |
93 | * @param collection of {@link ObligationBean}'s. | |
94 | * @return a {@link ObligationBeanCollection} instance. | |
95 | * @since 0.3.0 | |
96 | */ | |
97 | public ObligationBeanCollection createObligationCollection ( | |
98 | Collection<? extends Obligation> collection | |
99 | ); | |
100 | ||
101 | /** | |
102 | * Create a new policy bean. | |
103 | * @return a {@link PolicyBean} instance. | |
104 | * @since 0.1.0 | |
105 | */ | |
106 | public PolicyBean createPolicy (); | |
107 | ||
108 | /** | |
109 | * Creates a new policy bean. | |
110 | * @param zone a {@link DateTimeZone} the time zone of this policy, | |
111 | * @param hierarchies a {@link RoleHierarchyBeanCollection}. | |
112 | * @param targetAccessRules a {@link TargetAccessRuleBeanCollection}. | |
113 | * @param roleAssignmentRules a {@link RoleAssignmentRuleBeanCollection}. | |
114 | * @return a {@link PolicyBean} instance. | |
115 | * @since 0.3.0 | |
116 | */ | |
117 | public PolicyBean createPolicy ( | |
118 | DateTimeZone zone, | |
119 | RoleHierarchyCollection hierarchies, | |
120 | TargetAccessRuleCollection targetAccessRules, | |
121 | RoleAssignmentRuleCollection roleAssignmentRules | |
122 | ); | |
123 | ||
124 | /** | |
125 | * Create a new role hierarchy bean. | |
126 | * @param uri an {@link URI} uniquely identifying the role hierarchy. | |
127 | * @return a {@link RoleHierarchyBean} instance. | |
128 | * @since 0.3.0 | |
129 | */ | |
130 | public RoleHierarchyBean createRoleHierarchy (URI uri); | |
131 | ||
132 | /** | |
133 | * Creates a new role hierarchy bean collection. | |
134 | * @param collection of {@link RoleHierarchyBean}'s. | |
135 | * @return a {@link RoleHierarchyBeanCollection} instance. | |
136 | * @since 0.3.0 | |
137 | */ | |
138 | public RoleHierarchyBeanCollection createRoleHierarchyCollection ( | |
139 | Collection<? extends RoleHierarchy> collection | |
140 | ); | |
141 | ||
142 | /** | |
143 | * Create a role assignment rule bean. | |
144 | * @return a {@link RoleAssignmentRuleBean} instance. | |
145 | * @since 0.3.0 | |
146 | */ | |
147 | public RoleAssignmentRuleBean createRoleAssignmentRule ( | |
148 | Authority authority, | |
149 | DomainBean subjectDomain, | |
150 | Collection<Role> roles, | |
151 | TimePeriodConstraint constraint, | |
152 | int delegationDepth | |
153 | ); | |
154 | ||
155 | /** | |
156 | * Creates a role assignment rule bean collection. | |
157 | * @param collection of {@link RoleAssignmentRuleBean}'s. | |
158 | * @return a {@link RoleAssignmentRuleBeanCollection} instance. | |
159 | * @since 0.3.0 | |
160 | */ | |
161 | public RoleAssignmentRuleBeanCollection createRoleAssignmentRuleCollection ( | |
162 | Collection<? extends RoleAssignmentRule> collection | |
163 | ); | |
164 | ||
165 | /** | |
166 | * Creates a target bean. | |
167 | * @param domain the {@link DomainBean} identifying the resources of this target | |
168 | * @param actions the {@link ActionBeanCollection} that can be performed on the resources. | |
169 | * @return a {@link TargetBean} instance. | |
170 | * @since 0.3.0 | |
171 | */ | |
172 | public TargetBean createTarget (Domain domain, ActionCollection actions); | |
173 | ||
174 | /** | |
175 | * Creates a target bean collection. | |
176 | * @param collection of {@link TargetBean}'s. | |
177 | * @return a {@link TargetBeanCollection} instance. | |
178 | * @since 0.3.0 | |
179 | */ | |
180 | public TargetBeanCollection createTargetCollection (Collection<? extends Target> collection); | |
181 | ||
182 | /** | |
183 | * Creates a target access rule bean. | |
184 | * @param targets a {@link TargetBeanCollection} for which this rule applies. | |
185 | * @param roles the {@link Role}s that a subject needs to get access to this target. | |
186 | * @param obligations the {@link ObligationCollection}s for this rule. | |
187 | * @return a {@link TargetAccessRuleBean} instance. | |
188 | * @since 0.3.0 | |
189 | */ | |
190 | public TargetAccessRuleBean createTargetAccessRule ( | |
191 | TargetCollection targets, | |
192 | Collection<Role> roles, | |
193 | Predicate condition, | |
194 | ObligationCollection obligations | |
195 | ); | |
196 | ||
197 | /** | |
198 | * Creates a target access rule bean collection. | |
199 | * @param collection of {@link TargetAccessRuleBean}'s. | |
200 | * @return a {@link TargetAccessRuleBeanCollection} instance. | |
201 | * @since 0.3.0 | |
202 | */ | |
203 | public TargetAccessRuleBeanCollection createTargetAccessRuleCollection ( | |
204 | Collection<? extends TargetAccessRule> collection | |
205 | ); | |
206 | ||
207 | } |