Search in sources :

Example 36 with PolicyModel

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

the class PolicyNormalEditViewBean method handleButton1Request.

/**
     * Handles create policy request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    String currentRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        if (reconstructPolicy()) {
        // error message set in PolicyOpViewBeanBase
        } else {
            CachedPolicy cachedPolicy = getCachedPolicy();
            PolicyModel model = (PolicyModel) getModel();
            try {
                model.replacePolicy(currentRealm, cachedPolicy.getPolicy());
                setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.modified.message");
                cachedPolicy.setPolicyModified(false);
            } catch (AMConsoleException e) {
                setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            }
        }
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyNormalEditViewBean.handleButton1Request", e);
        redirectToStartURL();
    }
}
Also used : 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 37 with PolicyModel

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

the class PolicyNormalEditViewBean method getBreadCrumbDisplayName.

protected String getBreadCrumbDisplayName() {
    try {
        PolicyModel model = (PolicyModel) getModel();
        CachedPolicy cachedPolicy = getCachedPolicy();
        String[] arg = { cachedPolicy.getTrackPolicyName() };
        return MessageFormat.format(model.getLocalizedString("breadcrumbs.editPolicy"), (Object[]) arg);
    } catch (AMConsoleException e) {
        debug.warning("PolicyNormalEditViewBean.getBreadCrumbDisplayName", e);
        return "";
    }
}
Also used : 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 38 with PolicyModel

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

the class PolicyOpViewBeanBase method handleTblReferralsEditLinkRequest.

public void handleTblReferralsEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String name = hexToString((String) getDisplayFieldValue(TBL_REFERRALS_ACTION_HREF));
    setPageSessionAttribute(ReferralEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
    setPageSessionAttribute(ReferralEditViewBean.EDIT_REFERRAL_NAME, name);
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        Referral referral = policy.getReferral(name);
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        String referralType = referral.getReferralTypeName();
        String viewBeanURL = model.getReferralViewBeanURL(realmName, referralType);
        unlockPageTrail();
        if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
            forwardToReferralURL(viewBeanURL, name, referralType, realmName, "edit");
        } else {
            forwardToReferralEditViewBean(model, realmName, name, referralType);
        }
    } catch (NameNotFoundException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblReferralsEditLinkRequest", e);
        redirectToStartURL();
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Referral(com.sun.identity.policy.interfaces.Referral) 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 39 with PolicyModel

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

the class PolicyOpViewBeanBase method handleTblResponseProvidersButtonAddRequest.

public void handleTblResponseProvidersButtonAddRequest(RequestInvocationEvent event) throws ModelControlException {
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    PolicyModel model = (PolicyModel) getModel();
    try {
        if (!reconstructPolicy()) {
            Map activeTypes = model.getActiveResponseProviderTypes(curRealm);
            unlockPageTrail();
            if (activeTypes.size() == 1) {
                String respAttrType = (String) activeTypes.keySet().iterator().next();
                String viewBeanURL = model.getResponseProviderViewBeanURL(curRealm, respAttrType);
                removePageSessionAttribute(WIZARD);
                setPageSessionAttribute(ResponseProviderOpViewBeanBase.CALLING_VIEW_BEAN, getClass().getName());
                if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
                    forwardToResponseProviderURL(viewBeanURL, "", respAttrType, curRealm, "add");
                } else {
                    forwardToResponseProviderAddViewBean(curRealm, respAttrType);
                }
            } else {
                setPageSessionAttribute(SelectResponseProviderTypeViewBean.CALLING_VIEW_BEAN, getClass().getName());
                SelectResponseProviderTypeViewBean vb = (SelectResponseProviderTypeViewBean) getViewBean(SelectResponseProviderTypeViewBean.class);
                setPageSessionAttribute(WIZARD, "true");
                passPgSessionMap(vb);
                vb.forwardTo(getRequestContext());
            }
        } else {
            forwardTo();
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblResponseProvidersButtonAddRequest", e);
        redirectToStartURL();
    }
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 40 with PolicyModel

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

the class PolicyOpViewBeanBase method handleTblReferralsButtonAddRequest.

public void handleTblReferralsButtonAddRequest(RequestInvocationEvent event) throws ModelControlException {
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    PolicyModel model = (PolicyModel) getModel();
    try {
        if (!reconstructPolicy()) {
            unlockPageTrail();
            Map activeReferralTypes = model.getActiveReferralTypes(curRealm);
            if (activeReferralTypes.size() == 1) {
                String referralType = (String) activeReferralTypes.keySet().iterator().next();
                String viewBeanURL = model.getReferralViewBeanURL(curRealm, referralType);
                removePageSessionAttribute(WIZARD);
                setPageSessionAttribute(ReferralOpViewBeanBase.CALLING_VIEW_BEAN, getClass().getName());
                if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
                    forwardToReferralURL(viewBeanURL, "", referralType, curRealm, "add");
                } else {
                    forwardToReferralAddViewBean(referralType);
                }
            } else {
                setPageSessionAttribute(SelectReferralTypeViewBean.CALLING_VIEW_BEAN, getClass().getName());
                SelectReferralTypeViewBean vb = (SelectReferralTypeViewBean) getViewBean(SelectReferralTypeViewBean.class);
                setPageSessionAttribute(WIZARD, "true");
                passPgSessionMap(vb);
                vb.forwardTo(getRequestContext());
            }
        } else {
            forwardTo();
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblReferralsButtonAddRequest", e);
        redirectToStartURL();
    }
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

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