Search in sources :

Example 36 with CCDropDownMenu

use of com.sun.web.ui.view.html.CCDropDownMenu in project OpenAM by OpenRock.

the class CreateFedletViewBean method beginDisplay.

public void beginDisplay(DisplayEvent e) {
    HttpServletRequest req = getRequestContext().getRequest();
    populateTableModel();
    Set userAttrNames = AMAdminUtils.getUserAttributeNames();
    userAttrNames.remove("iplanet-am-user-account-life");
    CCDropDownMenu menuUserAttribute = (CCDropDownMenu) getChild("menuUserAttributes");
    OptionList optList = createOptionList(userAttrNames);
    optList.add(0, "name.attribute.mapping.select", "");
    menuUserAttribute.setOptions(optList);
    try {
        TaskModel model = (TaskModel) getModel();
        Map map = model.getRealmCotWithHostedIDPs();
        Set realms = new TreeSet();
        realms.addAll(map.keySet());
        CCDropDownMenu menuRealm = (CCDropDownMenu) getChild(REALM);
        menuRealm.setOptions(createOptionList(realms));
        String realm = req.getParameter("realm");
        if ((realm != null) && (realm.trim().length() > 0)) {
            setDisplayFieldValue(REALM, realm);
        } else {
            if (!realms.isEmpty()) {
                realm = (String) realms.iterator().next();
            }
        }
        if ((realm != null) && (realm.trim().length() > 0)) {
            Map mapCots = (Map) map.get(realm);
            Set cots = new TreeSet();
            cots.addAll(mapCots.keySet());
            CCDropDownMenu menuCOT = (CCDropDownMenu) getChild("choiceCOT");
            menuCOT.setOptions(createOptionList(cots));
            String cot = req.getParameter("cot");
            if ((cot != null) && (cot.trim().length() > 0)) {
                setDisplayFieldValue("choiceCOT", cot);
            } else {
                if (!cots.isEmpty()) {
                    cot = (String) cots.iterator().next();
                }
            }
            if ((cot != null) && (cot.trim().length() > 0)) {
                Set idps = new TreeSet();
                idps.addAll((Set) mapCots.get(cot));
                CCDropDownMenu menuIDP = (CCDropDownMenu) getChild("choiceIDP");
                menuIDP.setOptions(createOptionList(idps));
                String idp = req.getParameter("entityId");
                if ((idp != null) && (idp.trim().length() > 0)) {
                    setDisplayFieldValue("choiceIDP", idp);
                }
            }
        }
    } catch (AMConsoleException ex) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", ex.getMessage());
    }
    String cot = req.getParameter("cot");
    if ((cot != null) && (cot.trim().length() > 0)) {
        setDisplayFieldValue(COT_CHOICE, cot);
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Set(java.util.Set) TreeSet(java.util.TreeSet) TreeSet(java.util.TreeSet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList) TaskModel(com.sun.identity.console.task.model.TaskModel)

Example 37 with CCDropDownMenu

use of com.sun.web.ui.view.html.CCDropDownMenu in project OpenAM by OpenRock.

the class ValidateSAML2SetupViewBean method populateTableModel.

private void populateTableModel() {
    tableModel.clearAll();
    TaskModel model = (TaskModel) getModel();
    int invalid = 0;
    try {
        String realm = getRequestContext().getRequest().getParameter("realm");
        if ((realm == null) || (realm.length() == 0)) {
            realm = "/";
        }
        CCDropDownMenu menu = (CCDropDownMenu) getChild("tfRealm");
        Set realms = model.getRealms();
        menu.setOptions(createOptionList(realms));
        menu.setValue(realm);
        bOneRealm = (realms.size() == 1);
        Set cots = model.getCircleOfTrusts(realm);
        setCOTs = new TreeSet();
        setCOTs.addAll(cots);
        int counter = 0;
        for (Iterator i = setCOTs.iterator(); i.hasNext(); ) {
            String cotName = (String) i.next();
            if (counter > 0) {
                tableModel.appendRow();
            }
            counter++;
            int nHostedIDP = model.getHostedIDP(realm, cotName).size();
            int nRemoteIDP = model.getRemoteIDP(realm, cotName).size();
            int nHostedSP = model.getHostedSP(realm, cotName).size();
            int nRemoteSP = model.getRemoteSP(realm, cotName).size();
            boolean valid = ((nHostedIDP > 0) && (nRemoteSP > 0)) || ((nRemoteIDP > 0) && (nHostedSP > 0));
            tableModel.setValue("NameValue", cotName);
            tableModel.setSelectionVisible(valid);
            if (!valid) {
                invalid++;
            }
            tableModel.setValue("HostedIDPValue", Integer.toString(nHostedIDP));
            tableModel.setValue("RemoteIDPValue", Integer.toString(nRemoteIDP));
            tableModel.setValue("HostedSPValue", Integer.toString(nHostedSP));
            tableModel.setValue("RemoteSPValue", Integer.toString(nRemoteSP));
        }
    } catch (AMConsoleException ex) {
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", ex.getMessage());
    }
    if ((setCOTs.size() - invalid) == 0) {
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "no.providers.to.validate");
    }
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) TreeSet(java.util.TreeSet) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) TaskModel(com.sun.identity.console.task.model.TaskModel)

Aggregations

CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)37 OptionList (com.iplanet.jato.view.html.OptionList)25 Set (java.util.Set)23 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)16 Map (java.util.Map)10 TaskModel (com.sun.identity.console.task.model.TaskModel)9 Iterator (java.util.Iterator)8 TreeSet (java.util.TreeSet)7 HashSet (java.util.HashSet)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)6 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)4 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)4 List (java.util.List)4 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)2 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)2 HashMap (java.util.HashMap)2 View (com.iplanet.jato.view.View)1 Option (com.iplanet.jato.view.html.Option)1 AuthPropertiesModel (com.sun.identity.console.authentication.model.AuthPropertiesModel)1 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)1