Source Code Cross Referenced for ProxyletRulesReorderViewBean.java in  » Portal » Open-Portal » com » sun » portal » proxylet » 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.proxylet.admin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: ProxyletRulesReorderViewBean.java,v 1.3 2004/11/10 09:25:32 fa151985 Exp $
003:         * Copyright © 2004 Sun Microsystems, Inc. All rights reserved. 
004:         * 
005:         * Sun Microsystems, Inc. has intellectual property rights relating to
006:         * technology embodied in the product that is described in this document.
007:         * In particular, and without limitation, these intellectual property rights
008:         * may include one or more of the U.S. patents listed at
009:         * http://www.sun.com/patents and one or more additional patents or pending
010:         * patent applications in the U.S. and in other countries.
011:         * 
012:         * U.S. Government Rights - Commercial software. Government users are subject
013:         * to the Sun Microsystems, Inc. standard license agreement and applicable
014:         * provisions of the FAR and its supplements.
015:         * 
016:         * Use is subject to license terms. 
017:         * 
018:         * This distribution may include materials developed by third parties. Sun,
019:         * Sun Microsystems, the Sun logo, Java and Sun[tm] ONE are trademarks or
020:         * registered trademarks of Sun Microsystems, Inc. in the U.S. and other
021:         * countries. 
022:         * 
023:         * Copyright © 2004 Sun Microsystems, Inc. Tous droits réservés. Sun
024:         * Microsystems, Inc. détient les droits de propriété intellectuels relatifs
025:         * à la technologie incorporée dans le produit qui est décrit dans ce document.
026:         * En particulier, et ce sans limitation, ces droits de propriété
027:         * intellectuelle peuvent inclure un ou plus des brevets américains listés
028:         * à l'adresse http://www.sun.com/patents et un ou les brevets supplémentaires
029:         * ou les applications de brevet en attente aux Etats - Unis et dans les
030:         * autres pays.
031:         * 
032:         * L'utilisation est soumise aux termes du contrat de licence.
033:         * 
034:         * Cette distribution peut comprendre des composants développés par des
035:         * tierces parties.
036:         * 
037:         * Sun, Sun Microsystems, le logo Sun, Java et Sun[tm] ONE sont des marques
038:         * de fabrique ou des marques déposées de Sun Microsystems, Inc. aux
039:         * Etats-Unis et dans d'autres pays.
040:         */package com.sun.portal.proxylet.admin;
041:
042:        import com.iplanet.am.console.base.AMMessageViewBean;
043:        import com.iplanet.am.console.base.AMViewBeanBase;
044:        import com.iplanet.am.console.components.view.html.IPlanetButton;
045:        import com.iplanet.am.console.components.view.html.OrderedListView;
046:        import com.iplanet.am.console.components.view.html.SerializedField;
047:        import com.iplanet.am.console.user.UMCreateSvcTemplateViewBean;
048:        import com.iplanet.am.console.components.view.html.MessageBox;
049:        import com.iplanet.jato.RequestContext;
050:        import com.iplanet.jato.model.ModelControlException;
051:        import com.iplanet.jato.view.View;
052:        import com.iplanet.jato.view.ViewBean;
053:        import com.iplanet.jato.view.event.DisplayEvent;
054:        import com.iplanet.jato.view.event.RequestInvocationEvent;
055:        import com.iplanet.jato.view.html.OptionList;
056:        import com.iplanet.jato.view.html.Option;
057:        import com.iplanet.jato.view.html.ListBox;
058:        import com.iplanet.jato.view.html.StaticTextField;
059:
060:        import java.io.Serializable;
061:        import java.net.URLDecoder;
062:        import java.net.URLEncoder;
063:        import java.util.*;
064:        import java.util.ArrayList;
065:        import java.util.Iterator;
066:        import java.util.Set;
067:        import java.util.StringTokenizer;
068:        import javax.servlet.http.HttpServletRequest;
069:        import com.sun.portal.proxylet.admin.model.ProxyletAdminServiceModel;
070:        import com.sun.portal.proxylet.admin.model.ProxyletAdminServiceModelImpl;
071:
072:        /**
073:         * This view bean reorders <code>AuthConfig</code> modules
074:         */
075:        public class ProxyletRulesReorderViewBean extends AMViewBeanBase {
076:
077:            /** page name */
078:            public static final String PAGE_NAME = "ProxyletRulesReorder";
079:
080:            /** name of title peer component */
081:            public static final String PAGE_TITLE = "pageTitle";
082:
083:            /** default display URL of view bean */
084:            public static final String DEFAULT_DISPLAY_URL = "/ps/proxyletadmin/ProxyletRulesReorder.jsp";
085:
086:            /** name Submit button */
087:            public static final String BTN_SUBMIT = "SubmitButton";
088:
089:            /** name Cancel button */
090:            public static final String BTN_CANCEL = "CancelButton";
091:
092:            public static final String CHILD_ADD_BTN = "addButton";
093:
094:            public static final String CHILD_REMOVE_BTN = "removeButton";
095:
096:            public static final String CHILD_UP_BTN = "upButton";
097:
098:            public static final String CHILD_DOWN_BTN = "downButton";
099:
100:            public static final String CHILD_PROXYLETRULES = "ProxyletRules";
101:            public static final String CHILD_PROXYLETRULESLBL = "ProxyletRulesLabel";
102:            public static final String CHILD_PROXYLETRULESHELP = "ProxyletRulesHelp";
103:
104:            private ProxyletAdminServiceModel model = null;
105:            private ProxyletAdminModelManager modelManager = null;
106:
107:            private String serviceName = null;
108:            private String template = null;
109:            private boolean templateLevel = false;
110:
111:            public static final String SVC_NAME_ATTR = "com.iplanet.am.console.service.svcName";
112:            public static final String TEMPLATE_ATTR = "com.iplanet.am.console.service.templateLevel";
113:            public static final String LOCATION_DN = "com-iplanet-am-console-location-dn";
114:
115:            /**
116:             * Creates a reorder model view bean
117:             */
118:            public ProxyletRulesReorderViewBean() {
119:                super (PAGE_NAME);
120:                setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
121:                registerChildren();
122:            }
123:
124:            /**
125:             * Registers user interface components used by this view bean.
126:             */
127:            protected void registerChildren() {
128:                super .registerChildren();
129:                registerChild(PAGE_TITLE, StaticTextField.class);
130:                registerChild(BTN_SUBMIT, IPlanetButton.class);
131:                registerChild(BTN_CANCEL, IPlanetButton.class);
132:                registerChild(CHILD_ADD_BTN, IPlanetButton.class);
133:                registerChild(CHILD_REMOVE_BTN, IPlanetButton.class);
134:                registerChild(CHILD_UP_BTN, IPlanetButton.class);
135:                registerChild(CHILD_DOWN_BTN, IPlanetButton.class);
136:                registerChild(CHILD_PROXYLETRULES, ListBox.class);
137:                registerChild(CHILD_PROXYLETRULESLBL, StaticTextField.class);
138:                registerChild(CHILD_PROXYLETRULESHELP, StaticTextField.class);
139:            }
140:
141:            /**
142:             * Creates user interface components used by this view bean.
143:             *
144:             * @param name of component
145:             * @return child component
146:             */
147:            protected View createChild(String name) {
148:                View child = null;
149:                getProxyletModelMgr();
150:                if (name.equals(PAGE_TITLE)) {
151:                    child = new StaticTextField(this , PAGE_TITLE, "");
152:                } else if (name.equals(BTN_SUBMIT)) {
153:                    child = new IPlanetButton(this , BTN_SUBMIT, modelManager
154:                            .getString("ok.button"));
155:                } else if (name.equals(BTN_CANCEL)) {
156:                    child = new IPlanetButton(this , BTN_CANCEL, modelManager
157:                            .getString("close.button"));
158:                } else if (name.equals(CHILD_ADD_BTN)) {
159:                    return new IPlanetButton(this , CHILD_ADD_BTN, modelManager
160:                            .getString("add.button"));
161:                } else if (name.equals(CHILD_REMOVE_BTN)) {
162:                    return new IPlanetButton(this , CHILD_REMOVE_BTN,
163:                            modelManager.getString("remove.button"));
164:                } else if (name.equals(CHILD_UP_BTN)) {
165:                    return new IPlanetButton(this , CHILD_UP_BTN, modelManager
166:                            .getString("moveup.button"));
167:                } else if (name.equals(CHILD_DOWN_BTN)) {
168:                    return new IPlanetButton(this , CHILD_DOWN_BTN, modelManager
169:                            .getString("movedown.button"));
170:                } else if (name.equals(CHILD_PROXYLETRULES)) {
171:                    return new ListBox(this , CHILD_PROXYLETRULES, "");
172:                } else if (name.equals(CHILD_PROXYLETRULESLBL)) {
173:                    return new StaticTextField(this , CHILD_PROXYLETRULESLBL,
174:                            modelManager.getString("proxylet.rules"));
175:                } else if (name.equals(CHILD_PROXYLETRULESHELP)) {
176:                    return new StaticTextField(this , CHILD_PROXYLETRULESHELP,
177:                            modelManager.getString("proxylet.rules.help"));
178:                } else {
179:                    child = super .createChild(name);
180:                }
181:                return child;
182:            }
183:
184:            private String getListValue(String childName) {
185:                ListBox lb = (ListBox) getDisplayField(childName);
186:                Object[] objValues = (Object[]) lb.getValues();
187:                String entry = "";
188:                ListBox child = (ListBox) getChild(childName);
189:                Object[] urlObjs = child.getValues();
190:                for (int i = 0; i < urlObjs.length; i++) {
191:                    if (urlObjs[i] != null) {
192:                        String u = urlObjs[i].toString();
193:                        if (u != null && u.trim().length() > 0) {
194:                            if (entry != "")
195:                                entry = entry + "|" + u;
196:                            else
197:                                entry = u;
198:                        }
199:                    }
200:                }
201:                return entry;
202:            }
203:
204:            private void setListBoxInitialValue(String childName) {
205:                Set valueSet = model.getProxyletRules();
206:                String value = null;
207:                OptionList optList = new OptionList();
208:                ListBox lb = (ListBox) getChild(childName);
209:                if (valueSet != null) {
210:                    Iterator iter = valueSet.iterator();
211:                    if (iter.hasNext()) {
212:                        value = (String) iter.next();
213:                        String s1 = "";
214:                        StringTokenizer st1 = new StringTokenizer(value, "|");
215:                        while (st1.hasMoreTokens()) {
216:                            s1 = st1.nextToken();
217:                            optList.add(s1, s1);
218:                        }
219:                    }
220:                }
221:                optList.add("_______________________________________", "");
222:                lb.setOptions(optList);
223:            }
224:
225:            /**
226:             * Begins displaying page. we set the required information
227:             *
228:             * @param event - display event
229:             * @throws ModelControlException  if problem access value of component
230:             */
231:            public void beginDisplay(DisplayEvent event)
232:                    throws ModelControlException {
233:                getProxyletModelMgr();
234:                model = getModel();
235:                setChildValues(model);
236:                model.process();
237:                super .beginDisplay(event);
238:                setListBoxInitialValue(CHILD_PROXYLETRULES);
239:                setDisplayFieldValue(BTN_SUBMIT, modelManager
240:                        .getString("ok.button"));
241:                setDisplayFieldValue(BTN_CANCEL, modelManager
242:                        .getString("close.button"));
243:            }
244:
245:            /**
246:             * Gets model for this view bean
247:             *
248:             * @return model for view bean
249:             */
250:
251:            /**
252:             * Handles the event request for <i>Submit</i> button.
253:             *
254:             * @param event request invocation event
255:             */
256:            public void handleSubmitButtonRequest(RequestInvocationEvent event) {
257:
258:                Map map = new HashMap(10);
259:                getModel();
260:                Set newRuleSet = new HashSet();
261:                newRuleSet.add(getListValue(CHILD_PROXYLETRULES));
262:                map.put("sunPortalProxyletRules", newRuleSet);
263:                if (!map.isEmpty()) {
264:                    try {
265:                        model
266:                                .store(ProxyletAdminServiceModel.DYNAMIC_TYPE,
267:                                        map);
268:                    } catch (Exception e) {
269:                        System.out.println("ERROR in handleSubmitButtonRequest"
270:                                + e.getMessage());
271:                        e.printStackTrace();
272:                    }
273:                }
274:                forwardTo();
275:
276:            }
277:
278:            public ProxyletAdminModelManager getProxyletModelMgr() {
279:                if (modelManager == null) {
280:                    modelManager = (ProxyletAdminModelManager) getRequestContext()
281:                            .getModelManager();
282:                }
283:                return modelManager;
284:            }
285:
286:            public void passPgSessionMap(ViewBean other) {
287:                Map attributes = getPageSessionAttributes();
288:                if ((attributes != null) && (attributes.size() > 0)) {
289:                    Iterator iter = attributes.keySet().iterator();
290:                    while (iter.hasNext()) {
291:                        String key = (String) iter.next();
292:                        other.setPageSessionAttribute(key,
293:                                (Serializable) attributes.get(key));
294:                    }
295:                }
296:            }
297:
298:            /**
299:             * Gets model for this view bean
300:             *
301:             * @return model for view bean
302:             */
303:            public String getServiceName() {
304:                if (serviceName == null) {
305:                    HttpServletRequest req = getRequestContext().getRequest();
306:                    serviceName = req.getParameter("ServiceName");
307:                    if (serviceName == null) {
308:                        serviceName = (String) getPageSessionAttribute(SVC_NAME_ATTR);
309:                    } else {
310:                        setPageSessionAttribute(SVC_NAME_ATTR, serviceName);
311:                    }
312:                }
313:                return serviceName;
314:            }
315:
316:            public boolean isTemplate() {
317:
318:                if (template == null) {
319:                    HttpServletRequest req = getRequestContext().getRequest();
320:                    template = req.getParameter("Template");
321:                    if (template == null) {
322:                        template = (String) getPageSessionAttribute(TEMPLATE_ATTR);
323:                    } else {
324:                        setPageSessionAttribute(TEMPLATE_ATTR, template);
325:                    }
326:                    if (template != null && template.equals("true")) {
327:                        templateLevel = true;
328:                    } else {
329:                        template = "false";
330:                        templateLevel = false;
331:                    }
332:                }
333:                return templateLevel;
334:            }
335:
336:            public String getLocationDN() {
337:                String locationDN = null;
338:                HttpServletRequest req = getRequestContext().getRequest();
339:                String encodedDN = req.getParameter("Location");
340:                if (encodedDN == null) {
341:                    locationDN = (String) getPageSessionAttribute(LOCATION_DN);
342:                } else {
343:                    try {
344:                        locationDN = URLDecoder.decode(encodedDN);
345:                        setPageSessionAttribute(LOCATION_DN, locationDN);
346:                    } catch (Exception e) {
347:                        // Too bad
348:                    }
349:                }
350:                return locationDN;
351:            }
352:
353:            public ProxyletAdminServiceModel getModel() {
354:
355:                if (model == null) {
356:                    HttpServletRequest req = getRequestContext().getRequest();
357:                    req
358:                            .setAttribute(
359:                                    ProxyletAdminModelManager.SRAP_PROXYLET_MODEL_MGR_KEY,
360:                                    getProxyletModelMgr());
361:                    /*
362:                     *  Get all request parameters and set them as pageSessionAttributes
363:                     */
364:                    String locationDN = getLocationDN();
365:                    String svcName = getServiceName();
366:                    boolean isTemplateLevel = isTemplate();
367:
368:                    model = new ProxyletAdminServiceModelImpl(req,
369:                            "srapproxyletadminmsgs",
370:                            getPageSessionAttributes(), svcName,
371:                            isTemplateLevel);
372:                    model.process();
373:                }
374:                return model;
375:            }
376:
377:            /**
378:             * Handles the event request for <i>Cancel</i> button.
379:             *
380:             * @param event request invocation event
381:             */
382:            public void handleBtnCancelRequest(RequestInvocationEvent event) {
383:            }
384:
385:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.