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


001:        /**
002:         *  %W% %G% Sun Microsystems 
003:         * Copyright 2002 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.wireless.taglibs.ab;
014:
015:        import java.beans.*;
016:        import javax.servlet.jsp.*;
017:
018:        import com.sun.portal.wireless.taglibs.base.BeanSupport;
019:        import com.sun.portal.wireless.taglibs.base.Edit;
020:        import com.sun.portal.log.common.PortalLogger;
021:
022:        import com.sun.addressbook.Group;
023:        import com.sun.addressbook.Element;
024:        import java.util.StringTokenizer;
025:        import java.util.logging.Logger;
026:
027:        /**
028:         * ABDeleteGroupMembersTag - add group members to a group
029:         * 
030:         * This class writes the group members to the Group bean found in its parent 
031:         * entry tag or retrieved from pagecontext using name attribute.
032:         * 
033:         * Attributes:
034:         * 
035:         * members
036:         *   ',' separated list of element ids to add to the Group
037:         * groupid
038:         *   element from which to delete the members
039:         * 
040:         */
041:        public class ABDeleteGroupMembersTag extends ABBaseCommandTag {
042:
043:            // Create a logger for this class
044:            private static Logger debugLogger = PortalLogger
045:                    .getLogger(ABDeleteGroupMembersTag.class);
046:
047:            /*
048:             * Member ids of the group to be deleted
049:             */
050:            protected String members = null;
051:
052:            /**
053:             * Get the members attribute
054:             *
055:             * @return set the members attribute
056:             */
057:            public String getMembers() {
058:                return members;
059:            }
060:
061:            /**
062:             * Set the members attribute
063:             *
064:             * @param set the members attribute
065:             */
066:            public void setMembers(String members) {
067:                this .members = evalAttribute(members);
068:            }
069:
070:            /*
071:             * groupid of the address book entry to be deleted
072:             */
073:            protected String groupid = null;
074:
075:            /**
076:             * Get the groupid attribute
077:             * 
078:             * @return the groupid attribute
079:             */
080:            public String getGroupid() {
081:                return groupid;
082:            }
083:
084:            /**
085:             * Set the groupid attribute
086:             * 
087:             * @param set the groupid attribute
088:             */
089:            public void setGroupid(String groupid) {
090:                this .groupid = evalAttribute(groupid);
091:            }
092:
093:            /**
094:             * Verifying if the groupid attribute exists.. 
095:             * 
096:             * @exception JspException
097:             */
098:            public void verifyGroupid() throws JspException {
099:                // groupid is mandatory attribute for modify. delete
100:                if (groupid == null) {
101:                    throw new JspException(
102:                            "ABDeleteGroupMembersTag.verifyGroupid(): 'groupid' attribute not specified");
103:                }
104:            }
105:
106:            /**
107:             * Edit bean...
108:             */
109:            private Edit edit = null;
110:
111:            /**
112:             * Set the edit bean
113:             */
114:            public void setEdit(String edit) {
115:                this .edit = (Edit) pageContext.getAttribute(edit);
116:            }
117:
118:            /**
119:             * Execute the delete group members command on the address book.
120:             * Returns the command status.
121:             * If the command fails then the tag body is included,
122:             * Else if the command succeeds then the tag body is skipped.
123:             * 
124:             * @return true if the command succeeds.
125:             *         false if the command fails.
126:             * @exception JspException
127:             */
128:            public boolean execute() throws JspException {
129:
130:                // groupid attribute must be present for delete.. if not jsp
131:                //  exception is throw
132:                verifyGroupid();
133:
134:                // Get the contactDB object interacting with the Backend LDAP server
135:                ContactDB contactDB = getContactDB();
136:                // Get the element object corresponsing to the groupid, from context
137:                Element element = getEntry(Integer.parseInt(groupid));
138:                if (element.getElementType() != Element.GROUP) {
139:                    debugLogger.fine("PSMA_CSPWTA0009");
140:                    getABContext().setErrorCode("");
141:                    return false;
142:                }
143:                Group group = (Group) element;
144:
145:                if (edit != null) {
146:                    members = edit.editString(members.toString());
147:                }
148:
149:                if ((members != null) && (!members.equals(""))) {
150:                    // Delete all entries individually to the group using 
151:                    //  deleteElementFromGroup
152:                    StringTokenizer tok = new StringTokenizer(members, ",");
153:                    while (tok.hasMoreTokens()) {
154:                        Element elemToDel = getABContext().getGroupmember(
155:                                Integer.parseInt(tok.nextToken()));
156:                        if (!contactDB.deleteElementFromGroup(elemToDel, group)) {
157:                            debugLogger.fine("PSMA_CSPWTA0010");
158:                            getABContext().setErrorCode("");
159:                            return false;
160:                        }
161:                    }
162:                }
163:
164:                return true;
165:            }
166:
167:            /**
168:             * Cleanup
169:             */
170:            public void release() {
171:                super.release();
172:                members = null;
173:                edit = null;
174:            }
175:
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.