Set<AbstractPolicy> matchedPolicies = new HashSet<AbstractPolicy>();
Iterator it = policyElements.iterator();
while (it.hasNext()) {
AbstractPolicy policy =
((PolicyCombinerElement) it.next()).getPolicy();
// make sure that the policy matches the context
MatchResult match = policy.match(context);
if (match.getResult() == MatchResult.INDETERMINATE) {
atLeastOneError = true;
// keep track of the first error, regardless of cause
if (firstIndeterminateStatus == null) {
firstIndeterminateStatus = match.getStatus();
}
} else if (match.getResult() == MatchResult.MATCH) {
matchedPolicies.add(policy);
}
}
Set<AbstractPolicy> applicablePolicies =
getApplicablePolicies(context, matchedPolicies);
for (AbstractPolicy policy : applicablePolicies) {
Result result = policy.evaluate(context);
int effect = result.getDecision();
if (effect == Result.DECISION_DENY) {
denyObligations.addAll(result.getObligations());
return new Result(Result.DECISION_DENY, context.getResourceId()