Search in sources :

Example 1 with PrivilegeXMLBuilder

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();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) DelegationModel(com.sun.identity.console.delegation.model.DelegationModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) PrivilegeXMLBuilder(com.sun.identity.console.property.PrivilegeXMLBuilder) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with PrivilegeXMLBuilder

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");
    }
}
Also used : AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) PrivilegeXMLBuilder(com.sun.identity.console.property.PrivilegeXMLBuilder)

Aggregations

PrivilegeXMLBuilder (com.sun.identity.console.property.PrivilegeXMLBuilder)2 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)1 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)1 DelegationModel (com.sun.identity.console.delegation.model.DelegationModel)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1