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();
}
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);
}
}
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();
}
}
}
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();
}
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);
}
}
Aggregations