Search in sources :

Example 6 with ConditionTypeManager

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

the class PolicyModelImpl method getConditionInstance.

private Condition getConditionInstance(String realmName, String conditionTypeName) {
    Condition condition = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ConditionTypeManager condTypeMgr = policyMgr.getConditionTypeManager();
            condition = condTypeMgr.getCondition(conditionTypeName);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getConditionInstance", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getConditionInstance", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getConditionInstance", e);
    }
    return condition;
}
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 7 with ConditionTypeManager

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

the class PolicyModelImpl method getConditionTypeName.

/**
     * Returns condition type name of a condition.
     *
     * @param realmName Name of realm.
     * @param condition Condition instance.
     * @return Condition type name of a condition.
     */
public String getConditionTypeName(String realmName, Condition condition) {
    String typeName = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ConditionTypeManager conditionTypeMgr = policyMgr.getConditionTypeManager();
            typeName = conditionTypeMgr.getConditionTypeName(condition);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getConditionTypeName", e);
    }
    return typeName;
}
Also used : PolicyManager(com.sun.identity.policy.PolicyManager) ConditionTypeManager(com.sun.identity.policy.ConditionTypeManager) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 8 with ConditionTypeManager

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

the class PolicyModelImpl method createCondition.

/**
     * Returns a condition object.
     *
     * @param realmName Name of Realm.
     * @param conditionType Name of condition type.
     * @param values Values of the condition.
     * @return condition object.
     * @throws AMConsoleException if condition cannot be created.
     */
public Condition createCondition(String realmName, String conditionType, Map values) throws AMConsoleException {
    Condition condition = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ConditionTypeManager conditionTypeMgr = policyMgr.getConditionTypeManager();
            condition = conditionTypeMgr.getCondition(conditionType);
            condition.setProperties(values);
        }
    } catch (NameNotFoundException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (PolicyException e) {
        throw new AMConsoleException(getErrorString(e));
    }
    return condition;
}
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)

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