1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.profiler.rules.impl;
18
19 import org.apache.jetspeed.profiler.rules.ProfilingRule;
20 import org.apache.jetspeed.profiler.rules.RuleCriterion;
21 import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
22 import org.apache.jetspeed.request.RequestContext;
23
24 /***
25 * Standard Jetspeed-1 Group/Role/User resolver.
26 * First looking for a group request parameter, then a role request parameter,
27 * then a user request parameter. If none are found, then it uses the
28 * current user's principal.
29 *
30 * If it is null, it then falls back to a request parameter.
31 * If it is null it gives up and returns null allowing subclasses
32 * to continue processing.
33 *
34 * Since there is no 1:1 value for a combination rule of group, the criterion's
35 * value is ignored.
36 *
37 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
38 * @version $Id: GroupRoleUserCriterionResolver.java 516448 2007-03-09 16:25:47Z ate $
39 */
40 public class GroupRoleUserCriterionResolver
41 extends UserCriterionResolver
42 implements RuleCriterionResolver
43 {
44
45
46
47 public String resolve(RequestContext context, RuleCriterion criterion)
48 {
49 String value = context.getRequestParameter(ProfilingRule.STANDARD_GROUP);
50 if (value != null)
51 {
52 criterion.setName(ProfilingRule.STANDARD_GROUP);
53 return value;
54 }
55 value = context.getRequestParameter(ProfilingRule.STANDARD_ROLE);
56 if (value != null)
57 {
58 criterion.setName(ProfilingRule.STANDARD_ROLE);
59 return value;
60 }
61
62
63 criterion.setName(ProfilingRule.STANDARD_USER);
64 return super.resolve(context, criterion);
65 }
66
67
68
69 }