001: /*
002: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005:
006: package com.sun.portal.search.admin;
007:
008: import java.net.URL;
009: import java.io.IOException;
010: import java.util.logging.Logger;
011: import java.util.logging.Level;
012:
013: import com.sun.portal.search.admin.CSViewBeanBase;
014:
015: import javax.servlet.http.HttpServletRequest;
016: import javax.servlet.http.HttpServletResponse;
017: import com.iplanet.jato.RequestContext;
018:
019: import com.iplanet.jato.view.event.DisplayEvent;
020: import com.iplanet.jato.view.event.ChildDisplayEvent;
021: import com.iplanet.jato.view.event.RequestInvocationEvent;
022:
023: import com.iplanet.jato.view.html.StaticTextField;
024: import com.iplanet.jato.view.html.TextField;
025: import com.iplanet.jato.view.html.CheckBox;
026: import com.iplanet.jato.view.html.Button;
027: import com.iplanet.jato.view.html.ComboBox;
028: import com.iplanet.jato.view.html.RadioButtonGroup;
029: import com.iplanet.jato.view.html.HiddenField;
030:
031: import com.iplanet.jato.view.html.Option;
032: import com.iplanet.jato.view.html.OptionList;
033:
034: import com.iplanet.jato.view.View;
035: import com.iplanet.jato.view.ViewBean;
036: import com.iplanet.jato.view.ViewBeanBase;
037:
038: import com.iplanet.jato.ViewBeanManager;
039:
040: import com.iplanet.jato.model.*;
041:
042: import com.iplanet.am.console.components.view.html.IPlanetButton;
043:
044: import com.sun.portal.search.robot.*;
045: import com.sun.portal.search.admin.util.DBUtil;
046: import com.sun.portal.log.common.PortalLogger;
047:
048: /**
049: * iPS admin console view bean: TODO
050: */
051: public class SiteViewBean extends CSViewBeanBase {
052: public static final String DEFAULT_DISPLAY_URL = "/ps/searchadmin/Site.jsp";
053: public static final String PAGE_NAME = "Site";
054: public static final String ID_TEXT = "SiteID";
055: public static final String DATABASE_COMBO = "Database";
056: public static final String NICKNAME_TEXT = "Nickname";
057:
058: public static final String SERVERS_SECTION = "ServersSection";
059: //public static final String SERVER_SECTION_LABEL = "ServerSectionLabel";
060: public static final String SERVER_LIST = "ServerList";
061: public static final String ADD_SERVER_BUTTON = "addServer";
062: public static final String DEL_SERVER_BUTTON = "delServer";
063: public static final String VERIFY_BUTTON = "dnsResolve";
064:
065: // public static final String SERVER_GROUP ="ServerGroupView";
066: public static final String DOMAINS_SECTION = "DomainsSection";
067: //public static final String DOMAIN_SECTION_LABEL = "DomainSectionLabel";
068: public static final String DOMAIN_LIST = "DomainList";
069: public static final String HTTP_CHECKBOX = "http";
070: public static final String FILE_CHECKBOX = "file";
071: public static final String FTP_CHECKBOX = "ftp";
072: public static final String HTTPS_CHECKBOX = "https";
073: //public static final String PORTS_LABEL = "PortsLabel";
074: public static final String PORTS_TEXT = "Ports";
075: public static final String ADD_DOMAIN_BUTTON = "addDomain";
076: public static final String DEL_DOMAIN_BUTTON = "delDomain";
077:
078: public static final String DOMAIN_GROUP = "DomainGroupView";
079: //public static final String STARTING_SECTION_LABEL = "StartingSectionLabel";
080: //public static final String URL_LABEL = "urlLabel";
081: public static final String STARTING_LIST = "StartingList";
082: //public static final String DEPTH_LABEL = "depthLabel";
083: public static final String ADD_STARTING_BUTTON = "addStarting";
084: public static final String DEL_STARTING_BUTTON = "delStarting";
085:
086: //public static final String FILTER_SECTION_LABEL = "FilterSectionLabel";
087: public static final String FILTER_LIST = "FilterList";
088: public static final String ADD_FILTER_BUTTON = "addFilter";
089: public static final String DEL_FILTER_BUTTON = "delFilter";
090: public static final String MOVEUP_FILTER_BUTTON = "shiftFilterUp";
091: public static final String MOVEDOWN_FILTER_BUTTON = "shiftFilterDown";
092:
093: public static final String ONEXIT_COMBO = "onExit";
094: public static final String COMMENT_TEXTAREA = "Comment";
095: public static final String DNS_TRANS_TEXTAREA = "DNSTrans";
096:
097: public static final String SUBMIT_BUTTON = "SubmitButton";
098: public static final String RESET_BUTTON = "ResetButton";
099: public static final String CANCEL_BUTTON = "CancelButton";
100:
101: String rulesetID = null;
102:
103: // Create a Logger for this class
104: private static Logger debugLogger = PortalLogger
105: .getLogger(SiteViewBean.class);
106:
107: /**
108: * constructor
109: *
110: * @param PageName of this view bean
111: * @param displayURL default display URL
112: */
113: public SiteViewBean() {
114: super (PAGE_NAME);
115: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
116: registerChildren();
117: }
118:
119: /**
120: * register child component
121: */
122: protected void registerChildren() {
123: registerChild(ID_TEXT, HiddenField.class);
124: registerChild(DATABASE_COMBO, ComboBox.class);
125: registerChild(NICKNAME_TEXT, TextField.class);
126:
127: //Servers section
128: registerChild(VERIFY_BUTTON, IPlanetButton.class);
129: registerChild(ADD_SERVER_BUTTON, IPlanetButton.class);
130: registerChild(DEL_SERVER_BUTTON, IPlanetButton.class);
131: registerChild(SERVER_LIST, ServerGroupListView.class);
132:
133: //Domain section
134: registerChild(DOMAIN_LIST, DomainGroupListView.class);
135: registerChild(PORTS_TEXT, TextField.class);
136: registerChild(HTTP_CHECKBOX, CheckBox.class);
137: registerChild(FILE_CHECKBOX, CheckBox.class);
138: registerChild(FTP_CHECKBOX, CheckBox.class);
139: registerChild(HTTPS_CHECKBOX, CheckBox.class);
140: registerChild(ADD_DOMAIN_BUTTON, IPlanetButton.class);
141: registerChild(DEL_DOMAIN_BUTTON, IPlanetButton.class);
142:
143: //Starting point section
144: registerChild(ADD_STARTING_BUTTON, IPlanetButton.class);
145: registerChild(DEL_STARTING_BUTTON, IPlanetButton.class);
146: registerChild(STARTING_LIST, StartingGroupListView.class);
147:
148: //Filter definition section
149: registerChild(FILTER_LIST, FilterGroupListView.class);
150: registerChild(ADD_FILTER_BUTTON, IPlanetButton.class);
151: registerChild(DEL_FILTER_BUTTON, IPlanetButton.class);
152: registerChild(MOVEUP_FILTER_BUTTON, IPlanetButton.class);
153: registerChild(MOVEDOWN_FILTER_BUTTON, IPlanetButton.class);
154:
155: registerChild(ONEXIT_COMBO, ComboBox.class);
156:
157: registerChild(DNS_TRANS_TEXTAREA, TextField.class);
158: registerChild(COMMENT_TEXTAREA, TextField.class);
159:
160: registerChild(SUBMIT_BUTTON, IPlanetButton.class);
161: registerChild(RESET_BUTTON, IPlanetButton.class);
162: registerChild(CANCEL_BUTTON, IPlanetButton.class);
163:
164: }
165:
166: OptionList getDBListOption() {
167: try {
168: String[] dbs = DBUtil.getDBStringArray(CSConfig
169: .getServerRoot());
170: return new OptionList(dbs, dbs);
171: } catch (Exception e) {
172: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
173: .getMessage());
174: }
175:
176: return new OptionList();
177:
178: }
179:
180: /**
181: * create child component
182: *
183: * @param name of component
184: * @return child component
185: */
186: protected View createChild(String name) {
187:
188: View Headerchild = super .createChild(name);
189: if (Headerchild != null)
190: return Headerchild;
191: if (name.equals(ID_TEXT)) {
192: return new HiddenField(this , ID_TEXT, "");
193: }
194: if (name.equals(DATABASE_COMBO)) {
195: ComboBox child = new ComboBox(this , DATABASE_COMBO, "");
196: child.setOptions(getDBListOption());
197: return child;
198: }
199:
200: if (name.equals(NICKNAME_TEXT)) {
201: return new TextField(this , NICKNAME_TEXT, "");
202: }
203: if (name.equals(ADD_SERVER_BUTTON)) {
204: return new IPlanetButton(this , ADD_SERVER_BUTTON, "");
205: }
206: if (name.equals(DEL_SERVER_BUTTON)) {
207: return new IPlanetButton(this , DEL_SERVER_BUTTON, "");
208: }
209: if (name.equals(VERIFY_BUTTON)) {
210: return new IPlanetButton(this , VERIFY_BUTTON, "");
211: }
212: if (name.equals(SERVER_LIST)) {
213: return new ServerGroupListView(this , SERVER_LIST);
214: }
215: if (name.equals(DOMAIN_LIST)) {
216: return new DomainGroupListView(this , DOMAIN_LIST);
217: }
218: if (name.equals(HTTP_CHECKBOX)) {
219: return new CheckBox(this , HTTP_CHECKBOX, "true", "false",
220: false);
221: }
222: if (name.equals(FILE_CHECKBOX)) {
223: return new CheckBox(this , FILE_CHECKBOX, "true", "false",
224: false);
225: }
226: if (name.equals(FTP_CHECKBOX)) {
227: return new CheckBox(this , FTP_CHECKBOX, "true", "false",
228: false);
229: }
230: if (name.equals(HTTPS_CHECKBOX)) {
231: return new CheckBox(this , HTTPS_CHECKBOX, "true", "false",
232: false);
233: }
234: if (name.equals(PORTS_TEXT)) {
235: return new TextField(this , PORTS_TEXT, "");
236: }
237: if (name.equals(ADD_DOMAIN_BUTTON)) {
238: return new IPlanetButton(this , ADD_DOMAIN_BUTTON, "");
239: }
240: if (name.equals(DEL_DOMAIN_BUTTON)) {
241: return new IPlanetButton(this , DEL_DOMAIN_BUTTON, "");
242: }
243: if (name.equals(STARTING_LIST)) {
244: return new StartingGroupListView(this , STARTING_LIST);
245: }
246: if (name.equals(ADD_STARTING_BUTTON)) {
247: return new IPlanetButton(this , ADD_STARTING_BUTTON, "");
248: }
249: if (name.equals(DEL_STARTING_BUTTON)) {
250: return new IPlanetButton(this , DEL_STARTING_BUTTON, "");
251: }
252: if (name.equals(FILTER_LIST)) {
253: return new FilterGroupListView(this , FILTER_LIST);
254: }
255: if (name.equals(ADD_FILTER_BUTTON)) {
256: return new IPlanetButton(this , ADD_FILTER_BUTTON, "");
257: }
258: if (name.equals(DEL_FILTER_BUTTON)) {
259: return new IPlanetButton(this , DEL_FILTER_BUTTON, "");
260: }
261: if (name.equals(MOVEUP_FILTER_BUTTON)) {
262: return new IPlanetButton(this , MOVEUP_FILTER_BUTTON, "");
263: }
264: if (name.equals(MOVEDOWN_FILTER_BUTTON)) {
265: return new IPlanetButton(this , MOVEDOWN_FILTER_BUTTON, "");
266: }
267: if (name.equals(ONEXIT_COMBO)) {
268: ComboBox child = new ComboBox(this , ONEXIT_COMBO, "");
269: OptionList matchOptions = new OptionList(
270: this .getLocalizedStringArray("site.filter.options",
271: ","), // labels
272: new String[] { "deny", "allow" }); // values
273:
274: child.setOptions(matchOptions);
275: return child;
276: }
277: if (name.equals(COMMENT_TEXTAREA)) {
278: return new TextField(this , COMMENT_TEXTAREA, "");
279: }
280: if (name.equals(DNS_TRANS_TEXTAREA)) {
281: return new TextField(this , DNS_TRANS_TEXTAREA, "");
282: }
283: if (name.equals(SUBMIT_BUTTON)) {
284: return new IPlanetButton(this , SUBMIT_BUTTON, "");
285: }
286: if (name.equals(RESET_BUTTON)) {
287: return new IPlanetButton(this , RESET_BUTTON, "");
288: }
289: if (name.equals(CANCEL_BUTTON)) {
290: return new IPlanetButton(this , CANCEL_BUTTON, "");
291: }
292:
293: throw new IllegalArgumentException("Invalid child name ["
294: + name + "]");
295: }
296:
297: /** begin displaying page. we set the required information
298: *
299: * @param event display event
300: * @throws ModelControlException if problem access value of component
301: */
302: public void beginDisplay(DisplayEvent event) {
303: setPageEncoding();
304: setDisplayFieldValue(SUBMIT_BUTTON,
305: getLocalizedString("submit.text"));
306: setDisplayFieldValue(RESET_BUTTON,
307: getLocalizedString("reset.text"));
308: setDisplayFieldValue(CANCEL_BUTTON,
309: getLocalizedString("cancel.text"));
310: setDisplayFieldValue(MOVEDOWN_FILTER_BUTTON,
311: getLocalizedString("movedown.text"));
312: setDisplayFieldValue(MOVEUP_FILTER_BUTTON,
313: getLocalizedString("moveup.text"));
314: setDisplayFieldValue(DEL_FILTER_BUTTON,
315: getLocalizedString("delete.text"));
316: setDisplayFieldValue(ADD_FILTER_BUTTON,
317: getLocalizedString("add.text"));
318: setDisplayFieldValue(DEL_STARTING_BUTTON,
319: getLocalizedString("delete.text"));
320: setDisplayFieldValue(ADD_STARTING_BUTTON,
321: getLocalizedString("add.text"));
322: setDisplayFieldValue(DEL_DOMAIN_BUTTON,
323: getLocalizedString("delete.text"));
324: setDisplayFieldValue(ADD_DOMAIN_BUTTON,
325: getLocalizedString("add.text"));
326: setDisplayFieldValue(VERIFY_BUTTON,
327: getLocalizedString("site.verify"));
328: setDisplayFieldValue(DEL_SERVER_BUTTON,
329: getLocalizedString("delete.text"));
330: setDisplayFieldValue(ADD_SERVER_BUTTON,
331: getLocalizedString("add.text"));
332:
333: // Get request attributes and store them as Page Session Attributes
334: RequestContext rc = getRequestContext();
335: HttpServletRequest req = rc.getRequest();
336: rulesetID = req.getParameter("id");
337: if (rulesetID != null) {
338: this .setDisplayFieldValue(ID_TEXT, rulesetID);
339: } else {
340:
341: rulesetID = this .getDisplayFieldStringValue(ID_TEXT);
342: }
343: ServerGroupListView child_servers = (ServerGroupListView) this
344: .getChild(SERVER_LIST);
345: child_servers.rulesetID = rulesetID;
346: DomainGroupListView child_domains = (DomainGroupListView) this
347: .getChild(DOMAIN_LIST);
348: child_domains.rulesetID = rulesetID;
349: StartingGroupListView child_startings = (StartingGroupListView) this
350: .getChild(STARTING_LIST);
351: child_startings.rulesetID = rulesetID;
352: FilterGroupListView child_filters = (FilterGroupListView) this
353: .getChild(FILTER_LIST);
354: child_filters.rulesetID = rulesetID;
355:
356: FilterRuleset frs = CSConfig.getRobotConfig().GetRuleSet(
357: rulesetID);
358: this .setDisplayFieldValue(NICKNAME_TEXT, frs.nickname);
359: setDisplayFieldValue(PORTS_TEXT, frs.ports);
360: CheckBox child = (CheckBox) this .getChild(HTTP_CHECKBOX);
361: child.setChecked(frs.isProtocolChecked(HTTP_CHECKBOX));
362: child = (CheckBox) this .getChild(FILE_CHECKBOX);
363: child.setChecked(frs.isProtocolChecked(FILE_CHECKBOX));
364: child = (CheckBox) this .getChild(FTP_CHECKBOX);
365: child.setChecked(frs.isProtocolChecked(FTP_CHECKBOX));
366: child = (CheckBox) this .getChild(HTTPS_CHECKBOX);
367: child.setChecked(frs.isProtocolChecked(HTTPS_CHECKBOX));
368:
369: setDisplayFieldValue(ONEXIT_COMBO, RobotConfig
370: .ADtoString(frs.onExit));
371: setDisplayFieldValue(COMMENT_TEXTAREA, frs.getComments());
372: setDisplayFieldValue(DNS_TRANS_TEXTAREA, frs
373: .getDNSTranslation());
374: ComboBox childDatabase = (ComboBox) getChild(DATABASE_COMBO);
375: childDatabase
376: .setLabelForNoneSelected(getLocalizedString("site.db.usedefault"));
377: setDisplayFieldValue(DATABASE_COMBO, frs.getDatabase());
378: }
379:
380: public boolean beginServersSectionDisplay(ChildDisplayEvent event) {
381: FilterRuleset frs = CSConfig.getRobotConfig().GetRuleSet(
382: rulesetID);
383: return (frs.getType() == FilterRuleset.TYPE_SERVERS);
384: }
385:
386: public boolean beginDomainsSectionDisplay(ChildDisplayEvent event) {
387: FilterRuleset frs = CSConfig.getRobotConfig().GetRuleSet(
388: rulesetID);
389: return (frs.getType() == FilterRuleset.TYPE_DOMAINS);
390: }
391:
392: public void handleAddStartingRequest(RequestInvocationEvent event)
393: throws ModelControlException {
394: setPageSessionAttribute("retrieved", "true");
395: rulesetID = this .getDisplayFieldStringValue(ID_TEXT);
396: StartingGroupListView child = (StartingGroupListView) getChild(STARTING_LIST);
397: child.rulesetID = rulesetID;
398: try {
399: ModelExecutionContext modExe = new ModelExecutionContextBase(
400: ModelExecutionContext.OPERATION_INSERT);
401: child.executeAutoInsertingModels(modExe);
402: } catch (ModelControlException e) {
403: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
404: .getMessage());
405: }
406: forwardTo();
407: }
408:
409: public void handleAddFilterRequest(RequestInvocationEvent event)
410: throws ModelControlException {
411: setPageSessionAttribute("retrieved", "true");
412: rulesetID = getDisplayFieldStringValue(ID_TEXT);
413: FilterGroupListView child = (FilterGroupListView) getChild(FILTER_LIST);
414: child.rulesetID = rulesetID;
415: try {
416: ModelExecutionContext modExe = new ModelExecutionContextBase(
417: ModelExecutionContext.OPERATION_INSERT);
418: child.executeAutoInsertingModels(modExe);
419: } catch (ModelControlException e) {
420: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
421: .getMessage());
422: }
423: forwardTo();
424:
425: }
426:
427: public void handleAddServerRequest(RequestInvocationEvent event)
428: throws ModelControlException {
429: setPageSessionAttribute("retrieved", "true");
430: rulesetID = this .getDisplayFieldStringValue(ID_TEXT);
431: ServerGroupListView child = (ServerGroupListView) getChild(SERVER_LIST);
432: child.rulesetID = rulesetID;
433: try {
434: ModelExecutionContext modExe = new ModelExecutionContextBase(
435: ModelExecutionContext.OPERATION_INSERT);
436: child.executeAutoInsertingModels(modExe);
437: } catch (ModelControlException e) {
438: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
439: .getMessage());
440: }
441: forwardTo();
442: }
443:
444: public void handleDelServerRequest(RequestInvocationEvent event)
445: throws ModelControlException {
446: setPageSessionAttribute("retrieved", "true");
447: //rulesetID = this.getDisplayFieldStringValue(ID_TEXT);
448: ServerGroupListView child = (ServerGroupListView) getChild(SERVER_LIST);
449: //child.rulesetID = rulesetID;
450: //child.handleDelServerRequest(event);
451: try {
452: ModelExecutionContext modExe = new ModelExecutionContextBase(
453: ModelExecutionContext.OPERATION_DELETE);
454: child.executeAutoDeletingModels(modExe);
455: } catch (ModelControlException e) {
456: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
457: .getMessage());
458: }
459: forwardTo();
460: }
461:
462: public void handleDelDomainRequest(RequestInvocationEvent event)
463: throws ModelControlException {
464: setPageSessionAttribute("retrieved", "true");
465: //rulesetID = this.getDisplayFieldStringValue(ID_TEXT);
466: DomainGroupListView child = (DomainGroupListView) getChild(DOMAIN_LIST);
467: //child.rulesetID = rulesetID;
468: //child.handleDelServerRequest(event);
469: try {
470: ModelExecutionContext modExe = new ModelExecutionContextBase(
471: ModelExecutionContext.OPERATION_DELETE);
472: child.executeAutoDeletingModels(modExe);
473: } catch (ModelControlException e) {
474: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
475: .getMessage());
476: }
477: forwardTo();
478: }
479:
480: public void handleDelStartingRequest(RequestInvocationEvent event)
481: throws ModelControlException {
482: setPageSessionAttribute("retrieved", "true");
483: //rulesetID = this.getDisplayFieldStringValue(ID_TEXT);
484: StartingGroupListView child = (StartingGroupListView) getChild(STARTING_LIST);
485: //child.rulesetID = rulesetID;
486: //child.handleDelServerRequest(event);
487: try {
488: ModelExecutionContext modExe = new ModelExecutionContextBase(
489: ModelExecutionContext.OPERATION_DELETE);
490: child.executeAutoDeletingModels(modExe);
491: } catch (ModelControlException e) {
492: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
493: .getMessage());
494: }
495: forwardTo();
496: }
497:
498: public void handleDelFilterRequest(RequestInvocationEvent event)
499: throws ModelControlException {
500: setPageSessionAttribute("retrieved", "true");
501: //rulesetID = this.getDisplayFieldStringValue(ID_TEXT);
502: FilterGroupListView child = (FilterGroupListView) getChild(FILTER_LIST);
503: //child.rulesetID = rulesetID;
504: //child.handleDelServerRequest(event);
505: try {
506: ModelExecutionContext modExe = new ModelExecutionContextBase(
507: ModelExecutionContext.OPERATION_DELETE);
508: child.executeAutoDeletingModels(modExe);
509: } catch (ModelControlException e) {
510: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
511: .getMessage());
512: }
513: forwardTo();
514: }
515:
516: public void handleDnsResolveRequest(RequestInvocationEvent event)
517: throws ModelControlException {
518: forwardTo();
519: }
520:
521: public void handleAddDomainRequest(RequestInvocationEvent event)
522: throws ModelControlException {
523: setPageSessionAttribute("retrieved", "true");
524: rulesetID = this .getDisplayFieldStringValue(ID_TEXT);
525: DomainGroupListView child = (DomainGroupListView) getChild(DOMAIN_LIST);
526: child.rulesetID = rulesetID;
527: try {
528: ModelExecutionContext modExe = new ModelExecutionContextBase(
529: ModelExecutionContext.OPERATION_INSERT);
530: child.executeAutoInsertingModels(modExe);
531: } catch (ModelControlException e) {
532: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
533: .getMessage());
534: }
535: forwardTo();
536: }
537:
538: public void handleSubmitButtonRequest(RequestInvocationEvent event)
539: throws ModelControlException {
540: rulesetID = getDisplayFieldStringValue(ID_TEXT);
541: RobotConfig rc = CSConfig.getRobotConfig();
542: FilterRuleset frs = rc.GetRuleSet(rulesetID);
543: frs.nickname = getDisplayFieldStringValue(NICKNAME_TEXT);
544: String onExit = getDisplayFieldStringValue(ONEXIT_COMBO);
545: if (onExit != null) {
546: frs.onExit = RobotConfig.ADStringtoBoolean(onExit);
547: }
548: String database = getDisplayFieldStringValue(DATABASE_COMBO);
549: if (database.length() == 0) {
550: database = null;
551: }
552: frs.setDatabase(database);
553: String comment = getDisplayFieldStringValue(COMMENT_TEXTAREA);
554: frs.removeComment();
555: if (comment != null && comment.length() > 0) {
556: frs.addComments(comment);
557: }
558: String dnsTrans = getDisplayFieldStringValue(DNS_TRANS_TEXTAREA);
559: frs.removeDNSTranslation();
560: if (dnsTrans != null && dnsTrans.length() > 0) {
561: frs.addDNSTranslation(dnsTrans);
562: }
563:
564: StartingGroupListView spList = (StartingGroupListView) getChild(STARTING_LIST);
565: try {
566: ModelExecutionContext modExe = new ModelExecutionContextBase(
567: ModelExecutionContext.OPERATION_UPDATE);
568: this .executeAutoExecutingModels(modExe);
569: if (spList != null) {
570: spList.rulesetID = rulesetID;
571: spList.executeAutoUpdatingModels(modExe);
572: }
573: FilterGroupListView frList = (FilterGroupListView) getChild(FILTER_LIST);
574: if (frList != null) {
575: frList.rulesetID = rulesetID;
576: frList.executeAutoUpdatingModels(modExe);
577: }
578: if (frs.getType() == FilterRuleset.TYPE_SERVERS) {
579: ServerGroupListView serverList = (ServerGroupListView) getChild(SERVER_LIST);
580: if (serverList != null) {
581: serverList.rulesetID = rulesetID;
582: serverList.executeAutoUpdatingModels(modExe);
583: }
584: } else {
585: DomainGroupListView domainList = (DomainGroupListView) getChild(DOMAIN_LIST);
586: if (domainList != null) {
587: domainList.rulesetID = rulesetID;
588: domainList.executeAutoUpdatingModels(modExe);
589: }
590: frs.ports = this .getDisplayFieldStringValue(PORTS_TEXT);
591: frs.removeProtocol();
592:
593: CheckBox child = (CheckBox) this
594: .getChild(HTTP_CHECKBOX);
595: if (child.isChecked()) {
596: frs.addProtocol("http");
597: }
598: child = (CheckBox) this .getChild(FILE_CHECKBOX);
599: if (child.isChecked()) {
600: frs.addProtocol("file");
601: }
602: child = (CheckBox) this .getChild(FTP_CHECKBOX);
603: if (child.isChecked()) {
604: frs.addProtocol("ftp");
605: }
606: child = (CheckBox) this .getChild(HTTPS_CHECKBOX);
607: if (child.isChecked()) {
608: frs.addProtocol("https");
609: }
610: }
611: rc.updateFile();
612: } catch (ModelControlException e) {
613: debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
614: .getMessage());
615: }
616: clearPageSessionAttributes();
617: HttpServletResponse response = this .getRequestContext()
618: .getResponse();
619: try {
620: response.sendRedirect("Sites");
621: } catch (IOException e) {
622: //TOFIX: handle this
623: }
624: }
625:
626: public void handleResetButtonRequest(RequestInvocationEvent event)
627: throws ModelControlException {
628: clearPageSessionAttributes();
629: forwardTo();
630: }
631:
632: }
|