Search in sources :

Example 56 with PolicyModel

use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.

the class PolicyOpViewBeanBase method handleTblConditionsEditLinkRequest.

public void handleTblConditionsEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String name = hexToString((String) getDisplayFieldValue(TBL_CONDITIONS_ACTION_HREF));
    setPageSessionAttribute(ConditionEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
    setPageSessionAttribute(ConditionEditViewBean.EDIT_CONDITION_NAME, name);
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        Condition condition = policy.getCondition(name);
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        String conditionType = model.getConditionTypeName(realmName, condition);
        String viewBeanURL = model.getConditionViewBeanURL(realmName, conditionType);
        unlockPageTrail();
        if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
            forwardToConditionURL(viewBeanURL, name, conditionType, realmName, "edit");
        } else {
            forwardToConditionEditViewBean(model, realmName, name, conditionType);
        }
    } catch (NameNotFoundException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblConditionsButtonDeleteRequest", e);
        redirectToStartURL();
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Condition(com.sun.identity.policy.interfaces.Condition) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 57 with PolicyModel

use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.

the class PolicyOpViewBeanBase method populateRulesTable.

protected void populateRulesTable() throws AMConsoleException {
    tblRulesModel.clearAll();
    CachedPolicy cachedPolicy = getCachedPolicy();
    Policy policy = cachedPolicy.getPolicy();
    Set ruleNames = policy.getRuleNames();
    if ((ruleNames != null) && !ruleNames.isEmpty()) {
        PolicyModel model = (PolicyModel) getModel();
        Map localizedSvcTypeNames = model.getServiceTypeNames();
        boolean firstEntry = true;
        for (Iterator iter = ruleNames.iterator(); iter.hasNext(); ) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblRulesModel.appendRow();
            }
            try {
                String name = (String) iter.next();
                Rule rule = policy.getRule(name);
                tblRulesModel.setValue(TBL_RULES_DATA_NAME, name);
                tblRulesModel.setValue(TBL_RULES_DATA_TYPE, localizedSvcTypeNames.get(rule.getServiceTypeName()));
                tblRulesModel.setValue(TBL_RULES_ACTION_HREF, stringToHex(name));
            } catch (NameNotFoundException e) {
                debug.warning("PolicyOpViewBeanBase.populateRulesTable", e);
            }
        }
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Set(java.util.Set) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Iterator(java.util.Iterator) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Rule(com.sun.identity.policy.Rule) HashMap(java.util.HashMap) Map(java.util.Map)

Example 58 with PolicyModel

use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.

the class PolicyOpViewBeanBase method populateReferralsTable.

protected void populateReferralsTable() throws AMConsoleException {
    tblReferralsModel.clearAll();
    CachedPolicy cachedPolicy = getCachedPolicy();
    Policy policy = cachedPolicy.getPolicy();
    Set referralsNames = policy.getReferralNames();
    if ((referralsNames != null) && !referralsNames.isEmpty()) {
        PolicyModel model = (PolicyModel) getModel();
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        Map localizedRflTypeNames = model.getActiveReferralTypes(realmName);
        boolean firstEntry = true;
        for (Iterator iter = referralsNames.iterator(); iter.hasNext(); ) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblReferralsModel.appendRow();
            }
            try {
                String name = (String) iter.next();
                Referral referral = policy.getReferral(name);
                tblReferralsModel.setValue(TBL_REFERRALS_DATA_NAME, name);
                String rflTypeName = referral.getReferralTypeName();
                String displayName = (String) localizedRflTypeNames.get(rflTypeName);
                if (displayName == null) {
                    displayName = rflTypeName;
                }
                tblReferralsModel.setValue(TBL_REFERRALS_DATA_TYPE, displayName);
                tblReferralsModel.setValue(TBL_REFERRALS_ACTION_HREF, stringToHex(name));
            } catch (NameNotFoundException e) {
                debug.warning("PolicyOpViewBeanBase.populateReferralsTable", e);
            }
        }
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Set(java.util.Set) Referral(com.sun.identity.policy.interfaces.Referral) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Iterator(java.util.Iterator) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) HashMap(java.util.HashMap) Map(java.util.Map)

Example 59 with PolicyModel

use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.

the class PolicyOpViewBeanBase method populateConditionsTable.

protected void populateConditionsTable() throws AMConsoleException {
    tblConditionsModel.clearAll();
    CachedPolicy cachedPolicy = getCachedPolicy();
    Policy policy = cachedPolicy.getPolicy();
    Set conditionNames = policy.getConditionNames();
    if ((conditionNames != null) && !conditionNames.isEmpty()) {
        PolicyModel model = (PolicyModel) getModel();
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        Map localizedCndTypeNames = model.getActiveConditionTypes(realmName);
        boolean firstEntry = true;
        for (Iterator iter = conditionNames.iterator(); iter.hasNext(); ) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblConditionsModel.appendRow();
            }
            try {
                String name = (String) iter.next();
                Condition condition = policy.getCondition(name);
                tblConditionsModel.setValue(TBL_CONDITIONS_DATA_NAME, name);
                String cndTypeName = model.getConditionTypeName(realmName, condition);
                String displayName = (String) localizedCndTypeNames.get(cndTypeName);
                if (displayName == null) {
                    displayName = cndTypeName;
                }
                tblConditionsModel.setValue(TBL_CONDITIONS_DATA_TYPE, displayName);
                tblConditionsModel.setValue(TBL_CONDITIONS_ACTION_HREF, stringToHex(name));
            } catch (NameNotFoundException e) {
                debug.warning("PolicyOpViewBeanBase.populateConditionsTable", e);
            }
        }
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Condition(com.sun.identity.policy.interfaces.Condition) Set(java.util.Set) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Iterator(java.util.Iterator) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) HashMap(java.util.HashMap) Map(java.util.Map)

Example 60 with PolicyModel

use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.

the class ReferralOpViewBeanBase method getCachedPolicy.

protected CachedPolicy getCachedPolicy() throws AMConsoleException {
    CachedPolicy policy = null;
    String cacheID = (String) getPageSessionAttribute(ProfileViewBeanBase.PG_SESSION_POLICY_CACHE_ID);
    if (cacheID != null) {
        PolicyCache cache = PolicyCache.getInstance();
        PolicyModel model = (PolicyModel) getModel();
        policy = model.getCachedPolicy(cacheID);
    }
    return policy;
}
Also used : CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) PolicyCache(com.sun.identity.console.policy.model.PolicyCache)

Aggregations

PolicyModel (com.sun.identity.console.policy.model.PolicyModel)84 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)28 Map (java.util.Map)27 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)26 HashMap (java.util.HashMap)14 Policy (com.sun.identity.policy.Policy)12 Set (java.util.Set)12 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)11 Iterator (java.util.Iterator)8 OptionList (com.iplanet.jato.view.html.OptionList)7 PolicyCache (com.sun.identity.console.policy.model.PolicyCache)6 QueryResults (com.sun.identity.console.base.model.QueryResults)5 Syntax (com.sun.identity.policy.Syntax)5 Rule (com.sun.identity.policy.Rule)3 Referral (com.sun.identity.policy.interfaces.Referral)3 CCButton (com.sun.web.ui.view.html.CCButton)3 List (java.util.List)3 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)2 ActionSchema (com.sun.identity.policy.ActionSchema)2 ValidValues (com.sun.identity.policy.ValidValues)2