Source Code Cross Referenced for ABEntryTag.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:        import java.util.*;
013:        import com.sun.portal.wireless.taglibs.base.*;
014:
015:        import com.sun.addressbook.Entry;
016:        import com.sun.addressbook.Element;
017:        import com.sun.addressbook.Group;
018:
019:        /**
020:         * ABEntryTag - tag that represents an ical DateTime bean
021:         * 
022:         * @author Mihir Sambhus
023:         * @version 1.0
024:         * @see com.iplanet.portalserver.ical.DateTime
025:         */
026:
027:        public class ABEntryTag extends BeanTag {
028:
029:            /**
030:             * The entryid for the bean
031:             */
032:            protected String entryid = null;
033:
034:            /**
035:             * The element type for the bean .. can be Element.GROUP, Element.ENTRY, 
036:             * Element.ADDRESSBOOK and Element.UNSPECIFIED
037:             */
038:            protected int elementtype = Element.UNSPECIFIED;
039:
040:            /**
041:             * Get the entryid
042:             * 
043:             * @return the entryid
044:             */
045:            public String getEntryid() {
046:                return entryid;
047:            }
048:
049:            /**
050:             * Set the entryid
051:             * 
052:             * @param entryid   the entryid String
053:             */
054:            public void setEntryid(String entryid) {
055:                this .entryid = evalAttribute(entryid);
056:            }
057:
058:            /**
059:             * Get the element type
060:             * 
061:             * @return the element type
062:             */
063:            public String getElementtype() {
064:                if (elementtype == Element.ENTRY) {
065:                    return "contact";
066:                } else if (elementtype == Element.GROUP) {
067:                    return "group";
068:                } else {
069:                    // default type is entry
070:                    return "contact";
071:                }
072:            }
073:
074:            /**
075:             * Set the element type
076:             * 
077:             * @param type   the element type String
078:             */
079:            public void setElementtype(String elementtype) {
080:                if (evalAttribute(elementtype).equals("contact")) {
081:                    this .elementtype = Element.ENTRY;
082:                } else if (evalAttribute(elementtype).equals("group")) {
083:                    this .elementtype = Element.GROUP;
084:                } else {
085:                    // default is of type entry
086:                    this .elementtype = Element.ENTRY;
087:                }
088:            }
089:
090:            /**
091:             * Create a new Entry bean object
092:             * 
093:             * @return the Entry object
094:             */
095:            public Object newBean() throws Exception {
096:                if (elementtype == Element.ENTRY) {
097:                    return new Entry();
098:                } else if (elementtype == Element.GROUP) {
099:                    return new Group();
100:                }
101:                // default .. return entry
102:                return new Entry();
103:            }
104:
105:            /**
106:             * Find the bean
107:             * 
108:             * If the "entryid" attribute is specified then get
109:             * the bean from collection in the context.
110:             * 
111:             * Otherwise call super.findBean()
112:             * 
113:             * @return the found bean
114:             */
115:            public Object findBean() throws Exception {
116:
117:                // Override super.findBean only for the case where entryid is
118:                // specified
119:                if (entryid == null) {
120:                    return super .findBean();
121:                }
122:
123:                Element element = null;
124:
125:                // try to retrieve address book context from pagecontext .. 
126:                ABContext abContext;
127:
128:                // get context; allow exception to be thrown
129:                abContext = ABContext.getContext(pageContext);
130:
131:                if (abContext == null) {
132:                    throw new Exception(
133:                            "ABEntryTag.findBean(): Element bean corresponding to entryid"
134:                                    + " not found in the collection");
135:                }
136:
137:                element = abContext.getEntry(Integer.parseInt(entryid));
138:
139:                if (element == null) {
140:                    throw new Exception(
141:                            "ABEntryTag.findBean(): Element bean corresponding to entryid"
142:                                    + " not found in the collection");
143:                }
144:
145:                if (id != null) {
146:                    pageContext.setAttribute(id, element);
147:                }
148:
149:                return element;
150:            }
151:
152:            /**
153:             * Cleanup
154:             *
155:             */
156:            public void release() {
157:                super.release();
158:                entryid = null;
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.