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


001:        /**
002:         * $Id: SAPEmpDetailsPortlet.java,v 1.7 2005/10/19 10:25:58 ks161616 Exp $
003:         * Copyright 2005 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.sapportlet;
014:
015:        import com.sun.portal.sapportlet.config.*;
016:        import javax.portlet.GenericPortlet;
017:        import javax.portlet.PortletContext;
018:        import javax.portlet.PortletConfig;
019:        import javax.portlet.PortletException;
020:        import javax.portlet.RenderRequest;
021:        import javax.portlet.RenderResponse;
022:        import javax.portlet.PortletRequestDispatcher;
023:        import javax.portlet.ActionRequest;
024:        import javax.portlet.ActionResponse;
025:        import javax.portlet.PortletSession;
026:        import javax.portlet.*;
027:        import javax.portlet.PortletPreferences;
028:        import java.io.IOException;
029:        import java.util.Iterator;
030:        import java.util.logging.Logger;
031:        import com.sun.portal.sapportlet.employee.*;
032:        import java.rmi.RemoteException;
033:        import com.sun.portal.sapportlet.util.ssoa.SAPAuthUtils;
034:
035:        /**
036:         * This is the SAP Employee Details Portlet. It can be used 
037:         * to display the details of any given employee in the SAP 
038:         * system.
039:         *
040:         * @author nk137934
041:         */
042:
043:        public class SAPEmpDetailsPortlet extends GenericPortlet implements 
044:                SAPPortletConstants {
045:
046:            private static Logger logger = Logger
047:                    .getLogger(SAPPortletConstants.LOGGER_NAMESPACE);
048:
049:            /*
050:             *
051:             */
052:            public void init(PortletConfig config) throws PortletException {
053:                super .init(config);
054:            }
055:
056:            public void doView(RenderRequest request, RenderResponse response)
057:                    throws PortletException, IOException {
058:
059:                PortletSession session = request.getPortletSession();
060:                SAPUserConfig userConfig = (SAPUserConfig) session
061:                        .getAttribute(SESSION_USERCONFIG,
062:                                PortletSession.APPLICATION_SCOPE);
063:                if (userConfig == null) {
064:                    userConfig = SAPAuthUtils
065:                            .checkForUserAuthentication(request);
066:                }
067:
068:                if (userConfig == null) {
069:                    // Dispatch to the configuration page
070:                    dispatchToConfigErrorPage(request, response);
071:                    return;
072:                }
073:                //Retrieve the delegate object from the session
074:                EmployeeManager manager = (EmployeeManager) session
075:                        .getAttribute(SESSION_EMPMANAGER);
076:
077:                // If no delegate has been created, create one!
078:                // The delegate also needs to be created if the user config object has changed
079:                boolean userConfigChanged = false;
080:                if (manager == null
081:                        || !manager.getUserConfig().equals(userConfig)) {
082:                    userConfigChanged = true;
083:                }
084:                String endPoint = SAPAuthUtils.getSAPEndPoint(request);
085:
086:                if (userConfigChanged) {
087:                    try {
088:                        manager = createEmpManager(userConfig, session,
089:                                endPoint);
090:                        session.setAttribute(SESSION_EMPMANAGER, manager);
091:                    } catch (Exception Ex) {
092:                        logger.severe("failed to create emp manager");
093:                        // Dispatch to the configuration page
094:                        dispatchToConfigErrorPage(request, response);
095:                        return;
096:                    }
097:                }
098:                Employee employee = (Employee) session
099:                        .getAttribute(SESSION_EMPLOYEE);
100:                if (employee == null || userConfigChanged) {
101:                    String endPointHost = SAPAuthUtils
102:                            .getSAPEndpointHost(request);
103:                    try {
104:                        employee = manager.getEmployee(
105:                                userConfig.getUserName(), endPointHost);
106:                    } catch (RemoteException rExcp) {
107:                        // This means some error has occured in manager.getEmployee
108:                        // A misconfig perhaps
109:                        //redirect to error page
110:                        logger.warning("Failed to get employee");
111:                        logger.warning(rExcp.getMessage());
112:                        response.setContentType(request
113:                                .getResponseContentType());
114:                        PortletRequestDispatcher dispatcher = getPortletContext()
115:                                .getRequestDispatcher(SAP_CONFIG_ERROR_PAGE);
116:                        dispatcher.include(request, response);
117:                        return;
118:                    }
119:                    session.setAttribute(SESSION_EMPLOYEE, employee);
120:                }
121:                response.setContentType(request.getResponseContentType());
122:                PortletRequestDispatcher dispatcher = getPortletContext()
123:                        .getRequestDispatcher(EMP_DETAILS_PAGE);
124:                dispatcher.include(request, response);
125:            }
126:
127:            public void doHelp(RenderRequest request, RenderResponse response)
128:                    throws PortletException, IOException {
129:
130:                response.setContentType(request.getResponseContentType());
131:                PortletRequestDispatcher dispatcher = getPortletContext()
132:                        .getRequestDispatcher(EMPLOYEE_DETAILS_HELP_PAGE);
133:                dispatcher.include(request, response);
134:
135:            }
136:
137:            public void dispatchToConfigErrorPage(RenderRequest request,
138:                    RenderResponse response) throws PortletException,
139:                    IOException {
140:
141:                response.setContentType(request.getResponseContentType());
142:                PortletRequestDispatcher dispatcher = getPortletContext()
143:                        .getRequestDispatcher(USER_NO_CONFIG_PAGE);
144:                dispatcher.include(request, response);
145:
146:            }
147:
148:            /*
149:             * Invoke the appropriate search depending on the actual operation.
150:             */
151:            public void processAction(ActionRequest request,
152:                    ActionResponse response) throws PortletException,
153:                    java.io.IOException {
154:
155:            }
156:
157:            public void doEdit(RenderRequest request, RenderResponse response)
158:                    throws PortletException, IOException {
159:
160:                response.setContentType(request.getResponseContentType());
161:            }
162:
163:            private EmployeeManager createEmpManager(SAPUserConfig userConfig,
164:                    PortletSession session, String endPoint)
165:                    throws PortletException, java.io.IOException {
166:
167:                EmployeeManager manager = new EmployeeManager();
168:                // If the init of the manager fails, there is some misconfiguration.
169:                try {
170:                    manager.init(userConfig, endPoint);
171:                } catch (Throwable throwable) {
172:                    logger.severe("Failed to initialize employee delegate");
173:                }
174:                return manager;
175:            }
176:
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.