Search in sources :

Example 1 with SMProfileModel

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

the class SMProfileViewBean method handleBtnSearchRequest.

/**
     * Handles search request.
     *
     * @param event Request Invocation Event.
     */
public void handleBtnSearchRequest(RequestInvocationEvent event) {
    SMProfileModel model = (SMProfileModel) getModel();
    String serverName = (String) getPageSessionAttribute(SERVER_NAME);
    model.setProfileServerName(serverName);
    forwardTo();
}
Also used : SMProfileModel(com.sun.identity.console.session.model.SMProfileModel)

Example 2 with SMProfileModel

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

the class SMProfileViewBean method populateTableModel.

private void populateTableModel(List sessionList) {
    SMProfileModel model = (SMProfileModel) getModel();
    tblModel.clearAll();
    tblModel.setMaxRows(model.getPageSize());
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    if (sessionList != null && !sessionList.isEmpty()) {
        for (int i = 0; i < sessionList.size(); i++) {
            SMSessionData sData = (SMSessionData) sessionList.get(i);
            tblModel.appendRow();
            tblModel.setValue(TBL_DATA_SESSION_ID, sData.getId());
            tblModel.setValue(TBL_DATA_USER_ID, sData.getUserId());
            tblModel.setValue(TBL_DATA_TIME_LEFT, String.valueOf(sData.getTimeRemain()));
            tblModel.setValue(TBL_DATA_MAX_SESSION_TIME, String.valueOf(sData.getMaxSessionTime()));
            tblModel.setValue(TBL_DATA_IDLE_TIME, String.valueOf(sData.getIdleTime()));
            tblModel.setValue(TBL_DATA_MAX_IDLE_TIME, String.valueOf(sData.getMaxIdleTime()));
        }
        szCache.setValue((Serializable) sessionList);
    } else {
        szCache.setValue(null);
    }
}
Also used : SMSessionData(com.sun.identity.console.session.model.SMSessionData) SMProfileModel(com.sun.identity.console.session.model.SMProfileModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField)

Example 3 with SMProfileModel

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

Example 4 with SMProfileModel

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

the class SMProfileViewBean method handleTblButtonInvalidateRequest.

/**
     * Handles the event request for <i>Invalidate</i> button.
     *
     * @param event request invocation event.
     * @throws ModelControlException if table model cannot be restored.
     */
public void handleTblButtonInvalidateRequest(RequestInvocationEvent event) throws ModelControlException {
    SMProfileModel model = (SMProfileModel) getModel();
    String serverName = (String) getPageSessionAttribute(SERVER_NAME);
    model.setProfileServerName(serverName);
    CCActionTable child = (CCActionTable) getChild(TBL_SESSIONS);
    child.restoreStateData();
    Integer[] selected = tblModel.getSelectedRows();
    List names = new ArrayList(selected.length * 2);
    for (int i = 0; i < selected.length; i++) {
        tblModel.setRowIndex(selected[i].intValue());
        names.add((String) tblModel.getValue(TBL_DATA_SESSION_ID));
    }
    boolean error = false;
    List failList = null;
    try {
        failList = model.invalidateSessions(names, getFilterString());
    } catch (AMConsoleException e) {
        error = true;
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    if (!error && failList != null && !failList.isEmpty()) {
    // TOFIX:  need to display mutiple message.
    }
    if (!model.isSessionValid()) {
        validSession = false;
    }
    forwardTo();
}
Also used : SMProfileModel(com.sun.identity.console.session.model.SMProfileModel) ArrayList(java.util.ArrayList) 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)

Example 5 with SMProfileModel

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

the class SessionHAStatisticsViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    SMProfileModel model = (SMProfileModel) getModel();
    if (model != null) {
        // TODO
        // Set our Sub-Tabs and current position, relative to one.
        addSessionsTab(model, 3);
    }
}
Also used : SMProfileModel(com.sun.identity.console.session.model.SMProfileModel)

Aggregations

SMProfileModel (com.sun.identity.console.session.model.SMProfileModel)5 OptionList (com.iplanet.jato.view.html.OptionList)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 SerializedField (com.sun.identity.console.components.view.html.SerializedField)1 SMSessionCache (com.sun.identity.console.session.model.SMSessionCache)1 SMSessionData (com.sun.identity.console.session.model.SMSessionData)1 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1