ConfigureSalesForceAppsFinishWarningViewBean.java revision 4c2ed873ce0d69780e28220e175a838a6829d4ea
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk/**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * The contents of this file are subject to the terms
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * of the Common Development and Distribution License
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * (the License). You may not use this file except in
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * compliance with the License.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * You can obtain a copy of the License at
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * https://opensso.dev.java.net/public/CDDLv1.0.html or
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * opensso/legal/CDDLv1.0.txt
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * See the License for the specific language governing
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * permission and limitations under the License.
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * When distributing Covered Code, include this CDDL
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Header Notice in each file and include the License file
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk * at opensso/legal/CDDLv1.0.txt.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * If applicable, add the following below the CDDL Header,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * with the fields enclosed by brackets [] replaced by
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * your own identifying information:
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk * "Portions Copyrighted [year] [name of copyright owner]"
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * $Id: ConfigureSalesForceAppsFinishWarningViewBean.java,v 1.1 2009/07/28 17:45:20 babysunil Exp $
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk * Portions Copyrighted 2015 ForgeRock AS.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkpackage com.sun.identity.console.task;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport java.io.UnsupportedEncodingException;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport java.net.URLEncoder;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.iplanet.jato.RequestManager;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.iplanet.jato.view.event.ChildContentDisplayEvent;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.iplanet.jato.view.event.DisplayEvent;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.identity.console.XuiRedirectHelper;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.identity.console.base.AMPrimaryMastHeadViewBean;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.identity.console.base.model.AMModel;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.identity.console.task.model.TaskModel;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.identity.console.task.model.TaskModelImpl;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.web.ui.view.alert.CCAlert;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport javax.servlet.http.HttpServletRequest;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk/**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Create Warning for salesforce UI.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkpublic class ConfigureSalesForceAppsFinishWarningViewBean
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk extends AMPrimaryMastHeadViewBean {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final String DEFAULT_DISPLAY_URL =
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "/console/task/ConfigureSalesForceAppsFinishWarning.jsp";
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public ConfigureSalesForceAppsFinishWarningViewBean() {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk super("ConfigureSalesForceAppsFinishWarning");
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk registerChildren();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected void registerChildren() {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk super.registerChildren();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected AMModel getModelInternal() {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk HttpServletRequest req = getRequestContext().getRequest();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return new TaskModelImpl(req, getPageSessionAttributes());
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void beginDisplay(DisplayEvent e) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information",
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "create.salesforce.apps.finish.message");
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public String endIalertCommonDisplay(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ChildContentDisplayEvent event) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk TaskModel model = (TaskModel) getModel();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String html = event.getContent();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk int idx = html.lastIndexOf("</div>");
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String redirectUrl;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if (XuiRedirectHelper.isXuiAdminConsoleEnabled()) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String realm = RequestManager.getRequestContext().getRequest().getParameter("realm");
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk try {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk redirectUrl = "../XUI#realms/" + URLEncoder.encode(realm, "UTF-8") + "/dashboard";
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } catch (UnsupportedEncodingException e) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throw new IllegalStateException("UTF-8 not supported", e);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } else {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk redirectUrl = "../task/Home";
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk html = html.substring(0, idx + 6) +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "<p>&nbsp;<p><center><div class=\"TtlBtnDiv\">" +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "<input name=\"button1\" type=\"submit\" " + "" +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "class=\"Btn1\" value=\" " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk model.getLocalizedString("button.ok") +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk " \" onmouseover=\"javascript: this.className='Btn1Hov'\" " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "onmouseout=\"javascript: this.className='Btn1'\" " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "onblur=\"javascript: this.className='Btn1'\" " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "onfocus=\"javascript: this.className='Btn1Hov'\" " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "onClick=\"top.location.replace('" + redirectUrl + "'); return false;\" " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "/></div></center>" + html.substring(idx + 6);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return html;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk}
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk