Search in sources :

Example 16 with OrderedSet

use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.

the class FSSAMLServiceViewBean method handleTblTargetURLsButtonDeleteRequest.

public void handleTblTargetURLsButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    Map modifiedValues = null;
    try {
        modifiedValues = getValues(false, false);
    } catch (AMConsoleException e) {
    /* exception will not be thrown because we are instructing
             * AMPropertySheet to return values without doing password
             * validation.
             */
    }
    CCActionTable tbl = (CCActionTable) getChild(TABLE_TARGET_URLS);
    tbl.restoreStateData();
    Integer[] selected = tblTargetURLsModel.getSelectedRows();
    if ((selected != null) && (selected.length > 0)) {
        OrderedSet tblValues = (OrderedSet) modifiedValues.get(TABLE_TARGET_URLS);
        tblValues.removeAll(selected);
        modifiedValues.put(TABLE_TARGET_URLS, tblValues);
    }
    setPageSessionAttribute(PROPERTY_ATTRIBUTE, (HashMap) modifiedValues);
    setPageSessionAttribute(MODIFIED, "1");
    setValues();
    forwardTo();
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCActionTable(com.sun.web.ui.view.table.CCActionTable) HashMap(java.util.HashMap) Map(java.util.Map)

Example 17 with OrderedSet

use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.

the class SMG11NViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    resetButtonState(TBL_SUPPORTED_CHARSETS_DELETE_BTN);
    resetButtonState(TBL_CHARSET_ALIAS_DELETE_BTN);
    if (!tablePopulated) {
        if (!isSubmitCycle()) {
            AMServiceProfileModel model = (AMServiceProfileModel) getModel();
            if (model != null) {
                Set supportedCharsets = new OrderedSet();
                supportedCharsets.addAll(model.getAttributeValues(SMG11NModelImpl.ATTRIBUTE_NAME_SUPPORTED_CHARSETS));
                populateSupportedCharsetsTable(supportedCharsets);
                Set charsetAlias = new OrderedSet();
                charsetAlias.addAll(model.getAttributeValues(SMG11NModelImpl.ATTRIBUTE_NAME_CHARSET_ALIAS));
                populateCharsetAliasTable(charsetAlias);
            }
        }
    }
    if (!isInlineAlertMessageSet()) {
        String flag = (String) getPageSessionAttribute(PAGE_MODIFIED);
        if ((flag != null) && flag.equals("1")) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.profile.modified");
        }
    }
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) AMServiceProfileModel(com.sun.identity.console.base.model.AMServiceProfileModel)

Example 18 with OrderedSet

use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.

the class SMG11NViewBean method handleTblCharsetAliasButtonDeleteRequest.

/**
     * Handles remove charset alias request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblCharsetAliasButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    setSubmitCycle(true);
    CCActionTable table = (CCActionTable) getChild(SMG11NModelImpl.ATTRIBUTE_NAME_CHARSET_ALIAS);
    table.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(SMG11NModelImpl.ATTRIBUTE_NAME_CHARSET_ALIAS);
    Integer[] selected = tblModel.getSelectedRows();
    if ((selected != null) && (selected.length > 0)) {
        OrderedSet tblValues = (OrderedSet) getPageSessionAttribute(SMG11NModelImpl.ATTRIBUTE_NAME_CHARSET_ALIAS);
        tblValues.removeAll(selected);
        setPageSessionAttribute(SMG11NModelImpl.ATTRIBUTE_NAME_CHARSET_ALIAS, tblValues);
        populateCharsetAliasTable(tblValues);
    }
    forwardTo();
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable)

Example 19 with OrderedSet

use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.

the class AuthPropertiesViewBean method populateConfigTable.

private void populateConfigTable() {
    tablePopulated = true;
    CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(AUTH_CONFIG_TABLE);
    tableModel.clearAll();
    // get config names from previous pass. Need to use an ordered set
    // here to assure the same order is retained during the request cycle.
    OrderedSet configSet = (OrderedSet) removePageSessionAttribute(AUTH_CONFIG_TABLE);
    // no instances if this is the 1st pass, create it now
    if (configSet == null || configSet.isEmpty()) {
        AuthPropertiesModel model = (AuthPropertiesModel) getModel();
        String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        if ((realm == null) || (realm.length() == 0)) {
            realm = AMModelBase.getStartDN(getRequestContext().getRequest());
        }
        configSet = new OrderedSet();
        configSet.addAll(AuthConfigurationModelImpl.getNamedConfigurations(model.getUserSSOToken(), realm));
    }
    // add the data to the table
    boolean firstEntry = true;
    for (Iterator i = configSet.iterator(); i.hasNext(); ) {
        String name = (String) i.next();
        if (!firstEntry) {
            tableModel.appendRow();
        } else {
            firstEntry = false;
        }
        tableModel.setValue(CONFIG_NAME_COLUMN_DATA, name);
        tableModel.setValue(CONFIG_ACTION_COLUMN_HREF, stringToHex(name));
        tableModel.setValue(CONFIG_ACTION_COLUMN_HREF_LABEL, "authentication.module.instances.action.label");
    }
    // set the instances in the page session so when a request comes in
    // we can prepopulate the table model.
    setPageSessionAttribute(AUTH_CONFIG_TABLE, configSet);
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) Iterator(java.util.Iterator) AuthPropertiesModel(com.sun.identity.console.authentication.model.AuthPropertiesModel)

Example 20 with OrderedSet

use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.

the class AuthPropertiesViewBean method populateInstanceTable.

private void populateInstanceTable() {
    tablePopulated = true;
    CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(AUTH_INSTANCE_TABLE);
    tableModel.clearAll();
    boolean firstEntry = true;
    Map instanceMap = new HashMap();
    AuthPropertiesModel model = (AuthPropertiesModelImpl) getModel();
    Set tmp = model.getAuthInstances();
    /* 
         * These instance were deleted in the previous request. This
         * is needed because the getAuthInstances call may return the 
         * instances that were just deleted.
         */
    Set removedInstances = (Set) removePageSessionAttribute(INSTANCES_REMOVED);
    for (Iterator i = tmp.iterator(); i.hasNext(); ) {
        AMAuthenticationInstance inst = (AMAuthenticationInstance) i.next();
        String name = inst.getName();
        if ((removedInstances == null) || (!removedInstances.contains(name))) {
            instanceMap.put(name, inst);
        }
    }
    /*
        * get instance names from previous pass. Need to use an ordered set
        * here to assure the same order is retained during the request cycle.
        */
    OrderedSet instanceSet = (OrderedSet) removePageSessionAttribute(AUTH_INSTANCE_TABLE);
    // no instances if this is the 1st pass, create it now
    if (instanceSet == null) {
        instanceSet = new OrderedSet();
        instanceSet.addAll(instanceMap.keySet());
    }
    AMAuthenticationManager mgr = null;
    try {
        mgr = new AMAuthenticationManager(model.getUserSSOToken(), "/");
    } catch (AMConfigurationException e) {
        debug.warning("Could not create Authentication Manager. Using non-localized type names", e);
    }
    for (Iterator i = instanceSet.iterator(); i.hasNext(); ) {
        String name = (String) i.next();
        AMAuthenticationInstance instance = (AMAuthenticationInstance) instanceMap.get(name);
        /*
            * check if instance still exists. This can happen if user goes
            * the the advanced core properties page and removes an auth type
            * from the available auth instances list.
            */
        if (instance != null) {
            if (!firstEntry) {
                tableModel.appendRow();
            } else {
                firstEntry = false;
            }
            String type = instance.getType();
            if (model.hasAuthAttributes(type)) {
                tableModel.setValue(NAME_COLUMN_DATA, name);
                tableModel.setValue(ACTION_COLUMN_HREF, stringToHex(name));
                tableModel.setValue(NAME_COLUMN_DATA_NO_HREF, "");
            } else {
                tableModel.setValue(NAME_COLUMN_DATA, "");
                tableModel.setValue(ACTION_COLUMN_HREF, stringToHex(name));
                tableModel.setValue(NAME_COLUMN_DATA_NO_HREF, name);
            }
            if (mgr != null) {
                try {
                    type = model.getLocalizedServiceName(mgr.getAuthenticationSchema(type).getServiceName());
                } catch (AMConfigurationException e) {
                    if (debug.warningEnabled()) {
                        debug.warning("Could not get schema for type " + type + ". Using non-localized name.", e);
                    }
                }
            }
            tableModel.setValue(TYPE_COLUMN_DATA, type);
        }
    }
    /*
        * set the instances in the page session so when a request comes in 
        * we can prepopulate the table model. 
        */
    setPageSessionAttribute(AUTH_INSTANCE_TABLE, instanceSet);
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) HashMap(java.util.HashMap) Iterator(java.util.Iterator) AuthPropertiesModel(com.sun.identity.console.authentication.model.AuthPropertiesModel) AMConfigurationException(com.sun.identity.authentication.config.AMConfigurationException) AMAuthenticationInstance(com.sun.identity.authentication.config.AMAuthenticationInstance) HashMap(java.util.HashMap) Map(java.util.Map) AuthPropertiesModelImpl(com.sun.identity.console.authentication.model.AuthPropertiesModelImpl) AMAuthenticationManager(com.sun.identity.authentication.config.AMAuthenticationManager)

Aggregations

OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)87 Map (java.util.Map)52 Set (java.util.Set)36 Iterator (java.util.Iterator)20 HashMap (java.util.HashMap)17 HashSet (java.util.HashSet)16 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)13 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)13 CCActionTable (com.sun.web.ui.view.table.CCActionTable)12 AMServiceProfileModel (com.sun.identity.console.base.model.AMServiceProfileModel)6 CaseInsensitiveHashSet (com.sun.identity.common.CaseInsensitiveHashSet)5 ArrayList (java.util.ArrayList)5 LinkedHashSet (java.util.LinkedHashSet)5 SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)4 List (java.util.List)4 AuthPropertiesModel (com.sun.identity.console.authentication.model.AuthPropertiesModel)3 WSAuthHandlerEntry (com.sun.identity.console.webservices.model.WSAuthHandlerEntry)3 IdRepo (com.sun.identity.idm.IdRepo)3 Issuer (com.sun.identity.saml2.assertion.Issuer)3 SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)3