Source Code Cross Referenced for NetletAdminUserProfileViewBean.java in  » Portal » Open-Portal » com » sun » portal » netlet » 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.netlet.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 Bhavanishankar
014:         */package com.sun.portal.netlet.admin;
015:
016:        // JDK classes
017:
018:        import java.io.IOException;
019:        import java.io.Serializable;
020:        import java.util.HashMap;
021:        import java.util.HashSet;
022:        import java.util.Iterator;
023:        import java.util.LinkedList;
024:        import java.util.List;
025:        import java.util.Map;
026:        import java.util.Set;
027:        import java.util.StringTokenizer;
028:        import java.util.Vector;
029:
030:        import javax.servlet.http.HttpServletRequest;
031:        import javax.servlet.http.HttpServletResponse;
032:
033:        import com.iplanet.am.console.base.AMViewBeanBase;
034:        import com.iplanet.am.console.base.AMViewBeanUtils;
035:        import com.iplanet.am.console.base.model.AMConsoleException;
036:        import com.iplanet.am.console.components.view.html.DynamicGUI;
037:        import com.iplanet.am.console.components.view.html.IPlanetButton;
038:        import com.iplanet.am.console.components.view.html.MessageBox;
039:        import com.iplanet.jato.model.ModelControlException;
040:        import com.iplanet.jato.view.View;
041:        import com.iplanet.jato.view.ViewBean;
042:        import com.iplanet.jato.view.event.ChildDisplayEvent;
043:        import com.iplanet.jato.view.event.DisplayEvent;
044:        import com.iplanet.jato.view.event.RequestInvocationEvent;
045:        import com.iplanet.jato.view.html.ComboBox;
046:        import com.iplanet.jato.view.html.HiddenField;
047:        import com.iplanet.jato.view.html.OptionList;
048:        import com.iplanet.jato.view.html.StaticTextField;
049:        import com.iplanet.jato.view.html.TextField;
050:        import com.sun.portal.netlet.admin.model.NetletAdminUserProfileModelImpl;
051:
052:        public class NetletAdminUserProfileViewBean extends AMViewBeanBase {
053:
054:            public static final String PAGE_DESCRIPTION = "serviceDescription";
055:            public static final String PAGE_NAME = "NetletAdminUserProfile";
056:            public static final String DEFAULT_DISPLAY_URL = "/ps/netletadmin/NetletAdminUserProfile.jsp";
057:
058:            public static final String USER_DATA_VIEW = "UserDataView";
059:            public static final String CHILD_TILEDVIEW = "NetletRulesTiledView";
060:            public static final String CHILD_CC_MSGBOX = "ccMessageBox";
061:            public static final String CHILD_NETLETATTRSFOR = "NetletAttrsFor";
062:            public static final String CHILD_USERID = "userID";
063:            public static final String SAVE_BTN = "saveButton";
064:            public static final String RESET_BTN = "resetButton";
065:            public static final String TITLE_HTML_PAGE = "titleHtmlPage";
066:            public static final String CHILD_NAME_LABEL = "nameLabel";
067:            public static final String CHILD_ACTION_LABEL = "actionLabel";
068:            public static final String NETLET_RULES_LABEL = "netletRulesLabel";
069:            public static final String NETLET_RULES_STATUS = "rulesStatus";
070:            public static final String NETLET_PASSWORD_LABEL = "netletPasswordLabel";
071:            public static final String NETLET_PASSWORD = "netletPassword";
072:            public static final String EMPTY_PASSWORD = "emptyPassword";
073:
074:            public static final String ADD_NETLETRULE_BTN = "addruleButton";
075:            public static final String DELETE_NETLETRULES_BTN = "delrulesButton";
076:            public static final String NETLET_RULES_COUNT = "netletRulesCount";
077:            public static final String NO_RULE_SELECTION = "noRuleSelection";
078:            public static final String CONFIRM_RULE_DELETE = "confirmRuleDelete";
079:
080:            private String serviceName = null;
081:            private NetletAdminModelManager modelManager = null;
082:            //private UMUserProfileModel model = null;
083:            private NetletAdminUserProfileModelImpl model = null;
084:            private String userDN = null;
085:            /** name-values map*/
086:            private Map attrValues = null;
087:            /** name-status map*/
088:            private Map attrStatus = null;
089:
090:            public NetletAdminUserProfileViewBean() {
091:                super (PAGE_NAME);
092:                setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
093:                registerChildren();
094:            }
095:
096:            public NetletAdminUserProfileViewBean(String pageName) {
097:                super (pageName);
098:                setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
099:                registerChildren();
100:            }
101:
102:            protected void registerChildren() {
103:                registerChild(PAGE_DESCRIPTION, StaticTextField.class);
104:                registerChild(USER_DATA_VIEW, NetletAdminUserProfileView.class);
105:                registerChild(CHILD_TILEDVIEW,
106:                        NetletRulesUserProfileTiledView.class);
107:                registerChild(CHILD_CC_MSGBOX, MessageBox.class);
108:                registerChild(CHILD_NETLETATTRSFOR, StaticTextField.class);
109:                registerChild(CHILD_USERID, StaticTextField.class);
110:                registerChild(SAVE_BTN, IPlanetButton.class);
111:                registerChild(RESET_BTN, IPlanetButton.class);
112:                registerChild(TITLE_HTML_PAGE, StaticTextField.class);
113:                registerChild(CHILD_NAME_LABEL, StaticTextField.class);
114:                registerChild(CHILD_ACTION_LABEL, StaticTextField.class);
115:                registerChild(NETLET_RULES_LABEL, StaticTextField.class);
116:                registerChild(NETLET_RULES_STATUS, ComboBox.class);
117:                registerChild(NETLET_PASSWORD_LABEL, StaticTextField.class);
118:                registerChild(NETLET_PASSWORD, TextField.class);
119:                registerChild(EMPTY_PASSWORD, TextField.class);
120:                registerChild(ADD_NETLETRULE_BTN, IPlanetButton.class);
121:                registerChild(DELETE_NETLETRULES_BTN, IPlanetButton.class);
122:                registerChild(NETLET_RULES_COUNT, HiddenField.class);
123:                registerChild(NO_RULE_SELECTION, StaticTextField.class);
124:                registerChild(CONFIRM_RULE_DELETE, StaticTextField.class);
125:            }
126:
127:            protected View createChild(String name) {
128:                getNetletModelMgr();
129:                NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl) getModel();
130:                //m.initModel(getUserDN());
131:                View child = null;
132:                if (name.equals(USER_DATA_VIEW)) {
133:                    child = new NetletAdminUserProfileView(this , USER_DATA_VIEW);
134:                } else if (name.equals(CHILD_TILEDVIEW)) {
135:                    child = new NetletRulesUserProfileTiledView(this ,
136:                            CHILD_TILEDVIEW);
137:                } else if (name.equals(CHILD_CC_MSGBOX)) {
138:                    return new MessageBox(this , CHILD_CC_MSGBOX, "");
139:                } else if (name.equals(PAGE_DESCRIPTION)) {
140:                    child = new StaticTextField(this , PAGE_DESCRIPTION, "");
141:                } else if (name.equals(CHILD_NAME_LABEL)) {
142:                    return new StaticTextField(this , CHILD_NAME_LABEL,
143:                            modelManager.getString("name.label"));
144:                } else if (name.equals(CHILD_ACTION_LABEL)) {
145:                    return new StaticTextField(this , CHILD_ACTION_LABEL,
146:                            modelManager.getString("action.label"));
147:                } else if (name.equals(NETLET_RULES_LABEL)) {
148:                    int netletrulesIndex = m.getNetletRulesIndex();
149:                    m.setCurrentRow(netletrulesIndex);
150:                    return new StaticTextField(this , NETLET_RULES_LABEL, m
151:                            .getAttrLabel()
152:                            + ":");
153:                } else if (name.equals(NETLET_RULES_STATUS)) {
154:                    return new ComboBox(this , NETLET_RULES_STATUS, "");
155:                } else if (name.equals(CHILD_NETLETATTRSFOR)) {
156:                    child = new StaticTextField(this , CHILD_NETLETATTRSFOR,
157:                            modelManager.getString("netletattributesfor.label"));
158:                } else if (name.equals(CHILD_USERID)) {
159:                    child = new StaticTextField(this , CHILD_USERID, "");
160:                } else if (name.equals(NETLET_PASSWORD_LABEL)) {
161:                    child = new StaticTextField(this , NETLET_PASSWORD_LABEL, "");
162:                } else if (name.equals(NETLET_PASSWORD)) {
163:                    child = new TextField(this , NETLET_PASSWORD, "");
164:                } else if (name.equals(EMPTY_PASSWORD)) {
165:                    child = new StaticTextField(this , EMPTY_PASSWORD,
166:                            modelManager.getString("emptypassword"));
167:                } else if (name.equals(NETLET_RULES_COUNT)) {
168:                    return new HiddenField(this , NETLET_RULES_COUNT, "");
169:                } else if (name.equals(NO_RULE_SELECTION)) {
170:                    return new StaticTextField(this , NO_RULE_SELECTION,
171:                            modelManager.getString("noruleselection"));
172:                } else if (name.equals(CONFIRM_RULE_DELETE)) {
173:                    return new StaticTextField(this , CONFIRM_RULE_DELETE,
174:                            modelManager.getString("confirmruledelete"));
175:                } else if (name.equals(ADD_NETLETRULE_BTN)) {
176:                    child = new IPlanetButton(this , ADD_NETLETRULE_BTN,
177:                            modelManager.getString("add.button"));
178:                } else if (name.equals(DELETE_NETLETRULES_BTN)) {
179:                    child = new IPlanetButton(this , DELETE_NETLETRULES_BTN,
180:                            modelManager.getString("delete.button"));
181:                } else if (name.equals(SAVE_BTN)) {
182:                    child = new IPlanetButton(this , SAVE_BTN, "");
183:                } else if (name.equals(RESET_BTN)) {
184:                    child = new IPlanetButton(this , RESET_BTN, "");
185:                } else if (name.equals(TITLE_HTML_PAGE)) {
186:                    StaticTextField txtField = new StaticTextField(this ,
187:                            TITLE_HTML_PAGE, modelManager
188:                                    .getString("netlet.admin.title"));
189:                    child = txtField;
190:                } else {
191:                    child = super .createChild(name);
192:                }
193:                return child;
194:            }
195:
196:            public void beginDisplay(DisplayEvent event)
197:                    throws ModelControlException {
198:                getNetletModelMgr();
199:                NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl) getModel();
200:                setChildValues(model);
201:                //m.initModel(getUserDN());
202:                setDisplayFieldValue(PAGE_DESCRIPTION, m
203:                        .getServiceDescription());
204:                setDisplayFieldValue(SAVE_BTN, modelManager
205:                        .getString("save.button"));
206:                setDisplayFieldValue(RESET_BTN, modelManager
207:                        .getString("reset.button"));
208:                setDisplayFieldValue(CHILD_USERID, m.getUserID());
209:                if (!m.isReadOnly("sunPortalNetletRules")) {
210:                    setNetletRulesStatusOptions(m);
211:                }
212:                setDisplayFieldValue(NETLET_PASSWORD_LABEL, m
213:                        .getAttrLabel("sunPortalNetletPassword")
214:                        + ":");
215:                setDisplayFieldValue(NETLET_PASSWORD, m.getAttrStringValue(
216:                        "sunPortalNetletPassword", "srap-netlet"));
217:                setDisplayFieldValue(NETLET_RULES_COUNT, m
218:                        .getNetletRulesCount());
219:            }
220:
221:            public boolean beginNetletRulesStatusDisplay(ChildDisplayEvent event) {
222:                NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl) getModel();
223:                //m.initModel(getUserDN());
224:                return !m.isReadOnly("sunPortalNetletRules");
225:            }
226:
227:            public boolean beginUserLevelBlockDisplay(ChildDisplayEvent event) {
228:                NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl) getModel();
229:                //m.initModel(getUserDN());
230:                return (m.getSize() != 0);
231:            }
232:
233:            public boolean beginNetletRulesBtnBlockDisplay(
234:                    ChildDisplayEvent event) {
235:                NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl) getModel();
236:                //m.initModel(getUserDN());
237:                return !m.isReadOnly("sunPortalNetletRules");
238:            }
239:
240:            public boolean beginNetletPasswordBlockDisplay(
241:                    ChildDisplayEvent event) {
242:                NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl) getModel();
243:                //m.initModel(getUserDN());
244:                return !m.isReadOnly("sunPortalNetletPassword");
245:            }
246:
247:            public NetletAdminUserProfileModelImpl getModel() {
248:                HttpServletRequest request = getRequestContext().getRequest();
249:                return this .getModel(request, true);
250:            }
251:
252:            public NetletAdminUserProfileModelImpl getModel(
253:                    HttpServletRequest request, boolean retrieve) {
254:                if (model == null) {
255:                    model = new NetletAdminUserProfileModelImpl(request,
256:                            getPageSessionAttributes());
257:                    model.initModel(getUserDN());
258:                }
259:                return model;
260:            }
261:
262:            public NetletAdminModelManager getNetletModelMgr() {
263:                if (modelManager == null) {
264:                    modelManager = (NetletAdminModelManager) getRequestContext()
265:                            .getModelManager();
266:                }
267:                return modelManager;
268:            }
269:
270:            public NetletRulesUserProfileTiledView getNetletRulesUserProfileTiledView() {
271:                return (NetletRulesUserProfileTiledView) getChild(CHILD_TILEDVIEW);
272:            }
273:
274:            /*    
275:             public void handleSaveButtonRequest(RequestInvocationEvent event) throws ModelControlException {
276:             NetletAdminUserProfileView view = null;
277:             view = (NetletAdminUserProfileView) getChild(USER_DATA_VIEW);
278:             if(view != null){
279:             store(view);
280:             }
281:             NetletAdminUserProfileViewBean vb = (NetletAdminUserProfileViewBean)getViewBean(NetletAdminUserProfileViewBean.class);
282:             passPgSessionMap(vb);
283:             vb.forwardTo(getRequestContext());        
284:             }
285:
286:             private void store(NetletAdminUserProfileView view) {
287:             NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl)getModel();
288:             m.initModel(getUserDN());
289:             Map map = new HashMap(10);
290:             List dynComps = view.getDynamicCompList(m.getNetletRulesIndex());
291:             if (dynComps != null && !dynComps.isEmpty()) {
292:             Iterator it = dynComps.iterator();
293:             while(it.hasNext()){
294:             DynamicGUI dGui = (DynamicGUI) it.next();
295:             if (dGui != null) {
296:             map.put(dGui.getName(), dGui.getValues());
297:             }
298:             }
299:             }
300:             if (!map.isEmpty()) {
301:             //TOFIX: enclose in a try-catch and handle errors
302:             boolean success = m.store(map);
303:             }
304:             }
305:             */
306:
307:            public void handleSaveButtonRequest(RequestInvocationEvent event)
308:                    throws ModelControlException {
309:                NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl) getModel();
310:                m.initModel(getUserDN());
311:                try {
312:                    processAttributes(m.getNetletRulesIndex());
313:                    int size = attrValues.size();
314:                    Map userOnlyAttrs = new HashMap(size);
315:                    Map customizedAttrs = new HashMap(size);
316:                    Set inheritedAttrs = new HashSet(size);
317:                    Set nameSet = attrStatus.keySet();
318:                    Iterator nameIter = nameSet.iterator();
319:                    while (nameIter.hasNext()) {
320:                        String attrName = (String) nameIter.next();
321:                        Set values = (Set) attrValues.get(attrName);
322:                        String status = (String) attrStatus.get(attrName);
323:                        if (!m.isReadOnly(attrName)
324:                                && (status == null || status.trim().length() == 0)) {
325:                            userOnlyAttrs.put(attrName, values);
326:                        } else if (!m.isReadOnly(attrName)
327:                                && status.equals(m.getCustomizeValue())) {
328:                            customizedAttrs.put(attrName, values);
329:                        } else if (!m.isReadOnly(attrName)
330:                                && status.equals(m.getInheritValue())) {
331:                            inheritedAttrs.add(attrName);
332:                        }
333:                    }
334:                    String netletRulesStatus = (String) getDisplayFieldValue(NETLET_RULES_STATUS);
335:                    if (netletRulesStatus.equals(m.getInheritValue())) {
336:                        inheritedAttrs.add("sunPortalNetletRules");
337:                    }
338:                    String netletPassword = (String) getDisplayFieldValue(NETLET_PASSWORD);
339:                    if (netletPassword != null
340:                            && netletPassword.trim().length() != 0) {
341:                        Set s = new HashSet();
342:                        s.add(netletPassword);
343:                        userOnlyAttrs.put("sunPortalNetletPassword", s);
344:                    } else {
345:                        userOnlyAttrs.remove("sunPortalNetletPassword");
346:                    }
347:                    m.storeAttributes(userOnlyAttrs, customizedAttrs,
348:                            inheritedAttrs);
349:                } catch (AMConsoleException ace) {
350:                }
351:                NetletAdminUserProfileViewBean vb = (NetletAdminUserProfileViewBean) getViewBean(NetletAdminUserProfileViewBean.class);
352:                passPgSessionMap(vb);
353:                vb.forwardTo(getRequestContext());
354:            }
355:
356:            public void processAttributes(int netletRulesIndex)
357:                    throws AMConsoleException {
358:                if (attrValues == null) {
359:                    attrValues = new HashMap();
360:                }
361:                if (attrStatus == null) {
362:                    attrStatus = new HashMap();
363:                }
364:                NetletAdminUserProfileView view = (NetletAdminUserProfileView) getChild(USER_DATA_VIEW);
365:                List dynComps = view.getDynamicCompList(netletRulesIndex);
366:                if (dynComps != null && !dynComps.isEmpty()) {
367:                    Iterator it = dynComps.iterator();
368:                    while (it.hasNext()) {
369:                        DynamicGUI dGui = (DynamicGUI) it.next();
370:                        if (dGui != null) {
371:                            attrValues.put(dGui.getName(), dGui.getValues());
372:                            attrStatus.put(dGui.getName(), dGui
373:                                    .getStatusValue());
374:                        }
375:                    }
376:                }
377:            }
378:
379:            public void handleResetButtonRequest(RequestInvocationEvent event)
380:                    throws ModelControlException {
381:                NetletAdminUserProfileViewBean vb = (NetletAdminUserProfileViewBean) getViewBean(NetletAdminUserProfileViewBean.class);
382:                passPgSessionMap(vb);
383:                vb.forwardTo(getRequestContext());
384:            }
385:
386:            public void handleAddruleButtonRequest(RequestInvocationEvent event)
387:                    throws ModelControlException {
388:                getNetletModelMgr();
389:                modelManager.setCurrentNetletRulesRow(-1);
390:                EditNetletRuleUserProfileViewBean vb = (EditNetletRuleUserProfileViewBean) getViewBean(EditNetletRuleUserProfileViewBean.class);
391:                passPgSessionMap(vb);
392:                vb.forwardTo(getRequestContext());
393:            }
394:
395:            public void handleDelrulesButtonRequest(RequestInvocationEvent event)
396:                    throws ModelControlException {
397:                NetletRulesUserProfileTiledView tileView = getNetletRulesUserProfileTiledView();
398:                tileView.getPrimaryModel().setSize(
399:                        tileView.getNetletRulesCount());
400:                List selections = new LinkedList();
401:                while (tileView.nextTile()) {
402:                    String value = (String) tileView
403:                            .getDisplayFieldValue(NetletRulesUserProfileTiledView.CHILD_CB_SELECT_RULE);
404:                    if (value.equals("true")) {
405:                        value = (String) tileView
406:                                .getDisplayFieldValue(NetletRulesUserProfileTiledView.CHILD_HREF_TEXT);
407:                        selections.add(value);
408:                    }
409:                }
410:                if (selections.size() == 0) {
411:                    getNetletModelMgr();
412:                    MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
413:                    msgBox.setTitle(modelManager
414:                            .getString("noselectionmsgbox.title"));
415:                    msgBox
416:                            .setMessage(modelManager
417:                                    .getString("noruleselection"));
418:                    msgBox.setType(MessageBox.TYPE_ERROR);
419:                    msgBox.setVisible(true);
420:                    /* Redisplay the page with the error */
421:                    forwardTo();
422:                    return;
423:                } else if (selections.size() > 0) {
424:                    Vector netletRules = tileView.getNetletRules();
425:                    int nrSize = netletRules.size();
426:                    if (netletRules != null) {
427:                        for (int i = 0; i < selections.size(); i++) {
428:                            for (int j = 0; j < netletRules.size(); j++) {
429:                                StringTokenizer st1 = new StringTokenizer(
430:                                        (String) netletRules.get(j),
431:                                        EditNetletRuleViewBean.RULE_DELIM);
432:                                if (st1.hasMoreTokens())
433:                                    st1 = new StringTokenizer(st1.nextToken(),
434:                                            EditNetletRuleViewBean.ALGO_DELIM);
435:                                if (st1.hasMoreTokens()) {
436:                                    String rulename = st1.nextToken();
437:                                    if (rulename.equals(selections.get(i))) {
438:                                        netletRules.remove(j);
439:                                        --j;
440:                                    }
441:                                }
442:                            }
443:                        }
444:                    }
445:                    Set newRuleSet = new HashSet(netletRules);
446:                    Map newMap = new HashMap();
447:                    newMap.put("sunPortalNetletRules", newRuleSet);
448:                    NetletAdminUserProfileModelImpl m = (NetletAdminUserProfileModelImpl) getModel();
449:                    //m.initModel(getUserDN());
450:                    boolean success = m.store(newMap);
451:                    redirectToPage(NetletAdminUserProfileViewBean.PAGE_NAME);
452:                }
453:                /*        
454:                 NetletAdminUserProfileViewBean vb = (NetletAdminUserProfileViewBean)getViewBean(NetletAdminUserProfileViewBean.class);
455:                 passPgSessionMap(vb);
456:                 vb.forwardTo(getRequestContext());        
457:                 */
458:            }
459:
460:            public String getUserDN() {
461:                if (userDN == null) {
462:                    Map pageSessAttrs = getPageSessionAttributes();
463:                    userDN = (String) pageSessAttrs
464:                            .get("com-iplanet-am-admin-user-current-object");
465:                }
466:                return userDN;
467:            }
468:
469:            public void passPgSessionMap(ViewBean other) {
470:                Map attributes = getPageSessionAttributes();
471:                if ((attributes != null) && (attributes.size() > 0)) {
472:                    Iterator iter = attributes.keySet().iterator();
473:                    while (iter.hasNext()) {
474:                        String key = (String) iter.next();
475:                        other.setPageSessionAttribute(key,
476:                                (Serializable) attributes.get(key));
477:                    }
478:                }
479:            }
480:
481:            public void redirectToPage(String pageName) {
482:                String nasURL = getModuleURL() + "/" + pageName;
483:                nasURL = AMViewBeanUtils.appendPgSession(nasURL,
484:                        getPageSessionAttributes());
485:                HttpServletResponse response = getRequestContext()
486:                        .getResponse();
487:                try {
488:                    response.sendRedirect(nasURL);
489:                } catch (IOException ioe) {
490:                    forwardTo();
491:                }
492:            }
493:
494:            private void setNetletRulesStatusOptions(
495:                    NetletAdminUserProfileModelImpl model) {
496:                OptionList optionList = new OptionList();
497:                optionList.add(model.getCustomizeLabel(), model
498:                        .getCustomizeValue());
499:                optionList
500:                        .add(model.getInheritLabel(), model.getInheritValue());
501:                ComboBox cb = (ComboBox) getChild(NETLET_RULES_STATUS);
502:                cb.setOptions(optionList);
503:                cb.setValue(model.getCustomizeLabel());
504:            }
505:
506:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.