Search in sources :

Example 11 with ActionDecision

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;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) RequestSet(com.iplanet.services.comm.share.RequestSet) HashMap(java.util.HashMap) Iterator(java.util.Iterator) ActionDecision(com.sun.identity.policy.ActionDecision) Map(java.util.Map) HashMap(java.util.HashMap) HashSet(java.util.HashSet)

Aggregations

ActionDecision (com.sun.identity.policy.ActionDecision)11 PolicyDecision (com.sun.identity.policy.PolicyDecision)8 Map (java.util.Map)8 HashMap (java.util.HashMap)7 HashSet (java.util.HashSet)6 Set (java.util.Set)6 Iterator (java.util.Iterator)4 RequestSet (com.iplanet.services.comm.share.RequestSet)3 PolicyEvaluator (com.sun.identity.policy.PolicyEvaluator)2 PolicyException (com.sun.identity.policy.PolicyException)2 ResourceResult (com.sun.identity.policy.ResourceResult)2 ServletException (javax.servlet.ServletException)2 SSOException (com.iplanet.sso.SSOException)1 SSOToken (com.iplanet.sso.SSOToken)1 SSOTokenID (com.iplanet.sso.SSOTokenID)1 AuthContext (com.sun.identity.authentication.AuthContext)1 ISLocaleContext (com.sun.identity.common.ISLocaleContext)1 DelegationException (com.sun.identity.delegation.DelegationException)1 PolicyEvaluationException (com.sun.identity.policy.remote.PolicyEvaluationException)1 L10NMessageImpl (com.sun.identity.shared.locale.L10NMessageImpl)1