use of com.sun.identity.console.property.PrivilegeXMLBuilder 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.property.PrivilegeXMLBuilder in project OpenAM by OpenRock.
the class DelegationPropertiesViewBean method createPropertyModel.
private void createPropertyModel() {
PrivilegeXMLBuilder builder = PrivilegeXMLBuilder.getInstance();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String xml = builder.getXML(curRealm, getModel());
if (xml.length() > 0) {
psModel = new AMPropertySheetModel(xml);
psModel.clear();
hasPrivileges = true;
} else {
// This happens when we cannot get privileges from SM.
psModel = new AMPropertySheetModel(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/propertyBlank.xml"));
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "delegation.no.privileges");
}
}
Aggregations