Source Code Cross Referenced for ReceiptsPortlet.java in  » Portal » Open-Portal » com » sun » portal » oracleportlet » receipts » 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.receipts 
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.receipts;
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 Receivables module of
056:         * Oracle Applications. This Portlet is used to display data pertaining to the
057:         * receipts. 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 25 July 2005
063:         *
064:         **/
065:
066:        public class ReceiptsPortlet 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_RECEIPTS_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 two paremeters those form a part of the query string
108:                String queryValue1 = (String) request
109:                        .getParameter("QueryValue1");
110:                String queryValue2 = (String) request
111:                        .getParameter("QueryValue2");
112:
113:                //Obtain parameters used for pagination
114:                String curSummPage = (String) request
115:                        .getParameter("CurrentSummaryPage");
116:                String curPage = (String) request.getParameter("CurrentPage");
117:                String requestType = (String) request
118:                        .getParameter("RequestType");
119:                String queryField = (String) request.getParameter("QueryField");
120:                String queryValue = (String) request.getParameter("QueryValue");
121:                String tableSize = (String) request.getParameter("TableSize");
122:
123:                if (queryValue1 != null) {
124:                    response.setRenderParameter("QueryValue1", queryValue1
125:                            .trim());
126:                    response.setRenderParameter("QueryValue2", queryValue2
127:                            .trim());
128:                }
129:                if (curSummPage != null) {
130:                    response.setRenderParameter("CurrentSummaryPage",
131:                            curSummPage.trim());
132:                }
133:                if (curPage != null) {
134:                    response.setRenderParameter("CurrentPage", curPage.trim());
135:                }
136:                if (requestType != null) {
137:                    response.setRenderParameter("RequestType", requestType
138:                            .trim());
139:                }
140:                if (queryField != null) {
141:                    response
142:                            .setRenderParameter("QueryField", queryField.trim());
143:                }
144:                if (queryValue != null) {
145:                    response
146:                            .setRenderParameter("QueryValue", queryValue.trim());
147:                }
148:                if (tableSize != null) {
149:                    response.setRenderParameter("TableSize", tableSize.trim());
150:                }
151:
152:            }
153:
154:            /**
155:             * This method generates the content that is displayed in the portlet
156:             **/
157:            public void doView(RenderRequest request, RenderResponse response)
158:                    throws PortletException, IOException {
159:
160:                logMessage(Level.INFO, "In doView : ");
161:                // Obtain the value of receipt number and amount, using which details are retrieved
162:                // Initially, QueryValue1 would be null. This attribute is set in processAction method
163:
164:                String queryValue1 = request.getParameter("QueryValue1");
165:                String queryValue2 = request.getParameter("QueryValue2");
166:
167:                //For pagination
168:                String queryField = request.getParameter("QueryField");
169:                String queryValue = request.getParameter("QueryValue");
170:                String requestType = request.getParameter("RequestType");
171:                String curSummPage = request.getParameter("CurrentSummaryPage");
172:                String curPage = request.getParameter("CurrentPage");
173:                String tableSize = request.getParameter("TableSize");
174:                //End - For Pagination
175:
176:                Vector records = null;
177:                PortletSession session = request.getPortletSession(true);
178:                PortletContext ctx = session.getPortletContext();
179:                String sessionID = session.getId();
180:
181:                HttpServletRequest httpReq = (HttpServletRequest) request
182:                        .getAttribute(HTTPREQ_ATTR_NAME);
183:
184:                response.setContentType("text/html");
185:
186:                if (requestType != null) {
187:                    if (queryField.equals("goTo")) {
188:                        queryValue = PaginationUtils.checkGoToValue(queryValue,
189:                                tableSize);
190:                    }
191:                    request.setAttribute("CurrentPage", queryValue);
192:                    request.setAttribute("CurrentSummaryPage", queryValue);
193:
194:                    records = PaginationUtils.getPageCacheData(request,
195:                            responseCache, "CurrentSummaryPage", sessionID);
196:
197:                }
198:
199:                // If the doView method was invoked previously, get records from the cache
200:                if (queryValue1 != null) {
201:
202:                    records = (Vector) pageCache.get(sessionID);
203:
204:                    request.setAttribute("QueryValue1", queryValue1);
205:                    request.setAttribute("QueryValue2", queryValue2);
206:
207:                    request.setAttribute("CurrentSummaryPage", curSummPage);
208:                    request.setAttribute("CurrentPage", curPage);
209:                }
210:
211:                try {
212:                    // This condition is met only the first time doView method is invoked
213:                    if (records == null) {
214:                        // Obtain the records in the form of a vector by using a utility method
215:                        String numberOfRecords = ReceiptQueryUtils
216:                                .getNumberOfRecordsToDisplay();
217:                        records = ReceiptQueryUtils.getReceiptSummaryRecords(
218:                                httpReq, numberOfRecords);
219:
220:                        // Check whether we have obtained the records
221:                        if (records == null) {
222:                            logMessage(Level.WARNING,
223:                                    "In doView: No records obtained from getReceiptSummaryRecords");
224:                        } else {
225:                            //For Pagination
226:                            int rowsToShow = PaginationUtils
227:                                    .getNumberOfPaginationRows(records.size());
228:                            request.setAttribute("CurrentSummaryPage", "1");
229:                            request.setAttribute("CurrentPage", "1");
230:                            Vector cacheData = PaginationUtils
231:                                    .splitPageCacheData(records, sessionID,
232:                                            rowsToShow);
233:                            responseCache.put(sessionID, cacheData);
234:                            records = PaginationUtils.getPageCacheData(request,
235:                                    responseCache, "CurrentSummaryPage",
236:                                    sessionID);
237:                            //End - For Pagination
238:                        }
239:                    }
240:
241:                } catch (Exception ex) {
242:
243:                    logMessage(Level.SEVERE,
244:                            "In doView : while obtaining receipt records: "
245:                                    + ex);
246:                }
247:
248:                try {
249:
250:                    //If we have records to display, set the PaginationRow attribute and dispatch records				
251:                    if (records == null) {
252:                        // Dispatch the request to a JSP that displays error
253:                        PortletRequestDispatcher reqDisp = ctx
254:                                .getRequestDispatcher(NO_RECORDS_JSP);
255:                        reqDisp.include(request, response);
256:
257:                    } else {
258:                        Vector rowData = (Vector) responseCache.get(sessionID);
259:                        TablePagination.setPaginationRow(request, response,
260:                                "PaginateSummary", null, rowData.size());
261:
262:                        // Set the records as an attribute before dispatching to the JSP
263:                        request.setAttribute("Receipts", records);
264:                        pageCache.put(sessionID, records);
265:
266:                        // Dispatch the request to a relevant JSP
267:                        PortletRequestDispatcher reqDisp = ctx
268:                                .getRequestDispatcher(RECEIPT_SUMMARY_JSP);
269:                        reqDisp.include(request, response);
270:                    }
271:
272:                    // If the request is for the details, obtain the details
273:                    // from the method defined in utility class and append it below the records
274:                    if (requestType == null) {
275:                        if (queryValue1 != null) {
276:
277:                            ReceiptQueryUtils.appendReceiptDetails(queryValue1,
278:                                    queryValue2, request, response, session,
279:                                    httpReq);
280:                        }
281:                    }
282:
283:                } catch (Exception ex) {
284:
285:                    logMessage(Level.SEVERE,
286:                            "In doView : while dispatching to the JSP : " + ex);
287:                }
288:
289:            }
290:
291:            /**
292:             * This method logs the debug messages
293:             **/
294:            private void logMessage(Object debugLevel, String msg) {
295:
296:                logger.log((Level) debugLevel, msg);
297:            }
298:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.