Search in sources :

Example 21 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class IdentityMembershipHelper method getSelectedIdentities.

/**
     * Returns a map of
     * <code>AMIdentityMembershipCondition.AM_IDENTITY_NAME</code> to a set
     * of identity IDs.
     *
     * @param child Add Remove Child Component which contains the selected
     *        identity IDs.
     * @return a map of
     *         <code>AMIdentityMembershipCondition.AM_IDENTITY_NAME</code>
     *         to a set of identity IDs.
     */
public static Map getSelectedIdentities(CCAddRemove child) {
    Map map = new HashMap(2);
    child.restoreStateData();
    CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) child.getModel();
    OptionList selected = addRemoveModel.getSelectedOptionList();
    Set setValues = new HashSet();
    for (int i = 0; i < selected.size(); i++) {
        Option opt = selected.get(i);
        setValues.add(opt.getValue());
    }
    map.put(AMIdentityMembershipCondition.AM_IDENTITY_NAME, setValues);
    return map;
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Option(com.iplanet.jato.view.html.Option) HashMap(java.util.HashMap) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList) HashSet(java.util.HashSet)

Example 22 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class IdentitySubjectAddViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    IdentitySubjectModel model = (IdentitySubjectModel) getModel();
    Set values = null;
    if (bFilter) {
        Set defaultValue = getValues();
        if (defaultValue != null) {
            values = getAMIdentity(model, defaultValue);
        }
    }
    super.beginDisplay(event);
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    // initialize the 'Filter' drop down menu
    // supportedEntityTypes is a map of entity name to its
    // localized value
    CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
    Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
    OptionList entityTypes = createOptionList(supportedEntityTypes);
    entityTypes.add(0, "policy.subject.select.identity.type", "");
    menu.setOptions(entityTypes);
    menu.setValue("");
    // initialize the available/selected component
    CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
    child.restoreStateData();
    OptionList selected = addRemoveModel.getSelectedOptionList();
    OptionList possible = createOptionList(getPossibleValues(model, realmName));
    child.resetStateData();
    addRemoveModel.setAvailableOptionList(possible);
    List selectedIds = AMAdminUtils.toList(selected);
    addRemoveModel.setSelectedOptionList(createOptionList(getAMIdentity(model, selectedIds)));
}
Also used : IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) HashSet(java.util.HashSet) Set(java.util.Set) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) HashMap(java.util.HashMap) Map(java.util.Map) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList)

Example 23 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class IdentitySubjectAddViewBean method createOptionList.

/**
     * Creates an OptionList based on a set of AMIdentity objects.
     */
protected OptionList createOptionList(Set values) {
    OptionList optList = new OptionList();
    if ((values != null) && !values.isEmpty()) {
        /*
             * Need to convert to AMIdentity object if the set contains
             * universal Ids
             */
        Set amIdentity = (values.iterator().next() instanceof String) ? getAMIdentity((IdentitySubjectModel) getModel(), values) : values;
        Map entries = new HashMap(values.size() * 2);
        for (Iterator iter = amIdentity.iterator(); iter.hasNext(); ) {
            AMIdentity identity = (AMIdentity) iter.next();
            entries.put(IdUtils.getUniversalId(identity), PolicyUtils.getDNDisplayString(identity.getName()));
        }
        optList = createOptionList(entries);
    }
    return optList;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) HashMap(java.util.HashMap) AMIdentity(com.sun.identity.idm.AMIdentity) Iterator(java.util.Iterator) HashMap(java.util.HashMap) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList)

Example 24 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class IdentitySubjectEditViewBean method createOptionList.

protected OptionList createOptionList(Set values) {
    OptionList optList = new OptionList();
    if ((values != null) && !values.isEmpty()) {
        for (Iterator iter = values.iterator(); iter.hasNext(); ) {
            AMIdentity identity = (AMIdentity) iter.next();
            optList.add(PolicyUtils.getDNDisplayString(identity.getName()), IdUtils.getUniversalId(identity));
        }
    }
    return optList;
}
Also used : AMIdentity(com.sun.identity.idm.AMIdentity) Iterator(java.util.Iterator) OptionList(com.iplanet.jato.view.html.OptionList)

Example 25 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class AuthToServiceAddViewBean method beginDisplay.

/**
     * Set the realm names and service names.
     *
     * @param event Display event.
     * @throws ModelControlException if default <code>JATO</code> cannot be
     *         instantiated.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    String filter = (String) getDisplayFieldValue(AuthToServiceHelper.ATTR_FILTER);
    if ((filter == null) || (filter.trim().length() == 0)) {
        setDisplayFieldValue(AuthToServiceHelper.ATTR_FILTER, "*");
    }
    Set realmNames = getRealmNames(filter);
    if ((realmNames != null) && !realmNames.isEmpty()) {
        realmNames.add("");
        CCSelect sl = (CCSelect) getChild(AuthToServiceHelper.ATTR_REALM);
        sl.setOptions(createOptionList(getLabelValueMap(realmNames)));
        String realm = null;
        if (!bRealmSelect) {
            realm = (String) realmNames.iterator().next();
            sl.setValue(realm);
        } else {
            realm = (String) sl.getValue();
        }
        setServiceNames(realm);
    } else {
        CCSelect slService = (CCSelect) getChild(AuthToServiceHelper.ATTR_SERVICE);
        slService.setOptions(new OptionList());
    }
}
Also used : Set(java.util.Set) CCSelect(com.sun.web.ui.view.html.CCSelect) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

OptionList (com.iplanet.jato.view.html.OptionList)75 Set (java.util.Set)35 Iterator (java.util.Iterator)27 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)25 Map (java.util.Map)24 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)21 HashSet (java.util.HashSet)17 List (java.util.List)15 HashMap (java.util.HashMap)13 ArrayList (java.util.ArrayList)9 Option (com.iplanet.jato.view.html.Option)7 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)7 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)7 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)6 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)6 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)6 TreeSet (java.util.TreeSet)6 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)5 TaskModel (com.sun.identity.console.task.model.TaskModel)5 CCSelect (com.sun.web.ui.view.html.CCSelect)5