Result result = policy.evaluate(context); int effect = result.getDecision();
Result result = policy.evaluate(context); int effect = result.getDecision();
return selectedPolicy.evaluate(context);
Result result = policy.evaluate(context); int effect = result.getDecision();
} else if (match.getResult() == MatchResult.MATCH) { Result result = policy.evaluate(context); int effect = result.getDecision();
Result result = policy.evaluate(context); int effect = result.getDecision();
/** * A private helper routine that resolves a policy for the given * context, and then tries to evaluate based on the policy */ private Result evaluateContext(EvaluationCtx context) { // first off, try to find a policy PolicyFinderResult finderResult = policyFinder.findPolicy(context); // see if there weren't any applicable policies if (finderResult.notApplicable()) return new Result(Result.DECISION_NOT_APPLICABLE, context.getResourceId().encode()); // see if there were any errors in trying to get a policy if (finderResult.indeterminate()) return new Result(Result.DECISION_INDETERMINATE, finderResult.getStatus(), context.getResourceId().encode()); // we found a valid policy, so we can do the evaluation return finderResult.getPolicy().evaluate(context); }
/** * Tries to evaluate the policy by calling the combining algorithm on * the given policies or rules. The <code>match</code> method must always * be called first, and must always return MATCH, before this method * is called. * * @param context the representation of the request * * @return the result of evaluation */ public Result evaluate(EvaluationCtx context) { // if there is no finder, then we return NotApplicable if (finder == null) return new Result(Result.DECISION_NOT_APPLICABLE, context.getResourceId().encode()); PolicyFinderResult pfr = finder.findPolicy(reference, policyType, constraints, parentMetaData); // if we found nothing, then we return NotApplicable if (pfr.notApplicable()) return new Result(Result.DECISION_NOT_APPLICABLE, context.getResourceId().encode()); // if there was an error, we return that status data if (pfr.indeterminate()) return new Result(Result.DECISION_INDETERMINATE, pfr.getStatus(), context.getResourceId().encode()); // we must have found a policy return pfr.getPolicy().evaluate(context); }