use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class ServerEditAdvancedViewBean method createTableModel.
private void createTableModel() {
tblModel = new CCActionTableModel(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/tblServerConfigAdvanced.xml"));
tblModel.setTitleLabel("label.items");
tblModel.setActionValue(TBL_BUTTON_ADD, "table.serverconfig.advanced.properties.button.new");
tblModel.setActionValue(TBL_BUTTON_DELETE, "table.serverconfig.advanced.properties.button.delete");
tblModel.setActionValue(TBL_COL_NAME, "table.serverconfig.advanced.properties.name.column.name");
tblModel.setActionValue(TBL_COL_VALUE, "table.serverconfig.advanced.properties.value.column.name");
}
use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class AuthConfigViewBean method createAuthEntryTable.
private void createAuthEntryTable() {
entryTableModel = new CCActionTableModel(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/tblAuthConfig.xml"));
entryTableModel.setTitleLabel("label.items");
entryTableModel.setActionValue(MODULE_NAME_LABEL, "authentication.config.entry.module.column");
entryTableModel.setActionValue(CRITERIA_LABEL, "authentication.config.entry.criteria.column");
entryTableModel.setActionValue(OPTION_FIELD_LABEL, "authentication.config.entry.option.column");
entryTableModel.setActionValue(ADD_ENTRY_BUTTON, "authentication.config.entry.add.button");
entryTableModel.setActionValue(REMOVE_ENTRY_BUTTON, "authentication.config.entry.delete.button");
entryTableModel.setActionValue(REORDER_ENTRY_BUTTON, "authentication.config.entry.reorder.button");
propertySheetModel.setModel(AUTH_ENTRY_TABLE, entryTableModel);
}
use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class AuthPropertiesViewBean method populateConfigTable.
private void populateConfigTable() {
tablePopulated = true;
CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(AUTH_CONFIG_TABLE);
tableModel.clearAll();
// get config names from previous pass. Need to use an ordered set
// here to assure the same order is retained during the request cycle.
OrderedSet configSet = (OrderedSet) removePageSessionAttribute(AUTH_CONFIG_TABLE);
// no instances if this is the 1st pass, create it now
if (configSet == null || configSet.isEmpty()) {
AuthPropertiesModel model = (AuthPropertiesModel) getModel();
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if ((realm == null) || (realm.length() == 0)) {
realm = AMModelBase.getStartDN(getRequestContext().getRequest());
}
configSet = new OrderedSet();
configSet.addAll(AuthConfigurationModelImpl.getNamedConfigurations(model.getUserSSOToken(), realm));
}
// add the data to the table
boolean firstEntry = true;
for (Iterator i = configSet.iterator(); i.hasNext(); ) {
String name = (String) i.next();
if (!firstEntry) {
tableModel.appendRow();
} else {
firstEntry = false;
}
tableModel.setValue(CONFIG_NAME_COLUMN_DATA, name);
tableModel.setValue(CONFIG_ACTION_COLUMN_HREF, stringToHex(name));
tableModel.setValue(CONFIG_ACTION_COLUMN_HREF_LABEL, "authentication.module.instances.action.label");
}
// set the instances in the page session so when a request comes in
// we can prepopulate the table model.
setPageSessionAttribute(AUTH_CONFIG_TABLE, configSet);
}
use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class AuthPropertiesViewBean method handleDeleteInstanceButtonRequest.
/**
* Handles the delete authentication instance request.
*
* @param event Request Invocation Event.
*/
public void handleDeleteInstanceButtonRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(AUTH_INSTANCE_TABLE);
table.restoreStateData();
CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(AUTH_INSTANCE_TABLE);
Integer[] selected = tableModel.getSelectedRows();
Set instances = new HashSet(selected.length * 2);
for (int i = 0; i < selected.length; i++) {
tableModel.setRowIndex(selected[i].intValue());
instances.add((String) tableModel.getValue(NAME_COLUMN_DATA));
}
try {
AuthPropertiesModel model = (AuthPropertiesModel) getModel();
model.removeAuthInstance(instances);
/*
* There is a timing issue with the backend after an
* instance is deleted causing the UI to be out of synch with the
* backend. We are storing the instances removed to be used when
* the page is redrawn to ensure the deleted instances are not
* put back into the instance table.
*/
setPageSessionAttribute(INSTANCES_REMOVED, (Serializable) instances);
if (selected.length == 1) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.instance.deleted");
} else {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.instance.deleted.multiple");
}
removePageSessionAttribute(AUTH_INSTANCE_TABLE);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class AuthPropertiesViewBean method populateInstanceTable.
private void populateInstanceTable() {
tablePopulated = true;
CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(AUTH_INSTANCE_TABLE);
tableModel.clearAll();
boolean firstEntry = true;
Map instanceMap = new HashMap();
AuthPropertiesModel model = (AuthPropertiesModelImpl) getModel();
Set tmp = model.getAuthInstances();
/*
* These instance were deleted in the previous request. This
* is needed because the getAuthInstances call may return the
* instances that were just deleted.
*/
Set removedInstances = (Set) removePageSessionAttribute(INSTANCES_REMOVED);
for (Iterator i = tmp.iterator(); i.hasNext(); ) {
AMAuthenticationInstance inst = (AMAuthenticationInstance) i.next();
String name = inst.getName();
if ((removedInstances == null) || (!removedInstances.contains(name))) {
instanceMap.put(name, inst);
}
}
/*
* get instance names from previous pass. Need to use an ordered set
* here to assure the same order is retained during the request cycle.
*/
OrderedSet instanceSet = (OrderedSet) removePageSessionAttribute(AUTH_INSTANCE_TABLE);
// no instances if this is the 1st pass, create it now
if (instanceSet == null) {
instanceSet = new OrderedSet();
instanceSet.addAll(instanceMap.keySet());
}
AMAuthenticationManager mgr = null;
try {
mgr = new AMAuthenticationManager(model.getUserSSOToken(), "/");
} catch (AMConfigurationException e) {
debug.warning("Could not create Authentication Manager. Using non-localized type names", e);
}
for (Iterator i = instanceSet.iterator(); i.hasNext(); ) {
String name = (String) i.next();
AMAuthenticationInstance instance = (AMAuthenticationInstance) instanceMap.get(name);
/*
* check if instance still exists. This can happen if user goes
* the the advanced core properties page and removes an auth type
* from the available auth instances list.
*/
if (instance != null) {
if (!firstEntry) {
tableModel.appendRow();
} else {
firstEntry = false;
}
String type = instance.getType();
if (model.hasAuthAttributes(type)) {
tableModel.setValue(NAME_COLUMN_DATA, name);
tableModel.setValue(ACTION_COLUMN_HREF, stringToHex(name));
tableModel.setValue(NAME_COLUMN_DATA_NO_HREF, "");
} else {
tableModel.setValue(NAME_COLUMN_DATA, "");
tableModel.setValue(ACTION_COLUMN_HREF, stringToHex(name));
tableModel.setValue(NAME_COLUMN_DATA_NO_HREF, name);
}
if (mgr != null) {
try {
type = model.getLocalizedServiceName(mgr.getAuthenticationSchema(type).getServiceName());
} catch (AMConfigurationException e) {
if (debug.warningEnabled()) {
debug.warning("Could not get schema for type " + type + ". Using non-localized name.", e);
}
}
}
tableModel.setValue(TYPE_COLUMN_DATA, type);
}
}
/*
* set the instances in the page session so when a request comes in
* we can prepopulate the table model.
*/
setPageSessionAttribute(AUTH_INSTANCE_TABLE, instanceSet);
}
Aggregations