use of com.sun.identity.console.authentication.model.AuthConfigurationModel in project OpenAM by OpenRock.
the class AuthConfigViewBean method cacheValues.
private void cacheValues() throws ModelControlException {
AuthConfigurationModel acModel = (AuthConfigurationModel) getModel();
try {
Map original = acModel.getValues();
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
Map changedValues = (Map) ps.getAttributeValues(original, true, acModel);
original.putAll(changedValues);
setPageSessionAttribute(ReorderAuthChainsViewBean.PG_SESSION_TRACKING, (HashMap) changedValues);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
use of com.sun.identity.console.authentication.model.AuthConfigurationModel in project OpenAM by OpenRock.
the class AuthPropertiesViewBean method handleDeleteConfigButtonRequest.
/**
* Handles the delete authentication instance request.
*
* @param event Request Invocation Event.
*/
public void handleDeleteConfigButtonRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(AUTH_CONFIG_TABLE);
table.restoreStateData();
CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(AUTH_CONFIG_TABLE);
Integer[] selected = tableModel.getSelectedRows();
Set configurations = new HashSet(selected.length * 2);
for (int i = 0; i < selected.length; i++) {
tableModel.setRowIndex(selected[i].intValue());
configurations.add((String) tableModel.getValue(CONFIG_NAME_COLUMN_DATA));
}
try {
AuthConfigurationModel m = (AuthConfigurationModel) getConfigModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if ((curRealm == null) || (curRealm.length() == 0)) {
curRealm = AMModelBase.getStartDN(getRequestContext().getRequest());
}
m.deleteAuthConfiguration(curRealm, configurations);
if (selected.length == 1) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.config.deleted");
} else {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.config.deleted.multiple");
}
removePageSessionAttribute(AUTH_CONFIG_TABLE);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.authentication.model.AuthConfigurationModel in project OpenAM by OpenRock.
the class AuthConfigViewBean method showInvalidSet.
public void showInvalidSet() {
Set invalidSet = new HashSet();
Set validSet = new HashSet();
List list = getInstanceNames();
if ((list != null) && !list.isEmpty()) {
validSet.addAll(list);
}
AuthConfigurationModel model = (AuthConfigurationModel) getModel();
int size = model.getNumberEntries();
for (int i = 0; i < size; i++) {
String module = model.getModuleName(i);
if (!validSet.contains(module)) {
invalidSet.add(module);
}
}
if (!invalidSet.isEmpty()) {
StringBuilder buff = new StringBuilder();
boolean bFirst = true;
for (Iterator i = invalidSet.iterator(); i.hasNext(); ) {
if (bFirst) {
bFirst = false;
} else {
buff.append(", ");
}
buff.append((String) i.next());
}
Object[] params = { buff.toString() };
String msg = (invalidSet.size() > 1) ? "authentication.instance.invalids" : "authentication.instance.invalid";
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", MessageFormat.format(model.getLocalizedString(msg), params));
}
}
use of com.sun.identity.console.authentication.model.AuthConfigurationModel in project OpenAM by OpenRock.
the class AuthConfigViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
resetButtonState(REMOVE_ENTRY_BUTTON);
acModel = (AuthConfigurationModel) getModel();
// set the page title to include the auth config name
String title = acModel.getLocalizedString("page.title.auth.config.edit");
String[] param = { getConfigName() };
ptModel.setPageTitleText(MessageFormat.format(title, (Object[]) param));
AuthConfigurationModel model = (AuthConfigurationModel) getModel();
if (model != null) {
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
ps.setAttributeValues(getValues(model), model);
}
if (!tablePopulated) {
populateEntryTable();
}
CCButton btnReorder = (CCButton) getChild(REORDER_ENTRY_BUTTON);
btnReorder.setDisabled(model.getNumberEntries() < 2);
if (getInstanceNames().isEmpty()) {
CCButton btnAdd = (CCButton) getChild(ADD_ENTRY_BUTTON);
btnAdd.setDisabled(true);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.instance.list.empty");
}
showInvalidSet();
}
Aggregations