Search in sources :

Example 11 with TaskModel

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

the class ConfigureGoogleAppsViewBean 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 {
        ConfigureGoogleAppsWarningViewBean vb = (ConfigureGoogleAppsWarningViewBean) getViewBean(ConfigureGoogleAppsWarningViewBean.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 12 with TaskModel

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

the class ConfigureGoogleAppsWarningViewBean 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 13 with TaskModel

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

the class ConfigureSalesForceAppsCompleteViewBean method handleButton1Request.

/**
     * Handles finish button request.
     * 
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    String acsUrl = getDisplayFieldStringValue("SalesforceLoginURL");
    try {
        if ((acsUrl != null) && (acsUrl.length() > 0)) {
            String realm = (String) getPageSessionAttribute("entityRealm");
            String entityId = (String) getPageSessionAttribute(ENTITY_ID);
            TaskModel model = (TaskModel) getModelInternal();
            model.setAcsUrl(realm, entityId, acsUrl);
            redirectToHome();
        } else if ((acsUrl == null) || !(acsUrl.length() > 0)) {
            ConfigureSalesForceAppsFinishWarningViewBean vb = (ConfigureSalesForceAppsFinishWarningViewBean) getViewBean(ConfigureSalesForceAppsFinishWarningViewBean.class);
            vb.forwardTo(getRequestContext());
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) TaskModel(com.sun.identity.console.task.model.TaskModel)

Example 14 with TaskModel

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

the class ConfigureSalesForceAppsFinishWarningViewBean method endIalertCommonDisplay.

public String endIalertCommonDisplay(ChildContentDisplayEvent event) {
    TaskModel model = (TaskModel) getModel();
    String html = event.getContent();
    int idx = html.lastIndexOf("</div>");
    String redirectUrl;
    if (XuiRedirectHelper.isXuiAdminConsoleEnabled()) {
        String realm = RequestManager.getRequestContext().getRequest().getParameter("realm");
        redirectUrl = "../XUI#realms/" + Uris.urlEncodePathElement(realm) + "/dashboard";
    } else {
        redirectUrl = "../task/Home";
    }
    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('" + redirectUrl + "'); return false;\" " + "/></div></center>" + html.substring(idx + 6);
    return html;
}
Also used : TaskModel(com.sun.identity.console.task.model.TaskModel)

Example 15 with TaskModel

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

the class ConfigureSalesForceAppsViewBean method beginDisplay.

public void beginDisplay(DisplayEvent e) {
    HttpServletRequest req = getRequestContext().getRequest();
    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);
                }
            }
            //attrmapping
            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);
        }
    } 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) Map(java.util.Map) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) TaskModel(com.sun.identity.console.task.model.TaskModel) OptionList(com.iplanet.jato.view.html.OptionList)

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