Source Code Cross Referenced for ABBaseCommandTag.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:         *
004:         * Copyright 2000 Sun Microsystems, Inc.  All rights reserved.
005:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
006:         */
007:
008:        package com.sun.portal.wireless.taglibs.ab;
009:
010:        import javax.servlet.jsp.*;
011:        import javax.servlet.jsp.tagext.*;
012:
013:        import com.sun.portal.wireless.taglibs.base.*;
014:        import com.sun.portal.log.common.PortalLogger;
015:        import com.sun.addressbook.Element;
016:        import com.sun.addressbook.Entry;
017:        import com.sun.addressbook.Group;
018:
019:        import java.util.logging.Logger;
020:
021:        /**
022:         * The ABBaseCommandTag class forms the base class of all the command 
023:         * tags classes in Address book. It provides functionality common to all 
024:         * address book tags like retrieving the context object and the contactDB
025:         * object from the context which performs backend LDAP operations.
026:         * 
027:         * @author Mihir Sambhus
028:         * @version 1.0
029:         */
030:        public abstract class ABBaseCommandTag extends CommandTag {
031:
032:            // Create a logger for this class
033:            private static Logger debugLogger = PortalLogger
034:                    .getLogger(ABBaseCommandTag.class);
035:
036:            /*
037:             * Address Book context object to be accessed 
038:             */
039:            protected ABContext abContext = null;
040:
041:            /*
042:             * name of the entry bean to be modified
043:             */
044:            protected String name = null;
045:
046:            /**
047:             * Get the name attribute
048:             * 
049:             * @return the name attribute
050:             */
051:            public String getName() {
052:                return name;
053:            }
054:
055:            /**
056:             * Set the name attribute
057:             * 
058:             * @param set the name attribute
059:             */
060:            public void setName(String name) {
061:                this .name = name;
062:            }
063:
064:            /*
065:             * entryid of the address book entry to be deleted
066:             */
067:            protected String entryid = null;
068:
069:            /**
070:             * Get the entryid attribute
071:             * 
072:             * @return the entryid attribute
073:             */
074:            public String getEntryid() {
075:                return entryid;
076:            }
077:
078:            /**
079:             * Set the entryid attribute
080:             * 
081:             * @param set the entryid attribute
082:             */
083:            public void setEntryid(String entryid) {
084:                this .entryid = evalAttribute(entryid);
085:            }
086:
087:            /**
088:             * Get the current session's ABContext object 
089:             *
090:             * @return ABContext object
091:             * @exception JspException
092:             */
093:            public ABContext getABContext() throws JspException {
094:
095:                // try to retrieve address book context from pagecontext .. 
096:                try {
097:                    this .abContext = ABContext.getContext(pageContext);
098:                } catch (Exception e) {
099:                    throw new JspException(e.getMessage());
100:                }
101:                if (this .abContext == null) {
102:                    throw new JspException(
103:                            "ABBaseCommandTag.execute(): Address Book context not found");
104:                }
105:
106:                return this .abContext;
107:            }
108:
109:            /**
110:             * Retrieve the contactDB object from the AB context.
111:             * 
112:             * @return ContactDB object
113:             * @exception JspException
114:             */
115:            public ContactDB getContactDB() throws JspException {
116:
117:                ContactDB contactDB = getABContext().getContactDB();
118:                if (contactDB == null) {
119:                    throw new JspException(
120:                            "ABBaseCommandTag.getContactDB(): ContactDB object not found");
121:                }
122:                return contactDB;
123:            }
124:
125:            /**
126:             * Verifying if the entryid attribute exists.. only called from  
127:             *  delete, modify tags
128:             * 
129:             * @exception JspException
130:             */
131:            public void verifyEntryid() throws JspException {
132:                // entryid is mandatory attribute for modify. delete
133:                if (entryid == null) {
134:                    throw new JspException(
135:                            "ABCommangTag.verifyEntryid(): 'entryid' attribute not specified");
136:                }
137:            }
138:
139:            /**
140:             * Verifying if the last name property filled in .. only called from  
141:             *  add, modify tags
142:             * 
143:             * @exception JspException
144:             */
145:            public boolean requiredPropertiesExist(Element e)
146:                    throws JspException {
147:
148:                if (e.isEntry()) {
149:                    //
150:                    // Entry has to have Last name property filled
151:                    //
152:                    Entry entry = (Entry) e;
153:
154:                    if ((entry.getLn() != null) && (!entry.getLn().equals(""))) {
155:                        return true;
156:                    }
157:
158:                    getABContext().setErrorCode("AB_001"); // AB_001 = Last name required
159:                    debugLogger.finer("PSMA_CSPWTA0006");
160:
161:                } else if (e.isGroup()) {
162:                    // No required property for now
163:                    Group group = (Group) e;
164:                    if ((group.getCn() != null) && (!group.getCn().equals(""))) {
165:                        return true;
166:                    }
167:
168:                    getABContext().setErrorCode("AB_002"); // AB_002 = Group name required
169:                    debugLogger.finer("PSMA_CSPWTA0007");
170:
171:                }
172:
173:                return false;
174:            }
175:
176:            /**
177:             * Retrieve the element bean from the pagecontext... only called from  
178:             *  add, modify tags
179:             *
180:             * @return Element object
181:             * @exception JspException
182:             */
183:            public Element getElement() throws JspException {
184:                // name is a mandatory attribute for add, modify
185:                if (name == null) {
186:                    throw new JspException(
187:                            "ABCommangTag.getEntry(): 'name' attribute not specified");
188:                }
189:                // if name attribute present, return the bean corresponding to the name
190:                Element element = (Element) pageContext.getAttribute(name);
191:                if (element == null) {
192:                    throw new JspException(
193:                            "ABBaseCommandTag.getEntry(): Bean corresponding to "
194:                                    + name
195:                                    + "not found in address book context");
196:                }
197:                return element;
198:            }
199:
200:            /**
201:             * Retrieve the element bean from the resultset in context... only called 
202:             *  from delete, modify tags
203:             * 
204:             * @param int entryid - corresponding to which the element object from 
205:             *   the collection is to be retrieved
206:             * @return Element object
207:             * @exception JspException
208:             */
209:            public Element getEntry(int entryid) throws JspException {
210:
211:                // get the context first if null.
212:                if (this .abContext == null)
213:                    this .abContext = getABContext();
214:
215:                // Get the element object corresponsing to the entryid from context
216:                Element element = this .abContext.getEntry(entryid);
217:
218:                if (element == null) {
219:                    throw new JspException(
220:                            "ABBaseCommandTag.getEntry(): Element bean corresponding to "
221:                                    + entryid + " not found in the collection");
222:                }
223:                return element;
224:            }
225:
226:            /**
227:             * Cleanup
228:             */
229:            public void release() {
230:                super.release();
231:                abContext = null;
232:                name = null;
233:                entryid = null;
234:            }
235:
236:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.