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


001:        /*
002:         * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
003:         *
004:         * Redistribution and use in source and binary forms, with or without
005:         * modification, are permitted provided that the following conditions
006:         * are met:
007:         *
008:         * - Redistributions of source code must retain the above copyright
009:         *   notice, this list of conditions and the following disclaimer.
010:         *
011:         * - Redistribution in binary form must reproduce the above copyright
012:         *   notice, this list of conditions and the following disclaimer in
013:         *   the documentation and/or other materials provided with the
014:         *   distribution.
015:         *
016:         * Neither the name of Sun Microsystems, Inc. or the names of
017:         * contributors may be used to endorse or promote products derived
018:         * from this software without specific prior written permission.
019:         *
020:         * This software is provided "AS IS," without a warranty of any
021:         * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
022:         * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
023:         * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
024:         * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
025:         * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
026:         * DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
027:         * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
028:         * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
029:         * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
030:         * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE,
031:         * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
032:         *
033:         * You acknowledge that Software is not designed, licensed or intended
034:         * for use in the design, construction, operation or maintenance of
035:         * any nuclear facility.
036:         */
037:
038:        package com.sun.portal.oracleportlet.approval;
039:
040:        import java.util.Vector;
041:        import java.util.Hashtable;
042:        import java.io.IOException;
043:        import java.io.Writer;
044:        import java.util.logging.*;
045:
046:        import javax.portlet.*;
047:        import javax.servlet.http.HttpServletRequest;
048:
049:        import com.sun.portal.oracleportlet.util.*;
050:        import com.sun.portal.iwayutil.config.*;
051:        import com.sun.portal.iwayutil.sorting.*;
052:
053:        /**
054:         *
055:         * This Portlet is used to retrieve and display data from iProcurement module of
056:         * Oracle Applications. This Portlet is used to display data pertaining to requisitions
057:         * with pending approval . This portlet uses Oracle JDBC driver to hit appropriate
058:         * Oracle base tables and retrieve data
059:         *
060:         * @version 1.0
061:         * @author Zahid Syed
062:         * @date 10 June 2005
063:         *
064:         **/
065:
066:        public class ReqApprovalPortlet extends GenericPortlet implements 
067:                OraclePortletConstants {
068:
069:            Logger logger = null;
070:            Hashtable responseCache = new Hashtable();
071:            Hashtable pageCache = new Hashtable();
072:
073:            /**
074:             * This method is invoked by the portlet container to initialize the portlet
075:             **/
076:
077:            public void init(PortletConfig config) throws PortletException {
078:                super .init(config);
079:                logger = OraclePortletLogger.getLogger();
080:
081:            }
082:
083:            /**
084:             * This method displays the content for online help of the portlet
085:             **/
086:            public void doHelp(RenderRequest request, RenderResponse response)
087:                    throws PortletException, IOException {
088:
089:                logMessage(Level.INFO, "In doHelp : ");
090:                response.setContentType("text/html");
091:                PortletSession session = request.getPortletSession(true);
092:                PortletContext ctx = session.getPortletContext();
093:                PortletRequestDispatcher reqDisp = ctx
094:                        .getRequestDispatcher(HELP_APPROVAL_JSP);
095:                reqDisp.include(request, response);
096:            }
097:
098:            /**
099:             * This method is invoked by the portlet container after a user action
100:             **/
101:
102:            public void processAction(ActionRequest request,
103:                    ActionResponse response) throws PortletException,
104:                    IOException {
105:
106:                logMessage(Level.INFO, "In processAction : ");
107:                //Obtain the paremeter that forms a part of the query string
108:                String queryValue1 = request.getParameter("QueryValue1");
109:
110:                //Obtain parameters used for pagination
111:                String curSummPage = (String) request
112:                        .getParameter("CurrentSummaryPage");
113:                String curPage = (String) request.getParameter("CurrentPage");
114:                String requestType = (String) request
115:                        .getParameter("RequestType");
116:                String queryField = (String) request.getParameter("QueryField");
117:                String queryValue = (String) request.getParameter("QueryValue");
118:                String tableSize = (String) request.getParameter("TableSize");
119:
120:                if (queryValue1 != null) {
121:                    response.setRenderParameter("QueryValue1", queryValue1);
122:                }
123:
124:                if (curSummPage != null) {
125:                    response.setRenderParameter("CurrentSummaryPage",
126:                            curSummPage.trim());
127:                }
128:                if (curPage != null) {
129:                    response.setRenderParameter("CurrentPage", curPage.trim());
130:                }
131:                if (requestType != null) {
132:                    response.setRenderParameter("RequestType", requestType
133:                            .trim());
134:                }
135:                if (queryField != null) {
136:                    response
137:                            .setRenderParameter("QueryField", queryField.trim());
138:                }
139:                if (queryValue != null) {
140:                    response
141:                            .setRenderParameter("QueryValue", queryValue.trim());
142:                }
143:                if (tableSize != null) {
144:                    response.setRenderParameter("TableSize", tableSize.trim());
145:                }
146:
147:            }
148:
149:            /**
150:             * This method generates the content that is displayed in the portlet
151:             **/
152:            public void doView(RenderRequest request, RenderResponse response)
153:                    throws PortletException, IOException {
154:
155:                logMessage(Level.INFO, "In doView : ");
156:                // Obtain the value of SEGMENT1 (requisition no), using which details are retrieved
157:                // Initially, QueryValue1 would be null. This attribute is set in processAction method
158:
159:                String queryValue1 = request.getParameter("QueryValue1");
160:
161:                //For pagination
162:                String queryField = request.getParameter("QueryField");
163:                String queryValue = request.getParameter("QueryValue");
164:                String requestType = request.getParameter("RequestType");
165:                String curSummPage = request.getParameter("CurrentSummaryPage");
166:                String curPage = request.getParameter("CurrentPage");
167:                String tableSize = request.getParameter("TableSize");
168:                //End - For Pagination
169:
170:                Vector records = null;
171:                PortletSession session = request.getPortletSession(true);
172:                PortletContext ctx = session.getPortletContext();
173:                String sessionID = session.getId();
174:
175:                HttpServletRequest httpReq = (HttpServletRequest) request
176:                        .getAttribute(HTTPREQ_ATTR_NAME);
177:
178:                response.setContentType("text/html");
179:
180:                if (requestType != null) {
181:                    if (queryField.equals("goTo")) {
182:                        queryValue = PaginationUtils.checkGoToValue(queryValue,
183:                                tableSize);
184:                    }
185:                    request.setAttribute("CurrentPage", queryValue);
186:                    request.setAttribute("CurrentSummaryPage", queryValue);
187:
188:                    records = PaginationUtils.getPageCacheData(request,
189:                            responseCache, "CurrentSummaryPage", sessionID);
190:
191:                }
192:
193:                // If the doView method was invoked previously, get records from the cache
194:                if (queryValue1 != null) {
195:
196:                    records = (Vector) pageCache.get(sessionID);
197:                    request.setAttribute("QueryValue1", queryValue1);
198:
199:                    request.setAttribute("CurrentSummaryPage", curSummPage);
200:                    request.setAttribute("CurrentPage", curPage);
201:                }
202:
203:                try {
204:                    // This condition is met only the first time doView method is invoked
205:                    if (records == null) {
206:                        // Obtain the records in the form of a vector by using a utility method
207:                        records = ApprovalQueryUtils
208:                                .getPendingApprovalRecords(httpReq);
209:                        // Check whether we have obtained the records
210:                        if (records == null) {
211:                            logMessage(Level.INFO,
212:                                    "In doView: No records obtained from getPendingApprovalRecords");
213:                        } else {
214:                            //For Pagination
215:                            int rowsToShow = PaginationUtils
216:                                    .getNumberOfPaginationRows(records.size());
217:                            request.setAttribute("CurrentSummaryPage", "1");
218:                            request.setAttribute("CurrentPage", "1");
219:                            Vector cacheData = PaginationUtils
220:                                    .splitPageCacheData(records, sessionID,
221:                                            rowsToShow);
222:                            responseCache.put(sessionID, cacheData);
223:                            records = PaginationUtils.getPageCacheData(request,
224:                                    responseCache, "CurrentSummaryPage",
225:                                    sessionID);
226:                            //End - For Pagination
227:                        }
228:                    }
229:
230:                } catch (Exception ex) {
231:
232:                    logMessage(Level.SEVERE,
233:                            "In doView : while obtaining approval records : "
234:                                    + ex);
235:                }
236:
237:                try {
238:
239:                    //If we have records to display, set the PaginationRow attribute and dispatch records					
240:                    if (records == null) {
241:                        // Dispatch the request to a JSP that displays error
242:                        PortletRequestDispatcher reqDisp = ctx
243:                                .getRequestDispatcher(NO_RECORDS_JSP);
244:                        reqDisp.include(request, response);
245:
246:                    } else {
247:                        Vector rowData = (Vector) responseCache.get(sessionID);
248:                        TablePagination.setPaginationRow(request, response,
249:                                "PaginateSummary", null, rowData.size());
250:
251:                        // Set the records as an attribute before dispatching to the JSP
252:                        request.setAttribute("ApprovalHeaders", records);
253:                        pageCache.put(sessionID, records);
254:
255:                        // Dispatch the request to a relevant JSP
256:                        PortletRequestDispatcher reqDisp = ctx
257:                                .getRequestDispatcher(APPROVAL_HEADERS_JSP);
258:                        reqDisp.include(request, response);
259:                    }
260:
261:                    // If the request is for the details, obtain the details
262:                    // from the method defined in utility class and append it below the records
263:                    if (requestType == null) {
264:                        if (queryValue1 != null) {
265:
266:                            ApprovalQueryUtils.appendApprovalLines(queryValue1,
267:                                    request, response, session, httpReq);
268:                        }
269:                    }
270:
271:                } catch (Exception ex) {
272:
273:                    logMessage(Level.SEVERE,
274:                            "In doView : while dispatching to the JSP : " + ex);
275:                }
276:
277:            }
278:
279:            /**
280:             * This method logs the debug messages
281:             **/
282:            private void logMessage(Object debugLevel, String msg) {
283:
284:                logger.log((Level) debugLevel, msg);
285:            }
286:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.