001: /**
002: * $Id: Gateway4ViewBean.java,v 1.6 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.HashMap;
022: import java.util.Iterator;
023: import java.util.List;
024: import java.util.Map;
025: import java.util.Set;
026:
027: import com.iplanet.am.console.base.model.AMConsoleException;
028: import com.iplanet.am.console.components.view.html.DynamicGUI;
029: import com.iplanet.jato.model.ModelControlException;
030: import com.iplanet.jato.view.View;
031: import com.iplanet.jato.view.event.RequestInvocationEvent;
032: import com.iplanet.jato.view.html.StaticTextField;
033: import com.iplanet.sso.SSOException;
034: import com.sun.portal.rproxy.admin.model.GatewayModel;
035:
036: public class Gateway4ViewBean extends GatewayViewBeanBase implements
037: GatewayAdminService {
038:
039: public static final String PAGE_NAME = "Gateway4";
040:
041: public static final String DEFAULT_DISPLAY_URL = "/ps/gwadmin/Gateway4.jsp";
042:
043: public Gateway4ViewBean(String pageName) {
044: super (pageName);
045: registerChildren();
046: }
047:
048: public Gateway4ViewBean() {
049: super (PAGE_NAME);
050: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
051: registerChildren();
052: }
053:
054: protected void registerChildren() {
055: super .registerChildren();
056: registerChild(GLOBAL_DATA_VIEW, Gateway4View.class);
057: }
058:
059: protected View createChild(String name) {
060: getGWModelMgr();
061: View child = null;
062:
063: if (name.equals(GLOBAL_DATA_VIEW)) {
064: child = new Gateway4View(this , GLOBAL_DATA_VIEW);
065: } else if (name.equals(CHILD_GWPROFILEFOR)) {
066: child = new StaticTextField(this , CHILD_GWPROFILEFOR,
067: modelManager.getString("props.4.1")
068: + " "
069: + modelManager.getString("props.4")
070: + " "
071: + modelManager
072: .getString("properties.label")
073: + " " + modelManager.getString("for.label"));
074: } else {
075: child = super .createChild(name);
076: }
077: return child;
078: }
079:
080: public void handleSubmitButtonRequest(RequestInvocationEvent event)
081: throws ModelControlException, SSOException {
082: getModel();
083: Gateway4View view = null;
084: view = (Gateway4View) getChild(GLOBAL_DATA_VIEW);
085: if (view != null) {
086: store(view);
087: }
088: forwardTo();
089: }
090:
091: private void store(Gateway4View view) throws SSOException {
092:
093: String configName = (String) getDisplayFieldValue(HIDDEN_CONFIG_NAME);
094: GatewayModel m = getModel();
095: m.process(configName);
096: Map map = new HashMap(10);
097: List dynComps = view.getDynamicCompList();
098:
099: if (dynComps != null && !dynComps.isEmpty()) {
100: Iterator it = dynComps.iterator();
101: while (it.hasNext()) {
102: DynamicGUI dGui = (DynamicGUI) it.next();
103: if (dGui != null) {
104: Set dgValues = dGui.getValues();
105: if (dGui.getSyntax() == DynamicGUI.SYNTAX_DATE) {
106: try {
107: dgValues = m
108: .getDateInDefaultLocale(dgValues);
109: } catch (AMConsoleException ace) {
110: GatewayAdminModelManager
111: .debugError("Error in converting value to default locale : "
112: + ace);
113: continue;
114: }
115: }
116: map.put(dGui.getName(), dgValues);
117: }
118: }
119: }
120:
121: if (!map.isEmpty()) {
122: m.store(configName, map);
123: }
124: }
125:
126: }
|