use of com.sun.identity.console.realm.model.IDRepoModel in project OpenAM by OpenRock.
the class IDRepoViewBean method handleTblButtonDeleteRequest.
/**
* Deletes ID Repo.
*
* @param event Request Invocation Event.
* @throws ModelControlException if table model cannot be restored.
*/
public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(TBL_SEARCH);
table.restoreStateData();
Integer[] selected = tblModel.getSelectedRows();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
List list = (List) szCache.getSerializedObj();
Set names = new HashSet(selected.length * 2);
for (int i = 0; i < selected.length; i++) {
names.add(list.get(selected[i].intValue()));
}
try {
IDRepoModel model = (IDRepoModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
model.deleteIDRepos(curRealm, names);
if (selected.length == 1) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "idRepo.message.deleted");
} else {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "idRepo.message.deleted.pural");
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.realm.model.IDRepoModel in project OpenAM by OpenRock.
the class IDRepoEditViewBean method setDefaultValues.
/**
* Sets the default values for the attributes of a particular
* data store entry. The name of the data store is retrieved from
* the page session. The type passed in the request is not used here.
*/
protected void setDefaultValues(String type) {
String idRepoName = (String) getPageSessionAttribute(IDREPO_NAME);
if (idRepoName != null) {
IDRepoModel model = (IDRepoModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
Map attrValues = model.getAttributeValues(realmName, idRepoName);
propertySheetModel.clear();
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
ps.setAttributeValues(attrValues, model);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
}
use of com.sun.identity.console.realm.model.IDRepoModel in project OpenAM by OpenRock.
the class IDRepoEditViewBean method getBreadCrumbDisplayName.
protected String getBreadCrumbDisplayName() {
String idRepoName = (String) getPageSessionAttribute(IDREPO_NAME);
String[] arg = { idRepoName };
IDRepoModel model = (IDRepoModel) getModel();
return MessageFormat.format(model.getLocalizedString("breadcrumbs.realm.idrepo.editIdRepo"), (Object[]) arg);
}
use of com.sun.identity.console.realm.model.IDRepoModel in project OpenAM by OpenRock.
the class IDRepoOpViewBeanBase method createPropertyModel.
protected boolean createPropertyModel() {
boolean created = false;
HttpServletRequest req = RequestManager.getRequestContext().getRequest();
String type = (String) getPageSessionAttribute(IDREPO_TYPE);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if ((type != null) && (type.trim().length() > 0)) {
IDRepoModel model = (IDRepoModel) getModel();
try {
propertySheetModel = new AMPropertySheetModel(model.getPropertyXMLString(realmName, getClass().getName(), type, isCreateViewBean()));
propertySheetModel.clear();
created = true;
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
return created;
}
use of com.sun.identity.console.realm.model.IDRepoModel in project OpenAM by OpenRock.
the class IDRepoOpViewBeanBase method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
String idRepoName = (String) getPageSessionAttribute(IDREPO_NAME);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
IDRepoModel model = (IDRepoModel) getModel();
try {
Map localizedMap = model.getIDRepoTypesMap();
String idRepoType = (String) getPageSessionAttribute(IDREPO_TYPE);
String i18nName = (String) localizedMap.get(idRepoType);
if (!submitCycle) {
setDefaultValues(idRepoType);
}
propertySheetModel.setValue(IDREPO_TYPE, idRepoType);
propertySheetModel.setValue(IDREPO_TYPE_NAME, i18nName);
propertySheetModel.setValue(IDREPO_NAME, idRepoName);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
Aggregations