Search in sources :

Example 51 with PolicyModel

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

the class SubjectOpViewBeanBase method getValidValues.

protected Set getValidValues() {
    Set values = null;
    String filter = (String) propertySheetModel.getValue(FILTER);
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    String subjectType = (String) propertySheetModel.getValue(SUBJECT_TYPE);
    PolicyModel model = (PolicyModel) getModel();
    try {
        ValidValues validValues = model.getSubjectPossibleValues(realmName, subjectType, filter);
        if (validValues != null) {
            int errCode = validValues.getErrorCode();
            if (errCode == ValidValues.SIZE_LIMIT_EXCEEDED) {
                setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.subject.sizelimit.exceeded.message");
            } else if (errCode == ValidValues.SIZE_LIMIT_EXCEEDED) {
                setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.subject.timelimit.exceeded.message");
            }
            values = validValues.getSearchResults();
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return values;
}
Also used : Set(java.util.Set) ValidValues(com.sun.identity.policy.ValidValues) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 52 with PolicyModel

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

the class SubjectAddViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    boolean wizard = getPageSessionAttribute(PolicyOpViewBeanBase.WIZARD) != null;
    String ptTitle = "page.title.policy.subject.create";
    if (!wizard) {
        ptTitle = "page.title.policy.subject.create.shortcut";
        disableButton("button1", true);
    }
    PolicyModel model = (PolicyModel) getModel();
    String i18nName = (String) propertySheetModel.getValue(SUBJECT_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)

Example 53 with PolicyModel

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

the class SubjectEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    PolicyModel model = (PolicyModel) getModel();
    String i18nName = (String) propertySheetModel.getValue(SUBJECT_TYPE_NAME);
    String title = model.getLocalizedString("page.title.policy.subject.edit");
    String[] param = { i18nName };
    ptModel.setPageTitleText(MessageFormat.format(title, (Object[]) param));
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel)

Example 54 with PolicyModel

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

the class SubjectOpViewBeanBase method createSubject.

private Subject createSubject(String subjectType, Set values) throws AMConsoleException {
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    PolicyModel model = (PolicyModel) getModel();
    return model.createSubject(realmName, subjectType, values);
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel)

Example 55 with PolicyModel

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

the class PolicyOpViewBeanBase method handleTblResponseProvidersEditLinkRequest.

public void handleTblResponseProvidersEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String name = hexToString((String) getDisplayFieldValue(TBL_RESPONSE_ATTRIBUTES_ACTION_HREF));
    setPageSessionAttribute(ResponseProviderEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
    setPageSessionAttribute(ResponseProviderEditViewBean.EDIT_RESPONSEPROVIDER_NAME, name);
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        ResponseProvider provider = policy.getResponseProvider(name);
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        String responseProviderType = model.getResponseProviderTypeName(realmName, provider);
        String viewBeanURL = model.getResponseProviderViewBeanURL(realmName, responseProviderType);
        unlockPageTrail();
        if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
            forwardToResponseProviderURL(viewBeanURL, name, responseProviderType, realmName, "edit");
        } else {
            forwardToResponseProviderEditViewBean(model, realmName, name, responseProviderType);
        }
    } catch (NameNotFoundException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblResponseProvidersEditLinkRequest", e);
        redirectToStartURL();
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) ResponseProvider(com.sun.identity.policy.interfaces.ResponseProvider) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

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