Search in sources :

Example 1 with SubSchemaModel

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

the class SCServiceProfileViewBean method handleTblSubConfigButtonAddRequest.

/**
     * Adds sub configuration.
     *
     * @param event Request Invocation Event.
     */
public void handleTblSubConfigButtonAddRequest(RequestInvocationEvent event) {
    SubSchemaModel model = (SubSchemaModel) getModel();
    Map createable = model.getCreateableSubSchemaNames();
    if (!createable.isEmpty()) {
        if (createable.size() > 1) {
            SubSchemaTypeSelectViewBean vb = (SubSchemaTypeSelectViewBean) getViewBean(SubSchemaTypeSelectViewBean.class);
            addViewBeanClassToPageSession();
            unlockPageTrail();
            passPgSessionMap(vb);
            vb.forwardTo(getRequestContext());
        } else {
            String subSchema = (String) createable.keySet().iterator().next();
            setPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME, subSchema);
            SubConfigAddViewBean vb = (SubConfigAddViewBean) getViewBean(SubConfigAddViewBean.class);
            addViewBeanClassToPageSession();
            unlockPageTrail();
            passPgSessionMap(vb);
            vb.forwardTo(getRequestContext());
        }
    } else {
        forwardTo();
    }
}
Also used : SubSchemaModel(com.sun.identity.console.service.model.SubSchemaModel) Map(java.util.Map)

Example 2 with SubSchemaModel

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

the class SCServiceProfileViewBean method handleTblSubConfigButtonDeleteRequest.

/**
     * Deletes sub configuration.
     *
     * @param event Request Invocation Event.
     * @throws ModelControlException if table model cannot be restored.
     */
public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    tbl.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    Set names = new HashSet(selected.length * 2);
    for (int i = 0; i < selected.length; i++) {
        SMSubConfig sc = (SMSubConfig) list.get(selected[i].intValue());
        names.add(sc.getName());
    }
    try {
        SubSchemaModel model = (SubSchemaModel) getModel();
        model.deleteSubConfigurations(names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "subconfig.message.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "subconfig.message.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    submitCycle = false;
    forwardTo();
}
Also used : SubSchemaModel(com.sun.identity.console.service.model.SubSchemaModel) HashSet(java.util.HashSet) Set(java.util.Set) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Example 3 with SubSchemaModel

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

the class SCServiceProfileViewBean method createChild.

protected View createChild(String name) {
    if (!populatedSubConfigTable && name.equals(AMPropertySheetModel.TBL_SUB_CONFIG)) {
        populatedSubConfigTable = true;
        SubSchemaModel model = (SubSchemaModel) getModel();
        if (model.hasGlobalSubSchema()) {
            SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
            populateTableModel(szCache.<List<SMSubConfig>>getSerializedObj());
        }
    }
    return super.createChild(name);
}
Also used : SubSchemaModel(com.sun.identity.console.service.model.SubSchemaModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig)

Example 4 with SubSchemaModel

use of com.sun.identity.console.service.model.SubSchemaModel 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)

Aggregations

SubSchemaModel (com.sun.identity.console.service.model.SubSchemaModel)4 SMSubConfig (com.sun.identity.console.base.model.SMSubConfig)2 SerializedField (com.sun.identity.console.components.view.html.SerializedField)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)1 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 SubConfigModel (com.sun.identity.console.service.model.SubConfigModel)1 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)1 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 Iterator (java.util.Iterator)1