Search in sources :

Example 46 with PolicyModel

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

the class PMDefaultTimeConditionAddViewBean method getValues.

protected Map getValues(String conditionType) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    Map values = getConditionValues(model, realmName, conditionType);
    return helper.getConditionValues(this, values);
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Map(java.util.Map)

Example 47 with PolicyModel

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

the class PMDefaultTimeConditionEditViewBean method getValues.

protected Map getValues(String conditionType) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    Map values = getConditionValues(model, realmName, conditionType);
    return helper.getConditionValues(this, values);
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Map(java.util.Map)

Example 48 with PolicyModel

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

the class RuleEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    if (!submitCycle) {
        try {
            Rule rule = getRule();
            propertySheetModel.setValue(RULE_NAME, rule.getName());
            String serviceType = rule.getServiceTypeName();
            propertySheetModel.setValue(SERVICE_TYPE, serviceType);
            PolicyModel model = (PolicyModel) getModel();
            Map map = model.getServiceTypeNames();
            String i18nName = (String) map.get(serviceType);
            propertySheetModel.setValue(SERVICE_TYPE_NAME_LBL, i18nName);
            propertySheetModel.setValue(SERVICE_TYPE_NAME, i18nName);
            propertySheetModel.setValue(RESOURCE_NAME, rule.getResourceName());
        } catch (NameNotFoundException e) {
            debug.error("RuleEditViewBean.beginDisplay: rule not found.");
        } catch (AMConsoleException e) {
            debug.warning("RuleEditViewBean.beginDisplay", e);
        }
    } else {
        String i18nName = (String) propertySheetModel.getValue(SERVICE_TYPE_NAME);
        propertySheetModel.setValue(SERVICE_TYPE_NAME_LBL, i18nName);
    }
    try {
        populateActionsTable(submitCycle);
    } catch (AMConsoleException e) {
        debug.warning("RuleEditViewBean.beginDisplay", e);
    //NO-OP
    }
}
Also used : NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Rule(com.sun.identity.policy.Rule) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 49 with PolicyModel

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

the class RuleOpViewBeanBase method getActionValues.

private Map getActionValues(String serviceType, boolean withResource) throws ModelControlException {
    Map actionValues = new HashMap();
    PolicyModel model = (PolicyModel) getModel();
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        Map mapActionSchemas = mapActionSchemaNameToActionSchema(model.getActionSchemas(getCachedPolicy().getPolicy(), realmName, serviceType, withResource));
        CCActionTable table = (CCActionTable) getChild(TBL_ACTIONS);
        table.restoreStateData();
        List actionSchemaNames = (List) getPageSessionAttribute(PG_SESSION_ACTION_SCHEMA_NAMES);
        if ((actionSchemaNames != null) && !actionSchemaNames.isEmpty()) {
            HttpServletRequest req = getRequestContext().getRequest();
            String chkName = getName() + "." + SELECTION_CHKBOX_NAME;
            int sz = actionSchemaNames.size();
            for (int i = 0; i < sz; i++) {
                String chkValue = req.getParameter(chkName + i);
                if ((chkValue != null) && chkValue.equals("true")) {
                    String actionSchemaName = (String) actionSchemaNames.get(i);
                    ActionSchema actionSchema = (ActionSchema) mapActionSchemas.get(actionSchemaName);
                    Set values = getActionSchemaValues(actionSchema, i);
                    actionValues.put(actionSchemaName, values);
                }
            }
        }
        if (actionValues.isEmpty()) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.missing.actionValues");
            actionValues = null;
        }
    } catch (AMConsoleException e) {
        debug.warning("RuleOpViewBeanBase.getActionValues", e);
    //NO-OP
    }
    return actionValues;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Set(java.util.Set) HashMap(java.util.HashMap) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) CCSelectableList(com.sun.web.ui.view.html.CCSelectableList) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) ActionSchema(com.sun.identity.policy.ActionSchema)

Example 50 with PolicyModel

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

the class SelectSubjectTypeViewBean method handleButton2Request.

/**
     * Handles next button request.
     *
     * @param event Request invocation event.
     */
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String subjectType = (String) propertySheetModel.getValue(ATTR_SUBJECT_TYPE);
    setPageSessionAttribute(SubjectOpViewBeanBase.CALLING_VIEW_BEAN, (String) getPageSessionAttribute(CALLING_VIEW_BEAN));
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    String viewBeanURL = model.getSubjectViewBeanURL(realmName, subjectType);
    unlockPageTrailForSwapping();
    if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
        forwardToURL(viewBeanURL, subjectType, realmName);
    } else {
        forwardToViewBean(model, subjectType, realmName);
    }
}
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