001: /**
002: * Copyright 2002 Sun Microsystems, Inc. All
003: * rights reserved. Use of this product is subject
004: * to license terms. Federal Acquisitions:
005: * Commercial Software -- Government Users
006: * Subject to Standard License Terms and
007: * Conditions.
008: *
009: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010: * are trademarks or registered trademarks of Sun Microsystems,
011: * Inc. in the United States and other countries.
012: *
013: * Author: Anurag Gupta
014: */package com.sun.portal.netfile.admin;
015:
016: // JDK classes
017: import java.io.Serializable;
018: import com.sun.portal.log.common.PortalLogger;
019: import java.util.HashMap;
020: import java.util.HashSet;
021: import java.util.Iterator;
022: import java.util.Map;
023: import java.util.NoSuchElementException;
024: import java.util.Set;
025: import java.util.StringTokenizer;
026: import java.util.Vector;
027: import java.security.AccessController;
028:
029: import com.sun.identity.security.EncryptAction;
030:
031: // Servlet classes
032: import javax.servlet.http.HttpServletRequest;
033:
034: // iPlanet JATO classes
035: import com.iplanet.jato.model.ModelControlException;
036: import com.iplanet.jato.view.View;
037: import com.iplanet.jato.view.ViewBean;
038: import com.iplanet.jato.view.event.ChildDisplayEvent;
039: import com.iplanet.jato.view.event.DisplayEvent;
040: import com.iplanet.jato.view.event.RequestInvocationEvent;
041: import com.iplanet.jato.view.html.ComboBox;
042: import com.iplanet.jato.view.html.HiddenField;
043: import com.iplanet.jato.view.html.HREF;
044: import com.iplanet.jato.view.html.ListBox;
045: import com.iplanet.jato.view.html.OptionList;
046: import com.iplanet.jato.view.html.StaticTextField;
047: import com.iplanet.jato.view.html.TextField;
048:
049: // iDS/AME classes
050: import com.iplanet.am.console.base.AMViewBeanBase;
051: import com.iplanet.am.console.components.view.html.IPlanetButton;
052: import com.iplanet.am.console.components.view.html.MessageBox;
053:
054: // NetFile admin console classes
055: import com.sun.portal.netfile.admin.model.NetFileUserProfileModelImpl;
056:
057: public class NetFileHostsUserProfileViewBean extends AMViewBeanBase
058: implements NetFileHostConstants, NetFileHostTypeConstants,
059: NetFileEncodingTypeConstants {
060: public static final String PAGE_NAME = "NetFileHostsUserProfile";
061: public static final String DEFAULT_DISPLAY_URL = "/ps/netfileadmin/NetFileHostsUserProfile.jsp";
062:
063: public static final String ATTR_OSCHARSET = "sunPortalNetFileOSCharSet";
064:
065: private NetFileAdminModelManager modelManager = null;
066: private NetFileUserProfileModelImpl model = null;
067:
068: private String userDN = null;
069: private Vector netFileHosts = null;
070: private int currentRow = -1;
071:
072: /**
073: * Default Constructor
074: */
075: public NetFileHostsUserProfileViewBean() {
076: super (PAGE_NAME);
077: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
078: registerChildren();
079: }
080:
081: public NetFileHostsUserProfileViewBean(String pageName) {
082: super (pageName);
083: registerChildren();
084: }
085:
086: /**
087: * Creates the child view objects for this viewbean.
088: * @param name the name of the child view object to be created.
089: * @return the child view object.
090: */
091: protected View createChild(String name) {
092: getModelMgr();
093: if (name.equals(PAGE_TITLE)) {
094: return new StaticTextField(this , PAGE_TITLE, modelManager
095: .getString("HTMLPage.title"));
096: } else if (name.equals(PAGE_DESC)) {
097: return new StaticTextField(this , PAGE_DESC, "");
098: } else if (name.equals(PAGE_DESC_HREF)) {
099: return new HREF(this , PAGE_DESC_HREF, "");
100: } else if (name.equals(PAGE_DESC_ACTION)) {
101: return new StaticTextField(this , PAGE_DESC_ACTION,
102: modelManager.getString("edithost.pagetitle"));
103: } else if (name.equals(CHILD_CC_MSGBOX)) {
104: return new MessageBox(this , CHILD_CC_MSGBOX, "");
105: } else if (name.equals(CHILD_HOSTNAME_LBL)) {
106: return new StaticTextField(this , CHILD_HOSTNAME_LBL,
107: modelManager.getString("hostname.label"));
108: } else if (name.equals(CHILD_HOSTNAME)) {
109: return new TextField(this , CHILD_HOSTNAME, "");
110: } else if (name.equals(CHILD_HOSTTYPE_LBL)) {
111: return new StaticTextField(this , CHILD_HOSTTYPE_LBL,
112: modelManager.getString("hosttype.label"));
113: } else if (name.equals(CHILD_HOSTTYPE)) {
114: return new ComboBox(this , CHILD_HOSTTYPE, "");
115: } else if (name.equals(CHILD_HOSTENCODING_LBL)) {
116: return new StaticTextField(this , CHILD_HOSTENCODING_LBL,
117: modelManager.getString("hostencoding.label"));
118: } else if (name.equals(CHILD_HOSTENCODING)) {
119: return new ComboBox(this , CHILD_HOSTENCODING, "");
120: } else if (name.equals(CHILD_HOSTDOMAIN_LBL)) {
121: return new StaticTextField(this , CHILD_HOSTDOMAIN_LBL,
122: modelManager.getString("hostdomain.label"));
123: } else if (name.equals(CHILD_HOSTDOMAIN)) {
124: return new TextField(this , CHILD_HOSTDOMAIN, "");
125: } else if (name.equals(CHILD_HOSTUSERNAME_LBL)) {
126: return new StaticTextField(this , CHILD_HOSTUSERNAME_LBL,
127: modelManager.getString("hostusername.label"));
128: } else if (name.equals(CHILD_HOSTUSERNAME)) {
129: return new TextField(this , CHILD_HOSTUSERNAME, "");
130: } else if (name.equals(CHILD_HOSTPASSWORD_LBL)) {
131: return new StaticTextField(this , CHILD_HOSTPASSWORD_LBL,
132: modelManager.getString("hostpassword.label"));
133: } else if (name.equals(CHILD_HOSTPASSWORD)) {
134: return new TextField(this , CHILD_HOSTPASSWORD, "");
135: } else if (name.equals(CHILD_HOSTSHARELIST_LBL)) {
136: return new StaticTextField(this , CHILD_HOSTSHARELIST_LBL,
137: modelManager.getString("hostsharelist.label"));
138: } else if (name.equals(CHILD_HOSTSHARELIST)) {
139: return new ListBox(this , CHILD_HOSTSHARELIST, "");
140: } else if (name.equals(CHILD_HOSTSHARENAME_LBL)) {
141: return new StaticTextField(this , CHILD_HOSTSHARENAME_LBL,
142: modelManager.getString("hostsharename.label"));
143: } else if (name.equals(CHILD_HOSTSHARENAME)) {
144: return new TextField(this , CHILD_HOSTSHARENAME, "");
145: } else if (name.equals(CHILD_HOSTSHAREPASSWORD_LBL)) {
146: return new StaticTextField(this ,
147: CHILD_HOSTSHAREPASSWORD_LBL, modelManager
148: .getString("hostsharepassword.label"));
149: } else if (name.equals(CHILD_HOSTSHAREPASSWORD)) {
150: return new TextField(this , CHILD_HOSTSHAREPASSWORD, "");
151: /*
152: } else if ( name.equals(CHILD_HOSTSHAREUSER_LBL) ) {
153: return new StaticTextField(this, CHILD_HOSTSHAREUSER_LBL, modelManager.getString("hostshareuser.label"));
154: } else if ( name.equals(CHILD_HOSTSHAREUSER) ) {
155: return new TextField(this, CHILD_HOSTSHAREUSER, "");
156: } else if ( name.equals(CHILD_HOSTSHAREPASS_LBL) ) {
157: return new StaticTextField(this, CHILD_HOSTSHAREPASS_LBL, modelManager.getString("hostsharepass.label"));
158: } else if ( name.equals(CHILD_HOSTSHAREPASS) ) {
159: return new TextField(this, CHILD_HOSTSHAREPASS, "");
160: */
161: } else if (name.equals(CHILD_HOST_INDEX)) {
162: return new HiddenField(this , CHILD_HOST_INDEX, "");
163: } else if (name.equals(CHILD_SAVE_BTN)) {
164: return new IPlanetButton(this , CHILD_SAVE_BTN, modelManager
165: .getString("ok.button"));
166: } else if (name.equals(CHILD_CANCEL_BTN)) {
167: return new IPlanetButton(this , CHILD_CANCEL_BTN,
168: modelManager.getString("cancel.button"));
169: } else if (name.equals(CHILD_REMOVE_BTN)) {
170: return new StaticTextField(this , CHILD_REMOVE_BTN,
171: modelManager.getString("remove.button"));
172: } else if (name.equals(CHILD_ADDTOLIST_BTN)) {
173: return new StaticTextField(this , CHILD_ADDTOLIST_BTN,
174: modelManager.getString("addtolist.button"));
175: } else if (name.equals(CHILD_ERRORMSGS)) {
176: return new StaticTextField(this , CHILD_ERRORMSGS, "");
177: } else {
178: return super .createChild(name);
179: }
180: }
181:
182: /**
183: * To register all the child view objects and their classes.
184: */
185: protected void registerChildren() {
186: registerChild(PAGE_TITLE, StaticTextField.class);
187: registerChild(PAGE_DESC, StaticTextField.class);
188: registerChild(PAGE_DESC_HREF, HREF.class);
189: registerChild(PAGE_DESC_ACTION, StaticTextField.class);
190: registerChild(CHILD_CC_MSGBOX, MessageBox.class);
191: registerChild(CHILD_HOSTNAME_LBL, StaticTextField.class);
192: registerChild(CHILD_HOSTNAME, TextField.class);
193: registerChild(CHILD_HOSTTYPE_LBL, StaticTextField.class);
194: registerChild(CHILD_HOSTTYPE, ComboBox.class);
195: registerChild(CHILD_HOSTENCODING_LBL, StaticTextField.class);
196: registerChild(CHILD_HOSTENCODING, ComboBox.class);
197: registerChild(CHILD_HOSTDOMAIN_LBL, StaticTextField.class);
198: registerChild(CHILD_HOSTDOMAIN, TextField.class);
199: registerChild(CHILD_HOSTUSERNAME_LBL, StaticTextField.class);
200: registerChild(CHILD_HOSTUSERNAME, TextField.class);
201: registerChild(CHILD_HOSTPASSWORD_LBL, StaticTextField.class);
202: registerChild(CHILD_HOSTPASSWORD, TextField.class);
203: registerChild(CHILD_HOSTSHARELIST_LBL, StaticTextField.class);
204: registerChild(CHILD_HOSTSHARELIST, ListBox.class);
205: registerChild(CHILD_HOSTSHARENAME_LBL, StaticTextField.class);
206: registerChild(CHILD_HOSTSHARENAME, TextField.class);
207: /*
208: registerChild(CHILD_HOSTSHAREUSER_LBL, StaticTextField.class);
209: registerChild(CHILD_HOSTSHAREUSER, TextField.class);
210: registerChild(CHILD_HOSTSHAREPASS_LBL, StaticTextField.class);
211: registerChild(CHILD_HOSTSHAREPASS, TextField.class);
212: */
213: registerChild(CHILD_HOST_INDEX, HiddenField.class);
214: registerChild(CHILD_ERRORMSGS, StaticTextField.class);
215: registerChild(CHILD_SAVE_BTN, IPlanetButton.class);
216: registerChild(CHILD_CANCEL_BTN, IPlanetButton.class);
217: registerChild(CHILD_REMOVE_BTN, StaticTextField.class);
218: registerChild(CHILD_ADDTOLIST_BTN, StaticTextField.class);
219: }
220:
221: public void beginDisplay(DisplayEvent event)
222: throws ModelControlException {
223: getModel();
224: getModelMgr();
225: setChildValues(model);
226: Set s = model.getNetFileHosts();
227: netFileHosts = new Vector(s);
228: currentRow = modelManager.getCurrentNetFileHostsRow();
229: setDisplayFieldValue(PAGE_DESC, model.getServiceDescription());
230: setDisplayFieldValue(CHILD_ERRORMSGS, getErrorMessages());
231: ComboBox hostTypeCB = setHostTypeOptions();
232: ComboBox hostEncodingCB = setHostEncodingOptions();
233: String currentHost = null;
234:
235: if (currentRow == -1) { // Adding new host
236: currentHost = SAMPLE_HOST;
237: // Set the encoding type to default OS Char Set
238: Set valueSet = model.getAttrValues(ATTR_OSCHARSET);
239: String value = null;
240: if (valueSet != null && valueSet.iterator().hasNext()) {
241: value = (String) valueSet.iterator().next();
242: }
243: currentHost = currentHost.substring(0, currentHost
244: .indexOf(hostListStrEncoding))
245: + hostListStrEncoding
246: + value
247: + "\n"
248: + currentHost.substring(currentHost
249: .indexOf(hostListStrDomain));
250: setDisplayFieldValue(PAGE_DESC_ACTION, modelManager
251: .getString("addhost.pagetitle"));
252: } else { // Editing an existing host
253: currentHost = (String) netFileHosts.get(currentRow);
254: setDisplayFieldValue(PAGE_DESC_ACTION, modelManager
255: .getString("edithost.pagetitle"));
256: }
257: setDisplayFieldValue(CHILD_HOST_INDEX, currentRow);
258:
259: //NetFileAdminModelManager.debugMessage("CurrentHost -> " + currentHost);
260:
261: StringTokenizer st = new StringTokenizer(currentHost,
262: HOST_DELIM);
263: String tmp = null;
264: try {
265: tmp = st.nextToken();
266: setDisplayFieldValue(CHILD_HOSTNAME, tmp
267: .substring(hostListStrHost.length()));
268:
269: tmp = st.nextToken();
270: tmp = tmp.substring(hostListStrType.length());
271: if ("NT".equals(tmp)) {
272: hostTypeCB.setValue("WIN");
273: } else {
274: hostTypeCB.setValue(tmp);
275: }
276:
277: tmp = st.nextToken();
278: hostEncodingCB.setValue(tmp.substring(hostListStrEncoding
279: .length()));
280:
281: tmp = st.nextToken();
282: setDisplayFieldValue(CHILD_HOSTDOMAIN, tmp
283: .substring(hostListStrDomain.length()));
284:
285: tmp = st.nextToken();
286: setDisplayFieldValue(CHILD_HOSTPASSWORD, tmp
287: .substring(hostListStrPass.length()));
288:
289: tmp = st.nextToken();
290: setDisplayFieldValue(CHILD_HOSTUSERNAME, tmp
291: .substring(hostListStrUser.length()));
292:
293: OptionList optList = new OptionList();
294: ListBox lb = (ListBox) getChild(CHILD_HOSTSHARELIST);
295: String shareName;
296: String sharePassword;
297: String shareentry = null;
298: while (st.hasMoreTokens()) {
299: shareName = st.nextToken(); //Share Name
300: shareName = shareName.substring(hostListStrShare
301: .length());
302: sharePassword = st.nextToken(); //Share Password
303: sharePassword = sharePassword
304: .substring(hostListStrSharePass.length());
305: shareentry = shareName + HOST_DELIM + sharePassword;
306: optList.add(shareName, shareentry);
307: }
308: optList.add("---------------------------------------", "");
309: lb.setOptions(optList);
310: } catch (NoSuchElementException nsee) {
311: NetFileAdminModelManager.debugError(
312: "Error parsing netfile hosts ", nsee);
313: }
314: }
315:
316: public boolean beginNetFileHostsBtnBlockDisplay(
317: ChildDisplayEvent event) {
318: getModel();
319: return !model.isReadOnly("sunPortalNetFileCommonHostData");
320: }
321:
322: public void handleSaveButtonRequest(RequestInvocationEvent event)
323: throws ModelControlException {
324: /*
325: * Get all the display field values and store it to the backend
326: */
327: getModel();
328: getModelMgr();
329: Set s = model.getNetFileHosts();
330: netFileHosts = new Vector(s);
331: String currRow = (String) getDisplayFieldValue(CHILD_HOST_INDEX);
332: try {
333: currentRow = Integer.parseInt(currRow);
334: } catch (NumberFormatException nfe) {
335: currentRow = -1;
336: NetFileAdminModelManager.debugError(
337: "Error getting host index : ", nfe);
338: }
339: StringBuffer nhBuffer = new StringBuffer();
340: String newHost = null;
341: Set newHostSet = null;
342: Map newMap = null;
343:
344: String str1 = (String) getDisplayFieldValue(CHILD_HOSTNAME);
345:
346: //Check for empty hostname when adding a new host
347: if ((str1 == null) || (str1.trim().length() == 0)) {
348: MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
349: msgBox.setTitle(modelManager.getString("error.title"));
350: msgBox.setMessage(modelManager.getString("hostname.error"));
351: msgBox.setType(MessageBox.TYPE_ERROR);
352: msgBox.setVisible(true);
353:
354: /* Redisplay the page with the error */
355: forwardTo();
356: return;
357: }
358:
359: //Check for invalid hostname when adding a new host
360: char ch = str1.charAt(0);
361: if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9'))) {
362:
363: MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
364: msgBox.setTitle(modelManager.getString("error.title"));
365: msgBox.setMessage(modelManager.getString("hostname.error"));
366: msgBox.setType(MessageBox.TYPE_ERROR);
367: msgBox.setVisible(true);
368:
369: /* Redisplay the page with the error */
370: forwardTo();
371: return;
372: }
373:
374: /*
375: * Test for duplicate hostnames when adding a new host
376: */
377: if (netFileHosts != null) {
378: for (int i = 0; i < netFileHosts.size(); i++) {
379: if (i == currentRow) {
380: continue;
381: }
382: StringTokenizer st1 = new StringTokenizer(
383: (String) netFileHosts.get(i), HOST_DELIM);
384: String str2 = null;
385: if (st1.hasMoreTokens()) {
386: str2 = st1.nextToken();
387: str2 = str2.substring(hostListStrHost.length());
388: if (str1.equals(str2)) {
389:
390: MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
391: msgBox.setTitle(modelManager
392: .getString("error.title"));
393: msgBox.setMessage(modelManager
394: .getString("duplicatehostname.error"));
395: msgBox.setType(MessageBox.TYPE_ERROR);
396: msgBox.setVisible(true);
397:
398: /* Redisplay the page with the error */
399: forwardTo();
400: return;
401: }
402: }
403: }
404: }
405:
406: nhBuffer.append(hostListStrHost + str1);
407:
408: String hostDomain = (String) getDisplayFieldValue(CHILD_HOSTDOMAIN);
409:
410: ComboBox cb = (ComboBox) getDisplayField(CHILD_HOSTTYPE);
411: String hostType = (String) (cb.getValue());
412:
413: if (hostDomain != null && hostDomain.trim().length() != 0
414: && "WIN".equals(hostType)) {
415: hostType = "NT";
416: }
417:
418: /*
419: for (int count = 0; count < hostTypeOptionList.length; count++) {
420: tmp = modelManager.getString("hostType." + hostTypeOptionList[count]);
421: if (str1.equals(tmp)) {
422: str1 = hostTypeOptionList[count];
423: break;
424: }
425: }
426: */
427: nhBuffer.append(HOST_DELIM + hostListStrType + hostType);
428:
429: cb = (ComboBox) getDisplayField(CHILD_HOSTENCODING);
430: str1 = (String) (cb.getValue());
431: String tmp;
432: for (int count = 0; count < encodingTypeOptionList.length; count++) {
433: tmp = modelManager.getString("encoding_"
434: + encodingTypeOptionList[count]);
435: if (str1.equals(tmp)) {
436: //str1 = encodingTypeOptionList[count];
437: break;
438: }
439: }
440: nhBuffer.append(HOST_DELIM + hostListStrEncoding + str1);
441:
442: /*
443: str1 = (String)getDisplayFieldValue(CHILD_HOSTDOMAIN);
444: nhBuffer.append(HOST_DELIM + hostListStrDomain + str1);
445: */
446: nhBuffer.append(HOST_DELIM + hostListStrDomain + hostDomain);
447:
448: String hostPassword = (String) getDisplayFieldValue(CHILD_HOSTPASSWORD);
449: //str1 = (String)getDisplayFieldValue(CHILD_HOSTPASSWORD);
450: nhBuffer.append(HOST_DELIM + hostListStrPass + hostPassword);
451:
452: str1 = (String) getDisplayFieldValue(CHILD_HOSTUSERNAME);
453: nhBuffer.append(HOST_DELIM + hostListStrUser + str1);
454:
455: ListBox lb = (ListBox) getDisplayField(CHILD_HOSTSHARELIST);
456: Object[] objValues = (Object[]) lb.getValues();
457:
458: if ((objValues == null) || (objValues.length == 0)) {
459: //Empty Share list is allowed
460: } else {
461: int size = objValues.length;
462: for (int i = 0; i < size; i++) {
463: String shareentry = (String) objValues[i];
464: StringTokenizer tok = new StringTokenizer(shareentry,
465: "\n");
466: StringBuffer sb = new StringBuffer();
467: try {
468: sb.append(hostListStrShare + tok.nextToken()); //Share Name
469: if ("WIN".equals(hostType) || "NT".equals(hostType)) {
470: sb.append(HOST_DELIM + hostListStrSharePass
471: + tok.nextToken()); // Share password.
472: } else {
473: sb.append(HOST_DELIM + hostListStrSharePass
474: + hostPassword); // Share password.
475: }
476: nhBuffer.append(HOST_DELIM + sb.toString());
477: } catch (NoSuchElementException nsee) {
478:
479: }
480: }
481: }
482:
483: newHost = nhBuffer.toString();
484:
485: //NetFileAdminModelManager.debugMessage("Saving new host -> " + newHost);
486:
487: if (netFileHosts != null) {
488: if (currentRow == -1) { // New host
489: netFileHosts.add(netFileHosts.size(), newHost);
490: } else {
491: netFileHosts.set(currentRow, newHost);
492: }
493:
494: newHostSet = new HashSet();
495: if (!netFileHosts.isEmpty()) {
496: Iterator hosts = netFileHosts.iterator();
497: while (hosts.hasNext())
498: newHostSet.add((String) AccessController
499: .doPrivileged(new EncryptAction(
500: (String) hosts.next())));
501: }
502:
503: newMap = new HashMap();
504: newMap.put("sunPortalNetFileCommonHostData", newHostSet);
505: boolean success = model.store(newMap);
506: }
507:
508: NetFileUserProfileViewBean vb = (NetFileUserProfileViewBean) getViewBean(NetFileUserProfileViewBean.class);
509: passPgSessionMap(vb);
510: vb.forwardTo(getRequestContext());
511: }
512:
513: public void handleCancelButtonRequest(RequestInvocationEvent event)
514: throws ModelControlException {
515: NetFileUserProfileViewBean vb = (NetFileUserProfileViewBean) getViewBean(NetFileUserProfileViewBean.class);
516: passPgSessionMap(vb);
517: vb.forwardTo(getRequestContext());
518: }
519:
520: public void handleServiceDescHrefRequest(
521: RequestInvocationEvent event) throws ModelControlException {
522: NetFileUserProfileViewBean vb = (NetFileUserProfileViewBean) getViewBean(NetFileUserProfileViewBean.class);
523: passPgSessionMap(vb);
524: vb.forwardTo(getRequestContext());
525: }
526:
527: public String getUserDN() {
528: if (userDN == null) {
529: Map pageSessAttrs = getPageSessionAttributes();
530: userDN = (String) pageSessAttrs
531: .get("com-iplanet-am-admin-user-current-object");
532: }
533: return userDN;
534: }
535:
536: public NetFileUserProfileModelImpl getModel() {
537: if (model == null) {
538: HttpServletRequest request = getRequestContext()
539: .getRequest();
540: model = new NetFileUserProfileModelImpl(request,
541: getPageSessionAttributes());
542: model.initModel(getUserDN());
543: }
544: return model;
545: }
546:
547: public NetFileAdminModelManager getModelMgr() {
548: if (modelManager == null) {
549: modelManager = (NetFileAdminModelManager) getRequestContext()
550: .getModelManager();
551: }
552: return modelManager;
553: }
554:
555: public void passPgSessionMap(ViewBean other) {
556: Map attributes = getPageSessionAttributes();
557: if ((attributes != null) && (attributes.size() > 0)) {
558: Iterator iter = attributes.keySet().iterator();
559: while (iter.hasNext()) {
560: String key = (String) iter.next();
561: other.setPageSessionAttribute(key,
562: (Serializable) attributes.get(key));
563: }
564: }
565: }
566:
567: private String getErrorMessages() {
568: getModelMgr();
569: StringBuffer sb = new StringBuffer();
570: sb.append("errorMessages['invalidsharename'] = '"
571: + modelManager.getString("invalidsharename") + "';\n");
572: sb.append("errorMessages['invalidshareuser'] = '"
573: + modelManager.getString("invalidshareuser") + "';\n");
574: sb.append("errorMessages['duplicateshares'] = '"
575: + modelManager.getString("duplicateshares") + "';");
576: return sb.toString();
577: }
578:
579: public ComboBox setHostTypeOptions() {
580: OptionList optList = new OptionList();
581: String tmp;
582: for (int count = 0; count < hostTypeOptionList.length; count++) {
583: tmp = modelManager.getString("hostType."
584: + hostTypeOptionList[count]);
585: optList.add(tmp, hostTypeOptionList[count]);
586: }
587: ComboBox cb = (ComboBox) getDisplayField(CHILD_HOSTTYPE);
588: cb.setOptions(optList);
589: return cb;
590: }
591:
592: public ComboBox setHostEncodingOptions() {
593: getModelMgr();
594: OptionList optList = new OptionList();
595: String tmp;
596: for (int count = 0; count < encodingTypeOptionList.length; count++) {
597: tmp = modelManager.getString("encoding_"
598: + encodingTypeOptionList[count]);
599: optList.add(tmp, tmp);
600: }
601: ComboBox cb = (ComboBox) getDisplayField(CHILD_HOSTENCODING);
602: cb.setOptions(optList);
603: return cb;
604: }
605:
606: }
|