Search in sources :

Example 1 with ConditionTypeManager

use of com.sun.identity.policy.ConditionTypeManager in project OpenAM by OpenRock.

the class PolicyModelImpl method getConditionViewBeanURL.

/**
     * Returns properties view bean URL of a condition.
     *
     * @param realmName Name of realm.
     * @param condition Condition Object.
     * @return properties view bean URL of a condition.
     */
public String getConditionViewBeanURL(String realmName, Condition condition) {
    String url = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ConditionTypeManager conditionTypeMgr = policyMgr.getConditionTypeManager();
            url = conditionTypeMgr.getViewBeanURL(condition);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
    }
    return url;
}
Also used : PolicyManager(com.sun.identity.policy.PolicyManager) ConditionTypeManager(com.sun.identity.policy.ConditionTypeManager) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 2 with ConditionTypeManager

use of com.sun.identity.policy.ConditionTypeManager in project OpenAM by OpenRock.

the class PolicyModelImpl method getConditionViewBeanURL.

/**
     * Returns properties view bean URL of a condition.
     *
     * @param realmName Name of realm.
     * @param conditionTypeName Name of Condition Type.
     * @return properties view bean URL of a condition.
     */
public String getConditionViewBeanURL(String realmName, String conditionTypeName) {
    String url = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ConditionTypeManager condTypeMgr = policyMgr.getConditionTypeManager();
            Condition condition = condTypeMgr.getCondition(conditionTypeName);
            url = condTypeMgr.getViewBeanURL(condition);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
    }
    return url;
}
Also used : Condition(com.sun.identity.policy.interfaces.Condition) PolicyManager(com.sun.identity.policy.PolicyManager) ConditionTypeManager(com.sun.identity.policy.ConditionTypeManager) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 3 with ConditionTypeManager

use of com.sun.identity.policy.ConditionTypeManager in project OpenAM by OpenRock.

the class PrivilegePolicyMapping method createIPCondition.

private Condition createIPCondition(PolicyManager pm) throws PolicyException {
    ConditionTypeManager mgr = pm.getConditionTypeManager();
    Condition cond = mgr.getCondition("IPCondition");
    cond.setProperties(ipConditionEnvMap);
    return cond;
}
Also used : OrCondition(com.sun.identity.entitlement.OrCondition) PrivilegeCondition(com.sun.identity.policy.plugins.PrivilegeCondition) Condition(com.sun.identity.policy.interfaces.Condition) EntitlementCondition(com.sun.identity.entitlement.EntitlementCondition) ConditionTypeManager(com.sun.identity.policy.ConditionTypeManager)

Example 4 with ConditionTypeManager

use of com.sun.identity.policy.ConditionTypeManager in project OpenAM by OpenRock.

the class PrivilegePolicyMapping method createIPCondition1.

private Condition createIPCondition1(PolicyManager pm) throws PolicyException {
    ConditionTypeManager mgr = pm.getConditionTypeManager();
    Condition cond = mgr.getCondition("IPCondition");
    cond.setProperties(ipConditionEnvMap1);
    return cond;
}
Also used : OrCondition(com.sun.identity.entitlement.OrCondition) PrivilegeCondition(com.sun.identity.policy.plugins.PrivilegeCondition) Condition(com.sun.identity.policy.interfaces.Condition) EntitlementCondition(com.sun.identity.entitlement.EntitlementCondition) ConditionTypeManager(com.sun.identity.policy.ConditionTypeManager)

Example 5 with ConditionTypeManager

use of com.sun.identity.policy.ConditionTypeManager in project OpenAM by OpenRock.

the class PolicyModelImpl method getActiveConditionTypes.

/**
     * Returns a map of active condition types for a realm to its display name.
     *
     * @param realmName Name of Realm.
     * @return a map of active condition types for a realm to its display name.
     */
public Map getActiveConditionTypes(String realmName) {
    Map condTypes = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ConditionTypeManager condTypeMgr = policyMgr.getConditionTypeManager();
            if (condTypeMgr != null) {
                Set types = condTypeMgr.getSelectedConditionTypeNames();
                condTypes = new HashMap(types.size() * 2);
                for (Iterator iter = types.iterator(); iter.hasNext(); ) {
                    String rName = (String) iter.next();
                    condTypes.put(rName, condTypeMgr.getDisplayName(rName));
                }
            }
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getActiveConditionTypes", e);
    } catch (SSOException e) {
        debug.warning("PolicyModelImpl.getActiveConditionTypes", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getActiveConditionTypes", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getActiveConditionTypes", e);
    }
    return (condTypes == null) ? Collections.EMPTY_MAP : condTypes;
}
Also used : PolicyManager(com.sun.identity.policy.PolicyManager) Set(java.util.Set) HashSet(java.util.HashSet) ConditionTypeManager(com.sun.identity.policy.ConditionTypeManager) HashMap(java.util.HashMap) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) Iterator(java.util.Iterator) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

ConditionTypeManager (com.sun.identity.policy.ConditionTypeManager)8 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)6 PolicyManager (com.sun.identity.policy.PolicyManager)6 Condition (com.sun.identity.policy.interfaces.Condition)5 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)4 PolicyException (com.sun.identity.policy.PolicyException)4 EntitlementCondition (com.sun.identity.entitlement.EntitlementCondition)2 OrCondition (com.sun.identity.entitlement.OrCondition)2 PrivilegeCondition (com.sun.identity.policy.plugins.PrivilegeCondition)2 SSOException (com.iplanet.sso.SSOException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Set (java.util.Set)1