Search in sources :

Example 1 with SMSessionCache

use of com.sun.identity.console.session.model.SMSessionCache in project OpenAM by OpenRock.

the class SMProfileViewBean method beginDisplay.

/**
     * Sets the required information to display the page.
     *
     * @param event display event.
     * @throws ModelControlException if problem access value of component.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    if (validSession) {
        super.beginDisplay(event);
        SMProfileModel model = (SMProfileModel) getModel();
        Map map = model.getServerNames();
        OptionList optList = new OptionList();
        CCDropDownMenu child = (CCDropDownMenu) getChild(CHILD_SERVER_NAME_MENU);
        String value = (String) child.getValue();
        if (map != null && !map.isEmpty()) {
            for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
                String str = (String) iter.next();
                String val = (String) map.get(str);
                optList.add(str, val);
                if (value == null) {
                    child.setValue(val);
                }
            }
        }
        child.setOptions(optList);
        value = (String) child.getValue();
        model.setProfileServerName(value);
        SMSessionCache cache = null;
        try {
            cache = model.getSessionCache(getFilterString());
            if (cache != null) {
                populateTableModel(cache.getSessions());
                String errorMessage = cache.getErrorMessage();
                if (errorMessage != null && errorMessage.length() > 0) {
                    setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", errorMessage);
                }
            }
        } catch (AMConsoleException ae) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", ae.getMessage());
        }
        if (cache == null) {
            populateTableModel(Collections.EMPTY_LIST);
        }
        setPageSessionAttribute(SERVER_NAME, value);
        // Set our Sub-Tabs
        addSessionsTab(model, 1);
        // Both the SFO is Enabled and Repository Type has been Specified for view of HA Tabs.
        if ((!SystemPropertiesManager.get(CoreTokenConstants.IS_SFO_ENABLED, "false").equalsIgnoreCase("true")) && (SystemPropertiesManager.get(CoreTokenConstants.SYS_PROPERTY_SESSION_HA_REPOSITORY_TYPE, "None").equalsIgnoreCase("None"))) {
            removeSessionsTab();
        }
    }
}
Also used : SMSessionCache(com.sun.identity.console.session.model.SMSessionCache) SMProfileModel(com.sun.identity.console.session.model.SMProfileModel) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

OptionList (com.iplanet.jato.view.html.OptionList)1 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 SMProfileModel (com.sun.identity.console.session.model.SMProfileModel)1 SMSessionCache (com.sun.identity.console.session.model.SMSessionCache)1 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1