Search in sources :

Example 16 with OptionList

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

the class SubConfigAddViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    SubConfigModel model = (SubConfigModel) getModel();
    String schemaName = (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);
    if (!submitCycle) {
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        propertySheetModel.clear();
        try {
            ps.setAttributeValues(model.getServiceSchemaDefaultValues(schemaName), model);
        } catch (AMConsoleException a) {
            setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "noproperties.message");
        }
    }
    Set subconfigNames = model.getSelectableConfigNames(schemaName);
    if ((subconfigNames != null) && !subconfigNames.isEmpty()) {
        CCDropDownMenu menu = (CCDropDownMenu) getChild(ATTR_SUBCONFIG_NAME);
        OptionList optList = this.createOptionList(subconfigNames);
        menu.setOptions(optList);
    }
}
Also used : Set(java.util.Set) SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 17 with OptionList

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

the class CreateCOTViewBean method populateRealmData.

private void populateRealmData() {
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    try {
        Set realmNames = new TreeSet(model.getRealmNames("/", "*"));
        CCDropDownMenu menu = (CCDropDownMenu) getChild(SINGLECHOICE_REALM_MENU);
        OptionList list = new OptionList();
        for (Iterator i = realmNames.iterator(); i.hasNext(); ) {
            String name = (String) i.next();
            list.add(getPath(name), name);
        }
        menu.setOptions(list);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) TreeSet(java.util.TreeSet) Iterator(java.util.Iterator) FSAuthDomainsModel(com.sun.identity.console.federation.model.FSAuthDomainsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 18 with OptionList

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

the class CreateSAML2MetaDataViewBean method populateRealmData.

private void populateRealmData() {
    CreateMetaDataModel model = (CreateMetaDataModel) getModel();
    try {
        Set realmNames = new TreeSet(model.getRealmNames("/", "*"));
        CCDropDownMenu menu = (CCDropDownMenu) getChild("singleChoiceRealm");
        OptionList list = new OptionList();
        for (Iterator i = realmNames.iterator(); i.hasNext(); ) {
            String name = (String) i.next();
            list.add(getPath(name), name);
        }
        menu.setOptions(list);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : TreeSet(java.util.TreeSet) Set(java.util.Set) TreeSet(java.util.TreeSet) Iterator(java.util.Iterator) CreateMetaDataModel(com.sun.identity.console.federation.model.CreateMetaDataModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 19 with OptionList

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

the class IdentityMembershipHelper method setSelectedIdentities.

/**
     * Populates the add remove child component with identity IDs.
     *
     * @param child The add remove child component.
     * @param token Administrator Single Sign Token which is used to create
     *        <code>AMIdentity</code> object.
     * @param userLocale User Locale.
     * @param viewBean Instance of the view bean object that is used to create
     *        option list.
     * @param  values Map of
     *         <code>AMIdentityMembershipCondition.AM_IDENTITY_NAME</code>
     *         to a set of identity IDs.
     */
public static void setSelectedIdentities(CCAddRemove child, SSOToken token, Locale userLocale, AMViewBeanBase viewBean, Map values) {
    if ((values != null) && !values.isEmpty()) {
        Set setValues = (Set) values.get(AMIdentityMembershipCondition.AM_IDENTITY_NAME);
        if ((setValues != null) && !setValues.isEmpty()) {
            CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) child.getModel();
            OptionList optList = createOptionList(token, userLocale, viewBean, setValues);
            addRemoveModel.setSelectedOptionList(optList);
        }
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) OptionList(com.iplanet.jato.view.html.OptionList)

Example 20 with OptionList

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

the class IdentityMembershipHelper method createOptionList.

/**
     * Returns an option list that contains <code>AMIdentity</code> object
     * options.
     *
     * @param token Administrator Single Sign On token that is used to create
     *        the <code>AMIdentity</code> object.
     * @param userLocale User Locale.
     * @param viewBean Instance of the view bean object that is used to create
     *        option list.
     * @param values Either a collection of identity IDs or a collection of
     *        <code>AMIdentity</code> objects.
     * @return an option list that contains <code>AMIdentity</code> object
     *         options.
     */
public static OptionList createOptionList(SSOToken token, Locale userLocale, AMViewBeanBase viewBean, Collection values) {
    OptionList optList = new OptionList();
    if ((values != null) && !values.isEmpty()) {
        /*
             * Need to convert to AMIdentity object if the set contains
             * universal Ids
             */
        Collection amIdentity = (values.iterator().next() instanceof String) ? getAMIdentity(token, 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 = viewBean.createOptionList(entries, userLocale);
    }
    return optList;
}
Also used : HashMap(java.util.HashMap) AMIdentity(com.sun.identity.idm.AMIdentity) Iterator(java.util.Iterator) Collection(java.util.Collection) HashMap(java.util.HashMap) Map(java.util.Map) 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