001: /**
002: * $Id: Gateway5ViewBean.java,v 1.4 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 Gateway5ViewBean extends GatewayViewBeanBase implements
037: GatewayAdminService {
038:
039: public static final String PAGE_NAME = "Gateway5";
040:
041: public static final String DEFAULT_DISPLAY_URL = "/ps/gwadmin/Gateway5.jsp";
042:
043: public Gateway5ViewBean(String pageName) {
044: super (pageName);
045: registerChildren();
046: }
047:
048: public Gateway5ViewBean() {
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, Gateway5View.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 Gateway5View(this , GLOBAL_DATA_VIEW);
065: } else if (name.equals(CHILD_GWPROFILEFOR)) {
066: child = new StaticTextField(this , CHILD_GWPROFILEFOR,
067: modelManager.getString("props.5") + " "
068: + modelManager.getString("for.label"));
069: } else {
070: child = super .createChild(name);
071: }
072: return child;
073: }
074:
075: public void handleSubmitButtonRequest(RequestInvocationEvent event)
076: throws ModelControlException, SSOException {
077: getModel();
078: Gateway5View view = null;
079: view = (Gateway5View) getChild(GLOBAL_DATA_VIEW);
080: if (view != null) {
081: store(view);
082: }
083: forwardTo();
084: }
085:
086: private void store(Gateway5View view) throws SSOException {
087:
088: String configName = (String) getDisplayFieldValue(HIDDEN_CONFIG_NAME);
089: GatewayModel m = getModel();
090: m.process(configName);
091: Map map = new HashMap(10);
092: List dynComps = view.getDynamicCompList();
093:
094: if (dynComps != null && !dynComps.isEmpty()) {
095: Iterator it = dynComps.iterator();
096: while (it.hasNext()) {
097: DynamicGUI dGui = (DynamicGUI) it.next();
098: if (dGui != null) {
099: Set dgValues = dGui.getValues();
100: if (dGui.getSyntax() == DynamicGUI.SYNTAX_DATE) {
101: try {
102: dgValues = m
103: .getDateInDefaultLocale(dgValues);
104: } catch (AMConsoleException ace) {
105: GatewayAdminModelManager
106: .debugError("Error in converting value to default locale : "
107: + ace);
108: continue;
109: }
110: }
111: map.put(dGui.getName(), dgValues);
112: }
113: }
114: }
115:
116: if (!map.isEmpty()) {
117: m.store(configName, map);
118: }
119: }
120:
121: }
|