use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.
the class DelegationPropertiesViewBean method handleButton1Request.
/**
* Handles save button request.
*
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
DelegationModel model = (DelegationModel) getModel();
String uid = (String) getPageSessionAttribute(CURRENT_IDENTITY);
AMPropertySheet ps = (AMPropertySheet) getChild(DELEGATION_PROPERTIES);
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
PrivilegeXMLBuilder builder = PrivilegeXMLBuilder.getInstance();
Set privileges = builder.getAllPrivileges(realm, model);
Map values = ps.getAttributeValues(privileges);
model.setPrivileges(realm, uid, values);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "delegation.privilege.updated");
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.
the class DelegationPropertiesViewBean method getBreadCrumbDisplayName.
protected String getBreadCrumbDisplayName() {
String message = "breadcrumbs.realm.pivilege.editPrivilege";
DelegationModel model = (DelegationModel) getModel();
String[] tmp = { getDisplayName() };
return MessageFormat.format(model.getLocalizedString(message), (Object[]) tmp);
}
use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.
the class DelegationViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
DelegationModel model = (DelegationModel) getModel();
setPageTitle(model, "page.title.delegation");
tblModel.setTitle("table.delegation.title.name");
tblModel.setTitleLabel("table.delegation.summary");
tblModel.setSummary("table.delegation.summary");
getSubjects();
}
use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.
the class DelegationViewBean method populateTableModel.
private void populateTableModel(Collection DelegationNames) {
tblModel.clearAll();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
if ((DelegationNames != null) && !DelegationNames.isEmpty()) {
List cache = new ArrayList(DelegationNames.size());
DelegationModel model = (DelegationModel) getModel();
SSOToken ssoToken = model.getUserSSOToken();
boolean firstEntry = true;
for (Iterator iter = DelegationNames.iterator(); iter.hasNext(); ) {
String id = (String) iter.next();
try {
AMIdentity entity = IdUtils.getIdentity(ssoToken, id);
if (firstEntry) {
firstEntry = false;
} else {
tblModel.appendRow();
}
String name = AMFormatUtils.getIdentityDisplayName(model, entity);
tblModel.setValue(TBL_DATA_NAME, name);
tblModel.setValue(TBL_DATA_UNIVERSALNAME, id);
tblModel.setValue(TBL_DATA_ACTION_HREF, stringToHex(id));
cache.add(id);
} catch (IdRepoException e) {
//ignore since ID is not found.
}
}
szCache.setValue((Serializable) cache);
} else {
szCache.setValue(null);
}
}
use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.
the class DelegationPropertiesViewBean method getDisplayName.
/**
* Retrieve the name from the current object and convert it to a
* displayable format.
*/
private String getDisplayName() {
String displayName = "";
DelegationModel model = (DelegationModel) getModel();
String uid = (String) getPageSessionAttribute(CURRENT_IDENTITY);
try {
AMIdentity entity = IdUtils.getIdentity(model.getUserSSOToken(), uid);
displayName = AMFormatUtils.getIdentityDisplayName(model, entity);
} catch (IdRepoException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
}
return displayName;
}
Aggregations