Search in sources :

Example 6 with SubConfigModel

use of com.sun.identity.console.service.model.SubConfigModel in project OpenAM by OpenRock.

the class SubConfigAddViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    SubConfigModel model = (SubConfigModel) getModel();
    String schemaName = (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);
    if (!submitCycle) {
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        propertySheetModel.clear();
        try {
            ps.setAttributeValues(model.getServiceSchemaDefaultValues(schemaName), model);
        } catch (AMConsoleException a) {
            setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "noproperties.message");
        }
    }
    Set subconfigNames = model.getSelectableConfigNames(schemaName);
    if ((subconfigNames != null) && !subconfigNames.isEmpty()) {
        CCDropDownMenu menu = (CCDropDownMenu) getChild(ATTR_SUBCONFIG_NAME);
        OptionList optList = this.createOptionList(subconfigNames);
        menu.setOptions(optList);
    }
}
Also used : Set(java.util.Set) SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 7 with SubConfigModel

use of com.sun.identity.console.service.model.SubConfigModel in project OpenAM by OpenRock.

the class SCServiceProfileViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    SubSchemaModel model = (SubSchemaModel) getModel();
    if (model.hasGlobalSubSchema()) {
        if (!submitCycle) {
            populateTableModel(model.getSubConfigurations());
        }
        resetButtonState(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_DELETE);
        Map createable = model.getCreateableSubSchemaNames();
        if (createable.isEmpty()) {
            resetButtonState(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_ADD);
        } else {
            SubConfigModel scModel = getSubConfigModel();
            boolean canCreate = false;
            for (Iterator i = createable.keySet().iterator(); i.hasNext() && !canCreate; ) {
                String name = (String) i.next();
                String plugin = scModel.getSelectableSubConfigNamesPlugin(name);
                if (plugin == null) {
                    canCreate = true;
                } else {
                    Set subconfigNames = scModel.getSelectableConfigNames(name);
                    canCreate = (subconfigNames != null) && !subconfigNames.isEmpty();
                }
            }
            disableButton(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_ADD, !canCreate);
        }
    }
    if (serviceName.equals("iPlanetAMAuthHTTPBasicService")) {
        CCRadioButton radio = (CCRadioButton) getChild("iplanet-am-auth-http-basic-module-configured");
        if ((radio.getValue() == null) || (radio.getValue().equals(""))) {
            String defaultModule = new String();
            String realmName = SMSEntry.getRootSuffix();
            if (realmName != null) {
                List moduleList = AMAuthUtils.getModuleInstancesForHttpBasic(realmName);
                if (!moduleList.isEmpty()) {
                    defaultModule = (String) moduleList.get(0);
                    radio.setValue(defaultModule);
                }
            }
        }
    }
    // If this is a dynamic request the UI is set with unsaved attribute values
    AMPropertySheet propertySheet = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    if (dynamicRequest) {
        propertySheet.setAttributeValues(unsavedAttributeValues, model);
    }
}
Also used : SubSchemaModel(com.sun.identity.console.service.model.SubSchemaModel) CCRadioButton(com.sun.web.ui.view.html.CCRadioButton) HashSet(java.util.HashSet) Set(java.util.Set) SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map)

Example 8 with SubConfigModel

use of com.sun.identity.console.service.model.SubConfigModel in project OpenAM by OpenRock.

the class SubConfigEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    SubConfigModel model = (SubConfigModel) getModel();
    if (!submitCycle) {
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        propertySheetModel.clear();
        try {
            // If this is a dynamic request the UI is set with unsaved attribute values
            if (dynamicRequest) {
                ps.setAttributeValues(unsavedAttributeValues, model);
            } else {
                ps.setAttributeValues(model.getSubConfigAttributeValues(), model);
            }
        } catch (AMConsoleException a) {
            setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "noproperties.message");
        }
    }
    if (model.hasGlobalSubSchema()) {
        if (!submitCycle) {
            populateTableModel(model.getSubConfigurations());
        }
        resetButtonState(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_DELETE);
        Map createable = model.getCreateableSubSchemaNames();
        if (createable.isEmpty()) {
            resetButtonState(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_ADD);
        }
    }
    ptModel.setPageTitleText(MessageFormat.format(model.getLocalizedString("page.title.services.edit.subconfig"), model.getDisplayName()));
}
Also used : SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 9 with SubConfigModel

use of com.sun.identity.console.service.model.SubConfigModel in project OpenAM by OpenRock.

the class SubConfigAddViewBean method handleButton1Request.

/**
     * Handles next button request.
     *
     * @param event Request invocation event.
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    String subConfigName = (String) getDisplayFieldValue(ATTR_SUBCONFIG_NAME);
    SubConfigModel model = (SubConfigModel) getModel();
    try {
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        String schemaName = (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);
        Map values = ps.getAttributeValues(model.getAttributeNames(schemaName));
        model.createSubConfig(subConfigName, schemaName, values);
        backToProfileViewBean();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 10 with SubConfigModel

use of com.sun.identity.console.service.model.SubConfigModel in project OpenAM by OpenRock.

the class SubConfigAddViewBean method getAttributeValueMap.

@Override
protected Map<String, Set<String>> getAttributeValueMap() {
    try {
        SubConfigModel model = (SubConfigModel) getModel();
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        String schemaName = (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);
        return ps.getAttributeValues(model.getAttributeNames(schemaName));
    } catch (AMConsoleException | ModelControlException e) {
        debug.error("Could not retrieve attribute values", e);
    }
    return Collections.emptyMap();
}
Also used : SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) ModelControlException(com.iplanet.jato.model.ModelControlException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

SubConfigModel (com.sun.identity.console.service.model.SubConfigModel)13 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)9 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)8 Map (java.util.Map)6 Set (java.util.Set)3 ModelControlException (com.iplanet.jato.model.ModelControlException)2 OptionList (com.iplanet.jato.view.html.OptionList)2 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)2 SMSubConfig (com.sun.identity.console.base.model.SMSubConfig)2 SerializedField (com.sun.identity.console.components.view.html.SerializedField)2 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 List (java.util.List)2 View (com.iplanet.jato.view.View)1 SubSchemaModel (com.sun.identity.console.service.model.SubSchemaModel)1 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)1 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)1 CCPageTitle (com.sun.web.ui.view.pagetitle.CCPageTitle)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1