Search in sources :

Example 1 with PolicyModel

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

the class ResponseProviderOpViewBeanBase 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)

Example 2 with PolicyModel

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

the class PolicySelectTypeViewBean method handleButton1Request.

/**
     * Handles next button request.
     *
     * @param event Request invocation event.
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String policyName = (String) propertySheetModel.getValue(PolicyModel.TF_NAME);
    policyName = policyName.trim();
    String policyType = (String) propertySheetModel.getValue(ATTR_POLICY_TYPE);
    if (policyName.length() > 0) {
        try {
            boolean referralType = !policyType.equals(ATTR_VALUE_POLICY_TYPE_NORMAL);
            String id = model.cachePolicy(policyName, "", referralType, true);
            setPageSessionAttribute(PolicyOpViewBeanBase.PG_SESSION_POLICY_CACHE_ID, id);
            PolicyOpViewBeanBase vb = null;
            if (referralType) {
                vb = (PolicyReferralAddViewBean) getViewBean(PolicyReferralAddViewBean.class);
            } else {
                vb = (PolicyNormalAddViewBean) getViewBean(PolicyNormalAddViewBean.class);
            }
            passPgSessionMap(vb);
            vb.forwardTo(getRequestContext());
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            forwardTo();
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.missing.policyName");
        forwardTo();
    }
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 3 with PolicyModel

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

the class ReferralOpViewBeanBase method createOptionList.

protected OptionList createOptionList(Set values) {
    OptionList optList = new OptionList();
    if ((values != null) && !values.isEmpty()) {
        PolicyModel model = (PolicyModel) getModel();
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        String referralType = (String) propertySheetModel.getValue(REFERRAL_TYPE);
        Map mapLabels = model.getDisplayNameForReferralValues(realmName, referralType, values);
        for (Iterator iter = values.iterator(); iter.hasNext(); ) {
            String value = (String) iter.next();
            optList.add((String) mapLabels.get(value), value);
        }
    }
    return optList;
}
Also used : Iterator(java.util.Iterator) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList)

Example 4 with PolicyModel

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

the class ReferralOpViewBeanBase method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    if (!submitCycle) {
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        PolicyModel model = (PolicyModel) getModel();
        String referralName = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_NAME);
        String referralType = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_TYPE);
        Syntax syntax = model.getReferralSyntax(realmName, referralType);
        propertySheetModel.setValue(SYNTAX, Integer.toString(AMDisplayType.getDisplaySyntax(syntax)));
        propertySheetModel.setValue(REFERRAL_NAME, referralName);
        propertySheetModel.setValue(REFERRAL_TYPE, referralType);
        Map map = model.getActiveReferralTypes(realmName);
        String i18nName = (String) map.get(referralType);
        propertySheetModel.setValue(REFERRAL_TYPE_NAME, i18nName);
    }
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Syntax(com.sun.identity.policy.Syntax) Map(java.util.Map)

Example 5 with PolicyModel

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

the class ResponseProviderAddViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    wizard = getPageSessionAttribute(PolicyOpViewBeanBase.WIZARD) != null;
    String ptTitle = "page.title.policy.responseprovider.create";
    if (!wizard) {
        ptTitle = "page.title.policy.responseprovider.create.shortcut";
        disableButton("button1", true);
    }
    PolicyModel model = (PolicyModel) getModel();
    String i18nName = (String) propertySheetModel.getValue(RESPONSEPROVIDER_TYPE_NAME);
    String title = model.getLocalizedString(ptTitle);
    String[] param = { i18nName };
    ptModel.setPageTitleText(MessageFormat.format(title, (Object[]) param));
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel)

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