Search in sources :

Example 1 with SMSubConfig

use of com.sun.identity.console.base.model.SMSubConfig 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 2 with SMSubConfig

use of com.sun.identity.console.base.model.SMSubConfig 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 3 with SMSubConfig

use of com.sun.identity.console.base.model.SMSubConfig in project OpenAM by OpenRock.

the class SubConfigEditViewBean method createChild.

protected View createChild(String name) {
    if (!populatedSubConfigTable && name.equals(AMPropertySheetModel.TBL_SUB_CONFIG)) {
        populatedSubConfigTable = true;
        SubConfigModel model = (SubConfigModel) getModel();
        if (model.hasGlobalSubSchema()) {
            SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
            populateTableModel(szCache.<List<SMSubConfig>>getSerializedObj());
        }
    }
    View view = null;
    if (name.equals(PGTITLE_TWO_BTNS)) {
        view = new CCPageTitle(this, ptModel, name);
    } else if (name.equals(PROPERTY_ATTRIBUTE)) {
        view = new AMPropertySheet(this, propertySheetModel, name);
    } else if (propertySheetModel.isChildSupported(name)) {
        view = propertySheetModel.createChild(this, name, getModel());
    } else if (ptModel.isChildSupported(name)) {
        view = ptModel.createChild(this, name);
    } else {
        view = super.createChild(name);
    }
    return view;
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig) SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) View(com.iplanet.jato.view.View) CCPageTitle(com.sun.web.ui.view.pagetitle.CCPageTitle)

Example 4 with SMSubConfig

use of com.sun.identity.console.base.model.SMSubConfig in project OpenAM by OpenRock.

the class SubConfigEditViewBean method populateTableModel.

private void populateTableModel(List<SMSubConfig> subconfig) {
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();
    if (subconfig != null) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        List<SMSubConfig> cache = new ArrayList<>(subconfig.size());
        if (!subconfig.isEmpty()) {
            tblModel.clearAll();
            boolean firstEntry = true;
            for (SMSubConfig conf : subconfig) {
                if (conf.isHidden()) {
                    continue;
                }
                if (firstEntry) {
                    firstEntry = false;
                } else {
                    tblModel.appendRow();
                }
                tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_NAME, conf.getLocalizedName() == null ? conf.getName() : conf.getLocalizedName());
                tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_HREF_NAME, conf.getName());
                tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_TYPE, conf.getType());
                cache.add(conf);
            }
        }
        szCache.setValue(cache);
    }
}
Also used : 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) CCActionTable(com.sun.web.ui.view.table.CCActionTable)

Example 5 with SMSubConfig

use of com.sun.identity.console.base.model.SMSubConfig in project OpenAM by OpenRock.

the class AbstractAuditViewBean method handleTblSubConfigButtonDeleteRequest.

/**
     * Called on request from the UI to delete an event handler.
     *
     * @param event Request Invocation Event.
     */
@SuppressWarnings("unused")
public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG);
    tbl.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = szCache.getSerializedObj();
    Set<String> names = new HashSet<>(selected.length * 2);
    for (Integer index : selected) {
        SMSubConfig sc = (SMSubConfig) list.get(index);
        names.add(sc.getName());
    }
    try {
        AbstractAuditModel model = (AbstractAuditModel) getModel();
        model.deleteEventHandles(names);
        if (selected.length == 1) {
            setInlineAlertMessage(TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted");
        } else {
            setInlineAlertMessage(TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted.plural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(TYPE_ERROR, ERROR_MESSAGE, e.getMessage());
    }
    submitCycle = false;
    forwardTo();
}
Also used : CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) AbstractAuditModel(com.sun.identity.console.audit.model.AbstractAuditModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig) Collections.singletonList(java.util.Collections.singletonList) 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)

Aggregations

SMSubConfig (com.sun.identity.console.base.model.SMSubConfig)10 SerializedField (com.sun.identity.console.components.view.html.SerializedField)9 ArrayList (java.util.ArrayList)7 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)6 CCActionTable (com.sun.web.ui.view.table.CCActionTable)6 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)4 HashSet (java.util.HashSet)3 List (java.util.List)3 SubConfigModel (com.sun.identity.console.service.model.SubConfigModel)2 SubSchemaModel (com.sun.identity.console.service.model.SubSchemaModel)2 Set (java.util.Set)2 View (com.iplanet.jato.view.View)1 SSOException (com.iplanet.sso.SSOException)1 AbstractAuditModel (com.sun.identity.console.audit.model.AbstractAuditModel)1 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)1 SMSubConfigComparator (com.sun.identity.console.base.model.SMSubConfigComparator)1 SMSException (com.sun.identity.sm.SMSException)1 ServiceConfig (com.sun.identity.sm.ServiceConfig)1 CCPageTitle (com.sun.web.ui.view.pagetitle.CCPageTitle)1 Collections.singletonList (java.util.Collections.singletonList)1