Source Code Cross Referenced for RequestUtil.java in  » J2EE » jag » com » finalist » jag » taglib » util » 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 » J2EE » jag » com.finalist.jag.taglib.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*   Copyright (C) 2003 Finalist IT Group
002:         *
003:         *   This file is part of JAG - the Java J2EE Application Generator
004:         *
005:         *   JAG is free software; you can redistribute it and/or modify
006:         *   it under the terms of the GNU General Public License as published by
007:         *   the Free Software Foundation; either version 2 of the License, or
008:         *   (at your option) any later version.
009:         *   JAG is distributed in the hope that it will be useful,
010:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:         *   GNU General Public License for more details.
013:         *   You should have received a copy of the GNU General Public License
014:         *   along with JAG; if not, write to the Free Software
015:         *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
016:         */
017:
018:        package com.finalist.jag.taglib.util;
019:
020:        import com.finalist.jag.*;
021:        import com.finalist.jag.skelet.*;
022:
023:        import java.util.*;
024:
025:        /**
026:         * Class RequestUtil
027:         *
028:         *
029:         * @author Wendel D. de Witte
030:         * @version %I%, %G%
031:         */
032:        public class RequestUtil {
033:
034:            /**
035:             * Method lookupString
036:             *
037:             *
038:             * @param pageContext
039:             * @param name
040:             * @param property
041:             *
042:             * @return
043:             *
044:             */
045:            public static String lookupString(PageContext pageContext,
046:                    String name, String property) {
047:                Object object = pageContext.getAttribute(name);
048:
049:                if (object == null) {
050:                    object = pageContext.getSessionContext().getAttribute(name);
051:                }
052:
053:                String returnValue = null;
054:
055:                if ((object != null) && (object instanceof  ModuleData)) {
056:                    ModuleData moduleData = (ModuleData) object;
057:                    if (moduleData.isValueCollection()) {
058:                        Collection col = (Collection) moduleData.getValue();
059:                        Iterator iterator = col.iterator();
060:
061:                        while (iterator.hasNext()) {
062:                            moduleData = (ModuleData) iterator.next();
063:                            if (moduleData != null
064:                                    && moduleData.getName().equals(property)
065:                                    && moduleData.isValueString()) {
066:                                returnValue = (String) moduleData.getValue();
067:                                break;
068:                            }
069:                        }
070:                    }
071:                } else if ((object != null) && (object instanceof  String)) {
072:                    returnValue = (String) object;
073:                } else {
074:                    String colProperty = "";
075:                    String colName = "";
076:                    StringTokenizer tokens = new StringTokenizer(name, ".");
077:                    while (tokens.hasMoreTokens()) {
078:                        String token = tokens.nextToken();
079:                        if (!tokens.hasMoreTokens()) {
080:                            colProperty = token;
081:                        } else {
082:                            if (colName.length() > 0)
083:                                colName += ".";
084:                            colName += token;
085:                        }
086:                    }
087:                    Collection collection = lookupCollection(pageContext,
088:                            colName, colProperty);
089:                    if (collection != null) {
090:                        Iterator iterator = collection.iterator();
091:                        if (iterator.hasNext()) {
092:                            object = iterator.next();
093:                            String hashcode = "" + object.hashCode();
094:                            pageContext.setAttribute(hashcode, object);
095:                            returnValue = lookupString(pageContext, hashcode,
096:                                    property);
097:                            pageContext.removeAttribute(hashcode);
098:                        }
099:                    }
100:                }
101:                return returnValue;
102:            }
103:
104:            /**
105:             * Method lookupCollection
106:             *
107:             *
108:             * @param pageContext
109:             * @param name
110:             * @param property
111:             *
112:             * @return
113:             *
114:             */
115:            public static Collection lookupCollection(PageContext pageContext,
116:                    String name, String property) {
117:                SessionContext session = pageContext.getSessionContext();
118:                Object object = pageContext.getAttribute(name);
119:
120:                if (object == null) {
121:                    object = session.getAttribute(name);
122:                }
123:
124:                Collection returnValue = null;
125:
126:                if ((object != null) && (object instanceof  Collection)) {
127:                    returnValue = (Collection) object;
128:                } else {
129:                    Collection dataModules = null;
130:                    ArrayList tmpList = new ArrayList();
131:
132:                    if ((object != null) && (object instanceof  ModuleData)) {
133:                        ModuleData dataModule = (ModuleData) object;
134:
135:                        if (dataModule.isValueCollection()) {
136:                            dataModules = (Collection) dataModule.getValue();
137:                        }
138:                    } else {
139:                        SkeletDataObj skelet = session.getSkelet();
140:                        StringTokenizer tokens = new StringTokenizer(name, ".");
141:
142:                        dataModules = (Collection) skelet.getValue();
143:
144:                        if (name.indexOf(skelet.getName()) == 0) {
145:                            tokens.nextToken();
146:                        }
147:
148:                        while (tokens.hasMoreTokens()) {
149:                            String label = tokens.nextToken();
150:                            Iterator iterator = dataModules.iterator();
151:
152:                            while (iterator.hasNext()) {
153:                                ModuleData moduleData = (ModuleData) iterator
154:                                        .next();
155:
156:                                if (moduleData.isValueCollection()
157:                                        && moduleData.getName().equals(label)) {
158:                                    if (tokens.hasMoreTokens()) {
159:                                        dataModules = (Collection) moduleData
160:                                                .getValue();
161:                                        break;
162:                                    }
163:                                }
164:                            }
165:                            dataModules = null;
166:                            break;
167:                        }
168:                    }
169:
170:                    if (dataModules != null) {
171:                        Iterator iterator = dataModules.iterator();
172:                        while ((property != null) && iterator.hasNext()) {
173:                            ModuleData moduleData = (ModuleData) iterator
174:                                    .next();
175:
176:                            if (moduleData != null
177:                                    && moduleData.isValueCollection()
178:                                    && moduleData.getName().equals(property)) {
179:                                tmpList.add(moduleData);
180:                            }
181:                        }
182:                        returnValue = tmpList;
183:                    }
184:                }
185:                return returnValue;
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.