Search in sources :

Example 16 with TaskModel

use of com.sun.identity.console.task.model.TaskModel in project OpenAM by OpenRock.

the class ConfigureSalesForceAppsViewBean method forwardTo.

public void forwardTo(RequestContext rc) {
    boolean hasIdp = false;
    try {
        TaskModel model = (TaskModel) getModel();
        Set realms = model.getRealms();
        for (Iterator i = realms.iterator(); i.hasNext() && !hasIdp; ) {
            String realm = (String) i.next();
            Set cots = model.getCircleOfTrusts(realm);
            for (Iterator j = cots.iterator(); j.hasNext() && !hasIdp; ) {
                String cot = (String) j.next();
                Set idps = model.getHostedIDP(realm, cot);
                hasIdp = !idps.isEmpty();
            }
        }
    } catch (AMConsoleException ex) {
        hasIdp = false;
    }
    if (hasIdp) {
        super.forwardTo(rc);
    } else {
        ConfigureSalesForceAppsWarningViewBean vb = (ConfigureSalesForceAppsWarningViewBean) getViewBean(ConfigureSalesForceAppsWarningViewBean.class);
        vb.forwardTo(rc);
    }
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) TaskModel(com.sun.identity.console.task.model.TaskModel)

Example 17 with TaskModel

use of com.sun.identity.console.task.model.TaskModel in project OpenAM by OpenRock.

the class ConfigureSalesForceAppsWarningViewBean method endIalertCommonDisplay.

public String endIalertCommonDisplay(ChildContentDisplayEvent event) {
    TaskModel model = (TaskModel) getModel();
    String html = event.getContent();
    int idx = html.lastIndexOf("</div>");
    html = html.substring(0, idx + 6) + "<p>&nbsp;<p><center><div class=\"TtlBtnDiv\">" + "<input name=\"button1\" type=\"submit\" " + "" + "class=\"Btn1\" value=\"  " + model.getLocalizedString("button.ok") + "  \" onmouseover=\"javascript: this.className='Btn1Hov'\" " + "onmouseout=\"javascript: this.className='Btn1'\" " + "onblur=\"javascript: this.className='Btn1'\" " + "onfocus=\"javascript: this.className='Btn1Hov'\" " + "onClick=\"top.location.replace('../task/Home'); return false;\" " + "/></div></center>" + html.substring(idx + 6);
    return html;
}
Also used : TaskModel(com.sun.identity.console.task.model.TaskModel)

Example 18 with TaskModel

use of com.sun.identity.console.task.model.TaskModel 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 19 with TaskModel

use of com.sun.identity.console.task.model.TaskModel 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)

Example 20 with TaskModel

use of com.sun.identity.console.task.model.TaskModel in project OpenAM by OpenRock.

the class CreateFedletViewBean method forwardTo.

public void forwardTo(RequestContext rc) {
    boolean hasIdp = false;
    try {
        TaskModel model = (TaskModel) getModel();
        Set realms = model.getRealms();
        for (Iterator i = realms.iterator(); i.hasNext() && !hasIdp; ) {
            String realm = (String) i.next();
            Set cots = model.getCircleOfTrusts(realm);
            for (Iterator j = cots.iterator(); j.hasNext() && !hasIdp; ) {
                String cot = (String) j.next();
                Set idps = model.getHostedIDP(realm, cot);
                hasIdp = !idps.isEmpty();
            }
        }
    } catch (AMConsoleException ex) {
        hasIdp = false;
    }
    if (hasIdp) {
        super.forwardTo(rc);
    } else {
        CreateFedletWarningViewBean vb = (CreateFedletWarningViewBean) getViewBean(CreateFedletWarningViewBean.class);
        vb.forwardTo(rc);
    }
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) TaskModel(com.sun.identity.console.task.model.TaskModel)

Aggregations

TaskModel (com.sun.identity.console.task.model.TaskModel)20 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)15 Set (java.util.Set)12 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)9 TreeSet (java.util.TreeSet)7 HttpServletRequest (javax.servlet.http.HttpServletRequest)7 OptionList (com.iplanet.jato.view.html.OptionList)5 Iterator (java.util.Iterator)5 Map (java.util.Map)5 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)2 CCCheckBox (com.sun.web.ui.view.html.CCCheckBox)1 StringTokenizer (java.util.StringTokenizer)1