001: /**
002: * $Id: Gateway3ViewBean.java,v 1.5 2005/11/30 11:27:10 ss150821 Exp $
003: * Copyright 2001 Sun Microsystems, Inc. Some preexisting
004: * portions Copyright 2001 Netscape Communications Corp.
005: * All rights reserved. Use of this product is subject to
006: * license terms. Federal Acquisitions: Commercial Software --
007: * Government Users Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and iPlanet are
011: * trademarks or registered trademarks of Sun Microsystems, Inc.
012: * in the United States and other countries. Netscape and the
013: * Netscape N logo are registered trademarks of Netscape
014: * Communications Corporation in the U.S. and other countries.
015: * Other Netscape logos, product names, and service names are
016: * also trademarks of Netscape Communications Corporation,
017: * which may be registered in other countries.
018: */package com.sun.portal.rproxy.admin;
019:
020: // JDK classes
021: import java.util.Collections;
022: import java.util.HashMap;
023: import java.util.Iterator;
024: import java.util.List;
025: import java.util.Map;
026: import java.util.Set;
027:
028: import com.iplanet.am.console.base.model.AMConsoleException;
029: import com.iplanet.am.console.components.view.html.DynamicGUI;
030: import com.iplanet.jato.model.ModelControlException;
031: import com.iplanet.jato.view.View;
032: import com.iplanet.jato.view.event.RequestInvocationEvent;
033: import com.iplanet.jato.view.html.StaticTextField;
034: import com.iplanet.sso.SSOException;
035: import com.sun.portal.rproxy.admin.model.GatewayModel;
036:
037: public class Gateway3ViewBean extends GatewayViewBeanBase implements
038: GatewayAdminService {
039:
040: public static final String PAGE_NAME = "Gateway3";
041:
042: public static final String DEFAULT_DISPLAY_URL = "/ps/gwadmin/Gateway3.jsp";
043:
044: public Gateway3ViewBean(String pageName) {
045: super (pageName);
046: registerChildren();
047: }
048:
049: public Gateway3ViewBean() {
050: super (PAGE_NAME);
051: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
052: registerChildren();
053: }
054:
055: protected void registerChildren() {
056: super .registerChildren();
057: registerChild(GLOBAL_DATA_VIEW, Gateway3View.class);
058: }
059:
060: protected View createChild(String name) {
061: getGWModelMgr();
062: View child = null;
063:
064: if (name.equals(GLOBAL_DATA_VIEW)) {
065: child = new Gateway3View(this , GLOBAL_DATA_VIEW);
066: } else if (name.equals(CHILD_GWPROFILEFOR)) {
067: child = new StaticTextField(this , CHILD_GWPROFILEFOR,
068: modelManager.getString("props.3") + " "
069: + modelManager.getString("for.label"));
070: } else {
071: child = super .createChild(name);
072: }
073: return child;
074: }
075:
076: public void handleSubmitButtonRequest(RequestInvocationEvent event)
077: throws ModelControlException, SSOException {
078: getModel();
079: Gateway3View view = null;
080: view = (Gateway3View) getChild(GLOBAL_DATA_VIEW);
081: if (view != null) {
082: store(view);
083: }
084: forwardTo();
085: }
086:
087: private void store(Gateway3View view) throws SSOException {
088:
089: String configName = (String) getDisplayFieldValue(HIDDEN_CONFIG_NAME);
090:
091: GatewayModel m = getModel();
092: m.process(configName);
093: Map map = new HashMap(10);
094: List dynComps = view.getDynamicCompList();
095:
096: if (dynComps != null && !dynComps.isEmpty()) {
097: Iterator it = dynComps.iterator();
098: while (it.hasNext()) {
099: DynamicGUI dGui = (DynamicGUI) it.next();
100: if (dGui != null) {
101: Set dgValues = dGui.getValues();
102:
103: // The Display text for this property has changed on the
104: // amconsole pages to
105: // Enable Null Ciphers. However, the property name and the
106: // meaning of these property
107: // are still maintained i.e it is disableNullCipher. Hence
108: // in the UI when you check the box
109: // for enable null ciphers, actually this property
110: // "sunPortalGatewayDisableNull" should be false.
111: // Hence the following code to toggle the value. Same case
112: // also applies to when we are rendering the page
113: // Fix for bug : #5011629 plus some previous half hearted
114: // fix by someone who made the text change - Sandeep Soni
115: // but not the toggle of the value.
116: if (dGui.getName().equals(
117: "sunPortalGatewayDisableNull")) {
118: if (dgValues.size() == 1) {
119: Iterator i = dgValues.iterator();
120:
121: String s = (String) i.next(); // We know there is
122: // only one value
123: s = s.equals("true") ? "false" : "true";
124: dgValues = Collections.singleton(s);
125: }
126: }
127:
128: if (dGui.getSyntax() == DynamicGUI.SYNTAX_DATE) {
129: try {
130: dgValues = m
131: .getDateInDefaultLocale(dgValues);
132: } catch (AMConsoleException ace) {
133: GatewayAdminModelManager
134: .debugError("Error in converting value to default locale : "
135: + ace);
136: continue;
137: }
138: }
139: map.put(dGui.getName(), dgValues);
140: }
141: }
142: }
143:
144: if (!map.isEmpty()) {
145: m.store(configName, map);
146: }
147: }
148:
149: }
|