use of com.sun.identity.policy.ActionDecision in project OpenAM by OpenRock.
the class ResourceResultCache method mergePolicyDecisions.
/**
* Merges two policy decisions
* @param pd1 policy decision to be merged
* @param pd2 policy decision to be merged into
* @param serviceName service name
* @return merged policy decision
*/
private PolicyDecision mergePolicyDecisions(PolicyDecision pd1, PolicyDecision pd2, String serviceName) {
//pd2 is collector
Map actionDecisions1 = pd1.getActionDecisions();
Set actions = new HashSet();
actions.addAll(actionDecisions1.keySet());
Iterator iter = actions.iterator();
while (iter.hasNext()) {
String action = (String) iter.next();
ActionDecision ad1 = (ActionDecision) actionDecisions1.get(action);
pd2.addActionDecision(ad1, policyProperties.getTrueValue(serviceName, action), policyProperties.getFalseValue(serviceName, action));
}
Map mergedReponseAttrsMap = new HashMap();
PolicyUtils.appendMapToMap(pd1.getResponseAttributes(), mergedReponseAttrsMap);
PolicyUtils.appendMapToMap(pd2.getResponseAttributes(), mergedReponseAttrsMap);
pd2.setResponseAttributes(mergedReponseAttrsMap);
return pd2;
}
Aggregations