Source Code Cross Referenced for NetFileViewBeanBase.java in  » Portal » Open-Portal » com » sun » portal » netfile » admin » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.netfile.admin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.net.URLDecoder;
020:        import java.net.URLEncoder;
021:        import java.util.Iterator;
022:        import java.util.Map;
023:
024:        // Servlet classes
025:        import javax.servlet.http.HttpServletRequest;
026:
027:        // iPlanet JATO classes
028:        import com.iplanet.jato.view.event.ChildDisplayEvent;
029:        import com.iplanet.jato.model.ModelControlException;
030:        import com.iplanet.jato.view.View;
031:        import com.iplanet.jato.view.ViewBean;
032:        import com.iplanet.jato.view.event.DisplayEvent;
033:        import com.iplanet.jato.view.event.RequestInvocationEvent;
034:        import com.iplanet.jato.view.html.ComboBox;
035:        import com.iplanet.jato.view.html.HREF;
036:        import com.iplanet.jato.view.html.OptionList;
037:        import com.iplanet.jato.view.html.StaticTextField;
038:
039:        // iDS/AME classes
040:        import com.iplanet.am.console.base.AMMessageViewBean;
041:        import com.iplanet.am.console.base.AMViewBeanBase;
042:        import com.iplanet.am.console.base.model.AMConsoleException;
043:        import com.iplanet.am.console.components.view.html.IPlanetButton;
044:        import com.iplanet.am.console.components.view.html.MessageBox;
045:        import com.iplanet.am.console.user.UMCreateSvcTemplateViewBean;
046:
047:        // NetFile admin console classes
048:        import com.sun.portal.netfile.admin.model.NetFileModel;
049:        import com.sun.portal.netfile.admin.model.NetFileModelImpl;
050:
051:        public class NetFileViewBeanBase extends AMViewBeanBase implements 
052:                NetFileAdminService {
053:            public static final String PAGE_DESCRIPTION = "serviceDescription";
054:            public static final String GLOBAL_LABEL = "lblGlobal";
055:            public static final String ORG_LABEL = "lblOrg";
056:            public static final String DYNAMIC_LABEL = "lblDynamic";
057:            public static final String GLOBAL_DATA_VIEW = "GlobalDataView";
058:            public static final String ORG_DATA_VIEW = "OrgDataView";
059:            public static final String DYNAMIC_DATA_VIEW = "DynamicDataView";
060:            public static final String CHILD_CC_MSGBOX = "ccMessageBox";
061:            public static final String SUBMIT_BTN = "SubmitButton";
062:            public static final String RESET_BTN = "ResetButton";
063:            public static final String DELETE_BUTTON = "DeleteButton";
064:            public static final String PRIORITY_COMBOBOX = "Priority";
065:            public static final String PRIORITY_LABEL = "lblPriority";
066:            public static final String TITLE_HTML_PAGE = "titleHtmlPage";
067:
068:            public static final String CHILD_HREF_PROPS_ONE = "hrefPropsOne";
069:            public static final String CHILD_HREF_PROPS_ONE_TWO = "hrefPropsOneDotTwo";
070:            public static final String CHILD_HREF_PROPS_TWO = "hrefPropsTwo";
071:            public static final String CHILD_HREF_PROPS_THREE = "hrefPropsThree";
072:            public static final String CHILD_HREF_PROPS_FOUR = "hrefPropsFour";
073:            public static final String CHILD_HREF_PROPS_FOUR_TWO = "hrefPropsFourDotTwo";
074:            public static final String CHILD_HREF_PROPS_FOUR_THREE = "hrefPropsFourDotThree";
075:            public static final String CHILD_HREF_PROPS_FIVE = "hrefPropsFive";
076:
077:            public static final String CHILD_TEXT_PROPS_ONE = "propsOneText";
078:            public static final String CHILD_TEXT_PROPS_ONE_ONE = "propsOneDotOneText";
079:            public static final String CHILD_TEXT_PROPS_ONE_TWO = "propsOneDotTwoText";
080:            public static final String CHILD_TEXT_PROPS_TWO = "propsTwoText";
081:            public static final String CHILD_TEXT_PROPS_THREE = "propsThreeText";
082:            public static final String CHILD_TEXT_PROPS_FOUR = "propsFourText";
083:            public static final String CHILD_TEXT_PROPS_FOUR_ONE = "propsFourDotOneText";
084:            public static final String CHILD_TEXT_PROPS_FOUR_TWO = "propsFourDotTwoText";
085:            public static final String CHILD_TEXT_PROPS_FOUR_THREE = "propsFourDotThreeText";
086:            public static final String CHILD_TEXT_PROPS_FIVE = "propsFiveText";
087:
088:            public static final String JAVA2_ONLY = "java2OnlyNote";
089:
090:            protected NetFileModel model = null;
091:            protected NetFileAdminModelManager modelManager = null;
092:            protected String serviceName = null;
093:            protected String template = null;
094:            protected boolean templateLevel = false;
095:
096:            public NetFileViewBeanBase(String pageName) {
097:                super (pageName);
098:            }
099:
100:            protected void registerChildren() {
101:                registerChild(PAGE_DESCRIPTION, StaticTextField.class);
102:                registerChild(GLOBAL_LABEL, StaticTextField.class);
103:                registerChild(ORG_LABEL, StaticTextField.class);
104:                registerChild(DYNAMIC_LABEL, StaticTextField.class);
105:                registerChild(CHILD_CC_MSGBOX, MessageBox.class);
106:                registerChild(SUBMIT_BTN, IPlanetButton.class);
107:                registerChild(RESET_BTN, IPlanetButton.class);
108:                registerChild(DELETE_BUTTON, IPlanetButton.class);
109:                registerChild(TITLE_HTML_PAGE, StaticTextField.class);
110:                registerChild(PRIORITY_COMBOBOX, ComboBox.class);
111:                registerChild(PRIORITY_LABEL, StaticTextField.class);
112:                registerChild(CHILD_HREF_PROPS_ONE, HREF.class);
113:                registerChild(CHILD_HREF_PROPS_ONE_TWO, HREF.class);
114:                registerChild(CHILD_HREF_PROPS_TWO, HREF.class);
115:                registerChild(CHILD_HREF_PROPS_THREE, HREF.class);
116:                registerChild(CHILD_HREF_PROPS_FOUR, HREF.class);
117:                registerChild(CHILD_HREF_PROPS_FOUR_TWO, HREF.class);
118:                registerChild(CHILD_HREF_PROPS_FOUR_THREE, HREF.class);
119:                registerChild(CHILD_HREF_PROPS_FIVE, HREF.class);
120:                registerChild(CHILD_TEXT_PROPS_ONE, StaticTextField.class);
121:                registerChild(CHILD_TEXT_PROPS_ONE_ONE, StaticTextField.class);
122:                registerChild(CHILD_TEXT_PROPS_ONE_TWO, StaticTextField.class);
123:                registerChild(CHILD_TEXT_PROPS_TWO, StaticTextField.class);
124:                registerChild(CHILD_TEXT_PROPS_THREE, StaticTextField.class);
125:                registerChild(CHILD_TEXT_PROPS_FOUR, StaticTextField.class);
126:                registerChild(CHILD_TEXT_PROPS_FOUR_ONE, StaticTextField.class);
127:                registerChild(CHILD_TEXT_PROPS_FOUR_TWO, StaticTextField.class);
128:                registerChild(CHILD_TEXT_PROPS_FOUR_THREE,
129:                        StaticTextField.class);
130:                registerChild(CHILD_TEXT_PROPS_FIVE, StaticTextField.class);
131:            }
132:
133:            protected View createChild(String name) {
134:                getNetFileModelMgr();
135:                View child = null;
136:
137:                if (name.equals(PAGE_DESCRIPTION)) {
138:                    child = new StaticTextField(this , PAGE_DESCRIPTION, "");
139:                } else if (name.equals(GLOBAL_LABEL)) {
140:                    child = new StaticTextField(this , GLOBAL_LABEL, "");
141:                } else if (name.equals(ORG_LABEL)) {
142:                    child = new StaticTextField(this , ORG_LABEL, "");
143:                } else if (name.equals(DYNAMIC_LABEL)) {
144:                    child = new StaticTextField(this , DYNAMIC_LABEL, "");
145:                } else if (name.equals(CHILD_CC_MSGBOX)) {
146:                    return new MessageBox(this , CHILD_CC_MSGBOX, "");
147:                } else if (name.equals(SUBMIT_BTN)) {
148:                    child = new IPlanetButton(this , SUBMIT_BTN, "");
149:                } else if (name.equals(RESET_BTN)) {
150:                    child = new IPlanetButton(this , RESET_BTN, "");
151:                } else if (name.equals(DELETE_BUTTON)) {
152:                    child = new IPlanetButton(this , DELETE_BUTTON, "");
153:                } else if (name.equals(TITLE_HTML_PAGE)) {
154:                    child = new StaticTextField(this , TITLE_HTML_PAGE,
155:                            modelManager.getString("netfile.admin.title"));
156:                } else if (name.equals(PRIORITY_COMBOBOX)) {
157:                    child = new ComboBox(this , PRIORITY_COMBOBOX, "");
158:                } else if (name.equals(PRIORITY_LABEL)) {
159:                    child = new ComboBox(this , PRIORITY_LABEL, "");
160:                } else if (name.equals(CHILD_HREF_PROPS_ONE)) {
161:                    child = new HREF(this , CHILD_HREF_PROPS_ONE, "");
162:                } else if (name.equals(CHILD_HREF_PROPS_ONE_TWO)) {
163:                    child = new HREF(this , CHILD_HREF_PROPS_ONE_TWO, "");
164:                } else if (name.equals(CHILD_HREF_PROPS_TWO)) {
165:                    child = new HREF(this , CHILD_HREF_PROPS_TWO, "");
166:                } else if (name.equals(CHILD_HREF_PROPS_THREE)) {
167:                    child = new HREF(this , CHILD_HREF_PROPS_THREE, "");
168:                } else if (name.equals(CHILD_HREF_PROPS_FOUR)) {
169:                    child = new HREF(this , CHILD_HREF_PROPS_FOUR, "");
170:                } else if (name.equals(CHILD_HREF_PROPS_FOUR_TWO)) {
171:                    child = new HREF(this , CHILD_HREF_PROPS_FOUR_TWO, "");
172:                } else if (name.equals(CHILD_HREF_PROPS_FOUR_THREE)) {
173:                    child = new HREF(this , CHILD_HREF_PROPS_FOUR_THREE, "");
174:                } else if (name.equals(CHILD_HREF_PROPS_FIVE)) {
175:                    child = new HREF(this , CHILD_HREF_PROPS_FIVE, "");
176:                } else if (name.equals(CHILD_TEXT_PROPS_ONE)) {
177:                    child = new StaticTextField(this , CHILD_TEXT_PROPS_ONE,
178:                            modelManager.getString("props.total.one"));
179:                } else if (name.equals(CHILD_TEXT_PROPS_ONE_ONE)) {
180:                    child = new StaticTextField(this , CHILD_TEXT_PROPS_ONE_ONE,
181:                            modelManager.getString("props.total.one.one"));
182:                } else if (name.equals(CHILD_TEXT_PROPS_ONE_TWO)) {
183:                    child = new StaticTextField(this , CHILD_TEXT_PROPS_ONE_TWO,
184:                            modelManager.getString("props.total.one.two"));
185:                } else if (name.equals(CHILD_TEXT_PROPS_TWO)) {
186:                    child = new StaticTextField(this , CHILD_TEXT_PROPS_TWO,
187:                            modelManager.getString("props.total.two"));
188:                } else if (name.equals(CHILD_TEXT_PROPS_THREE)) {
189:                    child = new StaticTextField(this , CHILD_TEXT_PROPS_THREE,
190:                            modelManager.getString("props.total.three"));
191:                } else if (name.equals(CHILD_TEXT_PROPS_FOUR)) {
192:                    child = new StaticTextField(this , CHILD_TEXT_PROPS_FOUR,
193:                            modelManager.getString("props.total.four"));
194:                } else if (name.equals(CHILD_TEXT_PROPS_FOUR_ONE)) {
195:                    child = new StaticTextField(this ,
196:                            CHILD_TEXT_PROPS_FOUR_ONE, modelManager
197:                                    .getString("props.total.four.one"));
198:                } else if (name.equals(CHILD_TEXT_PROPS_FOUR_TWO)) {
199:                    child = new StaticTextField(this ,
200:                            CHILD_TEXT_PROPS_FOUR_TWO, modelManager
201:                                    .getString("props.total.four.two"));
202:                } else if (name.equals(CHILD_TEXT_PROPS_FOUR_THREE)) {
203:                    child = new StaticTextField(this ,
204:                            CHILD_TEXT_PROPS_FOUR_THREE, modelManager
205:                                    .getString("props.total.four.three"));
206:                } else if (name.equals(CHILD_TEXT_PROPS_FIVE)) {
207:                    child = new StaticTextField(this , CHILD_TEXT_PROPS_FIVE,
208:                            modelManager.getString("props.total.five"));
209:                } else {
210:                    child = super .createChild(name);
211:                }
212:                return child;
213:            }
214:
215:            public void beginDisplay(DisplayEvent event)
216:                    throws ModelControlException {
217:                getModel();
218:                setChildValues(model);
219:                model.process();
220:                setDisplayFieldValue(PAGE_DESCRIPTION, model
221:                        .getServiceDisplayName());
222:                setDisplayFieldValue(GLOBAL_LABEL, modelManager
223:                        .getString("global"));
224:                setDisplayFieldValue(ORG_LABEL, modelManager
225:                        .getString("organization"));
226:                setDisplayFieldValue(DYNAMIC_LABEL, modelManager
227:                        .getString("dynamic"));
228:                setDisplayFieldValue(SUBMIT_BTN, modelManager
229:                        .getString("save.button"));
230:                setDisplayFieldValue(RESET_BTN, modelManager
231:                        .getString("reset.button"));
232:                setDisplayFieldValue(DELETE_BUTTON, modelManager
233:                        .getString("delete.button"));
234:                setDisplayFieldValue(HELP_DOC_URL, modelManager
235:                        .getString(NetFileAdminService.SRA_BASE_HLP_URL));
236:                setDisplayFieldValue(
237:                        HELP_ANCHOR_TAG,
238:                        ((NetFileModelImpl) model)
239:                                .getHelpAnchorTag(NetFileAdminService.SRA_NF_HLP_URL));
240:            }
241:
242:            public boolean beginGlobalBlockDisplay(ChildDisplayEvent event) {
243:                return (getModel().getSize(NetFileModel.GLOBAL_TYPE) != 0);
244:            }
245:
246:            public boolean beginOrgBlockDisplay(ChildDisplayEvent event) {
247:                return (getModel().getSize(NetFileModel.ORG_TYPE) != 0);
248:            }
249:
250:            public boolean beginTopLevelBlockDisplay(ChildDisplayEvent event) {
251:                return (!templateLevel && getModel().getSize(
252:                        NetFileModel.DYNAMIC_TYPE) != 0);
253:            }
254:
255:            public boolean beginTemplateLevelBlockDisplay(
256:                    ChildDisplayEvent event) {
257:                if (!templateLevel) {
258:                    return false;
259:                } else {
260:                    NetFileModel m = getModel();
261:                    boolean visible = (m.getSize(NetFileModel.DYNAMIC_TYPE) != 0);
262:                    if (visible) {
263:                        setDisplayFieldValue(PRIORITY_LABEL, modelManager
264:                                .getString("priority.label"));
265:                        /*
266:                         String[][] optionNames = new String[1][7];
267:                         for (int i = 0; i < 7 ; i++) {
268:                         optionNames[0][i] = modelManager.getString("amTemplatePriority." + i);
269:                         }
270:                         */
271:                        String[][] options = m.getPriorityOptions();
272:                        OptionList optionList = new OptionList(options[0],
273:                                options[1]);
274:                        ComboBox cb = (ComboBox) getDisplayField(PRIORITY_COMBOBOX);
275:                        cb.setOptions(optionList);
276:                        cb.setValue(m.getPriority());
277:                    }
278:                    return visible;
279:                }
280:            }
281:
282:            public boolean beginDeleteButtonBlockDisplay(ChildDisplayEvent event) {
283:                return templateLevel;
284:            }
285:
286:            /**
287:             * Called when Reset button is clicked. Does nothing and refreshes the
288:             * page.
289:             */
290:            public void handleResetButtonRequest(RequestInvocationEvent event)
291:                    throws ModelControlException {
292:                forwardTo();
293:            }
294:
295:            public void handleDeleteButtonRequest(RequestInvocationEvent event)
296:                    throws ModelControlException, AMConsoleException {
297:                NetFileModel m = getModel();
298:                if (templateLevel) {
299:                    m.deleteTemplate();
300:                    UMCreateSvcTemplateViewBean vb = (UMCreateSvcTemplateViewBean) getViewBean(UMCreateSvcTemplateViewBean.class);
301:                    passPgSessionMap(vb);
302:                    vb.setServiceName(m.getServiceName());
303:                    vb.forwardTo(getRequestContext());
304:                } else {
305:                    forwardTo();
306:                }
307:            }
308:
309:            public void handleHrefPropsOneRequest(RequestInvocationEvent event)
310:                    throws ModelControlException {
311:                NetFileTotalOneViewBean vb = (NetFileTotalOneViewBean) getViewBean(NetFileTotalOneViewBean.class);
312:                passPgSessionMap(vb);
313:                vb.forwardTo(getRequestContext());
314:            }
315:
316:            public void handleHrefPropsOneDotTwoRequest(
317:                    RequestInvocationEvent event) throws ModelControlException {
318:                NetFileTotalOneDotTwoViewBean vb = (NetFileTotalOneDotTwoViewBean) getViewBean(NetFileTotalOneDotTwoViewBean.class);
319:                passPgSessionMap(vb);
320:                vb.forwardTo(getRequestContext());
321:            }
322:
323:            public void handleHrefPropsTwoRequest(RequestInvocationEvent event)
324:                    throws ModelControlException {
325:                NetFileTotalTwoViewBean vb = (NetFileTotalTwoViewBean) getViewBean(NetFileTotalTwoViewBean.class);
326:                passPgSessionMap(vb);
327:                vb.forwardTo(getRequestContext());
328:            }
329:
330:            public void handleHrefPropsThreeRequest(RequestInvocationEvent event)
331:                    throws ModelControlException {
332:                NetFileTotalThreeViewBean vb = (NetFileTotalThreeViewBean) getViewBean(NetFileTotalThreeViewBean.class);
333:                passPgSessionMap(vb);
334:                vb.forwardTo(getRequestContext());
335:            }
336:
337:            public void handleHrefPropsFourRequest(RequestInvocationEvent event)
338:                    throws ModelControlException {
339:                NetFileTotalFourViewBean vb = (NetFileTotalFourViewBean) getViewBean(NetFileTotalFourViewBean.class);
340:                passPgSessionMap(vb);
341:                vb.forwardTo(getRequestContext());
342:            }
343:
344:            public void handleHrefPropsFourDotTwoRequest(
345:                    RequestInvocationEvent event) throws ModelControlException {
346:                NetFileTotalFourDotTwoViewBean vb = (NetFileTotalFourDotTwoViewBean) getViewBean(NetFileTotalFourDotTwoViewBean.class);
347:                passPgSessionMap(vb);
348:                vb.forwardTo(getRequestContext());
349:            }
350:
351:            public void handleHrefPropsFourDotThreeRequest(
352:                    RequestInvocationEvent event) throws ModelControlException {
353:                NetFileTotalFourDotThreeViewBean vb = (NetFileTotalFourDotThreeViewBean) getViewBean(NetFileTotalFourDotThreeViewBean.class);
354:                passPgSessionMap(vb);
355:                vb.forwardTo(getRequestContext());
356:            }
357:
358:            public void handleHrefPropsFiveRequest(RequestInvocationEvent event)
359:                    throws ModelControlException {
360:                NetFileTotalFiveViewBean vb = (NetFileTotalFiveViewBean) getViewBean(NetFileTotalFiveViewBean.class);
361:                passPgSessionMap(vb);
362:                vb.forwardTo(getRequestContext());
363:            }
364:
365:            public NetFileAdminModelManager getNetFileModelMgr() {
366:                if (modelManager == null) {
367:                    modelManager = (NetFileAdminModelManager) getRequestContext()
368:                            .getModelManager();
369:                }
370:                return modelManager;
371:            }
372:
373:            public void passPgSessionMap(ViewBean other) {
374:                Map attributes = getPageSessionAttributes();
375:                if ((attributes != null) && (attributes.size() > 0)) {
376:                    Iterator iter = attributes.keySet().iterator();
377:                    while (iter.hasNext()) {
378:                        String key = (String) iter.next();
379:                        other.setPageSessionAttribute(key,
380:                                (Serializable) attributes.get(key));
381:                    }
382:                }
383:            }
384:
385:            public String getServiceName() {
386:                if (serviceName == null) {
387:                    HttpServletRequest req = getRequestContext().getRequest();
388:                    serviceName = req.getParameter("ServiceName");
389:                    if (serviceName == null) {
390:                        serviceName = (String) getPageSessionAttribute(SVC_NAME_ATTR);
391:                    } else {
392:                        setPageSessionAttribute(SVC_NAME_ATTR, serviceName);
393:                    }
394:                }
395:                return serviceName;
396:            }
397:
398:            public boolean isTemplate() {
399:                if (template == null) {
400:                    HttpServletRequest req = getRequestContext().getRequest();
401:                    template = req.getParameter("Template");
402:                    if (template == null) {
403:                        template = (String) getPageSessionAttribute(TEMPLATE_ATTR);
404:                    } else {
405:                        setPageSessionAttribute(TEMPLATE_ATTR, template);
406:                    }
407:                    if (template != null && template.equals("true")) {
408:                        templateLevel = true;
409:                    } else {
410:                        template = "false";
411:                        templateLevel = false;
412:                    }
413:                }
414:                return templateLevel;
415:            }
416:
417:            public String getLocationDN() {
418:                String locationDN = null;
419:                HttpServletRequest req = getRequestContext().getRequest();
420:                String encodedDN = req.getParameter("Location");
421:                if (encodedDN == null) {
422:                    locationDN = (String) getPageSessionAttribute(LOCATION_DN);
423:                } else {
424:                    try {
425:                        locationDN = URLDecoder.decode(encodedDN);
426:                        setPageSessionAttribute(LOCATION_DN, locationDN);
427:                    } catch (Exception e) {
428:                    }
429:                }
430:                return locationDN;
431:            }
432:
433:            /**
434:             * Returns the model object for the delete host UI.
435:             */
436:            public NetFileModel getModel() {
437:
438:                if (model == null) {
439:                    HttpServletRequest req = getRequestContext().getRequest();
440:                    req
441:                            .setAttribute(
442:                                    NetFileAdminModelManager.SRAP_NETFILE_MODEL_MGR_KEY,
443:                                    getNetFileModelMgr());
444:                    /*
445:                     *  Get all request parameters and set them as pageSessionAttributes
446:                     */
447:                    String locationDN = getLocationDN();
448:                    String svcName = getServiceName();
449:                    boolean isTemplateLevel = isTemplate();
450:
451:                    model = new NetFileModelImpl(req, "srapNetFileAdminMsgs",
452:                            getPageSessionAttributes(), svcName,
453:                            isTemplateLevel);
454:
455:                    /**
456:                     *  Check whether the template exists or not.
457:                     *  If not forward the request to UMCreateSvcTemplateViewBean
458:                     */
459:                    model.process();
460:
461:                    if (!model.hasSchema()) {
462:                        AMMessageViewBean vb = (AMMessageViewBean) getViewBean(AMMessageViewBean.class);
463:                        vb.setMessageType(MessageBox.TYPE_INFORMATION);
464:                        //				vb.setTitle(model.getNoAttrsMessage());
465:                        vb.setTitle(modelManager.getString("noSchema.message"));
466:                        vb.setMessage("");
467:                        vb.addButton(model.getLocalizedString("ok.button"),
468:                                "../console/html/blank.html");
469:                        vb.forwardTo(getRequestContext());
470:                    } else if (templateLevel && !model.hasTemplate()) {
471:                        UMCreateSvcTemplateViewBean vb = (UMCreateSvcTemplateViewBean) getViewBean(UMCreateSvcTemplateViewBean.class);
472:                        passPgSessionMap(vb);
473:                        vb.setServiceName(svcName);
474:                        vb.forwardTo(getRequestContext());
475:                    }
476:                }
477:                return model;
478:            }
479:
480:            public String getNetFileAdminServiceURL() {
481:                String nasURL = null;
482:                getModel();
483:                if (model != null) {
484:                    nasURL = model.getPropsUrl();
485:                    String queryParam = "?ServiceName="
486:                            + getPageSessionAttribute(this .SVC_NAME_ATTR)
487:                            + "&Location="
488:                            + URLEncoder
489:                                    .encode((String) getPageSessionAttribute(this .LOCATION_DN))
490:                            + "&Template="
491:                            + getPageSessionAttribute(this .TEMPLATE_ATTR);
492:                    nasURL += queryParam;
493:                }
494:                return nasURL;
495:            }
496:
497:            public void showPropertiesSavedMessageBox() {
498:                MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
499:                msgBox.setTitle(modelManager.getString("propertiessaved.info"));
500:                msgBox.setType(MessageBox.TYPE_INFORMATION);
501:                msgBox.setVisible(true);
502:            }
503:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.