return getEffectivePolicy(policyList);
}
private Policy getEffectivePolicy(List policyList) {
Policy policy = null;
Object policyElement;
;
for (Iterator iterator = policyList.iterator(); iterator.hasNext();) {
policyElement = iterator.next();
if (policyElement instanceof Policy) {
policy = (policy == null) ? (Policy) policyElement
: (Policy) policy.merge((Policy) policyElement,
registry);
} else if (policyElement instanceof PolicyReference) {
policy = (policy == null) ? (Policy) ((PolicyReference) policyElement)
.normalize(registry)
: (Policy) policy.merge(
(PolicyReference) policyElement, registry);
}
}
if (!policy.isNormalized()) {
policy = (Policy) policy.normalize(registry);
}
return policy;
}