Source Code Cross Referenced for SAPUserConfigPortlet.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: SAPUserConfigPortlet.java,v 1.5 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.SAPUserConfig;
016:        import com.sun.portal.sapportlet.employee.Employee;
017:        import com.sun.portal.sapportlet.employee.EmployeeManager;
018:        import javax.portlet.GenericPortlet;
019:        import javax.portlet.PortletContext;
020:        import javax.portlet.PortletConfig;
021:        import javax.portlet.PortletException;
022:        import javax.portlet.RenderRequest;
023:        import javax.portlet.RenderResponse;
024:        import javax.portlet.PortletRequestDispatcher;
025:        import javax.portlet.ActionRequest;
026:        import javax.portlet.ActionResponse;
027:        import javax.portlet.*;
028:        import java.io.IOException;
029:        import java.util.Iterator;
030:        import java.util.logging.Logger;
031:        import java.rmi.RemoteException;
032:        import com.sun.portal.sapportlet.customer.*;
033:        import com.sun.portal.sapportlet.util.ssoa.SAPAuthUtils;
034:        import com.sun.portal.sapportlet.util.ssoa.InvalidCredentialsException;
035:
036:        /**
037:         * This is the SAPUserConfigPortlet. It can be used
038:         * to search for customers from an existing SAP system.
039:         *
040:         * @author nk137934
041:         */
042:
043:        public class SAPUserConfigPortlet extends GenericPortlet implements 
044:                SAPPortletConstants {
045:
046:            private static Logger logger = Logger
047:                    .getLogger(SAPPortletConstants.LOGGER_NAMESPACE);
048:
049:            /*
050:             * On init, the portlet creates & initis a CusomerManager object.
051:             * The actual queries are delegated to this object
052:             */
053:            public void init(PortletConfig config) throws PortletException {
054:
055:                super .init(config);
056:            }
057:
058:            /*
059:             * The doView method of the SAPCustSearchPortlet.
060:             * If the query has already been executed, the results
061:             * are available in the session. If not, execute the default
062:             * query.
063:             */
064:            public void doView(RenderRequest request, RenderResponse response)
065:                    throws PortletException, IOException {
066:
067:                PortletSession session = request.getPortletSession();
068:                //boolean isValid = false;
069:                response.setContentType(request.getResponseContentType());
070:
071:                SAPUserConfig userConfig = (SAPUserConfig) session
072:                        .getAttribute(SESSION_USERCONFIG,
073:                                PortletSession.APPLICATION_SCOPE);
074:                PortletRequestDispatcher dispatcher = null;
075:
076:                if (userConfig == null) {
077:                    userConfig = SAPAuthUtils
078:                            .checkForUserAuthentication(request);
079:                }
080:
081:                if (userConfig != null) {
082:                    session.setAttribute(SESSION_USERCONFIG, userConfig,
083:                            PortletSession.APPLICATION_SCOPE);
084:                    SAPAuthUtils.setUserConfig(request);
085:                    dispatcher = getPortletContext().getRequestDispatcher(
086:                            USER_CONFIG_VIEW_PAGE);
087:                } else {
088:                    dispatcher = getPortletContext().getRequestDispatcher(
089:                            USER_CONFIG_REDIRECT);
090:                }
091:                session.removeAttribute(PARAM_AUTH,
092:                        PortletSession.APPLICATION_SCOPE);
093:                //logger.severe("PARAMETER IS =>"+request.getParameter(PARAM_CHANGE));        
094:                dispatcher.include(request, response);
095:            }
096:
097:            /*
098:             * The doEdit method of the SAPCustSearchPortlet.
099:             * This page displays the config page which asks for the username and password.      
100:             */
101:            public void doEdit(RenderRequest request, RenderResponse response)
102:                    throws PortletException, IOException {
103:
104:                PortletSession session = request.getPortletSession();
105:                response.setContentType(request.getResponseContentType());
106:                PortletRequestDispatcher dispatcher = null;
107:                //logger.severe("PARAMETER IS =>"+request.getParameter(PARAM_CHANGE));
108:                dispatcher = getPortletContext().getRequestDispatcher(
109:                        USER_CONFIG_PAGE);
110:                dispatcher.include(request, response);
111:            }
112:
113:            /*
114:             * processAction invokes the validateCredentials or simply transfers the control to doView
115:             * depending on the action chosen in the jsp page displayed by the doEdit method.
116:             */
117:            public void processAction(ActionRequest request,
118:                    ActionResponse response) throws PortletException,
119:                    IOException {
120:
121:                String action = request.getParameter(HTML_FIELD_OPERATION);
122:                if (action.equals(OPERATION_CONFIGURE)) {
123:                    validateCredentials(request, response);
124:                } else if (action.equals(OPERATION_CANCEL)) {
125:                    if (request.isPortletModeAllowed(PortletMode.VIEW)) {
126:                        logger.severe("SETTING PORTLET MODE IS ALLOWED");
127:                        response.setPortletMode(PortletMode.VIEW);
128:                    }
129:                }
130:            }
131:
132:            public void doHelp(RenderRequest request, RenderResponse response)
133:                    throws PortletException, IOException {
134:
135:                response.setContentType(request.getResponseContentType());
136:                PortletRequestDispatcher dispatcher = getPortletContext()
137:                        .getRequestDispatcher(USERCONFIG_HELP_PAGE);
138:                dispatcher.include(request, response);
139:
140:            }
141:
142:            private void validateCredentials(ActionRequest request,
143:                    ActionResponse response) throws PortletException,
144:                    IOException {
145:                PortletSession session = request.getPortletSession();
146:                session.removeAttribute(SESSION_USERCONFIG,
147:                        PortletSession.APPLICATION_SCOPE);
148:                SAPUserConfig userConfig = null;
149:                userConfig = SAPAuthUtils.checkForUserAuthentication(request);
150:                if (userConfig != null) {
151:                    session.setAttribute(SESSION_USERCONFIG, userConfig,
152:                            PortletSession.APPLICATION_SCOPE);
153:                    SAPAuthUtils.setUserConfig(request);
154:                    if (request.isPortletModeAllowed(PortletMode.VIEW)) {
155:                        logger.severe("SETTING PORTLET MODE IS ALLOWED");
156:                        response.setPortletMode(PortletMode.VIEW);
157:                    }
158:                } else {
159:                    session.removeAttribute(SESSION_USERCONFIG,
160:                            PortletSession.APPLICATION_SCOPE);
161:                    session.setAttribute(PARAM_AUTH, PARAM_AUTH_FAILED,
162:                            PortletSession.APPLICATION_SCOPE);
163:                    response.setPortletMode(PortletMode.EDIT);
164:                }
165:            }
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.